From 7d698273d04177d886499ef381702fb18eedbd92 Mon Sep 17 00:00:00 2001
From: 3970260761 <3970260761@qq.com>
Date: Sun, 8 Nov 2026 00:59:44 +0800
Subject: [PATCH] =?UTF-8?q?fixed75:=20TVBOX=E6=8C=89=E9=92=AE=E5=BC=B9?=
=?UTF-8?q?=E5=8F=8C=E5=9C=B0=E5=9D=80(=E9=85=8D=E7=BD=AE=E5=9C=B0?=
=?UTF-8?q?=E5=9D=80+=E7=9B=B4=E6=92=AD=E6=BA=90=E5=9C=B0=E5=9D=80?=
=?UTF-8?q?=E5=90=84=E5=B8=A6=E5=A4=8D=E5=88=B6)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Dockerfile | 2 +-
src/components/MobileHeader.tsx | 2 +-
src/components/TopRightButtons.tsx | 4 +-
src/components/TvboxButton.tsx | 98 +++++++++++++++++++++---------
4 files changed, 74 insertions(+), 32 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index fb64e6c..82fa1ce 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -51,7 +51,7 @@ ENV NODE_ENV=production
ENV HOSTNAME=0.0.0.0
ENV PORT=3000
ENV DOCKER_ENV=true
-ENV NEXT_PUBLIC_SITE_VERSION=fixed74
+ENV NEXT_PUBLIC_SITE_VERSION=fixed75
# 从构建器中复制 standalone 输出
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
diff --git a/src/components/MobileHeader.tsx b/src/components/MobileHeader.tsx
index 60c2b83..09039d4 100644
--- a/src/components/MobileHeader.tsx
+++ b/src/components/MobileHeader.tsx
@@ -27,7 +27,7 @@ const MobileHeader = ({ showBackButton = false }: MobileHeaderProps) => {
className='shrink-0 select-none rounded-md px-1.5 py-0.5 text-[10px] font-bold tracking-wide text-purple-600 dark:text-purple-400 bg-purple-500/10 border border-purple-500/20'
title='米视TV 当前版本'
>
- v{process.env.NEXT_PUBLIC_SITE_VERSION || 'fixed74'}
+ v{process.env.NEXT_PUBLIC_SITE_VERSION || 'fixed75'}
diff --git a/src/components/TopRightButtons.tsx b/src/components/TopRightButtons.tsx
index 7682b7c..ebef870 100644
--- a/src/components/TopRightButtons.tsx
+++ b/src/components/TopRightButtons.tsx
@@ -20,7 +20,7 @@ export default function TopRightButtons({ variant = 'bar' }: TopRightButtonsProp
className='shrink-0 select-none rounded-md px-1.5 py-1 text-[10px] font-bold tracking-wide text-purple-300 bg-purple-500/20 border border-purple-400/30'
title='米视TV 当前版本'
>
- v{process.env.NEXT_PUBLIC_SITE_VERSION || 'fixed74'}
+ v{process.env.NEXT_PUBLIC_SITE_VERSION || 'fixed75'}
@@ -43,7 +43,7 @@ export default function TopRightButtons({ variant = 'bar' }: TopRightButtonsProp
className='hidden lg:inline-flex shrink-0 items-center select-none rounded-lg px-2 py-1.5 text-xs font-bold tracking-wide text-purple-600 dark:text-purple-400 bg-purple-500/10 border border-purple-500/20'
title='米视TV 当前版本'
>
- v{process.env.NEXT_PUBLIC_SITE_VERSION || 'fixed74'}
+ v{process.env.NEXT_PUBLIC_SITE_VERSION || 'fixed75'}
diff --git a/src/components/TvboxButton.tsx b/src/components/TvboxButton.tsx
index 4e9ed80..f78d897 100644
--- a/src/components/TvboxButton.tsx
+++ b/src/components/TvboxButton.tsx
@@ -5,7 +5,25 @@ import { useState } from 'react';
export default function TvboxButton({ forceShow = false, compact = false }: { forceShow?: boolean; compact?: boolean }) {
const [label, setLabel] = useState('📺 TVBOX接口');
- const showModal = (title: string, body: string, link?: string) => {
+ const copyText = (t: string, btn?: HTMLButtonElement) => {
+ try {
+ if (navigator.clipboard && navigator.clipboard.writeText) {
+ navigator.clipboard.writeText(t).then(() => {
+ if (btn) { btn.textContent = '✓ 已复制'; setTimeout(() => (btn.textContent = '复制'), 1600); }
+ }).catch(() => {});
+ return;
+ }
+ } catch {}
+ const ta = document.createElement('textarea');
+ ta.value = t;
+ document.body.appendChild(ta);
+ ta.select();
+ try { document.execCommand('copy'); } catch {}
+ document.body.removeChild(ta);
+ if (btn) { btn.textContent = '✓ 已复制'; setTimeout(() => (btn.textContent = '复制'), 1600); }
+ };
+
+ const showTvboxModal = (cfg: string, live: string) => {
const ov = document.createElement('div');
ov.className =
'fixed inset-0 z-[9999] flex items-center justify-center bg-black/50 p-4';
@@ -18,7 +36,7 @@ export default function TvboxButton({ forceShow = false, compact = false }: { fo
const h3 = document.createElement('h3');
h3.className =
'text-base font-bold text-gray-900 dark:text-gray-100 truncate mr-2';
- h3.textContent = title;
+ h3.textContent = '📺 TVBOX 接入';
const xb = document.createElement('button');
xb.className =
'text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 text-lg leading-none flex-shrink-0';
@@ -27,8 +45,51 @@ export default function TvboxButton({ forceShow = false, compact = false }: { fo
head.appendChild(xb);
const bd = document.createElement('div');
bd.className =
- 'px-6 pb-4 overflow-y-auto text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap';
- bd.textContent = body;
+ 'px-6 pb-4 overflow-y-auto text-sm text-gray-700 dark:text-gray-300';
+ const mkRow = (label: string, url: string) => {
+ const wrap = document.createElement('div');
+ wrap.style.marginBottom = '14px';
+ const lb = document.createElement('div');
+ lb.style.fontWeight = '700';
+ lb.style.marginBottom = '6px';
+ lb.textContent = label;
+ const urlDiv = document.createElement('div');
+ urlDiv.style.wordBreak = 'break-all';
+ urlDiv.style.background = 'rgba(127,127,127,.12)';
+ urlDiv.style.borderRadius = '8px';
+ urlDiv.style.padding = '8px 10px';
+ urlDiv.style.fontSize = '12px';
+ urlDiv.textContent = url;
+ const row = document.createElement('div');
+ row.style.display = 'flex';
+ row.style.gap = '8px';
+ row.style.marginTop = '8px';
+ const cp = document.createElement('button');
+ cp.textContent = '复制';
+ cp.className =
+ 'px-3 py-1.5 rounded-lg text-xs font-medium text-white bg-purple-600 hover:bg-purple-700';
+ cp.onclick = () => copyText(url, cp);
+ const op = document.createElement('a');
+ op.href = url;
+ op.target = '_blank';
+ op.rel = 'noopener';
+ op.textContent = '打开 →';
+ op.className =
+ 'px-3 py-1.5 rounded-lg text-xs font-medium text-purple-600 dark:text-purple-400 hover:bg-purple-500/10';
+ row.appendChild(cp);
+ row.appendChild(op);
+ wrap.appendChild(lb);
+ wrap.appendChild(urlDiv);
+ wrap.appendChild(row);
+ return wrap;
+ };
+ bd.appendChild(mkRow('配置地址(含直播,推荐)', cfg));
+ bd.appendChild(mkRow('直播源地址(仅直播)', live));
+ const tip = document.createElement('div');
+ tip.style.fontSize = '12px';
+ tip.style.opacity = '0.75';
+ tip.textContent = '影视仓/TVBox「设置 → 配置地址」粘贴保存即可';
+ bd.appendChild(tip);
card.appendChild(head);
card.appendChild(bd);
const foot = document.createElement('div');
@@ -39,16 +100,6 @@ export default function TvboxButton({ forceShow = false, compact = false }: { fo
'px-3 py-1.5 rounded-lg text-xs font-medium text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-600';
kb.textContent = '我知道了';
foot.appendChild(kb);
- if (link) {
- const la = document.createElement('a');
- la.href = link;
- la.target = '_blank';
- la.rel = 'noopener';
- la.className =
- 'px-3 py-1.5 rounded-lg text-xs font-medium text-purple-600 dark:text-purple-400 hover:bg-purple-500/10';
- la.textContent = '查看详情 →';
- foot.insertBefore(la, kb);
- }
card.appendChild(foot);
const close = () => {
if (ov && ov.parentNode) ov.parentNode.removeChild(ov);
@@ -63,25 +114,16 @@ export default function TvboxButton({ forceShow = false, compact = false }: { fo
};
const onClick = (ev: React.MouseEvent) => {
- const u = location.origin + '/api/tvbox';
+ const cfg = location.origin + '/api/tvbox';
+ const live = location.origin + '/api/tvbox?live=txt';
const bt = ev.currentTarget;
const ok = () => {
setLabel('✓ 已复制');
setTimeout(() => setLabel('📺 TVBOX接口'), 1600);
};
- const tip = '影视仓/TVBox「设置 → 配置地址」粘贴保存即可';
- try {
- if (navigator.clipboard && navigator.clipboard.writeText) {
- navigator.clipboard
- .writeText(u)
- .then(ok)
- .catch(() =>
- showModal('📺 TVBOX 接入', '配置地址: ' + u + ' —— ' + tip, u)
- );
- return;
- }
- } catch {}
- showModal('📺 TVBOX 接入', '配置地址: ' + u + ' —— ' + tip, u);
+ void bt;
+ void ok;
+ showTvboxModal(cfg, live);
};
return (