param
This commit is contained in:
@@ -47,8 +47,8 @@ interface QrStatusResponse {
|
||||
export class CreatePage {
|
||||
private http = inject(HttpClient);
|
||||
private i18n = inject(TranslationService);
|
||||
private readonly parentRedirects: Record<string, string> = {
|
||||
fast: 'https://fastcheck.store'
|
||||
private readonly sites: Record<string, string> = {
|
||||
'51': 'fastcheck.store'
|
||||
};
|
||||
|
||||
private t(key: string): string { return this.i18n.translate(key); }
|
||||
@@ -95,8 +95,8 @@ export class CreatePage {
|
||||
private get partnerqrID(): string {
|
||||
return new URLSearchParams(window.location.search).get('id') ?? '';
|
||||
}
|
||||
private get parentAlias(): string {
|
||||
return new URLSearchParams(window.location.search).get('parent') ?? '';
|
||||
private get fromSite(): string {
|
||||
return new URLSearchParams(window.location.search).get('from') ?? '';
|
||||
}
|
||||
|
||||
get isMobile(): boolean {
|
||||
@@ -254,21 +254,16 @@ export class CreatePage {
|
||||
const withId = (target: string): string => {
|
||||
if (!id) return target;
|
||||
|
||||
const url = new URL(target, window.location.origin);
|
||||
const normalizedTarget = /^https?:\/\//i.test(target) ? target : `https://${target}`;
|
||||
const url = new URL(normalizedTarget);
|
||||
url.searchParams.set('id', id);
|
||||
return url.toString();
|
||||
};
|
||||
|
||||
const alias = this.parentAlias.trim().toLowerCase();
|
||||
const fromAlias = this.parentRedirects[alias];
|
||||
if (fromAlias) {
|
||||
window.location.href = withId(fromAlias);
|
||||
return;
|
||||
}
|
||||
|
||||
const referrer = document.referrer;
|
||||
if (referrer) {
|
||||
window.location.href = withId(referrer);
|
||||
const from = this.fromSite.trim();
|
||||
const target = this.sites[from];
|
||||
if (target) {
|
||||
window.location.href = withId(target);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user