diff --git a/functions/src/index.ts b/functions/src/index.ts index b2facbe..9e5441d 100644 --- a/functions/src/index.ts +++ b/functions/src/index.ts @@ -33,7 +33,7 @@ const verifyAppCheckToken = async ( const appCheckToken = req.get("X-Firebase-AppCheck"); if (!appCheckToken) { - res + return res .status(400) .send({ message: "Authentication error: App Check token is missing." }); } @@ -43,10 +43,10 @@ const verifyAppCheckToken = async ( .appCheck() .verifyToken(appCheckToken as string); console.log("Verified App Check Token:", decodedToken); - next(); + return next(); } catch (error) { logger.error(`Invalid App Check token with ${appCheckToken}:`, error); - res.status(401).send("Invalid App Check token."); + return res.status(401).send("Invalid App Check token."); } }; @@ -55,7 +55,7 @@ if (process.env.NODE_ENV === "production") { app.use((req, res, next) => { if (req.headers.token === process.env.NOTIFICATION_KEY) { // tasksからの/notificationの場合はスキップ - next(); + return next(); } else { verifyAppCheckToken(req, res, next); } diff --git a/src/Components/Account/AuthForm.tsx b/src/Components/Account/AuthForm.tsx index b528f08..7a40b0d 100644 --- a/src/Components/Account/AuthForm.tsx +++ b/src/Components/Account/AuthForm.tsx @@ -16,7 +16,6 @@ import { RoundedButton } from "./LoggedInView"; const CenteredToggleButtonGroup = styled(ToggleButtonGroup)({ display: "flex", justifyContent: "center", - marginBottom: "10px", }); export default function AuthForm() { @@ -82,9 +81,17 @@ export default function AuthForm() { ログイン + + {typeof Notification === "undefined" && ( + + この端末のでは通知やGoogleログイン等の機能が使用できません。 + {/iPad|iPhone|iPod/.test(navigator.userAgent) && + "iOS 16.4以降に更新してください"} + + )} + {formMode === "register" ? ( <> - 新規登録
+ 新規登録 ) : ( <> - ログイン + ログイン )} - または + + または +
+ ゲストログインを使用するとアカウントを作成せずに閲覧できます。 (投稿機能は使用できません。) diff --git a/src/Components/Account/LoggedInView.tsx b/src/Components/Account/LoggedInView.tsx index dc0513d..08ab17a 100644 --- a/src/Components/Account/LoggedInView.tsx +++ b/src/Components/Account/LoggedInView.tsx @@ -42,7 +42,7 @@ export default function LoggedInView() { } return ( -
+ <> {user.loginType === "Guest" ? ( ゲストとしてログイン中 @@ -104,6 +104,6 @@ export default function LoggedInView() {
)} -
+ ); } diff --git a/src/app/account/page.tsx b/src/app/account/page.tsx index 8610b8a..8a8e8e3 100644 --- a/src/app/account/page.tsx +++ b/src/app/account/page.tsx @@ -40,25 +40,16 @@ export default function Account() { const [isIOS, setIsIOS] = useState(false); const [isPWA, setIsPWA] = useState(false); const [PWAReady, setPWAReady] = useState(false); + const [isNotificationUnavailable, setIsNotificationUnavailable] = + useState(false); - // iOSか判定 useEffect(() => { - const checkIOS = () => { - const userAgent = navigator.userAgent || navigator.vendor; - return /iPad|iPhone|iPod/.test(userAgent); - }; - setIsIOS(checkIOS()); - }, []); - - // PWAか判定 - useEffect(() => { - const checkPWA = () => { - return ( - window.matchMedia("(display-mode: standalone)").matches || + setIsIOS(/iPad|iPhone|iPod/.test(navigator.userAgent)); + setIsPWA( + window.matchMedia("(display-mode: standalone)").matches || window.navigator.standalone === true - ); - }; - setIsPWA(checkPWA()); + ); + setIsNotificationUnavailable(typeof Notification === "undefined"); }, []); return ( @@ -79,7 +70,7 @@ export default function Account() { > TODO REAL - + {user ? : } @@ -94,6 +85,7 @@ export default function Account() { > 通知を受信・アプリに追加 +
- {!PWAReady && ( - - PWAを準備中です。しばらくしてからページを更新してください。 - - )} - {(user?.loginType === "Guest" || !user?.isMailVerified) && ( - - 通知を利用するには認証が必要です。 - - )} - - アプリに追加をすると、端末のホーム画面やアプリ一覧から起動できるようになります。 - - - 通知を複数端末で登録した場合は、最後に登録した端末に送信します。 -
- 通知が受信できない場合はブラウザやサイトの権限を確認してください。 -
- {isIOS && ( + + {isNotificationUnavailable ? ( <> - - iOSでは通常ブラウザで通知機能と「アプリに追加」ボタンを使用できません。以下の画像のように「ホーム画面に追加」を押してから、ホーム画面から起動してください。 + + この端末ではアプリ機能や通知機能が使用できません。 + {isIOS && "iOS 16.4以降に更新してください"} - iOS PWA + + ) : ( + <> + {!PWAReady && ( + + PWAを起動中です。しばらくしてから再度お試しください。 + + )} + {(user?.loginType === "Guest" || !user?.isMailVerified) && ( + + 通知を利用するには認証が必要です。 + + )} + + + アプリに追加をすると、端末のホーム画面やアプリ一覧から起動できるようになります。 + + + 通知を複数端末で登録した場合は、最後に登録した端末に送信します。 +
+ 通知が受信できない場合はブラウザやサイトの権限を確認してください。 +
+ + {/* iOSのPWAの追加方法 */} + {isIOS && ( + <> + + iOSでは通常ブラウザで通知機能と「アプリに追加」ボタンを使用できません。以下の画像のように「ホーム画面に追加」を押してから、ホーム画面から起動してください。 + + iOS PWA + + )} )} diff --git a/src/app/layout.tsx b/src/app/layout.tsx index d14e505..619f1a8 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -39,6 +39,7 @@ export default function RootLayout({ + {/* Twitter Card */}