From 1a0ec5345272aaf8a10abc53e281917bb92da28a Mon Sep 17 00:00:00 2001 From: mtvpls Date: Tue, 23 Dec 2025 20:48:15 +0800 Subject: [PATCH] =?UTF-8?q?openlist=E9=85=8D=E7=BD=AE=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=BF=9E=E9=80=9A=E6=80=A7=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/admin/page.tsx | 34 ++++++++++++++++ src/app/api/openlist/check/route.ts | 61 +++++++++++++++++++++++++++++ src/lib/openlist.client.ts | 36 +++++++++++++++++ 3 files changed, 131 insertions(+) create mode 100644 src/app/api/openlist/check/route.ts diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx index 6d3fa4e..9bc8a82 100644 --- a/src/app/admin/page.tsx +++ b/src/app/admin/page.tsx @@ -2747,6 +2747,33 @@ const OpenListConfigComponent = ({ fetchVideos(true); // 强制从数据库重新读取,不使用缓存 }; + const handleCheckConnectivity = async () => { + await withLoading('checkOpenList', async () => { + try { + const response = await fetch('/api/openlist/check', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ + url, + username, + password, + }), + }); + + const data = await response.json(); + + if (response.ok && data.success) { + showSuccess('连接成功', showAlert); + } else { + throw new Error(data.error || '连接失败'); + } + } catch (error) { + showError(error instanceof Error ? error.message : '连接失败', showAlert); + throw error; + } + }); + }; + const handleDeleteVideo = async (folder: string, title: string) => { // 显示确认对话框,直接在 onConfirm 中执行删除操作 showAlert({ @@ -2916,6 +2943,13 @@ const OpenListConfigComponent = ({
+