From 267e9373f9733c72d3b5911359a73e2c85ef3d76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=B4=80=E1=B4=8D=E1=B4=9B=E1=B4=8F=E1=B4=80=E1=B4=87?= =?UTF-8?q?=CA=80?= Date: Fri, 11 Jul 2025 01:53:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8A=A0=E5=85=A5=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E9=A1=B5=E9=87=8C=E7=BC=BA=E5=A4=B1=E7=9A=84=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E9=A1=B9=EF=BC=8C=E5=AF=86=E7=A0=81=E8=A1=A8=E5=8D=95=E5=85=81?= =?UTF-8?q?=E8=AE=B8=E4=BF=AE=E6=94=B9=E5=8F=AF=E8=A7=81=E6=80=A7=20(#387)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/custom/password-input.svelte | 85 ++++++++++++ web/src/lib/types.ts | 13 ++ web/src/routes/+page.svelte | 2 +- web/src/routes/settings/+page.svelte | 122 +++++++++++++----- web/src/routes/video-sources/+page.svelte | 3 +- 5 files changed, 189 insertions(+), 36 deletions(-) create mode 100644 web/src/lib/components/custom/password-input.svelte diff --git a/web/src/lib/components/custom/password-input.svelte b/web/src/lib/components/custom/password-input.svelte new file mode 100644 index 0000000..767d68f --- /dev/null +++ b/web/src/lib/components/custom/password-input.svelte @@ -0,0 +1,85 @@ + + +
+ + +
diff --git a/web/src/lib/types.ts b/web/src/lib/types.ts index 6e975b5..521110e 100644 --- a/web/src/lib/types.ts +++ b/web/src/lib/types.ts @@ -221,9 +221,22 @@ export interface DanmakuOption { time_offset: number; } +export interface RateLimit { + limit: number; + duration: number; +} + +export interface ConcurrentDownloadLimit { + enable: boolean; + concurrency: number; + threshold: number; +} + export interface ConcurrentLimit { video: number; page: number; + rate_limit?: RateLimit; + download: ConcurrentDownloadLimit; } export interface Config { diff --git a/web/src/routes/+page.svelte b/web/src/routes/+page.svelte index 3811a33..b852600 100644 --- a/web/src/routes/+page.svelte +++ b/web/src/routes/+page.svelte @@ -191,7 +191,7 @@
- 合集 + 合集 / 列表
{dashboardData.enabled_collections}
diff --git a/web/src/routes/settings/+page.svelte b/web/src/routes/settings/+page.svelte index 950ca95..ce291c8 100644 --- a/web/src/routes/settings/+page.svelte +++ b/web/src/routes/settings/+page.svelte @@ -7,6 +7,7 @@ import * as Tabs from '$lib/components/ui/tabs/index.js'; import { Separator } from '$lib/components/ui/separator/index.js'; import { Badge } from '$lib/components/ui/badge/index.js'; + import PasswordInput from '$lib/components/custom/password-input.svelte'; import api from '$lib/api'; import { toast } from 'svelte-sonner'; import { setBreadcrumb } from '$lib/stores/breadcrumb'; @@ -101,12 +102,7 @@ {#if !formData}
- +
{:else} @@ -199,11 +195,10 @@
- - 后端 API 认证Token +

@@ -227,25 +222,23 @@

-
-
-
-
-
- - - + +
-
- - + { + if (checked) { + formData!.concurrent_limit.rate_limit = { limit: 4, duration: 250 }; + } else { + formData!.concurrent_limit.rate_limit = undefined; + } + }} /> -

- 用于保护后端API的认证令牌,修改后需要重新进行前端认证 -

+ +
+ {#if formData.concurrent_limit.rate_limit} +
+
+ + +

请求限制的时间窗口(毫秒)

+
+
+ + +

每个时间间隔内允许的最大请求数

+
+
+ {/if} +
+ + +
+
+ + +
+
+
+ + +

+ 单文件将分为若干大小相同的块并行下载,所有分块下载完毕后合并 +

+
+
+ + +

+ 大于该阈值的文件才使用分块下载,文件过小时分块下载的拆分合并成本可能大于带来的增益 +

+
@@ -649,9 +708,6 @@

请先进行前端认证以加载配置

-
{/if} diff --git a/web/src/routes/video-sources/+page.svelte b/web/src/routes/video-sources/+page.svelte index 86e4583..abd3363 100644 --- a/web/src/routes/video-sources/+page.svelte +++ b/web/src/routes/video-sources/+page.svelte @@ -216,9 +216,8 @@ {#each Object.entries(TAB_CONFIG) as [key, config] (key)} - {@const sources = getSourcesForTab(key)} - {config.label}({sources.length}) + {config.label} {/each}