From 39ebd09f0989b37308c1c803d8e380f967ab0db5 Mon Sep 17 00:00:00 2001 From: "web@ppanel" Date: Tue, 30 Dec 2025 06:10:44 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20Update=20getUserSubscribe?= =?UTF-8?q?=20function=20to=20accept=20short=20and=20token=20parameters=20?= =?UTF-8?q?for=20improved=20URL=20generation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/sections/user/user-subscription/index.tsx | 2 +- apps/admin/src/stores/global.tsx | 13 +++++++------ apps/user/src/sections/user/dashboard/content.tsx | 2 +- apps/user/src/stores/global.tsx | 13 +++++++------ 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/apps/admin/src/sections/user/user-subscription/index.tsx b/apps/admin/src/sections/user/user-subscription/index.tsx index 309c97d..a132924 100644 --- a/apps/admin/src/sections/user/user-subscription/index.tsx +++ b/apps/admin/src/sections/user/user-subscription/index.tsx @@ -251,7 +251,7 @@ function RowMoreActions({ onSelect={async (e) => { e.preventDefault(); await navigator.clipboard.writeText( - getUserSubscribeUrls(token)[0] || "" + getUserSubscribeUrls(row.short, token)[0] || "" ); toast.success(t("copySuccess", "Copied successfully")); }} diff --git a/apps/admin/src/stores/global.tsx b/apps/admin/src/stores/global.tsx index b3133fa..9660293 100644 --- a/apps/admin/src/stores/global.tsx +++ b/apps/admin/src/stores/global.tsx @@ -8,7 +8,7 @@ export interface GlobalStore { setCommon: (common: Partial) => void; setUser: (user?: API.User) => void; getUserInfo: () => Promise; - getUserSubscribe: (uuid: string, type?: string) => string[]; + getUserSubscribe: (short: string, token: string, type?: string) => string[]; getAppSubLink: (url: string, schema?: string) => string; } @@ -120,7 +120,7 @@ export const useGlobalStore = create((set, get) => ({ console.error("Failed to refresh user:", error); } }, - getUserSubscribe: (uuid: string, type?: string) => { + getUserSubscribe: (short: string, token: string, type?: string) => { const { pan_domain, subscribe_domain, subscribe_path } = get().common.subscribe || {}; const domains = subscribe_domain @@ -129,12 +129,13 @@ export const useGlobalStore = create((set, get) => ({ return domains.map((domain) => { if (pan_domain) { - if (type) return `https://${uuid}.${type}.${domain}`; - return `https://${uuid}.${domain}`; + if (type) + return `https://${short}.${type}.${domain}${subscribe_path}?token=${token}&type=${type}`; + return `https://${short}.${domain}${subscribe_path}?token=${token}`; } if (type) - return `https://${domain}${subscribe_path}?token=${uuid}&type=${type}`; - return `https://${domain}${subscribe_path}?token=${uuid}`; + return `https://${domain}${subscribe_path}?token=${token}&type=${type}`; + return `https://${domain}${subscribe_path}?token=${token}`; }); }, getAppSubLink: (url: string, schema?: string) => { diff --git a/apps/user/src/sections/user/dashboard/content.tsx b/apps/user/src/sections/user/dashboard/content.tsx index 6a297d5..ff9fa30 100644 --- a/apps/user/src/sections/user/dashboard/content.tsx +++ b/apps/user/src/sections/user/dashboard/content.tsx @@ -394,7 +394,7 @@ export default function Content() { defaultValue="0" type="single" > - {getUserSubscribe(item.token, protocol)?.map( + {getUserSubscribe(item.short, item.token, protocol)?.map( (url, index) => ( diff --git a/apps/user/src/stores/global.tsx b/apps/user/src/stores/global.tsx index 3e7eb52..07ce695 100644 --- a/apps/user/src/stores/global.tsx +++ b/apps/user/src/stores/global.tsx @@ -8,7 +8,7 @@ export interface GlobalStore { setCommon: (common: Partial) => void; setUser: (user?: API.User) => void; getUserInfo: () => Promise; - getUserSubscribe: (uuid: string, type?: string) => string[]; + getUserSubscribe: (short: string, token: string, type?: string) => string[]; getAppSubLink: (url: string, schema?: string) => string; } @@ -120,7 +120,7 @@ export const useGlobalStore = create((set, get) => ({ console.error("Failed to refresh user:", error); } }, - getUserSubscribe: (uuid: string, type?: string) => { + getUserSubscribe: (short: string, token: string, type?: string) => { const { pan_domain, subscribe_domain, subscribe_path } = get().common.subscribe || {}; const domains = subscribe_domain @@ -129,12 +129,13 @@ export const useGlobalStore = create((set, get) => ({ return domains.map((domain) => { if (pan_domain) { - if (type) return `https://${uuid}.${type}.${domain}`; - return `https://${uuid}.${domain}`; + if (type) + return `https://${short}.${type}.${domain}${subscribe_path}?token=${token}&type=${type}`; + return `https://${short}.${domain}${subscribe_path}?token=${token}`; } if (type) - return `https://${domain}${subscribe_path}?token=${uuid}&type=${type}`; - return `https://${domain}${subscribe_path}?token=${uuid}`; + return `https://${domain}${subscribe_path}?token=${token}&type=${type}`; + return `https://${domain}${subscribe_path}?token=${token}`; }); }, getAppSubLink: (url: string, schema?: string) => {