From 2ec93639c20b906d12f8de9c1bcf84710b376e58 Mon Sep 17 00:00:00 2001 From: jinghui Date: Mon, 2 Nov 2026 12:11:54 +0800 Subject: [PATCH] =?UTF-8?q?v-fixed43:=20=E5=85=AC=E5=91=8A=E5=8F=AA?= =?UTF-8?q?=E4=BF=9D=E7=95=99=E7=B3=BB=E7=BB=9F=E5=8E=9F=E7=94=9F=E5=BC=B9?= =?UTF-8?q?=E7=AA=97(=E7=A7=BB=E9=99=A4HubNotice=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E6=8C=82=E8=BD=BD),=E9=93=83=E9=93=9B=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E5=8E=9F=E7=94=9F=E5=85=AC=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- patches/patch_license.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/patch_license.js b/patches/patch_license.js index 8c06269..5cb959f 100644 --- a/patches/patch_license.js +++ b/patches/patch_license.js @@ -126,7 +126,7 @@ function writeChecked(p, s) { '(0,u.useEffect)(()=>{const T=setTimeout(()=>{fetch("/api/license-config",{cache:"no-store"}).then(r=>r.json()).then(j=>{if(dead||!j||200!==j.code||!j.data)return;const d=j.data;let ann=null;try{const seen=JSON.parse(localStorage.getItem("hub_seen")||"{}");if(d.announcement&&!seen["a"+d.announcement.id])ann=d.announcement}catch(e){}let upd=null;try{upd=(d.update_available&&localStorage.getItem("hub_ver_dismiss")!==String(d.latest||""))?d:null}catch(e){}if(!ann&&!upd)return;ov=document.createElement("div");ov.className="fixed inset-0 z-[9999] flex items-center justify-center bg-black/50 p-4";ov.style.backdropFilter="blur(4px)";const card=document.createElement("div");card.className="bg-white dark:bg-gray-800 rounded-2xl shadow-2xl max-w-md w-full max-h-[80vh] flex flex-col overflow-hidden";const head=document.createElement("div");head.className="flex items-center justify-between px-6 pt-5 pb-3";const h3=document.createElement("h3");h3.className="text-base font-bold text-gray-900 dark:text-gray-100 truncate mr-2";h3.textContent=ann?String(ann.title||"📢 公告"):"发现新版本 v"+String(upd&&upd.latest||"");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";xb.textContent="✕";head.appendChild(h3);head.appendChild(xb);const bd=document.createElement("div");bd.className="px-6 pb-2 overflow-y-auto text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap";bd.textContent=ann?String(ann.content||""):String(upd&&upd.changelog||"").slice(0,600);const ver=document.createElement("div");ver.className="mt-3 text-xs text-gray-400 dark:text-gray-500";ver.textContent="当前版本 v"+String(upd&&upd.version||"");bd.appendChild(ver);card.appendChild(head);card.appendChild(bd);const closeAnn=()=>{try{if(ann){const s=JSON.parse(localStorage.getItem("hub_seen")||"{}");s["a"+ann.id]=1;localStorage.setItem("hub_seen",JSON.stringify(s))}}catch(e){}if(ov&&ov.parentNode)ov.parentNode.removeChild(ov)};xb.onclick=closeAnn;if(upd||ann&&ann.link_url){const foot=document.createElement("div");foot.className="px-6 py-4 bg-gray-50 dark:bg-gray-700/50 flex items-center justify-end gap-2";if(ann&&ann.link_url){const la=document.createElement("a");la.href=ann.link_url;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.appendChild(la)}if(upd){const ok=document.createElement("button");ok.className="px-4 py-1.5 rounded-lg text-xs font-medium text-white bg-purple-600 hover:bg-purple-700";ok.textContent="我知道了";ok.onclick=()=>{try{localStorage.setItem("hub_ver_dismiss",String(upd.latest||""))}catch(e){}if(ov&&ov.parentNode)ov.parentNode.removeChild(ov)};foot.appendChild(ok)}else{const cb=document.createElement("button");cb.className="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";cb.textContent="关闭";cb.onclick=closeAnn;foot.appendChild(cb)}card.appendChild(foot)}ov.appendChild(card);ov.onclick=(e)=>{if(e.target===ov)closeAnn()};document.body.appendChild(ov)}).catch(()=>{})},1200);return()=>{dead=!0;if(ov&&ov.parentNode)ov.parentNode.removeChild(ov)}},[]);', 'return null}', 'function mvModal(t,b,l){const ov=document.createElement("div");ov.className="fixed inset-0 z-[9999] flex items-center justify-center bg-black/50 p-4";ov.style.backdropFilter="blur(4px)";const card=document.createElement("div");card.className="bg-white dark:bg-gray-800 rounded-2xl shadow-2xl max-w-md w-full max-h-[80vh] flex flex-col overflow-hidden";const head=document.createElement("div");head.className="flex items-center justify-between px-6 pt-5 pb-3";const h3=document.createElement("h3");h3.className="text-base font-bold text-gray-900 dark:text-gray-100 truncate mr-2";h3.textContent=t;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";xb.textContent="✕";head.appendChild(h3);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=b;card.appendChild(head);card.appendChild(bd);const foot=document.createElement("div");foot.className="px-6 py-4 bg-gray-50 dark:bg-gray-700/50 flex items-center justify-end gap-2";const kb=document.createElement("button");kb.className="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(l){const la=document.createElement("a");la.href=l;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)};xb.onclick=close;kb.onclick=close;ov.onclick=(ev)=>{if(ev.target===ov)close()};ov.appendChild(card);document.body.appendChild(ov)}', - 'function HubBell(){(0,u.useEffect)(()=>{const T=setTimeout(()=>{fetch("/api/license-config",{cache:"no-store"}).then(r=>r.json()).then(j=>{try{const a=j&&j.data&&j.data.announcement;if(!a)return;const seen=JSON.parse(localStorage.getItem("hub_seen")||"{}");if(!seen["a"+a.id]){const d=document.querySelector(".mv-bell-dot");if(d)d.style.display="block"}}catch(e){}}).catch(()=>{})},1500);return()=>{clearTimeout(T)}},[]);return(0,a.jsxs)("button",{onClick:()=>{fetch("/api/license-config",{cache:"no-store"}).then(r=>r.json()).then(j=>{const a=j&&j.data&&j.data.announcement;mvModal(a?String(a.title||"📢 公告"):"通知",a?String(a.content||""):"暂无新公告",a?String(a.link_url||""):"")}).catch(()=>{})},title:"公告通知",className:"relative hidden md:flex items-center justify-center w-8 h-8 rounded-lg text-base text-gray-500 hover:text-purple-600 hover:bg-purple-500/10 dark:text-gray-400 dark:hover:text-purple-400 transition-colors duration-200",children:[(0,a.jsx)("span",{className:"leading-none",children:"🔔"}),(0,a.jsx)("span",{className:"mv-bell-dot absolute top-1.5 right-1.5 w-2 h-2 bg-red-500 rounded-full",style:{display:"none"}})]})}', + 'function HubBell(){(0,u.useEffect)(()=>{const T=setTimeout(()=>{fetch("/api/license-config",{cache:"no-store"}).then(r=>r.json()).then(j=>{try{const a=j&&j.data&&j.data.announcement;if(!a)return;const seen=JSON.parse(localStorage.getItem("hub_seen")||"{}");if(!seen["a"+a.id]){const d=document.querySelector(".mv-bell-dot");if(d)d.style.display="block"}}catch(e){}}).catch(()=>{})},1500);return()=>{clearTimeout(T)}},[]);return(0,a.jsxs)("button",{onClick:()=>{try{localStorage.removeItem("hasSeenAnnouncement")}catch(e){};if(location.pathname==="/")location.reload();else location.href="/"},title:"公告通知",className:"relative hidden md:flex items-center justify-center w-8 h-8 rounded-lg text-base text-gray-500 hover:text-purple-600 hover:bg-purple-500/10 dark:text-gray-400 dark:hover:text-purple-400 transition-colors duration-200",children:[(0,a.jsx)("span",{className:"leading-none",children:"🔔"}),(0,a.jsx)("span",{className:"mv-bell-dot absolute top-1.5 right-1.5 w-2 h-2 bg-red-500 rounded-full",style:{display:"none"}})]})}', '' ].join("\n"); @@ -176,7 +176,7 @@ function writeChecked(p, s) { const ci = oi >= 0 ? s.lastIndexOf(combo, oi) : -1; if (ci < 0) { failures.push("nav combo anchor missing"); return; } const tvboxBtn = '(0,a.jsx)("button",{onClick:(ev)=>{const u=location.origin+"/api/tvbox";const bt=ev.currentTarget;const t0=bt.textContent;const ok=()=>{bt.textContent="✓ 已复制";setTimeout(()=>{bt.textContent=t0},1600)};const tip="影视仓/TVBox「设置 → 配置地址」粘贴保存即可";try{if(navigator.clipboard&&navigator.clipboard.writeText){navigator.clipboard.writeText(u).then(ok).catch(()=>mvModal("📺 TVBOX 接入","配置地址: "+u+" —— "+tip,u));return}}catch(x){}mvModal("📺 TVBOX 接入","配置地址: "+u+" —— "+tip,u)},title:"TVBOX接口 · 点击复制配置地址",className:"hidden md:flex items-center rounded-lg px-3 py-2 text-sm font-medium text-gray-700 hover:bg-purple-100/30 hover:text-purple-600 dark:text-gray-300 dark:hover:bg-purple-500/10 transition-colors duration-200",children:"📺 TVBOX接口"}),'; - const gated = '"/"===(e.activePath||"/")&&(0,a.jsxs)("span",{className:"hidden md:flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"hidden lg:inline-flex 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 当前版本",children:"v' + VERSION + '"}),(0,a.jsx)(HubBell,{}),(0,a.jsx)(HubNotice,{}),' + tvboxBtn + '(0,a.jsx)("a",{href:"https://gitea.88531.cn/jinghui/katelyatv",target:"_blank",rel:"noopener",className:"hidden lg:flex items-center rounded-lg px-3 py-2 text-sm font-medium text-gray-700 hover:bg-purple-100/30 hover:text-purple-600 dark:text-gray-300 dark:hover:bg-purple-500/10 transition-colors duration-200",children:"⭐ 开源地址"})]}),';; + const gated = '"/"===(e.activePath||"/")&&(0,a.jsxs)("span",{className:"hidden md:flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"hidden lg:inline-flex 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 当前版本",children:"v' + VERSION + '"}),(0,a.jsx)(HubBell,{}),' + tvboxBtn + '(0,a.jsx)("a",{href:"https://gitea.88531.cn/jinghui/katelyatv",target:"_blank",rel:"noopener",className:"hidden lg:flex items-center rounded-lg px-3 py-2 text-sm font-medium text-gray-700 hover:bg-purple-100/30 hover:text-purple-600 dark:text-gray-300 dark:hover:bg-purple-500/10 transition-colors duration-200",children:"⭐ 开源地址"})]}),';; s = s.slice(0, ci) + gated + s.slice(ci); log("chunk: injected gated trio (home only)"); writeChecked(target, s);