feat: /filter 资源站测速(响应秒) + 移除失效彗星资源 (fixed122)
Docker Build & Test / build (push) Canceled after 0s
Docker Build & Test / test (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/amd64) (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/arm/v7) (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/arm64) (push) Canceled after 0s
Build & Push Docker image / merge-images (push) Canceled after 0s
Docker Build & Test / build (push) Canceled after 0s
Docker Build & Test / test (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/amd64) (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/arm/v7) (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/arm64) (push) Canceled after 0s
Build & Push Docker image / merge-images (push) Canceled after 0s
This commit is contained in:
1 parent
40473955d8
commit
41fe467e63
4 files changed
+54
-12
No files matched your search
+2
-2
@@ -35,7 +35,7 @@ RUN find ./src -type f -name "route.ts" -print0 \
|
||||
ENV DOCKER_ENV=true
|
||||
# 海报走站内 /api/image-proxy(浏览器直连豆瓣图被拦导致全裂)
|
||||
ENV NEXT_PUBLIC_IMAGE_PROXY=/api/image-proxy
|
||||
ENV NEXT_PUBLIC_SITE_VERSION=fixed121
|
||||
ENV NEXT_PUBLIC_SITE_VERSION=fixed122
|
||||
ENV NEXT_PUBLIC_ENABLE_REGISTER=true
|
||||
|
||||
# For Docker builds, force dynamic rendering to read runtime environment variables.
|
||||
@@ -56,7 +56,7 @@ ENV HOSTNAME=0.0.0.0
|
||||
ENV PORT=3000
|
||||
ENV DOCKER_ENV=true
|
||||
ENV NEXT_PUBLIC_IMAGE_PROXY=/api/image-proxy
|
||||
ENV NEXT_PUBLIC_SITE_VERSION=fixed121
|
||||
ENV NEXT_PUBLIC_SITE_VERSION=fixed122
|
||||
ENV NEXT_PUBLIC_ENABLE_REGISTER=true
|
||||
|
||||
# 从构建器中复制 standalone 输出
|
||||
|
||||
@@ -6,11 +6,6 @@
|
||||
"name": "无尽资源",
|
||||
"is_adult": false
|
||||
},
|
||||
"hhzy": {
|
||||
"api": "https://hhzyapi.com/api.php/provide/vod",
|
||||
"name": "彗星资源",
|
||||
"is_adult": false
|
||||
},
|
||||
"bfzy": {
|
||||
"api": "https://bfzyapi.com/api.php/provide/vod",
|
||||
"name": "暴风资源",
|
||||
|
||||
@@ -259,6 +259,30 @@ export async function GET(request: NextRequest) {
|
||||
{ headers }
|
||||
);
|
||||
}
|
||||
if (action === 'probe') {
|
||||
const results = await Promise.all(
|
||||
sites.map(async (st) => {
|
||||
const base = st.api + (st.api.includes('?') ? '&' : '?');
|
||||
const t0 = Date.now();
|
||||
let ok = false;
|
||||
try {
|
||||
const ctrl = new AbortController();
|
||||
const tm = setTimeout(() => ctrl.abort(), 6000);
|
||||
const r = await fetch(base + 'ac=list', {
|
||||
headers: { 'User-Agent': UA, Accept: 'application/json' },
|
||||
signal: ctrl.signal,
|
||||
});
|
||||
clearTimeout(tm);
|
||||
if (r.ok) {
|
||||
const j = await r.json().catch(() => null);
|
||||
ok = !!(j && (Array.isArray(j.list) || Array.isArray(j.class)));
|
||||
}
|
||||
} catch {}
|
||||
return { key: st.key, name: st.name, ms: Date.now() - t0, ok };
|
||||
})
|
||||
);
|
||||
return NextResponse.json({ results }, { headers });
|
||||
}
|
||||
if (source === 'all') {
|
||||
if (action === 'classes') {
|
||||
return NextResponse.json(
|
||||
|
||||
+28
-5
@@ -127,6 +127,19 @@ function Pills({
|
||||
function FilterClient() {
|
||||
const searchParams = useSearchParams();
|
||||
const [sources, setSources] = useState<Src[]>([]);
|
||||
const runProbe = async () => {
|
||||
setProbing(true);
|
||||
try {
|
||||
const r = await fetch('/api/filter?action=probe');
|
||||
const j = await r.json().catch(() => null);
|
||||
const map: Record<string, { ms: number; ok: boolean }> = {};
|
||||
(j?.results || []).forEach((x: any) => { map[x.key] = { ms: x.ms, ok: x.ok }; });
|
||||
setProbe(map);
|
||||
} catch { setErr('测速失败'); }
|
||||
finally { setProbing(false); }
|
||||
};
|
||||
const [probe, setProbe] = useState<Record<string, { ms: number; ok: boolean }>>({});
|
||||
const [probing, setProbing] = useState(false);
|
||||
const [source, setSource] = useState('all');
|
||||
const [classes, setClasses] = useState<Cls[]>([]);
|
||||
const [cat, setCat] = useState(() => searchParams.get('t') || searchParams.get('cat') || '');
|
||||
@@ -271,12 +284,22 @@ function FilterClient() {
|
||||
className='px-3 py-1.5 text-xs sm:text-sm rounded-full bg-gray-200/60 dark:bg-gray-700/60 text-gray-700 dark:text-gray-300 max-w-full'
|
||||
>
|
||||
<option value='all'>全部资源站</option>
|
||||
{sources.map((s) => (
|
||||
<option key={s.key} value={s.key}>
|
||||
{s.name}
|
||||
</option>
|
||||
))}
|
||||
{sources
|
||||
.filter((s) => !probe[s.key] || probe[s.key].ok)
|
||||
.map((s) => (
|
||||
<option key={s.key} value={s.key}>
|
||||
{s.name}
|
||||
{probe[s.key] ? `(${(probe[s.key].ms / 1000).toFixed(2)}s)` : ''}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<button
|
||||
onClick={runProbe}
|
||||
disabled={probing}
|
||||
className='px-2.5 py-1.5 text-xs rounded-full bg-blue-500/90 text-white disabled:opacity-50'
|
||||
>
|
||||
{probing ? '测速中…' : '测速'}
|
||||
</button>
|
||||
</div>
|
||||
<Pills
|
||||
label='分类'
|
||||
|
||||
Reference in new issue
Block a user