From acfdcdbc63ead3328ee98497d0179da10b089f99 Mon Sep 17 00:00:00 2001 From: jeppevinkel Date: Wed, 10 Jul 2024 01:22:12 +0200 Subject: [PATCH 1/3] Fix referral url when subdomain contains `account` This fix should work to grab the base url more consistently when the sub domain includes `account` in the name. --- ts/user.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ts/user.ts b/ts/user.ts index de13f63..d100031 100644 --- a/ts/user.ts +++ b/ts/user.ts @@ -267,9 +267,8 @@ class ReferralCard { set code(c: string) { this._code = c; let url = window.location.href; - for (let split of ["#", "?", "account", "my"]) { - url = url.split(split)[0]; - } + let pathArray = url.split('/'); + url = `${pathArray[0]}//${pathArray[2]}/`; if (url.slice(-1) != "/") { url += "/"; } url = url + "invite/" + this._code; this._url = url; From 6052329c0bf17e748149e69773da6e0b89e3ec88 Mon Sep 17 00:00:00 2001 From: jeppevinkel Date: Wed, 10 Jul 2024 09:07:21 +0200 Subject: [PATCH 2/3] Fix deprecated georeleaser flag Updated the `--skip-publish` flag to the new `--skip=publish` format. --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 47293dd..b843027 100644 --- a/.drone.yml +++ b/.drone.yml @@ -85,7 +85,7 @@ steps: commands: - curl -sL https://git.io/goreleaser > goreleaser - chmod +x goreleaser - - ./scripts/version.sh ./goreleaser --snapshot --skip-publish --clean + - ./scripts/version.sh ./goreleaser --snapshot --skip=publish --clean - wget https://builds.hrfee.pw/upload.py - pip3 install requests - bash -c 'sftp -i /id_rsa2 -o StrictHostKeyChecking=no root@161.97.102.153:/mnt/redoc <<< $"put docs/swagger.json jfa-go.json"' @@ -164,7 +164,7 @@ steps: commands: - curl -sL https://git.io/goreleaser > goreleaser - chmod +x goreleaser - - ./scripts/version.sh ./goreleaser --snapshot --skip-publish --clean + - ./scripts/version.sh ./goreleaser --snapshot --skip=publish --clean trigger: event: From 272c38e0c5b35d8247fcba6191db6bb013831974 Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Sat, 13 Jul 2024 14:22:05 +0100 Subject: [PATCH 3/3] user: url split on pathname only --- ts/user.ts | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/ts/user.ts b/ts/user.ts index d100031..44bfac3 100644 --- a/ts/user.ts +++ b/ts/user.ts @@ -266,12 +266,20 @@ class ReferralCard { get code(): string { return this._code; } set code(c: string) { this._code = c; - let url = window.location.href; - let pathArray = url.split('/'); - url = `${pathArray[0]}//${pathArray[2]}/`; - if (url.slice(-1) != "/") { url += "/"; } - url = url + "invite/" + this._code; - this._url = url; + + let u = new URL(window.location.href); + let path = u.pathname; + for (let split of ["account", "my"]) { + path = path.split(split)[0]; + } + if (path.slice(-1) != "/") { path += "/"; } + path = path + "invite/" + this._code; + + u.pathname = path; + u.hash = ""; + u.search = ""; + + this._url = u.toString(); } get remaining_uses(): number { return this._remainingUses; }