Compare commits
10
Commits
v-fixed96
...
v-fixed117
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
18953ebc9a | ||
|
|
566ee297d9 | ||
|
|
b734661e47 | ||
|
|
9dbe231c79 | ||
|
|
2b3582b4ff | ||
|
|
c29f5395ac | ||
|
|
d5443d97c9 | ||
|
|
2c8a68b064 | ||
|
|
9ffb113ca5 | ||
|
|
e34ec79d5a |
No files matched your search
+7
-2
@@ -33,7 +33,10 @@ COPY . .
|
|||||||
RUN find ./src -type f -name "route.ts" -print0 \
|
RUN find ./src -type f -name "route.ts" -print0 \
|
||||||
| xargs -0 sed -i "s/export const runtime = 'edge';/export const runtime = 'nodejs';/g"
|
| xargs -0 sed -i "s/export const runtime = 'edge';/export const runtime = 'nodejs';/g"
|
||||||
ENV DOCKER_ENV=true
|
ENV DOCKER_ENV=true
|
||||||
ENV NEXT_PUBLIC_SITE_VERSION=fixed96
|
# 海报走站内 /api/image-proxy(浏览器直连豆瓣图被拦导致全裂)
|
||||||
|
ENV NEXT_PUBLIC_IMAGE_PROXY=/api/image-proxy
|
||||||
|
ENV NEXT_PUBLIC_SITE_VERSION=fixed117
|
||||||
|
ENV NEXT_PUBLIC_ENABLE_REGISTER=true
|
||||||
|
|
||||||
# For Docker builds, force dynamic rendering to read runtime environment variables.
|
# For Docker builds, force dynamic rendering to read runtime environment variables.
|
||||||
RUN sed -i "/const inter = Inter({ subsets: \['latin'] });/a export const dynamic = 'force-dynamic';" src/app/layout.tsx
|
RUN sed -i "/const inter = Inter({ subsets: \['latin'] });/a export const dynamic = 'force-dynamic';" src/app/layout.tsx
|
||||||
@@ -52,7 +55,9 @@ ENV NODE_ENV=production
|
|||||||
ENV HOSTNAME=0.0.0.0
|
ENV HOSTNAME=0.0.0.0
|
||||||
ENV PORT=3000
|
ENV PORT=3000
|
||||||
ENV DOCKER_ENV=true
|
ENV DOCKER_ENV=true
|
||||||
ENV NEXT_PUBLIC_SITE_VERSION=fixed96
|
ENV NEXT_PUBLIC_IMAGE_PROXY=/api/image-proxy
|
||||||
|
ENV NEXT_PUBLIC_SITE_VERSION=fixed117
|
||||||
|
ENV NEXT_PUBLIC_ENABLE_REGISTER=true
|
||||||
|
|
||||||
# 从构建器中复制 standalone 输出
|
# 从构建器中复制 standalone 输出
|
||||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||||
|
|||||||
@@ -242,9 +242,16 @@ docker compose -f docker-compose.redis.yml down
|
|||||||
## 🐳 Docker 镜像
|
## 🐳 Docker 镜像
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker pull gitea.88531.cn/jinghui/katelyatv:latest
|
# 公网可拉(匿名)
|
||||||
|
docker pull gitea.88531.cn/jinghui/katelyatv:latest # 固定版本
|
||||||
|
docker pull gitea.88531.cn/jinghui/katelyatv:fixed96
|
||||||
|
|
||||||
|
# 腾讯云 TCR(东京,公网匿名)
|
||||||
|
docker pull jpccr.ccs.tencentyun.com/jinghui/katelyatv:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
|
当前版本:**v-fixed96**
|
||||||
|
|
||||||
## 🔗 源码
|
## 🔗 源码
|
||||||
|
|
||||||
- Gitea:https://gitea.88531.cn/jinghui/katelyatv
|
- Gitea:https://gitea.88531.cn/jinghui/katelyatv
|
||||||
|
|||||||
+16
-16
@@ -1,30 +1,30 @@
|
|||||||
{
|
{
|
||||||
"cache_time": 7200,
|
"cache_time": 7200,
|
||||||
"api_site": {
|
"api_site": {
|
||||||
"hnzy": {
|
"wjzy": {
|
||||||
"api": "https://hnzyapi.com/api.php/provide/vod",
|
"api": "https://api.wujinapi.me/api.php/provide/vod",
|
||||||
"name": "火鸟资源",
|
"name": "无尽资源",
|
||||||
"is_adult": false
|
"is_adult": false
|
||||||
},
|
},
|
||||||
"lzzy": {
|
"hhzy": {
|
||||||
"api": "https://api.liangzizy.com/inc/apijson_vod.php",
|
"api": "https://hhzyapi.com/api.php/provide/vod",
|
||||||
"name": "量子资源",
|
"name": "彗星资源",
|
||||||
"is_adult": false
|
"is_adult": false
|
||||||
},
|
},
|
||||||
"ffzy": {
|
"bfzy": {
|
||||||
"api": "https://ffzyapi.com/api.php/provide/vod",
|
"api": "https://bfzyapi.com/api.php/provide/vod",
|
||||||
"name": "非凡资源",
|
"name": "暴风资源",
|
||||||
"is_adult": false
|
"is_adult": false
|
||||||
},
|
},
|
||||||
"ykzy": {
|
"jyzy": {
|
||||||
"api": "https://api.yongjiuzy.cc/provide/vod",
|
"api": "https://jyzyapi.com/api.php/provide/vod",
|
||||||
"name": "永久资源",
|
"name": "极速资源",
|
||||||
"is_adult": false
|
"is_adult": false
|
||||||
},
|
},
|
||||||
"bdzy": {
|
"bz360": {
|
||||||
"api": "https://api.1080zyku.com/inc/apijson_vod.php",
|
"api": "https://360zy.com/api.php/provide/vod",
|
||||||
"name": "百度资源",
|
"name": "360资源",
|
||||||
"is_adult": false
|
"is_adult": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,10 +152,21 @@ async function aggregateAll(sources: SrcCfg[], sp: URLSearchParams) {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 进程内响应缓存:相同查询 60s 内直接返回,避免每次刷新都重新聚合上游(最新港剧等栏目秒开)
|
||||||
|
const respCache = new Map<string, [number, any]>();
|
||||||
export async function GET(request: NextRequest) {
|
export async function GET(request: NextRequest) {
|
||||||
const { searchParams } = new URL(request.url);
|
const { searchParams } = new URL(request.url);
|
||||||
|
const cacheKey = searchParams.toString();
|
||||||
|
const now = Date.now();
|
||||||
|
const c = respCache.get(cacheKey);
|
||||||
|
if (c && now - c[0] < 60000) {
|
||||||
|
return NextResponse.json(c[1], { headers: { 'Access-Control-Allow-Origin': '*', 'Cache-Control': 'public, max-age=60', 'X-Cache': 'HIT' } });
|
||||||
|
}
|
||||||
const config = await getConfig();
|
const config = await getConfig();
|
||||||
const sourceConfigs: SrcCfg[] = (config.SourceConfig || []).filter((s: any) => !s.disabled);
|
const sourceConfigs: SrcCfg[] = (config.SourceConfig || []).filter((s: any) => !s.disabled);
|
||||||
const r = await aggregateAll(sourceConfigs, searchParams);
|
const r = await aggregateAll(sourceConfigs, searchParams);
|
||||||
|
respCache.set(cacheKey, [now, r]);
|
||||||
|
// 防止缓存无限增长:超过 200 条清空
|
||||||
|
if (respCache.size > 200) respCache.clear();
|
||||||
return NextResponse.json(r, { headers: { 'Access-Control-Allow-Origin': '*', 'Cache-Control': 'public, max-age=60' } });
|
return NextResponse.json(r, { headers: { 'Access-Control-Allow-Origin': '*', 'Cache-Control': 'public, max-age=60' } });
|
||||||
}
|
}
|
||||||
@@ -200,7 +200,7 @@ function FilterClient() {
|
|||||||
}
|
}
|
||||||
const arr: Item[] = Array.isArray(j?.list) ? j.list : [];
|
const arr: Item[] = Array.isArray(j?.list) ? j.list : [];
|
||||||
setItems((prev) => {
|
setItems((prev) => {
|
||||||
const base = reset ? [] : [...prev, ...arr];
|
const base = reset ? [...arr] : [...prev, ...arr];
|
||||||
const seen = new Set<string>();
|
const seen = new Set<string>();
|
||||||
return base.filter((x) => {
|
return base.filter((x) => {
|
||||||
const k = x.title + '|' + x.year;
|
const k = x.title + '|' + x.year;
|
||||||
@@ -231,6 +231,12 @@ function FilterClient() {
|
|||||||
load(1, true);
|
load(1, true);
|
||||||
}, [source, cat, area, year]);
|
}, [source, cat, area, year]);
|
||||||
|
|
||||||
|
// 兜底:首次挂载确保加载一次(避免条件 effect 漏触发)
|
||||||
|
useEffect(() => {
|
||||||
|
load(1, true);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, []);
|
||||||
|
|
||||||
// 分页:上一页/下一页
|
// 分页:上一页/下一页
|
||||||
const goPage = (pg: number) => {
|
const goPage = (pg: number) => {
|
||||||
if (pg < 1) return;
|
if (pg < 1) return;
|
||||||
|
|||||||
+117
-34
@@ -8,15 +8,21 @@ const H = {
|
|||||||
v6: 'https://tv6.88531.cn:4443',
|
v6: 'https://tv6.88531.cn:4443',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 第一步:纯 IPv6 端点(仅 AAAA 记录),用于判断"客户端自己是否有 IPv6 出口"
|
||||||
|
const IPV6_TEST = 'https://api6.ipify.org?format=json';
|
||||||
|
// 第二步:我们自己的 IPv6 入口
|
||||||
const URLS = [
|
const URLS = [
|
||||||
'https://tv6.88531.cn:4443/api/license-config?_=',
|
'https://tv6.88531.cn:4443/api/license-config?_=',
|
||||||
'https://tv6.88531.cn/api/license-config?_=',
|
'https://tv6.88531.cn/api/license-config?_=',
|
||||||
];
|
];
|
||||||
|
|
||||||
type ProbeState = 'checking' | 'ok' | 'fail';
|
type ProbeState = 'checking' | 'ok' | 'fail';
|
||||||
|
type FailReason = 'no-ipv6' | 'entry' | 'unknown';
|
||||||
|
|
||||||
export default function IPv6Page() {
|
export default function IPv6Page() {
|
||||||
const [state, setState] = useState<ProbeState>('checking');
|
const [state, setState] = useState<ProbeState>('checking');
|
||||||
|
const [reason, setReason] = useState<FailReason>('unknown');
|
||||||
|
const [detail, setDetail] = useState('');
|
||||||
const [back, setBack] = useState('/');
|
const [back, setBack] = useState('/');
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -35,6 +41,8 @@ export default function IPv6Page() {
|
|||||||
const cached = JSON.parse(localStorage.getItem('__v6probe') || 'null');
|
const cached = JSON.parse(localStorage.getItem('__v6probe') || 'null');
|
||||||
if (cached && Date.now() - cached.t < 120000) {
|
if (cached && Date.now() - cached.t < 120000) {
|
||||||
setState(cached.ok ? 'ok' : 'fail');
|
setState(cached.ok ? 'ok' : 'fail');
|
||||||
|
setReason(cached.reason || 'unknown');
|
||||||
|
setDetail(cached.detail || '');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (e) { // ignore
|
} catch (e) { // ignore
|
||||||
@@ -42,51 +50,81 @@ export default function IPv6Page() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let cancelled = false;
|
let cancelled = false;
|
||||||
|
|
||||||
|
const fetchJson = (url: string, timeout = 5000) => {
|
||||||
|
const c = new AbortController();
|
||||||
|
const ti = setTimeout(() => c.abort(), timeout);
|
||||||
|
return fetch(url, { mode: 'cors', signal: c.signal, cache: 'no-store', credentials: 'omit' })
|
||||||
|
.then((r) => { clearTimeout(ti); return r.json(); })
|
||||||
|
.catch((e) => { clearTimeout(ti); throw e; });
|
||||||
|
};
|
||||||
|
|
||||||
|
const fail = (r: FailReason, d: string) => {
|
||||||
|
if (cancelled) return;
|
||||||
|
try { localStorage.setItem('__v6probe', JSON.stringify({ t: Date.now(), ok: false, reason: r, detail: d })); } catch (e) { /* ignore */ }
|
||||||
|
setReason(r);
|
||||||
|
setDetail(d);
|
||||||
|
setState('fail');
|
||||||
|
};
|
||||||
|
|
||||||
|
// 单一检测点:我们自己的 v6 入口(纯 IPv6,AAAA 记录)
|
||||||
|
// 能通 ⇒ 客户端有 IPv6 出口且 v6 入口可达;不通 ⇒ 其中一方有问题
|
||||||
let i = 0;
|
let i = 0;
|
||||||
const probe = () => {
|
const probeEntry = () => {
|
||||||
if (i >= URLS.length) {
|
if (i >= URLS.length) {
|
||||||
if (!cancelled) {
|
fail('entry', 'v6 入口 ' + URLS.join(' / ') + ' 全部失败:客户端没有可用的 IPv6 出口,或服务端 v6 入口被防火墙/运营商拦截。');
|
||||||
try { localStorage.setItem('__v6probe', JSON.stringify({ t: Date.now(), ok: false })); } catch (e) { // ignore
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
setState('fail');
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const c = new AbortController();
|
fetchJson(URLS[i] + Date.now(), 5000)
|
||||||
const ti = setTimeout(() => c.abort(), 5000);
|
.then((jj) => {
|
||||||
fetch(URLS[i] + Date.now(), { mode: 'cors', signal: c.signal, cache: 'no-store', credentials: 'omit' })
|
|
||||||
.then((r) => r.json())
|
|
||||||
.then((j) => {
|
|
||||||
clearTimeout(ti);
|
|
||||||
if (cancelled) return;
|
if (cancelled) return;
|
||||||
if (j && j.code === 200 && j.data) {
|
if (jj && jj.code === 200 && jj.data) {
|
||||||
try { localStorage.setItem('__v6probe', JSON.stringify({ t: Date.now(), ok: true })); } catch (e) { // ignore
|
try { localStorage.setItem('__v6probe', JSON.stringify({ t: Date.now(), ok: true })); } catch (e) { /* ignore */ }
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
setState('ok');
|
setState('ok');
|
||||||
} else {
|
} else {
|
||||||
i++;
|
i++;
|
||||||
probe();
|
probeEntry();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch((e) => {
|
||||||
clearTimeout(ti);
|
|
||||||
if (cancelled) return;
|
if (cancelled) return;
|
||||||
i++;
|
i++;
|
||||||
probe();
|
probeEntry();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
probe();
|
probeEntry();
|
||||||
|
|
||||||
return () => { cancelled = true; };
|
return () => { cancelled = true; };
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const choose = (which: 'v4' | 'v6') => {
|
const choose = (which: 'v4' | 'v6') => {
|
||||||
const dest = which === 'v4' ? H.v4 : H.v6;
|
const dest = which === 'v4' ? H.v4 : H.v6;
|
||||||
|
let targetBack = back;
|
||||||
|
try {
|
||||||
|
const s = sessionStorage.getItem('__v6back');
|
||||||
|
if (s) { targetBack = s; sessionStorage.removeItem('__v6back'); }
|
||||||
|
} catch (e) { /* ignore */ }
|
||||||
try { localStorage.setItem('__v6dest', which); } catch (e) { // ignore
|
try { localStorage.setItem('__v6dest', which); } catch (e) { // ignore
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
window.location.href = dest + back + window.location.search + window.location.hash;
|
document.cookie = `__v6dest=${which}; path=/; max-age=31536000; samesite=lax`;
|
||||||
|
// 去掉 search 里的 back 参数,避免透传到目标地址
|
||||||
|
const qs = new URLSearchParams(window.location.search);
|
||||||
|
qs.delete('back');
|
||||||
|
const searchStr = qs.toString() ? '?' + qs.toString() : '';
|
||||||
|
const u = new URL(dest);
|
||||||
|
const m = /^([^?#]*)(\?[^#]*)?(#.*)?$/.exec(targetBack) || [];
|
||||||
|
u.pathname = m[1] || '/';
|
||||||
|
if (m[2]) {
|
||||||
|
const q2 = new URLSearchParams(m[2].slice(1));
|
||||||
|
q2.forEach((v, k) => { if (!u.searchParams.has(k)) u.searchParams.set(k, v); });
|
||||||
|
}
|
||||||
|
if (searchStr) {
|
||||||
|
const q3 = new URLSearchParams(searchStr.slice(1));
|
||||||
|
q3.forEach((v, k) => { if (!u.searchParams.has(k)) u.searchParams.set(k, v); });
|
||||||
|
}
|
||||||
|
if (m[3]) u.hash = m[3];
|
||||||
|
window.location.href = u.toString();
|
||||||
};
|
};
|
||||||
|
|
||||||
const reprobe = () => {
|
const reprobe = () => {
|
||||||
@@ -104,7 +142,24 @@ export default function IPv6Page() {
|
|||||||
try { localStorage.setItem('__v6dest', 'v6'); } catch (e) { // ignore
|
try { localStorage.setItem('__v6dest', 'v6'); } catch (e) { // ignore
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
window.location.href = H.v6 + back + window.location.search + window.location.hash;
|
document.cookie = '__v6dest=v6; path=/; max-age=31536000; samesite=lax';
|
||||||
|
let targetBack = back;
|
||||||
|
try {
|
||||||
|
const s = sessionStorage.getItem('__v6back');
|
||||||
|
if (s) { targetBack = s; sessionStorage.removeItem('__v6back'); }
|
||||||
|
} catch (e) { /* ignore */ }
|
||||||
|
const u = new URL(H.v6);
|
||||||
|
const m = /^([^?#]*)(\?[^#]*)?(#.*)?$/.exec(targetBack) || [];
|
||||||
|
u.pathname = m[1] || '/';
|
||||||
|
if (m[2]) {
|
||||||
|
const q2 = new URLSearchParams(m[2].slice(1));
|
||||||
|
q2.forEach((v, k) => { if (!u.searchParams.has(k)) u.searchParams.set(k, v); });
|
||||||
|
}
|
||||||
|
const qs = new URLSearchParams(window.location.search);
|
||||||
|
qs.delete('back');
|
||||||
|
qs.forEach((v, k) => { if (!u.searchParams.has(k)) u.searchParams.set(k, v); });
|
||||||
|
if (m[3]) u.hash = m[3];
|
||||||
|
window.location.href = u.toString();
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -125,14 +180,35 @@ export default function IPv6Page() {
|
|||||||
<p style={{ color: 'rgba(255,255,255,.5)', marginBottom: 32 }}>选择访问线路</p>
|
<p style={{ color: 'rgba(255,255,255,.5)', marginBottom: 32 }}>选择访问线路</p>
|
||||||
|
|
||||||
{state === 'checking' && (
|
{state === 'checking' && (
|
||||||
<p style={{ color: 'rgba(255,255,255,.45)' }}>正在检测 IPv6…</p>
|
<p style={{ color: 'rgba(255,255,255,.45)' }}>正在检测 IPv6(客户端出口 + v6 入口)…</p>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{state === 'ok' && (
|
{state === 'ok' && (
|
||||||
<div style={{ display: 'flex', gap: 16, flexWrap: 'wrap', justifyContent: 'center' }}>
|
<>
|
||||||
<button onClick={() => choose('v4')} style={btnStyle}>IPv4 线路</button>
|
<div style={{
|
||||||
<button onClick={() => choose('v6')} style={btnStyle}>IPv6 线路</button>
|
background: 'rgba(80,220,120,.10)',
|
||||||
</div>
|
border: '1px solid rgba(80,220,120,.3)',
|
||||||
|
borderRadius: 12,
|
||||||
|
padding: '14px 20px',
|
||||||
|
maxWidth: 520,
|
||||||
|
textAlign: 'center',
|
||||||
|
marginBottom: 24,
|
||||||
|
}}>
|
||||||
|
<p style={{ margin: 0, fontWeight: 600, color: '#7ef0a0' }}>✅ 检测到你的网络支持 IPv6</p>
|
||||||
|
<p style={{ margin: '8px 0 0', color: 'rgba(255,255,255,.6)', fontSize: 13, lineHeight: 1.5 }}>
|
||||||
|
推荐选择「IPv6 线路」,观影更流畅;如遇 IPv6 无法访问再切回 IPv4。
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div style={{ display: 'flex', gap: 16, flexWrap: 'wrap', justifyContent: 'center' }}>
|
||||||
|
<button onClick={() => choose('v6')} style={{
|
||||||
|
...btnStyle,
|
||||||
|
background: 'rgba(80,220,120,.16)',
|
||||||
|
border: '1px solid rgba(80,220,120,.55)',
|
||||||
|
fontWeight: 600,
|
||||||
|
}}>IPv6 线路(推荐)</button>
|
||||||
|
<button onClick={() => choose('v4')} style={btnStyle}>IPv4 线路</button>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{state === 'fail' && (
|
{state === 'fail' && (
|
||||||
@@ -142,13 +218,20 @@ export default function IPv6Page() {
|
|||||||
border: '1px solid rgba(255,180,0,.3)',
|
border: '1px solid rgba(255,180,0,.3)',
|
||||||
borderRadius: 12,
|
borderRadius: 12,
|
||||||
padding: '16px 20px',
|
padding: '16px 20px',
|
||||||
maxWidth: 480,
|
maxWidth: 520,
|
||||||
textAlign: 'center',
|
textAlign: 'left',
|
||||||
marginBottom: 24,
|
marginBottom: 24,
|
||||||
}}>
|
}}>
|
||||||
<p style={{ margin: 0, fontWeight: 600 }}>⚠️ 检测到你的网络不支持 IPv6 访问</p>
|
<p style={{ margin: 0, fontWeight: 600 }}>
|
||||||
<p style={{ margin: '8px 0 0', color: 'rgba(255,255,255,.6)', fontSize: 14 }}>
|
{reason === 'no-ipv6' ? '⚠️ 你的浏览器/网络没有可用的 IPv6 出口' : '⚠️ 你的网络支持 IPv6,但我们的 v6 入口不可达'}
|
||||||
已隐藏 IPv6 线路。请使用 IPv4 线路访问。
|
</p>
|
||||||
|
<p style={{ margin: '8px 0 0', color: 'rgba(255,255,255,.6)', fontSize: 13, lineHeight: 1.5, wordBreak: 'break-word' }}>
|
||||||
|
{detail}
|
||||||
|
</p>
|
||||||
|
<p style={{ margin: '10px 0 0', color: 'rgba(255,255,255,.45)', fontSize: 12 }}>
|
||||||
|
{reason === 'no-ipv6'
|
||||||
|
? '常见原因:系统代理/VPN 只走 IPv4;路由器未分配 IPv6;浏览器禁用 IPv6。'
|
||||||
|
: '常见原因:路由器/光猫 IPv6 防火墙拦截入向 4443;运营商阻断;或服务端 IPv6 地址已变更。'}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', justifyContent: 'center' }}>
|
<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', justifyContent: 'center' }}>
|
||||||
|
|||||||
+4
-2
@@ -7,13 +7,14 @@ import 'sweetalert2/dist/sweetalert2.min.css';
|
|||||||
import { getConfig } from '@/lib/config';
|
import { getConfig } from '@/lib/config';
|
||||||
|
|
||||||
import { SiteProvider } from '../components/SiteProvider';
|
import { SiteProvider } from '../components/SiteProvider';
|
||||||
|
import Ipv6FirstVisitGate from '../components/Ipv6FirstVisitGate';
|
||||||
import { ThemeProvider } from '../components/ThemeProvider';
|
import { ThemeProvider } from '../components/ThemeProvider';
|
||||||
|
|
||||||
const inter = Inter({ subsets: ['latin'] });
|
const inter = Inter({ subsets: ['latin'] });
|
||||||
|
|
||||||
// 动态生成 metadata,支持配置更新后的标题变化
|
// 动态生成 metadata,支持配置更新后的标题变化
|
||||||
export async function generateMetadata(): Promise<Metadata> {
|
export async function generateMetadata(): Promise<Metadata> {
|
||||||
let siteName = process.env.SITE_NAME || 'KatelyaTV';
|
let siteName = process.env.SITE_NAME || '米视TV';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 只有在非 d1 和 upstash 存储类型时才尝试获取配置
|
// 只有在非 d1 和 upstash 存储类型时才尝试获取配置
|
||||||
@@ -57,7 +58,7 @@ export default async function RootLayout({
|
|||||||
}: {
|
}: {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}) {
|
}) {
|
||||||
let siteName = process.env.SITE_NAME || 'KatelyaTV';
|
let siteName = process.env.SITE_NAME || '米视TV';
|
||||||
let announcement =
|
let announcement =
|
||||||
process.env.ANNOUNCEMENT ||
|
process.env.ANNOUNCEMENT ||
|
||||||
'本网站仅提供影视信息搜索服务,所有内容均来自第三方网站。本站不存储任何视频资源,不对任何内容的准确性、合法性、完整性负责。Link Me TG:@katelya77';
|
'本网站仅提供影视信息搜索服务,所有内容均来自第三方网站。本站不存储任何视频资源,不对任何内容的准确性、合法性、完整性负责。Link Me TG:@katelya77';
|
||||||
@@ -114,6 +115,7 @@ export default async function RootLayout({
|
|||||||
disableTransitionOnChange
|
disableTransitionOnChange
|
||||||
>
|
>
|
||||||
<SiteProvider siteName={siteName} announcement={announcement}>
|
<SiteProvider siteName={siteName} announcement={announcement}>
|
||||||
|
<Ipv6FirstVisitGate />
|
||||||
{children}
|
{children}
|
||||||
</SiteProvider>
|
</SiteProvider>
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
|
|||||||
+7
-5
@@ -20,11 +20,12 @@ import { DoubanItem } from '@/lib/types';
|
|||||||
import CapsuleSwitch from '@/components/CapsuleSwitch';
|
import CapsuleSwitch from '@/components/CapsuleSwitch';
|
||||||
import ContinueWatching from '@/components/ContinueWatching';
|
import ContinueWatching from '@/components/ContinueWatching';
|
||||||
import HkDramaRow from '@/components/HkDramaRow';
|
import HkDramaRow from '@/components/HkDramaRow';
|
||||||
|
import LineRecommender from '@/components/LineRecommender';
|
||||||
import PageLayout from '@/components/PageLayout';
|
import PageLayout from '@/components/PageLayout';
|
||||||
import PaginatedRow from '@/components/PaginatedRow';
|
import PaginatedRow from '@/components/PaginatedRow';
|
||||||
import VideoCard from '@/components/VideoCard';
|
import VideoCard from '@/components/VideoCard';
|
||||||
|
|
||||||
// 主内容区大型 KatelyaTV Logo 组件
|
// 主内容区大型 米视TV Logo 组件
|
||||||
const MainKatelyaLogo = () => {
|
const MainKatelyaLogo = () => {
|
||||||
return (
|
return (
|
||||||
<div className='main-logo-container'>
|
<div className='main-logo-container'>
|
||||||
@@ -32,7 +33,7 @@ const MainKatelyaLogo = () => {
|
|||||||
<div className='logo-background-glow'></div>
|
<div className='logo-background-glow'></div>
|
||||||
|
|
||||||
{/* 主 Logo */}
|
{/* 主 Logo */}
|
||||||
<div className='main-katelya-logo'>KatelyaTV</div>
|
<div className='main-katelya-logo'>米视TV</div>
|
||||||
|
|
||||||
{/* 副标题 */}
|
{/* 副标题 */}
|
||||||
<div className='mt-3 text-center'>
|
<div className='mt-3 text-center'>
|
||||||
@@ -52,7 +53,7 @@ const MainKatelyaLogo = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
// KatelyaTV 底部 Logo 组件
|
// 米视TV 底部 Logo 组件
|
||||||
const BottomKatelyaLogo = () => {
|
const BottomKatelyaLogo = () => {
|
||||||
return (
|
return (
|
||||||
<div className='bottom-logo-container'>
|
<div className='bottom-logo-container'>
|
||||||
@@ -65,9 +66,9 @@ const BottomKatelyaLogo = () => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='text-center'>
|
<div className='text-center'>
|
||||||
<div className='bottom-logo'>KatelyaTV</div>
|
<div className='bottom-logo'>米视TV</div>
|
||||||
<div className='mt-2 text-sm text-gray-500 dark:text-gray-400 opacity-75'>
|
<div className='mt-2 text-sm text-gray-500 dark:text-gray-400 opacity-75'>
|
||||||
Powered by KatelyaTV Core
|
Powered by 米视TV Core
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -540,6 +541,7 @@ export default function Home() {
|
|||||||
return (
|
return (
|
||||||
<Suspense>
|
<Suspense>
|
||||||
<HomeClient />
|
<HomeClient />
|
||||||
|
<LineRecommender />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,7 @@ export default function Ipv6Button({ forceShow = false, compact = false, light =
|
|||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
try { sessionStorage.setItem('__v6back', location.pathname + location.search + location.hash); } catch {}
|
||||||
location.href = '/ipv6';
|
location.href = '/ipv6';
|
||||||
}}
|
}}
|
||||||
title='切换 IPv4 / IPv6 线路'
|
title='切换 IPv4 / IPv6 线路'
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
'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;
|
||||||
|
}
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
|
const V6 = 'https://tv6.88531.cn:4443';
|
||||||
|
const PROBE_URL = 'https://tv6.88531.cn:4443/api/license-config?_=';
|
||||||
|
|
||||||
|
// 首次访问的线路推荐:不阻塞数据加载,检测到支持 IPv6 时浮层提示用户可切换
|
||||||
|
export default function LineRecommender() {
|
||||||
|
const [show, setShow] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
try {
|
||||||
|
// 已记住线路 / 不在 v6 入口 / 已提示过 → 不再弹
|
||||||
|
if (window.location.hostname === 'tv6.88531.cn') return;
|
||||||
|
if (localStorage.getItem('__v6dest')) return;
|
||||||
|
if (localStorage.getItem('__v6hint')) return;
|
||||||
|
|
||||||
|
const cached = JSON.parse(localStorage.getItem('__v6probe') || 'null');
|
||||||
|
if (cached && Date.now() - cached.t < 120000) {
|
||||||
|
if (cached.ok) setShow(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const c = new AbortController();
|
||||||
|
const ti = setTimeout(() => c.abort(), 5000);
|
||||||
|
fetch(PROBE_URL + Date.now(), { mode: 'cors', signal: c.signal, cache: 'no-store', credentials: 'omit' })
|
||||||
|
.then((r) => { clearTimeout(ti); return r.json(); })
|
||||||
|
.then((jj) => {
|
||||||
|
const ok = !!(jj && jj.code === 200 && jj.data);
|
||||||
|
try { localStorage.setItem('__v6probe', JSON.stringify({ t: Date.now(), ok })); } catch (e) { /* ignore */ }
|
||||||
|
if (ok) setShow(true);
|
||||||
|
})
|
||||||
|
.catch(() => { clearTimeout(ti); });
|
||||||
|
} catch (e) { /* ignore */ }
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
if (!show) return null;
|
||||||
|
|
||||||
|
const dismiss = (pick?: 'v6' | 'v4') => {
|
||||||
|
try {
|
||||||
|
localStorage.setItem('__v6hint', '1');
|
||||||
|
if (pick === 'v6') {
|
||||||
|
localStorage.setItem('__v6dest', 'v6');
|
||||||
|
document.cookie = '__v6dest=v6; path=/; max-age=31536000; samesite=lax';
|
||||||
|
window.location.href = V6 + window.location.pathname + window.location.search;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (pick === 'v4') {
|
||||||
|
localStorage.setItem('__v6dest', 'v4');
|
||||||
|
document.cookie = '__v6dest=v4; path=/; max-age=31536000; samesite=lax';
|
||||||
|
}
|
||||||
|
} catch (e) { /* ignore */ }
|
||||||
|
setShow(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={{
|
||||||
|
position: 'fixed',
|
||||||
|
right: 16,
|
||||||
|
bottom: 16,
|
||||||
|
zIndex: 9999,
|
||||||
|
maxWidth: 340,
|
||||||
|
background: 'rgba(20,24,20,.96)',
|
||||||
|
border: '1px solid rgba(80,220,120,.45)',
|
||||||
|
borderRadius: 14,
|
||||||
|
padding: '14px 16px',
|
||||||
|
color: '#fff',
|
||||||
|
fontFamily: 'system-ui, -apple-system, sans-serif',
|
||||||
|
boxShadow: '0 8px 30px rgba(0,0,0,.45)',
|
||||||
|
}}>
|
||||||
|
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start', gap: 8 }}>
|
||||||
|
<p style={{ margin: 0, fontWeight: 600, color: '#7ef0a0', fontSize: 14 }}>
|
||||||
|
✅ 检测到你的网络支持 IPv6
|
||||||
|
</p>
|
||||||
|
<button onClick={() => dismiss()} aria-label='关闭' style={{
|
||||||
|
background: 'none', border: 'none', color: 'rgba(255,255,255,.5)',
|
||||||
|
fontSize: 16, cursor: 'pointer', lineHeight: 1, padding: 0,
|
||||||
|
}}>×</button>
|
||||||
|
</div>
|
||||||
|
<p style={{ margin: '8px 0 12px', color: 'rgba(255,255,255,.65)', fontSize: 13, lineHeight: 1.5 }}>
|
||||||
|
推荐切换到 IPv6 线路,观影更流畅。
|
||||||
|
</p>
|
||||||
|
<div style={{ display: 'flex', gap: 8 }}>
|
||||||
|
<button onClick={() => dismiss('v6')} style={{
|
||||||
|
flex: 1, padding: '8px 10px', borderRadius: 9,
|
||||||
|
border: '1px solid rgba(80,220,120,.55)', background: 'rgba(80,220,120,.18)',
|
||||||
|
color: '#fff', fontSize: 13, fontWeight: 600, cursor: 'pointer',
|
||||||
|
}}>切换 IPv6</button>
|
||||||
|
<button onClick={() => dismiss('v4')} style={{
|
||||||
|
flex: 1, padding: '8px 10px', borderRadius: 9,
|
||||||
|
border: '1px solid rgba(255,255,255,.18)', background: 'rgba(255,255,255,.06)',
|
||||||
|
color: 'rgba(255,255,255,.8)', fontSize: 13, cursor: 'pointer',
|
||||||
|
}}>保持 IPv4</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
+4
-4
@@ -205,7 +205,7 @@ async function initConfig() {
|
|||||||
}
|
}
|
||||||
adminConfig = {
|
adminConfig = {
|
||||||
SiteConfig: {
|
SiteConfig: {
|
||||||
SiteName: process.env.SITE_NAME || 'KatelyaTV',
|
SiteName: process.env.SITE_NAME || '米视TV',
|
||||||
Announcement:
|
Announcement:
|
||||||
process.env.ANNOUNCEMENT ||
|
process.env.ANNOUNCEMENT ||
|
||||||
'本网站仅提供影视信息搜索服务,所有内容均来自第三方网站。本站不存储任何视频资源,不对任何内容的准确性、合法性、完整性负责。',
|
'本网站仅提供影视信息搜索服务,所有内容均来自第三方网站。本站不存储任何视频资源,不对任何内容的准确性、合法性、完整性负责。',
|
||||||
@@ -245,7 +245,7 @@ async function initConfig() {
|
|||||||
// 本地存储直接使用文件配置
|
// 本地存储直接使用文件配置
|
||||||
cachedConfig = {
|
cachedConfig = {
|
||||||
SiteConfig: {
|
SiteConfig: {
|
||||||
SiteName: process.env.SITE_NAME || 'KatelyaTV',
|
SiteName: process.env.SITE_NAME || '米视TV',
|
||||||
Announcement:
|
Announcement:
|
||||||
process.env.ANNOUNCEMENT ||
|
process.env.ANNOUNCEMENT ||
|
||||||
'本网站仅提供影视信息搜索服务,所有内容均来自第三方网站。本站不存储任何视频资源,不对任何内容的准确性、合法性、完整性负责。',
|
'本网站仅提供影视信息搜索服务,所有内容均来自第三方网站。本站不存储任何视频资源,不对任何内容的准确性、合法性、完整性负责。',
|
||||||
@@ -290,7 +290,7 @@ export async function getConfig(): Promise<AdminConfig> {
|
|||||||
|
|
||||||
if (adminConfig) {
|
if (adminConfig) {
|
||||||
// 合并一些环境变量配置
|
// 合并一些环境变量配置
|
||||||
adminConfig.SiteConfig.SiteName = process.env.SITE_NAME || 'KatelyaTV';
|
adminConfig.SiteConfig.SiteName = process.env.SITE_NAME || '米视TV';
|
||||||
adminConfig.SiteConfig.Announcement =
|
adminConfig.SiteConfig.Announcement =
|
||||||
process.env.ANNOUNCEMENT ||
|
process.env.ANNOUNCEMENT ||
|
||||||
'本网站仅提供影视信息搜索服务,所有内容均来自第三方网站。本站不存储任何视频资源,不对任何内容的准确性、合法性、完整性负责。';
|
'本网站仅提供影视信息搜索服务,所有内容均来自第三方网站。本站不存储任何视频资源,不对任何内容的准确性、合法性、完整性负责。';
|
||||||
@@ -437,7 +437,7 @@ export async function resetConfig() {
|
|||||||
}
|
}
|
||||||
const adminConfig = {
|
const adminConfig = {
|
||||||
SiteConfig: {
|
SiteConfig: {
|
||||||
SiteName: process.env.SITE_NAME || 'KatelyaTV',
|
SiteName: process.env.SITE_NAME || '米视TV',
|
||||||
Announcement:
|
Announcement:
|
||||||
process.env.ANNOUNCEMENT ||
|
process.env.ANNOUNCEMENT ||
|
||||||
'本网站仅提供影视信息搜索服务,所有内容均来自第三方网站。本站不存储任何视频资源,不对任何内容的准确性、合法性、完整性负责。',
|
'本网站仅提供影视信息搜索服务,所有内容均来自第三方网站。本站不存储任何视频资源,不对任何内容的准确性、合法性、完整性负责。',
|
||||||
|
|||||||
@@ -349,6 +349,10 @@ export class RedisStorage implements IStorage {
|
|||||||
return match ? ensureString(match[1]) : undefined;
|
return match ? ensureString(match[1]) : undefined;
|
||||||
})
|
})
|
||||||
.filter((u): u is string => typeof u === 'string');
|
.filter((u): u is string => typeof u === 'string');
|
||||||
|
// 站长(owner)不一定有密码记录,但需显示其最后登录时间
|
||||||
|
if (!usernames.includes(ownerUsername)) {
|
||||||
|
usernames.push(ownerUsername);
|
||||||
|
}
|
||||||
|
|
||||||
// 获取用户创建时间、最后登录时间并构造 User 对象
|
// 获取用户创建时间、最后登录时间并构造 User 对象
|
||||||
const users = await Promise.all(
|
const users = await Promise.all(
|
||||||
|
|||||||
+4
-1
@@ -37,7 +37,10 @@ export function processImageUrl(originalUrl: string): string {
|
|||||||
const proxyUrl = getImageProxyUrl();
|
const proxyUrl = getImageProxyUrl();
|
||||||
if (!proxyUrl) return originalUrl;
|
if (!proxyUrl) return originalUrl;
|
||||||
|
|
||||||
return `${proxyUrl}${encodeURIComponent(originalUrl)}`;
|
// 代理地址若未自带查询参数(如 /api/image-proxy),补 ?url=,否则拼出的 URL 非法
|
||||||
|
if (proxyUrl.includes('url=')) return `${proxyUrl}${encodeURIComponent(originalUrl)}`;
|
||||||
|
const sep = proxyUrl.includes('?') ? '&' : '?url=';
|
||||||
|
return `${proxyUrl}${sep}${encodeURIComponent(originalUrl)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+4
-3
@@ -49,12 +49,13 @@ export async function middleware(request: NextRequest) {
|
|||||||
return NextResponse.next();
|
return NextResponse.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 首次访问不再强制跳转 /ipv6 选线路页:首页直接加载数据,线路由顶栏「IPV4/IPV6」切换
|
||||||
|
|
||||||
const storageType = process.env.NEXT_PUBLIC_STORAGE_TYPE || 'localstorage';
|
const storageType = process.env.NEXT_PUBLIC_STORAGE_TYPE || 'localstorage';
|
||||||
|
|
||||||
if (!process.env.AUTH_PASSWORD) {
|
if (!process.env.AUTH_PASSWORD) {
|
||||||
// 如果没有设置密码,重定向到警告页面
|
// 未配置 AUTH_PASSWORD 时直接放行,不强制访问控制
|
||||||
const warningUrl = new URL('/warning', request.url);
|
return NextResponse.next();
|
||||||
return NextResponse.redirect(warningUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 从cookie获取认证信息
|
// 从cookie获取认证信息
|
||||||
|
|||||||
Reference in new issue
Block a user