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
@@ -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(
|
||||
|
||||
Reference in new issue
Block a user