From d0697c1ef469a1177ada49bbbcccab98a0235f4a Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Mon, 18 Dec 2023 16:06:55 -0700 Subject: [PATCH] fix top warnings when on prod or non-prod servers --- src/components/TopMessage.vue | 10 +++++----- src/constants/app.ts | 3 --- src/views/AccountViewView.vue | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/components/TopMessage.vue b/src/components/TopMessage.vue index 82dadc79c..843374109 100644 --- a/src/components/TopMessage.vue +++ b/src/components/TopMessage.vue @@ -30,15 +30,15 @@ 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_HOST + settings.apiServer !== AppString.PROD_ENDORSER_API_SERVER ) { - const didPrefix = settings.activeDid?.slice(11, 14); - this.message = "You're linked to a test server, user " + didPrefix; + const didPrefix = settings.activeDid?.slice(11, 15); + this.message = "You're linked to a non-prod server, user " + didPrefix; } else if ( settings?.warnIfProdServer && - window.location.hostname === AppString.PROD_TIME_SAFARI_SERVER_HOST + settings.apiServer === AppString.PROD_ENDORSER_API_SERVER ) { - const didPrefix = settings.activeDid?.slice(1, 14); + const didPrefix = settings.activeDid?.slice(11, 15); this.message = "You're linked to the production server, user " + didPrefix; } diff --git a/src/constants/app.ts b/src/constants/app.ts index 2d7d3726b..c92709bd5 100644 --- a/src/constants/app.ts +++ b/src/constants/app.ts @@ -6,9 +6,6 @@ export enum AppString { APP_NAME = "Time Safari", - 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", LOCAL_ENDORSER_API_SERVER = "http://localhost:3000", diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index cb153bd26..916d1fb3d 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -390,7 +390,7 @@ @click="toggleTestWarning" > -

Show warning if on test server

+

Show warning if on non-prod server