From ac3e68ec10e77fde295fb5cdb17c9cc299d4ddbf Mon Sep 17 00:00:00 2001 From: mtvpls Date: Mon, 22 Dec 2025 23:08:03 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=81=E4=BA=BA=E5=BD=B1=E5=BA=93=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/admin/page.tsx | 95 +++++++++++++++++++++++------ src/app/api/admin/openlist/route.ts | 26 +++++++- src/app/api/cron/route.ts | 8 ++- src/app/layout.tsx | 3 +- src/app/private-library/page.tsx | 11 +++- src/lib/admin.types.ts | 1 + 6 files changed, 119 insertions(+), 25 deletions(-) diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx index bf2f56a..8170d79 100644 --- a/src/app/admin/page.tsx +++ b/src/app/admin/page.tsx @@ -2540,6 +2540,7 @@ const OpenListConfigComponent = ({ }) => { const { alertModal, showAlert, hideAlert } = useAlertModal(); const { isLoading, withLoading } = useLoadingState(); + const [enabled, setEnabled] = useState(false); const [url, setUrl] = useState(''); const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); @@ -2557,6 +2558,7 @@ const OpenListConfigComponent = ({ useEffect(() => { if (config?.OpenListConfig) { + setEnabled(config.OpenListConfig.Enabled || false); setUrl(config.OpenListConfig.URL || ''); setUsername(config.OpenListConfig.Username || ''); setPassword(config.OpenListConfig.Password || ''); @@ -2595,6 +2597,7 @@ const OpenListConfigComponent = ({ headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ action: 'save', + Enabled: enabled, URL: url, Username: username, Password: password, @@ -2719,6 +2722,57 @@ const OpenListConfigComponent = ({ return (
+ {/* 使用说明 */} +
+
+ + + + + 使用说明 + +
+
+

• 私人影库功能需要配合 OpenList 使用,用于管理和播放您自己的视频文件

+

• OpenList 是一个开源的网盘聚合程序,支持多种存储后端(本地、阿里云盘、OneDrive 等)

+

• 配置后,系统会自动扫描指定目录下的视频文件夹,并通过 TMDB 匹配元数据信息

+

• 定时扫描间隔设置为 0 表示关闭自动扫描,最低间隔为 60 分钟

+

• 视频文件夹名称为影片名称,精准命名可以提高 TMDB 匹配准确率

+ +
+
+ + {/* 功能开关 */} +
+
+

+ 启用私人影库功能 +

+

+ 关闭后将不显示私人影库入口,也不会执行定时扫描 +

+
+ +
+ {/* 配置表单 */}
@@ -2729,8 +2783,9 @@ const OpenListConfigComponent = ({ type='text' value={url} onChange={(e) => setUrl(e.target.value)} + disabled={!enabled} placeholder='https://your-openlist-server.com' - className='w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent' + className='w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed' />
@@ -2743,8 +2798,9 @@ const OpenListConfigComponent = ({ type='text' value={username} onChange={(e) => setUsername(e.target.value)} + disabled={!enabled} placeholder='admin' - className='w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent' + className='w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed' />
@@ -2755,8 +2811,9 @@ const OpenListConfigComponent = ({ type='password' value={password} onChange={(e) => setPassword(e.target.value)} + disabled={!enabled} placeholder='password' - className='w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent' + className='w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed' />
@@ -2769,8 +2826,9 @@ const OpenListConfigComponent = ({ type='text' value={rootPath} onChange={(e) => setRootPath(e.target.value)} + disabled={!enabled} placeholder='/' - className='w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent' + className='w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed' />

OpenList 中的视频文件夹路径,默认为根目录 / @@ -2785,9 +2843,10 @@ const OpenListConfigComponent = ({ type='number' value={scanInterval} onChange={(e) => setScanInterval(parseInt(e.target.value) || 0)} + disabled={!enabled} placeholder='0' min='0' - className='w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent' + className='w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed' />

设置为 0 关闭定时扫描,最低 60 分钟 @@ -2806,7 +2865,7 @@ const OpenListConfigComponent = ({ {/* 视频列表区域 */} - {config?.OpenListConfig?.URL && config?.OpenListConfig?.Username && config?.OpenListConfig?.Password && ( + {enabled && config?.OpenListConfig?.URL && config?.OpenListConfig?.Username && config?.OpenListConfig?.Password && (

@@ -7675,18 +7734,6 @@ function AdminPageClient() { - {/* 私人影库配置标签 */} - - } - isExpanded={expandedTabs.openListConfig} - onToggle={() => toggleTab('openListConfig')} - > - - - {/* 直播源配置标签 */} + {/* 私人影库配置标签 */} + + } + isExpanded={expandedTabs.openListConfig} + onToggle={() => toggleTab('openListConfig')} + > + + + {/* 分类配置标签 */}
-

- 私人影库 -

+
+

+ 私人影库 +

+

+ 观看自我收藏的高清视频吧 +

+
{error && (
diff --git a/src/lib/admin.types.ts b/src/lib/admin.types.ts index 4cfb376..e76fa01 100644 --- a/src/lib/admin.types.ts +++ b/src/lib/admin.types.ts @@ -92,6 +92,7 @@ export interface AdminConfig { cacheVersion: number; // CSS版本号(用于缓存控制) }; OpenListConfig?: { + Enabled: boolean; // 是否启用私人影库功能 URL: string; // OpenList 服务器地址 Username: string; // 账号(用于登录获取Token) Password: string; // 密码(用于登录获取Token)