diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx index 9424738..d7cdc28 100644 --- a/src/app/admin/page.tsx +++ b/src/app/admin/page.tsx @@ -3708,6 +3708,8 @@ const NetDiskConfigComponent = ({ const [openListTempPath, setOpenListTempPath] = useState('/'); const [mobileEnabled, setMobileEnabled] = useState(false); const [mobileAuthorization, setMobileAuthorization] = useState(''); + const [baiduEnabled, setBaiduEnabled] = useState(false); + const [baiduCookie, setBaiduCookie] = useState(''); useEffect(() => { const quark = config?.NetDiskConfig?.Quark; @@ -3719,6 +3721,8 @@ const NetDiskConfigComponent = ({ setOpenListTempPath(quark?.OpenListTempPath || '/'); setMobileEnabled(mobile?.Enabled || false); setMobileAuthorization(mobile?.Authorization || ''); + setBaiduEnabled(config?.NetDiskConfig?.Baidu?.Enabled || false); + setBaiduCookie(config?.NetDiskConfig?.Baidu?.Cookie || ''); }, [config]); const handleSave = async () => { @@ -3739,6 +3743,10 @@ const NetDiskConfigComponent = ({ Enabled: mobileEnabled, Authorization: mobileAuthorization, }, + Baidu: { + Enabled: baiduEnabled, + Cookie: baiduCookie, + }, }), }); @@ -3809,6 +3817,34 @@ const NetDiskConfigComponent = ({ }); }; + const handleValidateBaidu = async () => { + await withLoading('validateBaiduNetDisk', async () => { + try { + const response = await fetch('/api/admin/netdisk', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ + action: 'validate', + provider: 'baidu', + Baidu: { + Cookie: baiduCookie, + }, + }), + }); + + const data = await response.json(); + if (!response.ok) { + throw new Error(data.error || '校验失败'); + } + + showSuccess(data.message || '百度网盘 Cookie 格式正常', showAlert); + } catch (error) { + showError(error instanceof Error ? error.message : '校验失败', showAlert); + throw error; + } + }); + }; + return (
@@ -3986,6 +4022,64 @@ const NetDiskConfigComponent = ({
+
+ + 百度网盘 + +
+
+
+

+ 启用百度网盘 +

+

+ 开启后,网盘搜索中的百度网盘资源会显示“立即播放”按钮 +

+
+ +
+ +
+ +