From 4f2cb557537c3010523c1354f0d478fa5d7c5cd4 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Sat, 16 Dec 2023 08:04:16 -0700 Subject: [PATCH] add warning if on unexpected server --- src/components/TopMessage.vue | 58 +++++++++ src/constants/app.ts | 3 + src/db/index.ts | 3 - src/db/tables/settings.ts | 15 ++- src/views/AccountViewView.vue | 217 +++++++++++++++++++++++++--------- src/views/DiscoverView.vue | 3 + src/views/HomeView.vue | 5 +- src/views/ProjectViewView.vue | 5 +- src/views/ProjectsView.vue | 5 +- 9 files changed, 245 insertions(+), 69 deletions(-) create mode 100644 src/components/TopMessage.vue diff --git a/src/components/TopMessage.vue b/src/components/TopMessage.vue new file mode 100644 index 0000000..6c5c692 --- /dev/null +++ b/src/components/TopMessage.vue @@ -0,0 +1,58 @@ + + + diff --git a/src/constants/app.ts b/src/constants/app.ts index f4be364..2e2cffc 100644 --- a/src/constants/app.ts +++ b/src/constants/app.ts @@ -6,12 +6,15 @@ export enum AppString { APP_NAME = "Time Safari", + PROD_TIME_SAFARI_SERVER = "https://timesafari.app", + PROD_ENDORSER_API_SERVER = "https://api.endorser.ch", TEST_ENDORSER_API_SERVER = "https://test-api.endorser.ch", LOCAL_ENDORSER_API_SERVER = "http://localhost:3000", DEFAULT_ENDORSER_API_SERVER = TEST_ENDORSER_API_SERVER, + // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values PROD_PUSH_SERVER = "https://timesafari.app", TEST1_PUSH_SERVER = "https://test.timesafari.app", TEST2_PUSH_SERVER = "https://timesafari-pwa.anomalistlabs.com", diff --git a/src/db/index.ts b/src/db/index.ts index 16c99d8..37d6cf5 100644 --- a/src/db/index.ts +++ b/src/db/index.ts @@ -45,8 +45,5 @@ db.on("populate", () => { db.settings.add({ id: MASTER_SETTINGS_KEY, apiServer: AppString.DEFAULT_ENDORSER_API_SERVER, - - // remember that things you add from now on aren't automatically in the DB for old users - webPushServer: AppString.DEFAULT_PUSH_SERVER, }); }); diff --git a/src/db/tables/settings.ts b/src/db/tables/settings.ts index 135dc8d..4b3ad1e 100644 --- a/src/db/tables/settings.ts +++ b/src/db/tables/settings.ts @@ -12,15 +12,17 @@ export type BoundingBox = { * Settings type encompasses user-specific configuration details. */ export type Settings = { - id: number; // Only one entry using MASTER_SETTINGS_KEY + id: number; // Only one entry, keyed with MASTER_SETTINGS_KEY + activeDid?: string; // Active Decentralized ID apiServer?: string; // API server URL firstName?: string; // User's first name + isRegistered?: boolean; lastName?: string; // deprecated - put all names in firstName - lastViewedClaimId?: string; // Last viewed claim ID lastNotifiedClaimId?: string; // Last notified claim ID - isRegistered?: boolean; - webPushServer?: string; // Web Push server URL + lastViewedClaimId?: string; // Last viewed claim ID + reminderTime?: number; // Time in milliseconds since UNIX epoch for reminders + reminderOn?: boolean; // Toggle to enable or disable reminders // Array of named search boxes defined by bounding boxes searchBoxes?: Array<{ @@ -30,8 +32,9 @@ export type Settings = { showContactGivesInline?: boolean; // Display contact inline or not vapid?: string; // VAPID (Voluntary Application Server Identification) field for web push - reminderTime?: number; // Time in milliseconds since UNIX epoch for reminders - reminderOn?: boolean; // Toggle to enable or disable reminders + warnIfProdServer?: boolean; // Warn if using a production server + warnIfTestServer?: boolean; // Warn if using a testing server + webPushServer?: string; // Web Push server URL }; /** diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index 7e6ba96..1dad814 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -1,5 +1,7 @@