From 5825d1d1380d7100b9d666da9e25497613461057 Mon Sep 17 00:00:00 2001 From: MurakawaTakuya Date: Sun, 12 Jan 2025 20:54:53 +0900 Subject: [PATCH] =?UTF-8?q?=E8=A1=A8=E8=A8=98=E3=82=84=E3=83=87=E3=82=B6?= =?UTF-8?q?=E3=82=A4=E3=83=B3=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions/src/index.ts | 29 +++++++++++++++---- .../NavigationMenu/NavigationMenu.tsx | 13 +++++++++ src/Components/Progress/PendingStep.tsx | 1 + src/Components/Progress/StepperBlock.tsx | 2 +- src/app/account/page.tsx | 9 ++++-- 5 files changed, 46 insertions(+), 8 deletions(-) diff --git a/functions/src/index.ts b/functions/src/index.ts index 9e5441d7..bd8e177f 100644 --- a/functions/src/index.ts +++ b/functions/src/index.ts @@ -103,11 +103,6 @@ app.use("/notification", notificationRouter); const region = "asia-northeast1"; -export const helloWorld = onRequest({ region: region }, (req, res) => { - logger.info("Hello log!", { structuredData: true }); - res.send("Hello World!"); -}); - export const firestore = onRequest({ region: region }, async (req, res) => { app(req, res); }); @@ -117,3 +112,27 @@ export { deleteTasksOnGoalDelete, deleteTasksOnPostCreate, } from "./tasks"; + +// テスト用API +app.use( + "/helloWorld", + rateLimit({ + // 10分に最大10回に制限 + windowMs: 10 * 60 * 1000, + max: 10, + keyGenerator: (req) => { + const key = req.headers["x-forwarded-for"] || req.ip || "unknown"; + return Array.isArray(key) ? key[0] : key; + }, + handler: (req, res) => { + return res + .status(429) + .json({ message: "Too many requests, please try again later." }); + }, + }) +); + +export const helloWorld = onRequest({ region: region }, (req, res) => { + logger.info("Hello log!", { structuredData: true }); + res.send("Hello World!"); +}); diff --git a/src/Components/NavigationMenu/NavigationMenu.tsx b/src/Components/NavigationMenu/NavigationMenu.tsx index 6e6350b2..d7c849d3 100644 --- a/src/Components/NavigationMenu/NavigationMenu.tsx +++ b/src/Components/NavigationMenu/NavigationMenu.tsx @@ -1,4 +1,5 @@ "use client"; +import { useUser } from "@/utils/UserContext"; import FormatListBulletedIcon from "@mui/icons-material/FormatListBulleted"; import GroupIcon from "@mui/icons-material/Group"; import HomeIcon from "@mui/icons-material/Home"; @@ -39,6 +40,8 @@ export default function NavigationMenu() { const colors = ["success", "primary", "warning", "danger"] as const; + const { user } = useUser(); + return ( @@ -105,10 +113,15 @@ export default function NavigationMenu() { orientation="vertical" sx={{ padding: "5px 0 !important", + transition: "0.5s", ...(index === 1 && { backgroundColor: "#ffecee !important", color: "#bf1818 !important", }), + ...(!user && { + pointerEvents: "none", + opacity: "0.3 !important", + }), }} > diff --git a/src/Components/Progress/PendingStep.tsx b/src/Components/Progress/PendingStep.tsx index 434ae0a3..d79d0e59 100644 --- a/src/Components/Progress/PendingStep.tsx +++ b/src/Components/Progress/PendingStep.tsx @@ -30,6 +30,7 @@ export const PendingStep = ({ } + sx={{ gap: "10px 16px" }} > )} - {(user?.loginType === "Guest" || !user?.isMailVerified) && ( + {user?.loginType === "Guest" && ( - 通知を利用するには認証が必要です。 + ゲストユーザーは通知機能を使用できません。 + + )} + {!user?.isMailVerified && ( + + 通知機能を利用するには認証メールを確認してください。 )}