diff --git a/firebase.json b/firebase.json
index 00a56f63..21ed6bcc 100644
--- a/firebase.json
+++ b/firebase.json
@@ -1,7 +1,11 @@
{
"hosting": {
"public": "dist/musil",
- "ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
+ "ignore": [
+ "firebase.json",
+ "**/.*",
+ "**/node_modules/**"
+ ],
"rewrites": [
{
"source": "/**/n/**",
@@ -21,7 +25,8 @@
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint",
"npm --prefix \"$RESOURCE_DIR\" run build"
- ]
+ ],
+ "source": "functions"
},
"storage": {
"rules": "storage.rules"
diff --git a/firestore.rules b/firestore.rules
index 00146dfe..3ca8a6a8 100644
--- a/firestore.rules
+++ b/firestore.rules
@@ -2,18 +2,20 @@ rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /articles/{articleId} {
- allow read: if true;
- allow create: if request.auth.uid != null;
- allow update: if request.auth.uid == resource.data.uid && resource.data.uid == request.resource.data.uid;
+ allow read: if resource.data.isPublic == true || request.auth.uid == resource.data.uid;
+ allow create: if request.auth.uid == request.resource.data.uid;
+ allow update: if request.auth.uid == resource.data.uid && request.resource.data.uid == resource.data.uid;
allow delete: if request.auth.uid == resource.data.uid;
}
match /users/{userId} {
allow read: if true;
- allow write: if request.auth.uid == userId;
- }
- match /users/{userId}/likedArticles/{articleId} {
- allow read: if true;
- allow write: if request.auth.uid == userId;
+ allow create: if request.auth.uid == request.resource.data.uid;
+ allow update: if request.auth.uid == resource.data.uid && request.resource.data.uid == resource.data.uid;
+ allow delete: if request.auth.uid == resource.data.uid;
+ match /likedArticles/{articleId} {
+ allow read: if true;
+ allow write: if request.auth.uid == userId;
+ }
}
}
}
diff --git a/functions/.gitignore b/functions/.gitignore
index 9d7b336d..a1f8593d 100644
--- a/functions/.gitignore
+++ b/functions/.gitignore
@@ -7,3 +7,8 @@ typings/
node_modules/
lib/
+.runtimeconfig.json
+
+firebase-debug.log
+firestore-debug.log
+ui-debug.log
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 1ce41cff..d441b950 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -15,9 +15,16 @@ import {
import { FooterComponent } from './footer/footer.component';
import { AngularFireModule } from '@angular/fire';
import { AngularFireAnalyticsModule } from '@angular/fire/analytics';
-import { AngularFirestoreModule } from '@angular/fire/firestore';
+import {
+ AngularFirestoreModule,
+ SETTINGS as FIRESTORE_SETTINGS,
+} from '@angular/fire/firestore';
import { AngularFireStorageModule } from '@angular/fire/storage';
-import { AngularFireFunctionsModule, REGION } from '@angular/fire/functions';
+import {
+ AngularFireFunctionsModule,
+ REGION,
+ ORIGIN,
+} from '@angular/fire/functions';
import { AngularFireAuthModule } from '@angular/fire/auth';
import { environment } from '../environments/environment';
import { FroalaEditorModule, FroalaViewModule } from 'angular-froala-wysiwyg';
@@ -75,6 +82,14 @@ import { MatPaginatorIntlJaModule } from './mat-paginator-intl-ja/mat-paginator-
{ provide: REGION, useValue: 'asia-northeast1' },
{ provide: MAT_SNACK_BAR_DEFAULT_OPTIONS, useValue: { duration: 4000 } },
{ provide: MatPaginatorIntl, useClass: MatPaginatorIntlJaModule },
+ // {
+ // provide: ORIGIN,
+ // useValue: environment.production ? undefined : 'http://localhost:5001',
+ // },
+ // {
+ // provide: FIRESTORE_SETTINGS,
+ // useValue: environment.production ? {} : { host: 'localhost:8080', ssl: false },
+ // },
],
bootstrap: [AppComponent],
})
diff --git a/src/app/footer/footer.component.html b/src/app/footer/footer.component.html
index 07aa898a..35a22b35 100644
--- a/src/app/footer/footer.component.html
+++ b/src/app/footer/footer.component.html
@@ -10,5 +10,8 @@
>お問い合わせ(TwitterDM)
© 2020 MusiL by komura
++ © 2020 MusiL by + komura +
diff --git a/src/app/footer/footer.component.scss b/src/app/footer/footer.component.scss index 8edb27f0..1a2770ab 100644 --- a/src/app/footer/footer.component.scss +++ b/src/app/footer/footer.component.scss @@ -1,3 +1,5 @@ +@import 'mixins'; + .footer { background-color: inherit; padding: 16px 0 32px; @@ -8,6 +10,9 @@ a { margin: 0 8px 8px; text-align: center; + @include sp { + font-size: 14px; + } } } } @@ -17,4 +22,7 @@ mat-icon { .copyright { text-align: center; margin: 8px 0px; + @include sp { + font-size: 14px; + } } diff --git a/src/app/mypage/liked-articles/liked-articles.component.ts b/src/app/mypage/liked-articles/liked-articles.component.ts index 8fdec2b4..c5a7776d 100644 --- a/src/app/mypage/liked-articles/liked-articles.component.ts +++ b/src/app/mypage/liked-articles/liked-articles.component.ts @@ -14,7 +14,7 @@ export class LikedArticlesComponent implements OnInit { articles$: Observable< ArticleWithAuthor[] > = this.articleService - .getMyLikedArticles(this.userService.mypageUser.uid) + .getMyLikedArticles(this.userService.mypageUser?.uid) .pipe( take(1), tap(() => { diff --git a/src/app/mypage/my-articles/my-articles.component.ts b/src/app/mypage/my-articles/my-articles.component.ts index 99a150ef..665a25fd 100644 --- a/src/app/mypage/my-articles/my-articles.component.ts +++ b/src/app/mypage/my-articles/my-articles.component.ts @@ -14,7 +14,7 @@ export class MyArticlesComponent implements OnInit { articles$: Observable< ArticleWithAuthor[] > = this.articleService - .getMyArticlesPublic(this.userService.mypageUser.uid) + .getMyArticlesPublic(this.userService.mypageUser?.uid) .pipe( take(1), tap(() => { diff --git a/src/app/mypage/mypage.module.ts b/src/app/mypage/mypage.module.ts index a2f3960e..8e57381b 100644 --- a/src/app/mypage/mypage.module.ts +++ b/src/app/mypage/mypage.module.ts @@ -15,6 +15,7 @@ import { ClipboardModule } from '@angular/cdk/clipboard'; import { MyArticlesComponent } from './my-articles/my-articles.component'; import { LikedArticlesComponent } from './liked-articles/liked-articles.component'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; +import { StringToLinkPipe } from '../pipes/string-to-link.pipe'; @NgModule({ declarations: [ @@ -22,6 +23,7 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; NoteComponent, MyArticlesComponent, LikedArticlesComponent, + StringToLinkPipe, ], imports: [ CommonModule, diff --git a/src/app/mypage/mypage/mypage.component.html b/src/app/mypage/mypage/mypage.component.html index f30dde97..8c0bb96e 100644 --- a/src/app/mypage/mypage/mypage.component.html +++ b/src/app/mypage/mypage/mypage.component.html @@ -22,7 +22,7 @@@{{ user.screenName }}
{{ user.userName }} class="mypage__twitter" target="_blank" rel="noopener noreferrer" + *ngIf="user.uid !== authService.uid" >