Browse Source

fix top warnings when on prod or non-prod servers

pull/100/head
Trent Larson 11 months ago
parent
commit
d0697c1ef4
  1. 10
      src/components/TopMessage.vue
  2. 3
      src/constants/app.ts
  3. 2
      src/views/AccountViewView.vue

10
src/components/TopMessage.vue

@ -30,15 +30,15 @@ export default class TopMessage extends Vue {
const settings = await db.settings.get(MASTER_SETTINGS_KEY); const settings = await db.settings.get(MASTER_SETTINGS_KEY);
if ( if (
settings?.warnIfTestServer && 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); const didPrefix = settings.activeDid?.slice(11, 15);
this.message = "You're linked to a test server, user " + didPrefix; this.message = "You're linked to a non-prod server, user " + didPrefix;
} else if ( } else if (
settings?.warnIfProdServer && 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 = this.message =
"You're linked to the production server, user " + didPrefix; "You're linked to the production server, user " + didPrefix;
} }

3
src/constants/app.ts

@ -6,9 +6,6 @@
export enum AppString { export enum AppString {
APP_NAME = "Time Safari", 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", PROD_ENDORSER_API_SERVER = "https://api.endorser.ch",
TEST_ENDORSER_API_SERVER = "https://test-api.endorser.ch", TEST_ENDORSER_API_SERVER = "https://test-api.endorser.ch",
LOCAL_ENDORSER_API_SERVER = "http://localhost:3000", LOCAL_ENDORSER_API_SERVER = "http://localhost:3000",

2
src/views/AccountViewView.vue

@ -390,7 +390,7 @@
@click="toggleTestWarning" @click="toggleTestWarning"
> >
<!-- label --> <!-- label -->
<h2>Show warning if on test server</h2> <h2>Show warning if on non-prod server</h2>
<!-- toggle --> <!-- toggle -->
<div class="relative ml-2"> <div class="relative ml-2">
<!-- input --> <!-- input -->

Loading…
Cancel
Save