From 951fadd4a6a682ff50f0584e4eb4f937cf42b36c Mon Sep 17 00:00:00 2001 From: noelorin Date: Sun, 27 Sep 2026 22:28:23 +0800 Subject: [PATCH] chore: batch pending changes (danmaku filter, rootPath migration, i18n) - web: artplayer danmaku block-filter lib and danmaku/settings page updates - mount: replacePathPrefix dao helper for rootPath migration on re-mount - stream/webdav: error copy, timeout handling and test coverage tweaks - i18n/docs: danmaku guide wording updates --- app/docs/en/guide/danmaku.md | 2 +- app/docs/guide/danmaku.md | 2 +- app/web/AGENTS.md | 6 +- app/web/src/components/AuthForm.tsx | 2 +- .../components/pages/DanmakuSettingsBody.tsx | 30 +--- app/web/src/components/pages/HomeBody.tsx | 2 +- .../components/pages/SettingsAdminBody.tsx | 6 +- app/web/src/components/pages/WatchBody.tsx | 153 ++++++++++++------ app/web/src/layouts/AppLayout.astro | 4 +- app/web/src/lib/artplayer-danmaku-filter.ts | 27 ++++ app/web/src/middleware.ts | 1 - app/web/src/pages/[locale]/danmaku.astro | 7 +- app/web/src/pages/[locale]/settings.astro | 13 +- app/web/src/views/danmaku.astro | 25 --- packages/dao/src/media-items.ts | 48 +++++- packages/i18n/src/messages/en.ts | 23 ++- packages/i18n/src/messages/zh-CN.ts | 17 +- packages/trpc/src/router/settings.router.ts | 8 +- packages/trpc/src/services/mount.service.ts | 15 +- .../trpc/src/services/stream.service.test.ts | 38 ++++- packages/trpc/src/services/stream.service.ts | 24 ++- .../trpc/src/services/webdav-client.test.ts | 23 ++- packages/trpc/src/services/webdav-client.ts | 32 ++++ packages/types/src/media-schemas.ts | 1 - 24 files changed, 362 insertions(+), 147 deletions(-) create mode 100644 app/web/src/lib/artplayer-danmaku-filter.ts delete mode 100644 app/web/src/views/danmaku.astro diff --git a/app/docs/en/guide/danmaku.md b/app/docs/en/guide/danmaku.md index c82fca4..5d7c125 100644 --- a/app/docs/en/guide/danmaku.md +++ b/app/docs/en/guide/danmaku.md @@ -33,7 +33,7 @@ A video and a same-named danmaku file in one folder is also picked up. ## Danmaku settings -The **Danmaku** page lets you set: +The **Settings** page's Danmaku section lets you set: - On or off by default - Opacity (lower it if it blocks the picture) diff --git a/app/docs/guide/danmaku.md b/app/docs/guide/danmaku.md index 3a9654b..4acb64f 100644 --- a/app/docs/guide/danmaku.md +++ b/app/docs/guide/danmaku.md @@ -35,7 +35,7 @@ ## 弹幕设置 -侧栏 **弹幕** 页面可以调: +侧栏 **设置** 页面的弹幕区块可以调: - 默认开还是关 - 透明度(怕挡画面就调淡一点) diff --git a/app/web/AGENTS.md b/app/web/AGENTS.md index bc594e7..f44c733 100644 --- a/app/web/AGENTS.md +++ b/app/web/AGENTS.md @@ -22,7 +22,7 @@ src/ pages/ [locale]/ index.astro | dashboard.astro | library.astro | browse.astro - watch.astro | mounts.astro | danmaku.astro | settings.astro + watch.astro | mounts.astro | danmaku.astro(302→settings) | settings.astro auth/login.astro | auth/register.astro auth/forgot-password.astro | auth/reset-password.astro api/trpc/[...trpc].ts | api/stream.ts | api/users.ts @@ -30,13 +30,13 @@ src/ 403.astro | 404.astro | 500.astro views/ # SSR 壳 + seo/nav(每页一个) home.astro | dashboard.astro | library.astro | browse.astro - watch.astro | mounts.astro | danmaku.astro | auth.astro | error.astro + watch.astro | mounts.astro | auth.astro | error.astro middleware.ts # 裸 / 语言检测跳转 + locale 规范化 layouts/AppLayout.astro components/ pages/ # 薄 SSR 主体(client:load) HomeBody.tsx | DashboardBody.tsx | LibraryBody.tsx | BrowseBody.tsx - WatchBody.tsx | MountsBody.tsx | DanmakuSettingsBody.tsx + WatchBody.tsx | MountsBody.tsx | DanmakuSettingsBody.tsx(settings 页弹幕区块) AuthBody.tsx | ErrorBody.tsx UserList.tsx | UserMenu.tsx | ThemeSwitch.tsx | AuthForm.tsx | errors/* lib/ diff --git a/app/web/src/components/AuthForm.tsx b/app/web/src/components/AuthForm.tsx index 7c96bee..d20f835 100644 --- a/app/web/src/components/AuthForm.tsx +++ b/app/web/src/components/AuthForm.tsx @@ -157,7 +157,7 @@ function AuthFormInner({ locale, mode, next, defaultToken }: AuthFormProps) { const homeBase = home(locale); return ( - + {titles[mode].title} {titles[mode].desc} diff --git a/app/web/src/components/pages/DanmakuSettingsBody.tsx b/app/web/src/components/pages/DanmakuSettingsBody.tsx index a544ce4..b89ce2d 100644 --- a/app/web/src/components/pages/DanmakuSettingsBody.tsx +++ b/app/web/src/components/pages/DanmakuSettingsBody.tsx @@ -3,7 +3,6 @@ import { t } from "@app/i18n"; import { Button, Card, Input, toast } from "@app/ui"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { useCallback, useEffect, useRef, useState } from "react"; -import { go } from "~/lib/nav"; import { createTRPCReactClient, trpc } from "~/lib/trpc"; const DANMAKU_SETTINGS_KEY = "media-danmaku-settings"; @@ -146,17 +145,14 @@ function Inner(props: { locale: Locale }) { const openNetworkMissing = prefsQuery.data?.openNetworkConfigured === false; return ( -
-

