From bcdd2464ca387104e63eaf0d7dc37a5d9d236bc8 Mon Sep 17 00:00:00 2001 From: mtvpls Date: Wed, 21 Jan 2026 00:27:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AE=A2=E9=98=85=E5=8E=BB?= =?UTF-8?q?=E5=B9=BF=E5=91=8A=E5=BC=80=E5=85=B3=E4=B8=8D=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=93=BE=E6=8E=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/UserMenu.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/UserMenu.tsx b/src/components/UserMenu.tsx index 16fcbc8..82dcb3c 100644 --- a/src/components/UserMenu.tsx +++ b/src/components/UserMenu.tsx @@ -275,10 +275,11 @@ export const UserMenu: React.FC = () => { }, []); // 懒加载订阅 URL - 只在打开订阅面板时请求 - const fetchSubscribeUrl = async () => { + const fetchSubscribeUrl = async (adFilter?: boolean) => { try { const currentOrigin = window.location.origin; - const response = await fetch(`/api/tvbox/config?origin=${encodeURIComponent(currentOrigin)}&adFilter=${adFilterEnabled}`); + const filterValue = adFilter !== undefined ? adFilter : adFilterEnabled; + const response = await fetch(`/api/tvbox/config?origin=${encodeURIComponent(currentOrigin)}&adFilter=${filterValue}`); if (response.ok) { const data = await response.json(); setSubscribeUrl(data.url); @@ -588,8 +589,8 @@ export const UserMenu: React.FC = () => { const handleAdFilterToggle = async (checked: boolean) => { setAdFilterEnabled(checked); - // 当去广告开关改变时,重新获取订阅URL - await fetchSubscribeUrl(); + // 当去广告开关改变时,重新获取订阅URL,传入新的值 + await fetchSubscribeUrl(checked); }; const handleCopySubscribeUrl = async () => {