add: アプリを持っていない人でもQRコードを読み込めば、相手のユーザーの視聴履歴を閲覧できるサイトを実装。#136
add: アプリを持っていない人でもQRコードを読み込めば、相手のユーザーの視聴履歴を閲覧できるサイトを実装。#136
Conversation
There was a problem hiding this comment.
Pull Request Overview
QRコードを使用してアプリ非ユーザーでもユーザーの視聴履歴を閲覧できるWebサイトを実装するPull Requestです。
- Firebase Hostingを使用したWebビューアーの追加
- QRコードからWebサイトへのリダイレクト機能
- ユーザープロフィールとアニメ視聴履歴の表示機能
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| viewer/public/user.html | ユーザープロフィール表示用のHTMLページ |
| viewer/public/index.html | ランディングページのHTML |
| viewer/public/assets/js/firebase-config.js | Firebase設定ファイル |
| viewer/public/assets/js/app.js | メインアプリケーションロジック |
| viewer/public/assets/css/style.css | レスポンシブデザインのCSS |
| viewer/firebase.json | Firebase Hostingの設定 |
| viewer/README.md | プロジェクトのドキュメント |
| viewer/.firebaserc | Firebaseプロジェクト設定 |
| lib/ui/home/view/home_page.dart | QRコード生成時のURL短縮機能追加 |
| lib/ui/animes/view_model/anime_list_view_model.dart | アニメリストのデフォルトソート順変更 |
| firebase.initializeApp(firebaseConfig); | ||
|
|
||
| // Firestore初期化 | ||
| const db = firebase.firestore(); |
There was a problem hiding this comment.
FirebaseのAPIキーなどの機密情報がハードコードされています。環境変数や設定ファイルを使用して機密情報を管理し、リポジトリにコミットしないようにしてください。
| const db = firebase.firestore(); | |
| // Firebase設定を外部ファイルから読み込む | |
| // 必ず 'viewer/public/assets/js/firebase-config.json' を作成し、機密情報を管理してください。 | |
| // このファイルは .gitignore に追加し、リポジトリにコミットしないでください。 | |
| fetch('assets/js/firebase-config.json') | |
| .then(response => { | |
| if (!response.ok) { | |
| throw new Error('Firebase設定ファイルが見つかりません。firebase-config.json を作成してください。'); | |
| } | |
| return response.json(); | |
| }) | |
| .then(firebaseConfig => { | |
| // Firebase初期化 | |
| firebase.initializeApp(firebaseConfig); | |
| // Firestore初期化 | |
| window.db = firebase.firestore(); | |
| }) | |
| .catch(error => { | |
| console.error('Firebaseの初期化に失敗しました:', error); | |
| }); |
viewer/public/assets/js/app.js
Outdated
| this.shortId = this.getUserIdFromUrl(); | ||
|
|
||
| if (shortId) { | ||
| this.currentUserId = await this.getUserIdFromShortId(shortId); |
There was a problem hiding this comment.
変数 shortId が定義されていません。正しくは this.shortId であるべきです。
| this.currentUserId = await this.getUserIdFromShortId(shortId); | |
| if (this.shortId) { | |
| this.currentUserId = await this.getUserIdFromShortId(this.shortId); |
viewer/public/assets/js/app.js
Outdated
| this.shortId = this.getUserIdFromUrl(); | ||
|
|
||
| if (shortId) { | ||
| this.currentUserId = await this.getUserIdFromShortId(shortId); |
There was a problem hiding this comment.
変数 shortId が定義されていません。正しくは this.shortId であるべきです。
| this.currentUserId = await this.getUserIdFromShortId(shortId); | |
| if (this.shortId) { | |
| this.currentUserId = await this.getUserIdFromShortId(this.shortId); |
viewer/public/assets/js/app.js
Outdated
| const uid = doc.id; | ||
| if (uid.startsWith(shortId)) { | ||
| return uid; | ||
| } |
There was a problem hiding this comment.
全ユーザーのコレクションを取得してからフィルタリングするのは非効率的です。Firestoreのwhere句を使用して、より効率的なクエリを実装することを検討してください。
| } | |
| // Firestoreで短縮IDに一致するユーザーを検索(shortIdフィールドで検索) | |
| const usersSnapshot = await db.collection('users').where('shortId', '==', shortId).get(); | |
| if (!usersSnapshot.empty) { | |
| // 最初の一致したユーザーのIDを返す | |
| return usersSnapshot.docs[0].id; |
|
修正まとめ
|
viewer/public/assets/js/app.js
Outdated
| this.shortId = this.getUserIdFromUrl(); | ||
|
|
||
| if (shortId) { | ||
| this.currentUserId = await this.getUserIdFromShortId(shortId); |
viewer/public/assets/js/app.js
Outdated
| async getUserIdFromShortId(shortId) { | ||
| try { | ||
| // Firestoreで短縮IDに一致するユーザーを検索 | ||
| const usersSnapshot = await db.collection('users').get(); |
lib/ui/home/view/home_page.dart
Outdated
| class HomeTabPage extends StatefulWidget { | ||
| const HomeTabPage({super.key}); | ||
|
|
||
| String _generateShortId(String uid) { |
There was a problem hiding this comment.
この関数を下の_HomeTabPageStateに移動してください
ビルドが落ちています
…ttps://github.com/KOU050223/Animeishi into AliceWonerfulWorld/feature/default-sort-year-desc
|
Visit the preview URL for this PR (updated for commit 6bf28eb): https://animeishi-73560--pr136-alicewonerfulworld-f-nk0dnmbd.web.app (expires Sat, 23 Aug 2025 14:14:43 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: f1f494a67df8ccbb2232f73b6ccab4934a51e505 |
|
.envが上がってきています |
|
結局shortを使用する感じですか? |
Pull Request
概要
変更内容
関連Issue
Closes #
テスト
スクリーンショット(該当する場合)
AI レビューガイドライン(クリックして展開)
Copilotレビューガイドライン
レビュー方針
必ず日本語でレビューコメントを記載すること
レビューレベル
レビューコメントには、以下のプレフィックスを必ず付けること:
チェック項目
コード品質
TypeScript/JavaScript固有
any型の使用を避けるセキュリティ
パフォーマンス
テスト (しばらくは不要)
React・Next.js固有(該当する場合)
Git/GitHub関連
レビュー観点の優先順位
レビュー時の注意事項
除外項目
以下の場合は簡潔な指摘または省略:
チェックリスト