diff --git a/Dockerfile b/Dockerfile
index 654f18f..452eea6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -33,7 +33,7 @@ COPY . .
RUN find ./src -type f -name "route.ts" -print0 \
| xargs -0 sed -i "s/export const runtime = 'edge';/export const runtime = 'nodejs';/g"
ENV DOCKER_ENV=true
-ENV NEXT_PUBLIC_SITE_VERSION=fixed96
+ENV NEXT_PUBLIC_SITE_VERSION=fixed97
# 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
@@ -52,7 +52,7 @@ ENV NODE_ENV=production
ENV HOSTNAME=0.0.0.0
ENV PORT=3000
ENV DOCKER_ENV=true
-ENV NEXT_PUBLIC_SITE_VERSION=fixed96
+ENV NEXT_PUBLIC_SITE_VERSION=fixed97
# 从构建器中复制 standalone 输出
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
diff --git a/src/app/ipv6/page.tsx b/src/app/ipv6/page.tsx
index de4cdf3..26020f6 100644
--- a/src/app/ipv6/page.tsx
+++ b/src/app/ipv6/page.tsx
@@ -83,10 +83,31 @@ export default function IPv6Page() {
const choose = (which: 'v4' | '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
// ignore
}
- window.location.href = dest + back + window.location.search + window.location.hash;
+ // 去掉 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 = () => {
@@ -104,7 +125,23 @@ export default function IPv6Page() {
try { localStorage.setItem('__v6dest', 'v6'); } catch (e) { // ignore
// ignore
}
- window.location.href = H.v6 + back + window.location.search + window.location.hash;
+ 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 (
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index 8af3944..b56622f 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -8,6 +8,7 @@ import { getConfig } from '@/lib/config';
import { SiteProvider } from '../components/SiteProvider';
import { ThemeProvider } from '../components/ThemeProvider';
+import Ipv6FirstVisitGate from '../components/Ipv6FirstVisitGate';
const inter = Inter({ subsets: ['latin'] });
@@ -114,6 +115,7 @@ export default async function RootLayout({
disableTransitionOnChange
>
+
{children}
diff --git a/src/components/Ipv6Button.tsx b/src/components/Ipv6Button.tsx
index f191b9a..73f85f1 100644
--- a/src/components/Ipv6Button.tsx
+++ b/src/components/Ipv6Button.tsx
@@ -9,6 +9,7 @@ export default function Ipv6Button({ forceShow = false, compact = false, light =
return (