Browse Source

fix logic for prod & test host detection

kb/add-usage-guide
Trent Larson 11 months ago
parent
commit
5534f8fa50
  1. 2
      README.md
  2. 4
      src/components/TopMessage.vue
  3. 3
      src/constants/app.ts

2
README.md

@ -34,7 +34,7 @@ If you are deploying in a subdirectory, add it to `publicPath` in vue.config.js,
* `npm run build` * `npm run build`
* Revert src/constants/app.ts & change version to "-beta" * Revert src/constants/app.ts
* `cp sw_scripts/[ns]* dist/` * `cp sw_scripts/[ns]* dist/`

4
src/components/TopMessage.vue

@ -30,13 +30,13 @@ 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 window.location.hostname !== AppString.PROD_TIME_SAFARI_SERVER_HOST
) { ) {
const didPrefix = settings.activeDid?.slice(11, 14); const didPrefix = settings.activeDid?.slice(11, 14);
this.message = "You're linked to a test server, user " + didPrefix; this.message = "You're linked to a test server, user " + didPrefix;
} else if ( } else if (
settings?.warnIfProdServer && 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); const didPrefix = settings.activeDid?.slice(1, 14);
this.message = this.message =

3
src/constants/app.ts

@ -6,7 +6,8 @@
export enum AppString { export enum AppString {
APP_NAME = "Time Safari", 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", 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",

Loading…
Cancel
Save