🐛 fix: Update getUserSubscribe function to accept short and token parameters for improved URL generation
This commit is contained in:
parent
1c93df8172
commit
39ebd09f09
@ -251,7 +251,7 @@ function RowMoreActions({
|
|||||||
onSelect={async (e) => {
|
onSelect={async (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
await navigator.clipboard.writeText(
|
await navigator.clipboard.writeText(
|
||||||
getUserSubscribeUrls(token)[0] || ""
|
getUserSubscribeUrls(row.short, token)[0] || ""
|
||||||
);
|
);
|
||||||
toast.success(t("copySuccess", "Copied successfully"));
|
toast.success(t("copySuccess", "Copied successfully"));
|
||||||
}}
|
}}
|
||||||
|
|||||||
@ -8,7 +8,7 @@ export interface GlobalStore {
|
|||||||
setCommon: (common: Partial<API.GetGlobalConfigResponse>) => void;
|
setCommon: (common: Partial<API.GetGlobalConfigResponse>) => void;
|
||||||
setUser: (user?: API.User) => void;
|
setUser: (user?: API.User) => void;
|
||||||
getUserInfo: () => Promise<void>;
|
getUserInfo: () => Promise<void>;
|
||||||
getUserSubscribe: (uuid: string, type?: string) => string[];
|
getUserSubscribe: (short: string, token: string, type?: string) => string[];
|
||||||
getAppSubLink: (url: string, schema?: string) => string;
|
getAppSubLink: (url: string, schema?: string) => string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ export const useGlobalStore = create<GlobalStore>((set, get) => ({
|
|||||||
console.error("Failed to refresh user:", error);
|
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 } =
|
const { pan_domain, subscribe_domain, subscribe_path } =
|
||||||
get().common.subscribe || {};
|
get().common.subscribe || {};
|
||||||
const domains = subscribe_domain
|
const domains = subscribe_domain
|
||||||
@ -129,12 +129,13 @@ export const useGlobalStore = create<GlobalStore>((set, get) => ({
|
|||||||
|
|
||||||
return domains.map((domain) => {
|
return domains.map((domain) => {
|
||||||
if (pan_domain) {
|
if (pan_domain) {
|
||||||
if (type) return `https://${uuid}.${type}.${domain}`;
|
if (type)
|
||||||
return `https://${uuid}.${domain}`;
|
return `https://${short}.${type}.${domain}${subscribe_path}?token=${token}&type=${type}`;
|
||||||
|
return `https://${short}.${domain}${subscribe_path}?token=${token}`;
|
||||||
}
|
}
|
||||||
if (type)
|
if (type)
|
||||||
return `https://${domain}${subscribe_path}?token=${uuid}&type=${type}`;
|
return `https://${domain}${subscribe_path}?token=${token}&type=${type}`;
|
||||||
return `https://${domain}${subscribe_path}?token=${uuid}`;
|
return `https://${domain}${subscribe_path}?token=${token}`;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getAppSubLink: (url: string, schema?: string) => {
|
getAppSubLink: (url: string, schema?: string) => {
|
||||||
|
|||||||
@ -394,7 +394,7 @@ export default function Content() {
|
|||||||
defaultValue="0"
|
defaultValue="0"
|
||||||
type="single"
|
type="single"
|
||||||
>
|
>
|
||||||
{getUserSubscribe(item.token, protocol)?.map(
|
{getUserSubscribe(item.short, item.token, protocol)?.map(
|
||||||
(url, index) => (
|
(url, index) => (
|
||||||
<AccordionItem key={url} value={String(index)}>
|
<AccordionItem key={url} value={String(index)}>
|
||||||
<AccordionTrigger className="hover:no-underline">
|
<AccordionTrigger className="hover:no-underline">
|
||||||
|
|||||||
@ -8,7 +8,7 @@ export interface GlobalStore {
|
|||||||
setCommon: (common: Partial<API.GetGlobalConfigResponse>) => void;
|
setCommon: (common: Partial<API.GetGlobalConfigResponse>) => void;
|
||||||
setUser: (user?: API.User) => void;
|
setUser: (user?: API.User) => void;
|
||||||
getUserInfo: () => Promise<void>;
|
getUserInfo: () => Promise<void>;
|
||||||
getUserSubscribe: (uuid: string, type?: string) => string[];
|
getUserSubscribe: (short: string, token: string, type?: string) => string[];
|
||||||
getAppSubLink: (url: string, schema?: string) => string;
|
getAppSubLink: (url: string, schema?: string) => string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ export const useGlobalStore = create<GlobalStore>((set, get) => ({
|
|||||||
console.error("Failed to refresh user:", error);
|
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 } =
|
const { pan_domain, subscribe_domain, subscribe_path } =
|
||||||
get().common.subscribe || {};
|
get().common.subscribe || {};
|
||||||
const domains = subscribe_domain
|
const domains = subscribe_domain
|
||||||
@ -129,12 +129,13 @@ export const useGlobalStore = create<GlobalStore>((set, get) => ({
|
|||||||
|
|
||||||
return domains.map((domain) => {
|
return domains.map((domain) => {
|
||||||
if (pan_domain) {
|
if (pan_domain) {
|
||||||
if (type) return `https://${uuid}.${type}.${domain}`;
|
if (type)
|
||||||
return `https://${uuid}.${domain}`;
|
return `https://${short}.${type}.${domain}${subscribe_path}?token=${token}&type=${type}`;
|
||||||
|
return `https://${short}.${domain}${subscribe_path}?token=${token}`;
|
||||||
}
|
}
|
||||||
if (type)
|
if (type)
|
||||||
return `https://${domain}${subscribe_path}?token=${uuid}&type=${type}`;
|
return `https://${domain}${subscribe_path}?token=${token}&type=${type}`;
|
||||||
return `https://${domain}${subscribe_path}?token=${uuid}`;
|
return `https://${domain}${subscribe_path}?token=${token}`;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getAppSubLink: (url: string, schema?: string) => {
|
getAppSubLink: (url: string, schema?: string) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user