feat(web): protect media routes + i18n keys

This commit is contained in:
noelorin 2026-09-25 03:23:10 +08:00
parent 94e923486e
commit 2c6bc8818d
3 changed files with 65 additions and 1 deletions

View File

@ -6,7 +6,15 @@ import { authService } from "@app/trpc";
const SKIP_PREFIX = ["/api", "/_astro", "/favicon", "/robots", "/sitemap", "/llms"];
/** 需登录的基础路径(无 locale 前缀)。按需增删。 */
const PROTECTED_BASES = ["/dashboard", "/settings"] as const;
const PROTECTED_BASES = [
"/dashboard",
"/settings",
"/library",
"/browse",
"/watch",
"/mounts",
"/danmaku",
] as const;
const LOCALE_SEGMENTS = new Set(["zh-CN", "en"]);

View File

@ -9,6 +9,11 @@ export const en: Record<MessageKey, string> = {
"nav.dashboard": "Dashboard",
"nav.primary": "Primary nav",
"nav.brandHome": "Home",
"nav.library": "Library",
"nav.browse": "Browse",
"nav.watch": "Watch",
"nav.mounts": "Mounts",
"nav.danmaku": "Danmaku settings",
"home.title": "App Template",
"home.subtitle":
@ -31,6 +36,29 @@ export const en: Record<MessageKey, string> = {
"dashboard.desc":
"Full vertical example: tRPC → service → dao → db (scaffold baseline — replace with your domain).",
"library.title": "Library",
"library.scan": "Scan mounts",
"library.unmatched": "Unmatched",
"library.continue": "Continue watching",
"browse.title": "File browser",
"browse.play": "Play",
"browse.addLibrary": "Scan into library",
"mounts.title": "Mounts",
"mounts.add": "Add WebDAV",
"mounts.test": "Test connection",
"mounts.openlistHint": "For OpenList, use its WebDAV URL (e.g. https://host/dav)",
"watch.danmakuOn": "Danmaku on",
"watch.importXml": "Import local XML",
"watch.noDanmaku": "No online danmaku yet",
"danmaku.title": "Danmaku settings",
"danmaku.opacity": "Opacity",
"danmaku.density": "Density",
"danmaku.enabled": "Enable danmaku",
"auth.login.title": "Sign in",
"auth.login.heading": "Sign in",
"auth.login.subtitle": "Continue with email and password",

View File

@ -11,6 +11,11 @@ export const zhCN = {
"nav.dashboard": "仪表盘",
"nav.primary": "主导航",
"nav.brandHome": "首页",
"nav.library": "媒体库",
"nav.browse": "文件浏览",
"nav.watch": "播放",
"nav.mounts": "挂载管理",
"nav.danmaku": "弹幕设置",
"home.title": "应用模板",
"home.subtitle": "Astro + tRPC + Drizzle monorepo 脚手架。登录后可进入仪表盘查看用户列表示例。",
@ -32,6 +37,29 @@ export const zhCN = {
"dashboard.desc":
"tRPC → service → dao → db 的完整垂直示例(脚手架基线,可替换为你的业务实体)。",
"library.title": "媒体库",
"library.scan": "扫描挂载",
"library.unmatched": "未匹配",
"library.continue": "继续播放",
"browse.title": "文件浏览",
"browse.play": "播放",
"browse.addLibrary": "扫描入库",
"mounts.title": "挂载管理",
"mounts.add": "添加 WebDAV",
"mounts.test": "测试连接",
"mounts.openlistHint": "OpenList 请填写其 WebDAV 地址(如 https://host/dav)",
"watch.danmakuOn": "弹幕开",
"watch.importXml": "导入本地 XML",
"watch.noDanmaku": "暂无在线弹幕",
"danmaku.title": "弹幕设置",
"danmaku.opacity": "不透明度",
"danmaku.density": "密度",
"danmaku.enabled": "启用弹幕",
"auth.login.title": "登录",
"auth.login.heading": "登录",
"auth.login.subtitle": "使用邮箱与密码继续",