This commit is contained in:
2026-05-14 17:22:43 +04:00
parent 9c96370235
commit 02a33e9b14

View File

@@ -47,8 +47,8 @@ interface QrStatusResponse {
export class CreatePage { export class CreatePage {
private http = inject(HttpClient); private http = inject(HttpClient);
private i18n = inject(TranslationService); private i18n = inject(TranslationService);
private readonly parentRedirects: Record<string, string> = { private readonly sites: Record<string, string> = {
fast: 'https://fastcheck.store' '51': 'fastcheck.store'
}; };
private t(key: string): string { return this.i18n.translate(key); } private t(key: string): string { return this.i18n.translate(key); }
@@ -95,8 +95,8 @@ export class CreatePage {
private get partnerqrID(): string { private get partnerqrID(): string {
return new URLSearchParams(window.location.search).get('id') ?? ''; return new URLSearchParams(window.location.search).get('id') ?? '';
} }
private get parentAlias(): string { private get fromSite(): string {
return new URLSearchParams(window.location.search).get('parent') ?? ''; return new URLSearchParams(window.location.search).get('from') ?? '';
} }
get isMobile(): boolean { get isMobile(): boolean {
@@ -254,21 +254,16 @@ export class CreatePage {
const withId = (target: string): string => { const withId = (target: string): string => {
if (!id) return target; 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); url.searchParams.set('id', id);
return url.toString(); return url.toString();
}; };
const alias = this.parentAlias.trim().toLowerCase(); const from = this.fromSite.trim();
const fromAlias = this.parentRedirects[alias]; const target = this.sites[from];
if (fromAlias) { if (target) {
window.location.href = withId(fromAlias); window.location.href = withId(target);
return;
}
const referrer = document.referrer;
if (referrer) {
window.location.href = withId(referrer);
return; return;
} }