私人影库增加扫描模式

This commit is contained in:
mtvpls
2026-01-01 20:57:44 +08:00
parent 42b11c3679
commit a698c6b493
4 changed files with 62 additions and 18 deletions
+22
View File
@@ -2766,6 +2766,7 @@ const OpenListConfigComponent = ({
const [rootPath, setRootPath] = useState('/');
const [offlineDownloadPath, setOfflineDownloadPath] = useState('/');
const [scanInterval, setScanInterval] = useState(0);
const [scanMode, setScanMode] = useState<'torrent' | 'name' | 'hybrid'>('hybrid');
const [videos, setVideos] = useState<any[]>([]);
const [refreshing, setRefreshing] = useState(false);
const [scanProgress, setScanProgress] = useState<{
@@ -2785,6 +2786,7 @@ const OpenListConfigComponent = ({
setRootPath(config.OpenListConfig.RootPath || '/');
setOfflineDownloadPath(config.OpenListConfig.OfflineDownloadPath || '/');
setScanInterval(config.OpenListConfig.ScanInterval || 0);
setScanMode(config.OpenListConfig.ScanMode || 'hybrid');
}
}, [config]);
@@ -2825,6 +2827,7 @@ const OpenListConfigComponent = ({
RootPath: rootPath,
OfflineDownloadPath: offlineDownloadPath,
ScanInterval: scanInterval,
ScanMode: scanMode,
}),
});
@@ -3151,6 +3154,25 @@ const OpenListConfigComponent = ({
</p>
</div>
<div>
<label className='block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2'>
</label>
<select
value={scanMode}
onChange={(e) => setScanMode(e.target.value as 'torrent' | 'name' | 'hybrid')}
disabled={!enabled}
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'
>
<option value='hybrid'></option>
<option value='torrent'></option>
<option value='name'></option>
</select>
<p className='mt-1 text-xs text-gray-500 dark:text-gray-400'>
</p>
</div>
<div className='flex gap-3'>
<button
onClick={handleCheckConnectivity}
+3 -1
View File
@@ -26,7 +26,7 @@ export async function POST(request: NextRequest) {
try {
const body = await request.json();
const { action, Enabled, URL, Username, Password, RootPath, OfflineDownloadPath, ScanInterval } = body;
const { action, Enabled, URL, Username, Password, RootPath, OfflineDownloadPath, ScanInterval, ScanMode } = body;
const authInfo = getAuthInfoFromCookie(request);
if (!authInfo || !authInfo.username) {
@@ -58,6 +58,7 @@ export async function POST(request: NextRequest) {
LastRefreshTime: adminConfig.OpenListConfig?.LastRefreshTime,
ResourceCount: adminConfig.OpenListConfig?.ResourceCount,
ScanInterval: 0,
ScanMode: ScanMode || 'hybrid',
};
await db.saveAdminConfig(adminConfig);
@@ -108,6 +109,7 @@ export async function POST(request: NextRequest) {
LastRefreshTime: adminConfig.OpenListConfig?.LastRefreshTime,
ResourceCount: adminConfig.OpenListConfig?.ResourceCount,
ScanInterval: scanInterval,
ScanMode: ScanMode || 'hybrid',
};
await db.saveAdminConfig(adminConfig);