From 5534f8fa50f1395d75f8ccf21986b4a8ff77bbcf Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Sun, 17 Dec 2023 20:17:45 -0700 Subject: [PATCH] fix logic for prod & test host detection --- README.md | 2 +- src/components/TopMessage.vue | 4 ++-- src/constants/app.ts | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3108afc3..dea888a3 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ If you are deploying in a subdirectory, add it to `publicPath` in vue.config.js, * `npm run build` -* Revert src/constants/app.ts & change version to "-beta" +* Revert src/constants/app.ts * `cp sw_scripts/[ns]* dist/` diff --git a/src/components/TopMessage.vue b/src/components/TopMessage.vue index 6c5c6921..82dadc79 100644 --- a/src/components/TopMessage.vue +++ b/src/components/TopMessage.vue @@ -30,13 +30,13 @@ export default class TopMessage extends Vue { const settings = await db.settings.get(MASTER_SETTINGS_KEY); if ( settings?.warnIfTestServer && - window.location.hostname !== AppString.PROD_TIME_SAFARI_SERVER + window.location.hostname !== AppString.PROD_TIME_SAFARI_SERVER_HOST ) { const didPrefix = settings.activeDid?.slice(11, 14); this.message = "You're linked to a test server, user " + didPrefix; } else if ( settings?.warnIfProdServer && - window.location.hostname === AppString.PROD_TIME_SAFARI_SERVER + window.location.hostname === AppString.PROD_TIME_SAFARI_SERVER_HOST ) { const didPrefix = settings.activeDid?.slice(1, 14); this.message = diff --git a/src/constants/app.ts b/src/constants/app.ts index 2e2cffc7..2d7d3726 100644 --- a/src/constants/app.ts +++ b/src/constants/app.ts @@ -6,7 +6,8 @@ export enum AppString { APP_NAME = "Time Safari", - PROD_TIME_SAFARI_SERVER = "https://timesafari.app", + PROD_TIME_SAFARI_SERVER_HOST = "timesafari.app", + PROD_TIME_SAFARI_SERVER = "https://" + PROD_TIME_SAFARI_SERVER_HOST, PROD_ENDORSER_API_SERVER = "https://api.endorser.ch", TEST_ENDORSER_API_SERVER = "https://test-api.endorser.ch",