fix: prefer select

This commit is contained in:
shinya
2025-07-16 18:38:05 +08:00
parent 1cd7ad3b7b
commit af2d257344
2 changed files with 49 additions and 2 deletions

33
public/manifest.json Normal file
View File

@@ -0,0 +1,33 @@
{
"name": "MoonTV",
"short_name": "MoonTV",
"description": "影视聚合",
"start_url": "/",
"scope": "/",
"display": "standalone",
"background_color": "#000000",
"apple-mobile-web-app-capable": "yes",
"apple-mobile-web-app-status-bar-style": "black",
"icons": [
{
"src": "/icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/icons/icon-256x256.png",
"sizes": "256x256",
"type": "image/png"
},
{
"src": "/icons/icon-384x384.png",
"sizes": "384x384",
"type": "image/png"
},
{
"src": "/icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}

View File

@@ -540,8 +540,23 @@ function PlayPageClient() {
}
let detailData: SearchResult = sourcesInfo[0];
// 指定源和id且无需优选
if (currentSource && currentId && !needPreferRef.current) {
const target = sourcesInfo.find(
(source) => source.source === currentSource && source.id === currentId
);
if (target) {
detailData = target;
} else {
setError('未找到匹配结果');
setLoading(false);
return;
}
}
// 未指定源和 id 或需要优选,且开启优选开关
if (
((!currentSource && !currentId) || needPreferRef.current) &&
(!currentSource || !currentId || needPreferRef.current) &&
optimizationEnabled
) {
setLoadingStage('preferring');
@@ -550,7 +565,6 @@ function PlayPageClient() {
detailData = await preferBestSource(sourcesInfo);
}
console.log(sourcesInfo);
console.log(detailData.source, detailData.id);
setNeedPrefer(false);