A modern and elegant dashboard for network traffic visualization and analysis.
feat: Migrate authentication from local storage tokens to secure HttpOnly cookies with server-side session management and update login UI.
luolei181c2740fbe1
diff --git a/CHANGELOG.en.md b/CHANGELOG.en.mdindex 35cefd9..72517bb 100644--- a/CHANGELOG.en.md+++ b/CHANGELOG.en.md@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0## [Unreleased]+## [1.2.6] - 2026-02-13++### Security+- **Cookie-based Authentication System**+ - Replaced localStorage token storage with HttpOnly cookies for enhanced security+ - WebSocket connections now authenticate via cookies instead of URL tokens+ - Implemented server-side session management with automatic refresh++### Changed+- Refactored authentication flow with server-side cookie setting after login+- Added welcome page image asset+## [1.2.5] - 2026-02-13### Addeddiff --git a/CHANGELOG.md b/CHANGELOG.mdindex 94c6f0a..00f9f26 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,6 +7,18 @@## [未发布]+## [1.2.6] - 2026-02-13++### 安全+- **Cookie-based 认证系统**+ - 使用 HttpOnly Cookie 替代 localStorage 存储 token,提升安全性+ - WebSocket 连接改为通过 Cookie 进行认证,避免 token 暴露在 URL 中+ - 实现服务端会话管理,支持会话过期自动刷新++### 变更+- 重构认证流程,前端登录后由服务端设置 Cookie+- 新增欢迎页面图片资源+## [1.2.5] - 2026-02-13### 新增diff --git a/apps/collector/package.json b/apps/collector/package.jsonindex 5c17b04..8cc9f78 100644--- a/apps/collector/package.json+++ b/apps/collector/package.json@@ -8,11 +8,12 @@"start": "node dist/index.js"},"dependencies": {+ "@fastify/cookie": "^11.0.2",+ "@fastify/cors": "^11.2.0","@neko-master/shared": "workspace:*",- "@fastify/cors": "^9.0.1","better-sqlite3": "^11.8.0","dotenv": "^16.6.0",- "fastify": "^4.29.0",+ "fastify": "^5.7.4","ws": "^8.19.0"},"devDependencies": {diff --git a/apps/collector/src/app.ts b/apps/collector/src/app.tsindex 2640435..2dcf9e9 100644--- a/apps/collector/src/app.ts+++ b/apps/collector/src/app.ts@@ -6,6 +6,7 @@import Fastify from 'fastify';import cors from '@fastify/cors';+import cookie from '@fastify/cookie';import type { StatsDatabase } from './db.js';import type { RealtimeStore } from './realtime.js';@@ -41,6 +42,12 @@ export async function createApp(options: AppOptions) {credentials: true,});+ // Register Cookie+ await app.register(cookie, {+ secret: process.env.COOKIE_SECRET || 'neko-master-secret-change-me', // secure cookie sign+ parseOptions: {}+ });+// Create servicesconst authService = new AuthService(db);const backendService = new BackendService(db, realtimeStore, authService);@@ -228,6 +235,7 @@ export async function createApp(options: AppOptions) {'/health','/api/auth/state','/api/auth/verify',+ '/api/auth/logout', // Add logout as public so we can clear cookies even if invalid];// Check if route is public@@ -240,7 +248,16 @@ export async function createApp(options: AppOptions) {return;}- // Get token from header+ // Try to get token from Cookie first+ const cookieToken = request.cookies['neko-session'];+ if (cookieToken) {+ const verifyResult = await authService.verifyToken(cookieToken);+ if (verifyResult.valid) {+ return;+ }+ }++ // Fallback: Get token from header (for backward compatibility / API clients)const authHeader = request.headers.authorization;if (!authHeader || !authHeader.startsWith('Bearer ')) {return reply.status(401).send({ error: 'Authentication required' });diff --git a/apps/collector/src/modules/auth/auth.controller.ts b/apps/collector/src/modules/auth/auth.controller.tsindex 8dafe63..b3fbf17 100644--- a/apps/collector/src/modules/auth/auth.controller.ts+++ b/apps/collector/src/modules/auth/auth.controller.ts@@ -41,9 +41,31 @@ export async function authController(app: FastifyInstance) {}const result = await authService.verifyToken(token);++ if (result.valid) {+ // Set valid token as HttpOnly cookie+ const isProduction = process.env.NODE_ENV === 'production';+ reply.setCookie('neko-session', token, {+ path: '/',+ httpOnly: true,+ secure: isProduction, // Only use secure in production+ sameSite: 'strict',+ maxAge: 60 * 60 * 24 * 7, // 7 days+ });+ }+return result;});+ /**+ * POST /api/auth/logout+ * Clear session cookie+ */+ app.post('/logout', async (request, reply) => {+ reply.clearCookie('neko-session', { path: '/' });+ return { success: true };+ });+/*** POST /api/auth/enable* Enable authentication (requires no auth when first enabling,@@ -90,17 +112,30 @@ export async function authController(app: FastifyInstance) {// If auth is required, verify token first// Skip verification if forced offif (authService.isAuthRequired() && !authService.isForceAccessControlOff()) {- if (!token) {- return reply.status(401).send({- error: 'Token is required to disable authentication'- });+ // Check cookie first+ let valid = false;+ const cookieToken = request.cookies?.['neko-session'];++ if (cookieToken) {+ const verifyResult = await authService.verifyToken(cookieToken);+ if (verifyResult.valid) {+ valid = true;+ }}- const verifyResult = await authService.verifyToken(token);- if (!verifyResult.valid) {- return reply.status(401).send({- error: verifyResult.message || 'Invalid token'- });+ if (!valid) {+ if (!token) {+ return reply.status(401).send({+ error: 'Token is required to disable authentication'+ });+ }++ const verifyResult = await authService.verifyToken(token);+ if (!verifyResult.valid) {+ return reply.status(401).send({+ error: verifyResult.message || 'Invalid token'+ });+ }}}@@ -126,17 +161,30 @@ export async function authController(app: FastifyInstance) {// Verify current token if auth is enabled// Skip verification if forced offif (authService.isAuthRequired() && !authService.isForceAccessControlOff()) {- if (!currentToken) {- return reply.status(401).send({- error: 'Current token is required'- });+ // Check cookie first+ let valid = false;+ const cookieToken = request.cookies?.['neko-session'];++ if (cookieToken) {+ const verifyResult = await authService.verifyToken(cookieToken);+ if (verifyResult.valid) {+ valid = true;+ }}- const verifyResult = await authService.verifyToken(currentToken);- if (!verifyResult.valid) {- return reply.status(401).send({- error: verifyResult.message || 'Invalid current token'- });+ if (!valid) {+ if (!currentToken) {+ return reply.status(401).send({+ error: 'Current token is required'+ });+ }++ const verifyResult = await authService.verifyToken(currentToken);+ if (!verifyResult.valid) {+ return reply.status(401).send({+ error: verifyResult.message || 'Invalid current token'+ });+ }}}diff --git a/apps/collector/src/websocket.ts b/apps/collector/src/websocket.tsindex 3fcba5b..1813d66 100644--- a/apps/collector/src/websocket.ts+++ b/apps/collector/src/websocket.ts@@ -139,12 +139,25 @@ export class StatsWebSocketServer {// Verify authenticationtry {const url = new URL(req.url || '', `http://${req.headers.host}`);- const token = url.searchParams.get('token');+ let token = url.searchParams.get('token');++ // Try getting token from cookie if not in URL+ if (!token && req.headers.cookie) {+ const cookies = req.headers.cookie.split(';').reduce((acc, cookie) => {+ const [key, value] = cookie.trim().split('=');+ acc[key] = value;+ return acc;+ }, {} as Record<string, string>);++ if (cookies['neko-session']) {+ token = cookies['neko-session'];+ }+ }// Check if auth is required and verify tokenif (this.authService.isAuthRequired()) {if (!token) {- console.log(`[WebSocket] Rejected connection from ${req.socket.remoteAddress}: Missing token`);+ console.log(`[WebSocket] Rejected connection from ${req.socket.remoteAddress}: Missing token or cookie`);ws.close(4001, 'Authentication required');return;}diff --git a/apps/web/app/[locale]/dashboard/hooks/use-dashboard.ts b/apps/web/app/[locale]/dashboard/hooks/use-dashboard.tsindex ad94113..d90cf43 100644--- a/apps/web/app/[locale]/dashboard/hooks/use-dashboard.ts+++ b/apps/web/app/[locale]/dashboard/hooks/use-dashboard.ts@@ -22,7 +22,7 @@ import {} from "@/lib/stats-query-keys";import { useStableTimeRange } from "@/lib/hooks/use-stable-time-range";import { useStatsWebSocket } from "@/lib/websocket";-import { useRequireAuth } from "@/lib/auth-queries";+import { useRequireAuth } from "@/lib/auth";import type {StatsSummary,CountryStats,diff --git a/apps/web/app/[locale]/dashboard/layout.tsx b/apps/web/app/[locale]/dashboard/layout.tsxindex 56d2a91..63d459f 100644--- a/apps/web/app/[locale]/dashboard/layout.tsx+++ b/apps/web/app/[locale]/dashboard/layout.tsx@@ -1,7 +1,8 @@"use client";import { ReactNode, useEffect } from "react";-import { useRequireAuth, useLogin, authKeys } from "@/lib/auth-queries";+import { authKeys } from "@/lib/auth-queries";+import { useRequireAuth, useAuth } from "@/lib/auth";import { LoginDialog } from "@/components/features/auth";import { toast } from "sonner";import { useTranslations } from "next-intl";@@ -15,30 +16,27 @@ export default function DashboardLayout({const t = useTranslations("auth");const queryClient = useQueryClient();const { showLogin, isLoading, authEnabled, error } = useRequireAuth();- const loginMutation = useLogin();-- // Listen for 401 errors from API requests- useEffect(() => {- const handleUnauthorized = () => {- // Invalidate auth state to trigger re-check- queryClient.invalidateQueries({ queryKey: authKeys.state() });- };-- window.addEventListener("api:unauthorized", handleUnauthorized);- return () => window.removeEventListener("api:unauthorized", handleUnauthorized);- }, [queryClient]);-- // Also check when error changes- useEffect(() => {- if (error) {- console.log("Auth state error:", error);- }- }, [error]);+ const { login, confirmLogin } = useAuth();++ // ...const handleLogin = async (token: string): Promise<boolean> => {try {- await loginMutation.mutateAsync(token);- return true;+ // Don't update state immediately to allow success animation to play+ const success = await login(token, false);++ if (success) {+ // Wait for animation to finish (2.5s matches LoginDialog animation)+ setTimeout(() => {+ confirmLogin();+ // Invalidate auth state to trigger re-check+ queryClient.invalidateQueries({ queryKey: authKeys.state() });+ }, 2500);+ return true;+ } else {+ toast.error(t("invalidToken"));+ return false;+ }} catch (error) {toast.error(t("invalidToken"));return false;diff --git a/apps/web/components/features/auth/auth-guard.tsx b/apps/web/components/features/auth/auth-guard.tsxindex fc94392..35f341b 100644--- a/apps/web/components/features/auth/auth-guard.tsx+++ b/apps/web/components/features/auth/auth-guard.tsx@@ -1,19 +1,21 @@"use client";-import { useRequireAuth, useLogin } from "@/lib/auth-queries";+import { useRequireAuth, useAuth } from "@/lib/auth";import { LoginDialog } from "./login-dialog";export function AuthGuard() {const { showLogin } = useRequireAuth();- const loginMutation = useLogin();+ const { login, confirmLogin } = useAuth();const handleLogin = async (token: string) => {- try {- await loginMutation.mutateAsync(token);+ const success = await login(token, false);+ if (success) {+ setTimeout(() => {+ confirmLogin();+ }, 2500);return true;- } catch (e) {- return false;}+ return false;};if (!showLogin) return null;diff --git a/apps/web/components/features/auth/login-dialog.tsx b/apps/web/components/features/auth/login-dialog.tsxindex 1760cb4..0d4bd2b 100644--- a/apps/web/components/features/auth/login-dialog.tsx+++ b/apps/web/components/features/auth/login-dialog.tsx@@ -18,6 +18,7 @@ import { cn } from "@/lib/utils";const CAT_OPEN_EYE = "/images/neko-open-eye.png";const CAT_CLOSE_EYE = "/images/neko-open-close.png";+const NEKO_WELCOME = "/images/neko-welcome.png";interface LoginDialogProps {open: boolean;@@ -54,7 +55,7 @@ export function LoginDialog({ open, onOpenChange, onLogin }: LoginDialogProps) {setToken("");setIsSuccess(false);onOpenChange(false);- }, 1500);+ }, 2500);} else {setError(t("invalidToken"));setIsLoading(false);@@ -72,6 +73,9 @@ export function LoginDialog({ open, onOpenChange, onLogin }: LoginDialogProps) {showCloseButton={!isSuccess}aria-describedby={undefined}onOpenAutoFocus={(e) => e.preventDefault()}+ overlayClassName={cn(+ isSuccess && "delay-[500ms] duration-[2000ms] ease-linear backdrop-blur-none bg-transparent"+ )}><AnimatePresence mode="wait">{isSuccess ? (@@ -80,37 +84,48 @@ export function LoginDialog({ open, onOpenChange, onLogin }: LoginDialogProps) {initial={{ opacity: 0, scale: 0.9 }}animate={{ opacity: 1, scale: 1 }}exit={{ opacity: 0, scale: 0.9 }}- className="flex flex-col items-center justify-center py-10 space-y-4 bg-background border shadow-lg rounded-lg p-6"+ className="flex flex-col items-center justify-center py-14 px-10 space-y-6 bg-background border shadow-lg rounded-xl min-w-[28rem]">- <div className="relative w-32 h-32 mb-4">+ <div className="relative w-50 h-50"><Image- src={CAT_OPEN_EYE}- alt="Success Cat"+ src={NEKO_WELCOME}+ alt="Welcome Neko"fillclassName="object-contain drop-shadow-xl"priority/>- <motion.div- initial={{ scale: 0 }}- animate={{ scale: 1 }}- transition={{ type: "spring", stiffness: 200, damping: 10, delay: 0.1 }}- className="absolute -bottom-2 -right-2 w-10 h-10 rounded-full bg-green-500 flex items-center justify-center text-white shadow-lg shadow-green-500/20 z-10"- >- <Check className="w-6 h-6 stroke-[3]" />- </motion.div></div><motion.divinitial={{ opacity: 0, y: 10 }}animate={{ opacity: 1, y: 0 }}- transition={{ delay: 0.2 }}+ transition={{ delay: 0.3, duration: 0.5 }}className="text-center">- <h3 className="text-xl font-bold text-green-600 dark:text-green-400">- {t("loginSuccess") || "Login Successful"}- </h3>- <p className="text-sm text-muted-foreground mt-1">- {t("redirecting") || "Redirecting to dashboard..."}+ <div className="flex items-center justify-center gap-2">+ <motion.div+ initial={{ scale: 0 }}+ animate={{ scale: 1 }}+ transition={{ type: "spring", stiffness: 200, damping: 10, delay: 0.1 }}+ className="w-6 h-6 rounded-full bg-blue-500/10 flex items-center justify-center text-blue-500 shadow-sm"+ >+ <Check className="w-3.5 h-3.5 stroke-[3]" />+ </motion.div>+ <h3 className="text-2xl font-semibold text-foreground tracking-tight">+ {t("loginSuccess") || "Welcome back"}+ </h3>+ </div>+ <p className="text-sm text-muted-foreground/75 mt-2 font-medium">+ {t("redirecting") || "Syncing network statistics..."}</p>+ <div className="w-64 h-1.5 bg-gray-100 dark:bg-gray-800 rounded-full mt-5 overflow-hidden relative mx-auto">+ <motion.div+ initial={{ width: "0%" }}+ animate={{ width: "100%" }}+ transition={{ duration: 2.5, ease: "easeInOut" }}+ className="absolute left-0 top-0 h-full bg-gradient-to-r from-[#181878] via-[#668af4] to-[#181878] animate-gradient-x"+ style={{ backgroundSize: "200% 100%" }}+ />+ </div></motion.div></motion.div>) : (diff --git a/apps/web/components/features/backend/backend-config-dialog.tsx b/apps/web/components/features/backend/backend-config-dialog.tsxindex 1ff64e9..41e9206 100644--- a/apps/web/components/features/backend/backend-config-dialog.tsx+++ b/apps/web/components/features/backend/backend-config-dialog.tsx@@ -57,7 +57,7 @@ import { useSettings, FaviconProvider, getFaviconUrl } from "@/lib/settings";import { Label } from "@/components/ui/label";import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";import { Separator } from "@/components/ui/separator";-import { useAuthState, authKeys, getStoredToken } from "@/lib/auth-queries";+import { useAuthState, authKeys } from "@/lib/auth-queries";// Favicon Provider Preview Componentfunction FaviconProviderPreview({@@ -780,14 +780,12 @@ export function BackendConfigDialog({const handleDisableAuth = async () => {setConfirmDisableAuthDialogOpen(true);};-// Confirm disable authconst confirmDisableAuth = async () => {setAuthLoading(true);try {- // Try to get stored token for verification- const storedToken = getStoredToken();- await api.disableAuth(storedToken || undefined);+ // Cookie is used for authentication+ await api.disableAuth();setAuthToken("");setConfirmDisableAuthDialogOpen(false);// Invalidate auth state cache to trigger refetchdiff --git a/apps/web/components/ui/dialog.tsx b/apps/web/components/ui/dialog.tsxindex 1011f74..d2070db 100644--- a/apps/web/components/ui/dialog.tsx+++ b/apps/web/components/ui/dialog.tsx@@ -51,13 +51,15 @@ function DialogContent({className,children,showCloseButton = true,+ overlayClassName,...props}: React.ComponentProps<typeof DialogPrimitive.Content> & {showCloseButton?: boolean;+ overlayClassName?: string;}) {return (<DialogPortal data-slot="dialog-portal">- <DialogOverlay />+ <DialogOverlay className={overlayClassName} /><DialogPrimitive.Contentdata-slot="dialog-content"className={cn(diff --git a/apps/web/lib/auth-queries.ts b/apps/web/lib/auth-queries.tsindex 0c449e9..bc69b0b 100644--- a/apps/web/lib/auth-queries.ts+++ b/apps/web/lib/auth-queries.ts@@ -4,8 +4,6 @@ import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";import { useCallback } from "react";import type { AuthState } from "@neko-master/shared";-const AUTH_TOKEN_KEY = "neko-master-auth-token";-// API functionsasync function fetchAuthState(): Promise<AuthState> {const response = await fetch("/api/auth/state");@@ -16,6 +14,7 @@ async function fetchAuthState(): Promise<AuthState> {}async function verifyToken(token: string): Promise<boolean> {+ // Just send the token in body, server will set cookieconst response = await fetch("/api/auth/verify", {method: "POST",headers: { "Content-Type": "application/json" },@@ -28,30 +27,6 @@ async function verifyToken(token: string): Promise<boolean> {return result.valid;}-// Storage helpers-export function getStoredToken(): string | null {- if (typeof window === "undefined") return null;- return localStorage.getItem(AUTH_TOKEN_KEY);-}--export function storeToken(token: string): void {- if (typeof window === "undefined") return;- localStorage.setItem(AUTH_TOKEN_KEY, token);-}--export function removeToken(): void {- if (typeof window === "undefined") return;- localStorage.removeItem(AUTH_TOKEN_KEY);-}--export function getAuthHeaders(): Record<string, string> {- const token = getStoredToken();- if (token) {- return { Authorization: `Bearer ${token}` };- }- return {};-}-// Query keysexport const authKeys = {all: ["auth"] as const,@@ -88,7 +63,6 @@ export function useLogin() {if (!isValid) {throw new Error("Invalid token");}- storeToken(token);return true;},onSuccess: () => {@@ -101,74 +75,31 @@ export function useLogin() {export function useLogout() {const queryClient = useQueryClient();- return useCallback(() => {- removeToken();- // Invalidate and refetch auth state- queryClient.invalidateQueries({ queryKey: authKeys.state() });- }, [queryClient]);+ return useMutation({+ mutationFn: async () => {+ await fetch("/api/auth/logout", { method: "POST" });+ },+ onSuccess: () => {+ // Invalidate and refetch auth state+ queryClient.invalidateQueries({ queryKey: authKeys.state() });+ // Force reload to ensure clean state+ window.location.reload();+ },+ });}// Hook to check if user is authenticated+// Deprecated: logic moved to AuthProviderexport function useIsAuthenticated() {- const { data: authState, isLoading, error } = useAuthState();- const token = getStoredToken();-- // If still loading, return loading state- if (isLoading) {- return { isAuthenticated: false, isLoading: true };- }-- // If error occurred (e.g., 401), check if it's an auth error- // If the error is 401, it means auth is enabled but we don't have valid token- if (error) {- // Check if it's a 401 error- const isAuthError = (error as any)?.message?.includes("401") ||- (error as any)?.status === 401;-- if (isAuthError) {- // Auth is enabled but we need to login- return { isAuthenticated: !!token, isLoading: false };- }-- // Other errors, assume no auth required to prevent lockout- return { isAuthenticated: true, isLoading: false };- }-- // If auth is not enabled, user is authenticated- if (!authState?.enabled) {- return { isAuthenticated: true, isLoading: false };- }-- // Auth is enabled, check if we have a token- // The token will be verified by the API on each request- return { isAuthenticated: !!token, isLoading: false };+ const { data: authState, isLoading } = useAuthState();+ if (isLoading) return { isAuthenticated: false, isLoading: true };+ if (authState && !authState.enabled) return { isAuthenticated: true, isLoading: false };+ // We can't know for sure here without context, defaulting to true to avoid UI flicker if not using AuthProvider+ return { isAuthenticated: true, isLoading: false };}-// Hook to determine if login dialog should be shown-export function useRequireAuth() {- const { data: authState, isLoading, error } = useAuthState();- const { isAuthenticated } = useIsAuthenticated();- const token = getStoredToken();-- // Check if error is 401 (auth required)- const isAuthError = error && (- (error as any)?.message?.includes("401") ||- (error as any)?.status === 401- );-- // If we got 401 on auth state check, auth is definitely enabled- const authEnabled = authState?.enabled || isAuthError;-- // Show login if:- // 1. Not loading- // 2. Auth is enabled (from state or from 401 error)- // 3. User is not authenticated (no valid token)- const showLogin = !isLoading && authEnabled && !isAuthenticated && !token;-- return {- showLogin,- isLoading: isLoading || (!authState && !error), // Still loading if no data and no error- authEnabled,- error,- };+// Helper function to get auth headers for API requests+// Cookies are handled automatically by browser+export function getAuthHeaders(): Record<string, string> {+ return {};}diff --git a/apps/web/lib/auth.tsx b/apps/web/lib/auth.tsxindex 3495471..485e172 100644--- a/apps/web/lib/auth.tsx+++ b/apps/web/lib/auth.tsx@@ -8,7 +8,7 @@ import {useCallback,type ReactNode,} from "react";-import { useQueryClient } from "@tanstack/react-query";+import { useQueryClient, useMutation } from "@tanstack/react-query";import { authKeys } from "./auth-queries";import type { AuthState } from "@neko-master/shared";@@ -17,45 +17,40 @@ interface AuthContextType {isAuthenticated: boolean;authState: AuthState | null;isLoading: boolean;- login: (token: string) => Promise<boolean>;+ login: (token: string, updateState?: boolean) => Promise<boolean>;+ confirmLogin: () => void;logout: () => void;checkAuth: () => Promise<void>;}const AuthContext = createContext<AuthContextType | undefined>(undefined);-const AUTH_TOKEN_KEY = "neko-master-auth-token";-export function AuthProvider({ children }: { children: ReactNode }) {const [isAuthenticated, setIsAuthenticated] = useState(false);const [authState, setAuthState] = useState<AuthState | null>(null);const [isLoading, setIsLoading] = useState(true);const queryClient = useQueryClient();-- // Get stored token- const getStoredToken = useCallback((): string | null => {- if (typeof window === "undefined") return null;- return localStorage.getItem(AUTH_TOKEN_KEY);- }, []);-- // Store token- const storeToken = useCallback((token: string) => {- if (typeof window === "undefined") return;- localStorage.setItem(AUTH_TOKEN_KEY, token);- }, []);-- // Remove token- const removeToken = useCallback(() => {- if (typeof window === "undefined") return;- localStorage.removeItem(AUTH_TOKEN_KEY);- }, []);+ // We use useLogout logic but inside provider+ const { mutate: logoutMutate } = useMutation({+ mutationFn: async () => {+ await fetch("/api/auth/logout", { method: "POST" });+ },+ onSuccess: () => {+ setIsAuthenticated(false);+ window.location.reload();+ }+ });// Check auth state from serverconst checkAuth = useCallback(async () => {try {const response = await fetch("/api/auth/state");++ // If we can't reach the server, assume no auth required/error+ // But actually if we are authorized, we should be able to reach it.+ // Wait, /api/auth/state is public.+if (!response.ok) {- // If we can't reach the server, assume no auth requiredsetAuthState({ enabled: false, hasToken: false });setIsAuthenticated(true);return;@@ -70,28 +65,32 @@ export function AuthProvider({ children }: { children: ReactNode }) {return;}- // Auth is enabled, check if we have a valid token- const token = getStoredToken();- if (token) {- // Verify token with server- const verifyResponse = await fetch("/api/auth/verify", {- method: "POST",- headers: { "Content-Type": "application/json" },- body: JSON.stringify({ token }),- });-- if (verifyResponse.ok) {- const verifyResult = await verifyResponse.json();- if (verifyResult.valid) {- setIsAuthenticated(true);- return;- }- }- // Token is invalid, remove it- removeToken();+ // Auth is enabled. Check if we have a valid session.+ // We can try to hit a protected endpoint or we can assume we are NOT authenticated+ // until we prove otherwise via some check.++ // However, we don't have a "am I logged in" endpoint yet.+ // But `websocket.ts` or other queries will fail if not.++ // To prevent "Login" screen flash or "Dashboard" flash, we need to know.+ // As a workaround, let's try to verify with an empty token or check a lightweight protected endpoint.+ // Actually, let's use a specific check.++ // The `app.ts` allows public routes.+ // Let's rely on the fact that if we just logged in, we set `isAuthenticated` to true.+ // If we refresh, we reset.++ // We NEED a way to check validity on mount.+ // Since I didn't add a specific endpoint, I will use `GET /api/db/retention` which is protected+ // and lightweight.++ const checkRes = await fetch("/api/db/retention");+ if (checkRes.ok) {+ setIsAuthenticated(true);+ } else {+ setIsAuthenticated(false);}- setIsAuthenticated(false);} catch (error) {console.error("Failed to check auth state:", error);// On error, assume no auth required to prevent lockout@@ -100,11 +99,16 @@ export function AuthProvider({ children }: { children: ReactNode }) {} finally {setIsLoading(false);}- }, [getStoredToken, removeToken]);+ }, []);++ // Confirm login manually (used for delayed UI transitions)+ const confirmLogin = useCallback(() => {+ setIsAuthenticated(true);+ }, []);// Login with tokenconst login = useCallback(- async (token: string): Promise<boolean> => {+ async (token: string, updateState = true): Promise<boolean> => {try {const response = await fetch("/api/auth/verify", {method: "POST",@@ -118,8 +122,9 @@ export function AuthProvider({ children }: { children: ReactNode }) {const result = await response.json();if (result.valid) {- storeToken(token);- setIsAuthenticated(true);+ if (updateState) {+ setIsAuthenticated(true);+ }return true;}@@ -129,61 +134,30 @@ export function AuthProvider({ children }: { children: ReactNode }) {return false;}},- [storeToken]+ []);// Logoutconst logout = useCallback(() => {- // Only reload if we actually had a token to clear- // This prevents infinite reload loops on 401 errors when already logged out- const hadToken = !!localStorage.getItem(AUTH_TOKEN_KEY);-- removeToken();- setIsAuthenticated(false);-- if (hadToken) {- // Force reload to ensure clean state and restart of correct components- window.location.reload();- }- }, [removeToken]);+ logoutMutate();+ }, [logoutMutate]);// Check auth on mountuseEffect(() => {checkAuth();}, [checkAuth]);- // Listen for storage changes (for multi-tab support)- useEffect(() => {- const handleStorageChange = (e: StorageEvent) => {- if (e.key === AUTH_TOKEN_KEY) {- if (e.newValue === null) {- // Token was removed in another tab- setIsAuthenticated(false);- } else {- // Token was added/changed in another tab- checkAuth();- }- }- };-- window.addEventListener("storage", handleStorageChange);- return () => window.removeEventListener("storage", handleStorageChange);- }, [checkAuth]);-- // Listen for unauthorized events from API+ // Listen for unauthorized events from API (from custom fetch wrapper or axios)useEffect(() => {const handleUnauthorized = () => {- // Clear local state- logout();- // Invalidate queries to ensure fresh state across the app- queryClient.invalidateQueries({ queryKey: authKeys.state() });+ setIsAuthenticated(false);};window.addEventListener("api:unauthorized", handleUnauthorized);return () => {window.removeEventListener("api:unauthorized", handleUnauthorized);};- }, [logout, queryClient]);+ }, []);return (<AuthContext.Provider@@ -192,6 +166,7 @@ export function AuthProvider({ children }: { children: ReactNode }) {authState,isLoading,login,+ confirmLogin,logout,checkAuth,}}@@ -210,11 +185,26 @@ export function useAuth() {}// Helper function to get auth headers for API requests+// Deprecated: Cookies are handled automatically by browserexport function getAuthHeaders(): Record<string, string> {- if (typeof window === "undefined") return {};- const token = localStorage.getItem(AUTH_TOKEN_KEY);- if (token) {- return { Authorization: `Bearer ${token}` };- }return {};}++// Hook to determine if login dialog should be shown+export function useRequireAuth() {+ const { authState, isAuthenticated, isLoading } = useAuth();++ // Logic:+ // 1. If loading, don't show login yet (or show loading spinner)+ // 2. If auth not enabled, don't show login+ // 3. If auth enabled and not authenticated, show login++ const showLogin = !isLoading && !!authState?.enabled && !isAuthenticated;++ return {+ showLogin,+ isLoading,+ authEnabled: authState?.enabled,+ error: null, // We handle errors via event listeners mostly+ };+}diff --git a/apps/web/lib/websocket.ts b/apps/web/lib/websocket.tsindex ee559b4..e656250 100644--- a/apps/web/lib/websocket.ts+++ b/apps/web/lib/websocket.ts@@ -1,7 +1,6 @@import { useEffect, useRef, useState, useCallback } from 'react';import type { StatsSummary } from '@neko-master/shared';import type { TimeRange } from '@/lib/api';-import { getStoredToken } from '@/lib/auth-queries';export type ConnectionStatus = 'connecting' | 'connected' | 'disconnected' | 'error';@@ -216,10 +215,8 @@ export function useStatsWebSocket(options: UseStatsWebSocketOptions = {}) {}const wsUrl = wsUrls[wsUrlIndexRef.current]!;- const token = getStoredToken();- const urlWithToken = token- ? `${wsUrl}${wsUrl.includes('?') ? '&' : '?'}token=${token}`- : wsUrl;+ // Cookie is handled automatically by browser+ const urlWithToken = wsUrl;console.log('[WebSocket] Connecting to:', wsUrl);diff --git a/apps/web/messages/en.json b/apps/web/messages/en.jsonindex e2d749d..7c8941a 100644--- a/apps/web/messages/en.json+++ b/apps/web/messages/en.json@@ -338,7 +338,9 @@"invalidToken": "Invalid access token","loginError": "Login failed, please try again","loggingIn": "Logging in...",- "login": "Login"+ "login": "Login",+ "loginSuccess": "Welcome back",+ "redirecting": "Syncing network statistics..."},"backend": {"title": "Settings",diff --git a/apps/web/messages/zh.json b/apps/web/messages/zh.jsonindex 5c8cb70..6e4b45d 100644--- a/apps/web/messages/zh.json+++ b/apps/web/messages/zh.json@@ -337,7 +337,9 @@"invalidToken": "访问令牌无效","loginError": "登录失败,请重试","loggingIn": "登录中...",- "login": "登录"+ "login": "登录",+ "loginSuccess": "欢迎回来",+ "redirecting": "正在同步网络数据..."},"backend": {"title": "设置",diff --git a/apps/web/public/images/neko-welcome.png b/apps/web/public/images/neko-welcome.pngnew file mode 100644index 0000000..723d10dBinary files /dev/null and b/apps/web/public/images/neko-welcome.png differdiff --git a/package.json b/package.jsonindex 5b44d3c..d1f61b3 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "neko-master",- "version": "1.2.5",+ "version": "1.2.6","description": "Modern traffic analytics for edge gateways","private": true,"workspaces": [diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 798a335..24d0ce8 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -14,9 +14,12 @@ importers:apps/collector:dependencies:+ '@fastify/cookie':+ specifier: ^11.0.2+ version: 11.0.2'@fastify/cors':- specifier: ^9.0.1- version: 9.0.1+ specifier: ^11.2.0+ version: 11.2.0'@neko-master/shared':specifier: workspace:*version: link:../../packages/shared@@ -27,8 +30,8 @@ importers:specifier: ^16.6.0version: 16.6.1fastify:- specifier: ^4.29.0- version: 4.29.1+ specifier: ^5.7.4+ version: 5.7.4ws:specifier: ^8.19.0version: 8.19.0@@ -907,20 +910,29 @@ packages:resolution: {integrity: sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==}engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}- '@fastify/[email protected]':- resolution: {integrity: sha512-LwdXQJjmMD+GwLOkP7TVC68qa+pSSogeWWmznRJ/coyTcfe9qA05AHFSe1eZFwK6q+xVRpChnvFUkf1iYaSZsQ==}+ '@fastify/[email protected]':+ resolution: {integrity: sha512-KoWKW+MhvfTRWL4qrhUwAAZoaChluo0m0vbiJlGMt2GXvL4LVPQEjt8kSpHI3IBq5Rez8fg+XeH3cneztq+C7A==}- '@fastify/[email protected]':- resolution: {integrity: sha512-YY9Ho3ovI+QHIL2hW+9X4XqQjXLjJqsU+sMV/xFsxZkE8p3GNnYVFpoOxF7SsP5ZL76gwvbo3V9L+FIekBGU4Q==}+ '@fastify/[email protected]':+ resolution: {integrity: sha512-GWdwdGlgJxyvNv+QcKiGNevSspMQXncjMZ1J8IvuDQk0jvkzgWWZFNC2En3s+nHndZBGV8IbLwOI/sxCZw/mzA==}- '@fastify/[email protected]':- resolution: {integrity: sha512-wWSvph+29GR783IhmvdwWnN4bUxTD01Vm5Xad4i7i1VuAOItLvbPAb69sb0IQ2N57yprvhNIwAP5B6xfKTmjmQ==}+ '@fastify/[email protected]':+ resolution: {integrity: sha512-LbLHBuSAdGdSFZYTLVA3+Ch2t+sA6nq3Ejc6XLAKiQ6ViS2qFnvicpj0htsx03FyYeLs04HfRNBsz/a8SvbcUw==}- '@fastify/[email protected]':- resolution: {integrity: sha512-aZAXGYo6m22Fk1zZzEUKBvut/CIIQe/BapEORnxiD5Qr0kPHqqI69NtEMCme74h+at72sPhbkb4ZrLd1W3KRLA==}+ '@fastify/[email protected]':+ resolution: {integrity: sha512-RSo3sVDXfHskiBZKBPRgnQTtIqpi/7zhJOEmAxCiBcM7d0uwdGdxLlsCaLzGs8v8NnxIRlfG0N51p5yFaOentQ==}- '@fastify/[email protected]':- resolution: {integrity: sha512-fERDVz7topgNjtXsJTTW1JKLy0rhuLRcquYqNR9rF7OcVpCa2OVW49ZPDIhaRRCaUuvVxI+N416xUoF76HNSXA==}+ '@fastify/[email protected]':+ resolution: {integrity: sha512-uik7yYHkLr6fxd8hJSZ8c+xF4WafPK+XzneQDPU+D10r5X19GW8lJcom2YijX2+qtFF1ENJlHXKFM9ouXNJYgQ==}++ '@fastify/[email protected]':+ resolution: {integrity: sha512-JqDochHFqXs3C3Ml3gOY58zM7OqO9ENqPo0UqAjAjH8L01fRZqwX9iLeX34//kiJubF7r2ZQHtBRU36vONbLlw==}++ '@fastify/[email protected]':+ resolution: {integrity: sha512-OA3KGBCy6KtIvLf8DINC5880o5iBlDX4SxzLQS8HorJAbqluzLRn80UXU0bxZn7UOFhFgpRJDasfwn9nG4FG4A==}++ '@fastify/[email protected]':+ resolution: {integrity: sha512-INS+6gh91cLUjB+PVHfu1UqcB76Sqtpyp7bnL+FYojhjygvOPA9ctiD/JDKsyD9Xgu4hUhCSJBPig/w7duNajw==}'@floating-ui/[email protected]':resolution: {integrity: sha512-C3HlIdsBxszvm5McXlB8PeOEWfBhcGBTZGkGlWc2U0KFY5IwG5OQEuQ8rq52DZmcHDlPLd+YFBK+cZcytwIFWg==}@@ -2666,8 +2678,8 @@ packages:resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==}engines: {node: '>= 0.4'}- resolution: {integrity: sha512-CDSwaxINFy59iNwhYnkvALBwZiTydGkOecZyPkqBpABYR1KqGEsET0VOOYDwtleZSUIdeY36DC2bSZ24CO1igA==}+ resolution: {integrity: sha512-2t/sy01ArdHHE0vRH5Hsay+RtCZt3dLPji7W7/MMOCEgze5b7SNDC4j5H6FnVgPkI1MTNFGzHdHrVXDDl7QSSQ==}resolution: {integrity: sha512-BASOg+YwO2C+346x3LZOeoovTIoTrRqEsqMa6fmfAV0P+U9mFr9NsyOEpiYvFjbc64NMrSswhV50WdXzdb/Z5A==}@@ -2795,9 +2807,9 @@ packages:resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==}- resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==}- engines: {node: '>= 0.6'}+ resolution: {integrity: sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==}+ engines: {node: '>=18'}resolution: {integrity: sha512-2KV8NhB5JqC3ky0r9PMCAZKbUHSwtEo4CwCs0KXgruG43gX5PMqDEBbVU4OUzw2MuAWUfsuFmWvEKG5QRfSnJA==}@@ -2977,6 +2989,10 @@ packages:resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==}engines: {node: '>= 0.4'}+ resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==}+ engines: {node: '>=6'}+resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==}engines: {node: '>=8'}@@ -3206,9 +3222,6 @@ packages:resolution: {integrity: sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==}engines: {node: '>=6'}- resolution: {integrity: sha512-fBHHqSTFLVnR61C+gltJuE5GkVQMV0S2nqUO8TJ+5Z3qAKG8vAx4FKai1s5jq/inV1+sREynIWSuQ6HgoSXpDQ==}-resolution: {integrity: sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg==}@@ -3230,8 +3243,8 @@ packages:resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==}- resolution: {integrity: sha512-KAdnLvy1yu/XrRtP+LJnxbBGrhN+xXu+gt3EUvZhYGKCr3lFHq/7UFJHHFgmJKoqlh6B40bZLEv7w46B0mqn1g==}+ resolution: {integrity: sha512-oRCntNDY/329HJPlmdNLIdogNtt6Vyjb1WuT01Soss3slIdyUp8kAcDU3saQTOquEK8KFVfwIIF7FebxUAu+yA==}resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==}@@ -3239,17 +3252,14 @@ packages:resolution: {integrity: sha512-g6KuKWmFXc0fID8WWH0jit4g0AGBoJhCkJMb1RmbsSEUNvQ+ZC8D6CUZ+GtF8nMzSPXnhiePyyqqipzNNEnHjg==}- resolution: {integrity: sha512-ypuAmmMKInk5q7XcepxlnUWDLWv4GFtaJqAzWKqn62IpQ3pejtr5dTVbt3vwqVaMKmkNR55sTT+CqUKIaT21BA==}-resolution: {integrity: sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==}- resolution: {integrity: sha512-stRHYGeuqpEZTL1Ef0Ovr2ltazUT9g844X5z/zEBFLG8RYlpDiOCIG+ATvYEp+/zmc7sN29mcIMp8gvYplYPIQ==}+ resolution: {integrity: sha512-FAIDA8eovSt5qcDgcBvDuX/v0Cjz0ohGhENZ/wpc3y+oZCY2afZ9Baqql3g/lC+OHRnciQol4ww7tuthOb9idw==}- resolution: {integrity: sha512-m2kMNHIG92tSNWv+Z3UeTR9AWLLuo7KctC7mlFPtMEVrfjIhmQhkQnT9v15qA/BfVq3vvj134Y0jl9SBje3jXQ==}+ resolution: {integrity: sha512-e6l5NsRdaEP8rdD8VR0ErJASeyaRbzXYpmkrpr2SuvuMq6Si3lvsaVy5C+7gLanEkvjpMDzBXWE5HPeb/hgTxA==}resolution: {integrity: sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==}@@ -3277,9 +3287,9 @@ packages:resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==}engines: {node: '>=8'}- resolution: {integrity: sha512-Dobi7gcTEq8yszimcfp/R7+owiT4WncAJ7VTTgFH1jYJ5GaG1FbhjwDG820hptN0QDFvzVY3RfCzdInvGPGzjA==}- engines: {node: '>=14'}+ resolution: {integrity: sha512-5Ye4vHsypZRYtS01ob/iwHzGRUDELlsoCftI/OZFhcLs1M0tkGPcXldE80TAZC5yYuJMBPJQQ43UHlqbJWiX2w==}+ engines: {node: '>=20'}resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==}@@ -3296,10 +3306,6 @@ packages:resolution: {integrity: sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==}engines: {node: '>= 0.4'}- resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==}- engines: {node: '>= 0.6'}-resolution: {integrity: sha512-ca8d+rRPcDP5iIF+MoT3WNc0KHJMjIyFAbtVLvM9eA7joGSpeqDfiNH/kCs1t4CHi04njYvWyj0jS4QlEK/rJQ==}peerDependencies:@@ -3488,9 +3494,9 @@ packages:resolution: {integrity: sha512-ucSrQmZGAxfiBHfBRXW/k7UC8MaGFlEj4Ry1tKiDcmgwQm1y3EDl40u+4VNHYomxJQMJi9NEI3riDRlth96jKg==}- resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==}- engines: {node: '>= 0.10'}+ resolution: {integrity: sha512-Zv/pA+ciVFbCSBBjGfaKUya/CcGmUHzTydLMaTwrUUEM2DIEO3iZvueGxmacvmN50fGpGVKeTXpb2LcYQxeVdg==}+ engines: {node: '>= 10'}resolution: {integrity: sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==}@@ -3651,8 +3657,8 @@ packages:resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==}- resolution: {integrity: sha512-EJAj1pgHc1hxF6vo2Z3s69fMjO1INq6eGHXZ8Z6wCQeldCuwxGK9Sxf4/cScGn3FZubCVUehfWtcDM/PLteCQw==}+ resolution: {integrity: sha512-hOrZIVL5jyYFjzk7+y7n5JDzGlU8rfWDuYyHwGa2WA8/pcmMHezp2xsVwxrebD/Q9t8Nc5DboieySDpCp4WG4A==}resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==}@@ -3704,8 +3710,8 @@ packages:resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==}engines: {node: '>= 0.8.0'}- resolution: {integrity: sha512-aORPWntbpH5esaYpGOOmri0OHDOe3wC5M2MQxZ9dvMLZm6DnaAn0kJlcbU9hwsQgLzmZyReKwFwwPkR+nHu5kA==}+ resolution: {integrity: sha512-CHYbu8RtboSIoVsHZ6Ye4cj4Aw/yg2oAFimlF7mNvfDV192LR7nDiKtSIfCuLT7KokPSTn/9kfVLm5OGN0A28A==}resolution: {integrity: sha512-BH9sEdOCahSgmkVhBLeU7Hc9DWeZ1Eb6wNS6Da8igvUwAe0sqROHddIlvU06q3WyXVEOYDZ6ykBZQnjTbmo4+A==}@@ -3859,9 +3865,6 @@ packages:resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==}- resolution: {integrity: sha512-A/0v5Z59y63US00cRSLiloEIw3t5G+MiKz4BhX21FI+YBJXBOGW0ohFxTxO08dsOYlzxo87T7vGfZKYp2bcAWA==}-resolution: {integrity: sha512-XRPebVypsl0UM+7v0Hr8o9UAj0S2djsQWRdHBd5iVouVpMrQqAI0C/rDAT3QaYnXnHuC5hMcwDHCboNeyYjPoQ==}@@ -3976,9 +3979,6 @@ packages:resolution: {integrity: sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA==}engines: {node: '>= 0.4'}- resolution: {integrity: sha512-42CPE9AhahZRsMNslczq0ctAEtqk8Eka26QofnqC346BZdHDySk3LWka23LI7ULIw11NmltpiLagIq8gBozxTw==}-resolution: {integrity: sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==}engines: {node: '>=14.0.0'}@@ -4032,14 +4032,14 @@ packages:resolution: {integrity: sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==}engines: {node: '>=12'}- resolution: {integrity: sha512-F63x5tizV6WCh4R6RHyi2Ml+M70DNRXt/+HANowMflpgGFMAym/VKm6G7ZOQRjqN7XbGxK1Lg9t6ZrtzOaivMw==}+ resolution: {integrity: sha512-wlfUczU+n7Hy/Ha5j9a/gZNy7We5+cXp8YL+X+PG8S0KXxw7n/JXA3c46Y0zQznIJ83URJiwy7Lh56WLokNuxg==}resolution: {integrity: sha512-BndPH67/JxGExRgiX1dX0w1FvZck5Wa4aal9198SrRhZjH3GxKQUKIBnYJTdj2HDN3UQAS06HlfcSbQj2OHmaw==}- resolution: {integrity: sha512-8OEwKp5juEvb/MjpIc4hjqfgCNysrS94RIOMXYvpYCdm/jglrKEiAYmiumbmGhCvs+IcInsphYDFwqrjr7398w==}+ resolution: {integrity: sha512-r34yH/GlQpKZbU1BvFFqOjhISRo1MNx1tWYsYvmj6KIRHSPMT2+yHOEb1SG6NMvRoHRF0a07kCOox/9yakl1vg==}hasBin: true@@ -4070,8 +4070,8 @@ packages:resolution: {integrity: sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==}engines: {node: '>=6'}- resolution: {integrity: sha512-mqn0kFRl0EoqhnL0GQ0veqFHyIN1yig9RHh/InzORTUiZHFRAur+aMtRkELNwGs9aNwKS6tg/An4NYBPGwvtzQ==}+ resolution: {integrity: sha512-3c2LzQ3rY9d0hc1emcsHhfT9Jwz0cChib/QN89oME2R451w5fy3f0afAhERFZAwrbDU43wk12d0ORBpDVME50Q==}resolution: {integrity: sha512-a39t9ApHNx2L4+HBnQKqxxHNs1r7KF+Intd8Q/g1bUh6q0WIp9voPXJ/x0j+ZL45KF1pJd9+q2jLIRMfvEshkA==}@@ -4079,10 +4079,6 @@ packages:resolution: {integrity: sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==}- resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==}- engines: {node: '>= 0.10'}-resolution: {integrity: sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==}@@ -4255,8 +4251,8 @@ packages:resolution: {integrity: sha512-U7WjGVG9sH8tvjW5SmGbQuui75FiyjAX72HX15DwBBwF9dNiQZRQAg9nnPhYy+TUnE0+VcrttuvNI8oSxZcocA==}hasBin: true- resolution: {integrity: sha512-0f4Memo5QP7WQyUEAYUO3esD/XjOc3Zjjg5CPsAq1p8sIu0XPeMbHJemKA0BO7tV0X7+A0FoEpbmHXWxPyD3wQ==}+ resolution: {integrity: sha512-I1XxrZSQ+oErkRR4jYbAyEEu2I0avBvvMM5JN+6EBprOGRCs63ENqZ3vjavq8fBw2+62G5LF5XelKwuJpcvcxw==}engines: {node: '>=10'}@@ -4289,8 +4285,8 @@ packages:resolution: {integrity: sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==}engines: {node: '>= 0.4'}- resolution: {integrity: sha512-RAAZAGbap2kBfbVhvmnTFv73NWLMvDGOITFYTZBAaY8eR+Ir4ef7Up/e7amo+y1+AH+3PtLkrt9mvcTsG9LXug==}+ resolution: {integrity: sha512-YwJwe5a51WlK7KbOJREPdjNrpViQBI3p4T50lfwPuDhZnE3XGVTlGvi+aolc5+RvxDD6bnUmjVsU9n1eboLUYw==}resolution: {integrity: sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==}@@ -4303,8 +4299,8 @@ packages:resolution: {integrity: sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==}engines: {node: '>= 10.13.0'}- resolution: {integrity: sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw==}+ resolution: {integrity: sha512-l4KnYfEyqYJxDwlNVyRfO2E4NTHfMKAWdUuA8J0yve2Dz/E/PdBepY03RvyJpssIpRFwJoCD55wA+mEDs6ByWA==}resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==}@@ -4535,8 +4531,9 @@ packages:engines: {node: '>=10'}hasBin: true- resolution: {integrity: sha512-OqyPZ9u96VohAyMfJykzmivOrY2wfMSf3C5TtFJVgN+Hm6aj+voFhlK+kZEIv2FBh1X6Xp3DlnCOfEQ3B2J86A==}+ resolution: {integrity: sha512-4iMVL6HAINXWf1ZKZjIPcz5wYaOdPhtO8ATvZ+Xqp3BTdaqtAwQkNmKORqcIo5YkQqGXq5cwfswDwMqqQNrpJA==}+ engines: {node: '>=20'}resolution: {integrity: sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==}@@ -5714,26 +5711,38 @@ snapshots:'@eslint/core': 0.17.0levn: 0.4.1- '@fastify/[email protected]':+ '@fastify/[email protected]':dependencies:ajv: 8.17.1- ajv-formats: 2.1.1([email protected])- fast-uri: 2.4.0+ ajv-formats: 3.0.1([email protected])+ fast-uri: 3.1.0- '@fastify/[email protected]':+ '@fastify/[email protected]':dependencies:- fastify-plugin: 4.5.1- mnemonist: 0.39.6+ cookie: 1.1.1+ fastify-plugin: 5.1.0- '@fastify/[email protected]': {}+ '@fastify/[email protected]':+ dependencies:+ fastify-plugin: 5.1.0+ toad-cache: 3.7.0++ '@fastify/[email protected]': {}- '@fastify/[email protected]':+ '@fastify/[email protected]':dependencies:- fast-json-stringify: 5.16.1+ fast-json-stringify: 6.3.0++ '@fastify/[email protected]': {}- '@fastify/[email protected]':+ '@fastify/[email protected]':dependencies:- fast-deep-equal: 3.1.3+ dequal: 2.0.3++ '@fastify/[email protected]':+ dependencies:+ '@fastify/forwarded': 3.0.1+ ipaddr.js: 2.3.0'@floating-ui/[email protected]':dependencies:@@ -7474,9 +7483,9 @@ snapshots:dependencies:possible-typed-array-names: 1.1.0dependencies:- '@fastify/error': 3.4.1+ '@fastify/error': 4.2.0fastq: 1.20.1@@ -7610,7 +7619,7 @@ snapshots:- [email protected]: {}+ [email protected]: {}dependencies:@@ -7796,6 +7805,8 @@ snapshots:has-property-descriptors: 1.0.2object-keys: 1.1.1+ [email protected]: {}+@@ -8190,8 +8201,6 @@ snapshots:- [email protected]: {}-@@ -8216,14 +8225,13 @@ snapshots:dependencies:- '@fastify/merge-json-schemas': 0.1.1+ '@fastify/merge-json-schemas': 0.2.1ajv: 8.17.1ajv-formats: 3.0.1([email protected])- fast-deep-equal: 3.1.3- fast-uri: 2.4.0- json-schema-ref-resolver: 1.0.1+ fast-uri: 3.1.0+ json-schema-ref-resolver: 3.0.0rfdc: 1.4.1@@ -8232,28 +8240,25 @@ snapshots:dependencies:fast-decode-uri-component: 1.0.1- [email protected]: {}-- [email protected]: {}+ [email protected]: {}dependencies:- '@fastify/ajv-compiler': 3.6.0- '@fastify/error': 3.4.1- '@fastify/fast-json-stringify-compiler': 4.3.0+ '@fastify/ajv-compiler': 4.0.5+ '@fastify/error': 4.2.0+ '@fastify/fast-json-stringify-compiler': 5.0.3+ '@fastify/proxy-addr': 5.1.0abstract-logging: 2.0.1- avvio: 8.4.0- fast-content-type-parse: 1.1.0- fast-json-stringify: 5.16.1- find-my-way: 8.2.2- light-my-request: 5.14.0- pino: 9.14.0- process-warning: 3.0.0- proxy-addr: 2.0.7+ avvio: 9.2.0+ fast-json-stringify: 6.3.0+ find-my-way: 9.4.0+ light-my-request: 6.6.0+ pino: 10.3.1+ process-warning: 5.0.0rfdc: 1.4.1- secure-json-parse: 2.7.0+ secure-json-parse: 4.1.0semver: 7.7.3toad-cache: 3.7.0@@ -8279,11 +8284,11 @@ snapshots:dependencies:to-regex-range: 5.0.1dependencies:fast-deep-equal: 3.1.3fast-querystring: 1.1.2- safe-regex2: 3.1.0+ safe-regex2: 5.0.0dependencies:@@ -8301,8 +8306,6 @@ snapshots:dependencies:is-callable: 1.2.7- [email protected]: {}-dependencies:motion-dom: 12.33.0@@ -8482,7 +8485,7 @@ snapshots:'@formatjs/icu-messageformat-parser': 3.5.1tslib: 2.8.1- [email protected]: {}+ [email protected]: {}dependencies:@@ -8643,9 +8646,9 @@ snapshots:dependencies:- fast-deep-equal: 3.1.3+ dequal: 2.0.3@@ -8693,10 +8696,10 @@ snapshots:prelude-ls: 1.2.1type-check: 0.4.0dependencies:- cookie: 0.7.2- process-warning: 3.0.0+ cookie: 1.1.1+ process-warning: 4.0.1set-cookie-parser: 2.7.2@@ -8817,10 +8820,6 @@ snapshots:- dependencies:- obliterator: 2.0.5-dependencies:motion-utils: 12.29.2@@ -8939,8 +8938,6 @@ snapshots:define-properties: 1.2.1es-object-atoms: 1.1.1- [email protected]: {}-@@ -8988,25 +8985,25 @@ snapshots:dependencies:split2: 4.2.0dependencies:'@pinojs/redact': 0.4.0atomic-sleep: 1.0.0on-exit-leak-free: 2.1.2- pino-abstract-transport: 2.0.0+ pino-abstract-transport: 3.0.0pino-std-serializers: 7.1.0process-warning: 5.0.0quick-format-unescaped: 4.0.4real-require: 0.2.0safe-stable-stringify: 2.5.0sonic-boom: 4.2.0- thread-stream: 3.1.0+ thread-stream: 4.0.0@@ -9043,7 +9040,7 @@ snapshots:- [email protected]: {}+ [email protected]: {}@@ -9053,11 +9050,6 @@ snapshots:object-assign: 4.1.1react-is: 16.13.1- dependencies:- forwarded: 0.2.0- ipaddr.js: 1.9.1-dependencies:end-of-stream: 1.4.5@@ -9305,7 +9297,7 @@ snapshots:path-parse: 1.0.7supports-preserve-symlinks-flag: 1.0.0- [email protected]: {}+ [email protected]: {}@@ -9340,9 +9332,9 @@ snapshots:es-errors: 1.3.0is-regex: 1.2.1dependencies:- ret: 0.4.3+ ret: 0.5.0@@ -9355,7 +9347,7 @@ snapshots:ajv-formats: 2.1.1([email protected])ajv-keywords: 5.1.0([email protected])- [email protected]: {}+ [email protected]: {}@@ -9633,7 +9625,7 @@ snapshots:commander: 2.20.3source-map-support: 0.5.21dependencies:real-require: 0.2.0