{t(locale, "danmaku.title")}

+
{openNetworkMissing && (
- {t(locale, "danmaku.openNetworkNotConfigured")}{" "} - - {t(locale, "auth.menu.settings")} - + {t(locale, "danmaku.openNetworkNotConfigured")}
)} - + +

{t(locale, "settings.danmakuSection")}

-
- - -
); } diff --git a/app/web/src/components/pages/HomeBody.tsx b/app/web/src/components/pages/HomeBody.tsx index fd186cc..7dd8071 100644 --- a/app/web/src/components/pages/HomeBody.tsx +++ b/app/web/src/components/pages/HomeBody.tsx @@ -46,7 +46,7 @@ function HomeInner({ locale }: HomeBodyProps) { { key: "nav.mounts", href: `/${locale}/mounts` }, { key: "nav.browse", href: `/${locale}/browse` }, { key: "nav.library", href: `/${locale}/library` }, - { key: "nav.danmaku", href: `/${locale}/danmaku` }, + { key: "nav.settings", href: `/${locale}/settings` }, ] as const; return ( diff --git a/app/web/src/components/pages/SettingsAdminBody.tsx b/app/web/src/components/pages/SettingsAdminBody.tsx index 62d010a..1a6d602 100644 --- a/app/web/src/components/pages/SettingsAdminBody.tsx +++ b/app/web/src/components/pages/SettingsAdminBody.tsx @@ -49,7 +49,7 @@ function Inner(props: { locale: Locale }) { const label = (key: MessageKey) => t(locale, key); return ( - +

{label("settings.adminSection")}

@@ -214,9 +214,7 @@ function Inner(props: { locale: Locale }) { : label("settings.autoScrapeOff")}
-

- {label("settings.autoScrapeHint")} -

+

{label("settings.autoScrapeHint")}