fix: 移除首访强制跳转/ipv6 与图片代理拼接修复 (fixed105)
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

- 删除 Ipv6FirstVisitGate 首访强制跳转(layout.tsx 不再挂载),首页直接加载数据
- 开启 NEXT_PUBLIC_IMAGE_PROXY=/api/image-proxy,海报走站内代理
- 修复 processImageUrl 缺少 ?url= 分隔符导致的非法图片 URL
- 实测: 30/30 海报加载成功, 无跳转, IPv6 推荐浮层正常显示
This commit is contained in:
jinghui committed 2026-11-10 02:14:18 +08:00
1 parent 2c8a68b064
commit d5443d97c9
7 files changed
+190 -52

No files matched your search

+98
View File
@@ -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>
);
}