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) => {