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
Release / release (push) Canceled after 0s
Release / docker (push) Canceled after 0s
26 lines
954 B
TypeScript
26 lines
954 B
TypeScript
'use client';
|
|
|
|
// 首次访问公网入口:若用户支持 IPv6,则跳转到 tv6 线路选择页让用户选择
|
|
import { useEffect } from 'react';
|
|
|
|
export default function Ipv6FirstVisitGate() {
|
|
useEffect(() => {
|
|
try {
|
|
if (location.hostname !== 'tv.88531.cn') return;
|
|
if (/(^|;\s*)__v6dest=/.test(document.cookie)) return;
|
|
if (localStorage.getItem('__v6dest')) return;
|
|
// 探测 IPv6 可达性,可达才跳转
|
|
const ctrl = new AbortController();
|
|
const t = setTimeout(() => ctrl.abort(), 1500);
|
|
fetch('https://tv6.88531.cn:4443/api/license-config?_=', { mode: 'no-cors', signal: ctrl.signal })
|
|
.then(() => {
|
|
clearTimeout(t);
|
|
sessionStorage.setItem('__v6back', location.pathname + location.search + location.hash);
|
|
location.replace('https://tv6.88531.cn:4443/ipv6');
|
|
})
|
|
.catch(() => { clearTimeout(t); });
|
|
} catch {}
|
|
}, []);
|
|
return null;
|
|
}
|