Browse Source

rename "push" to "webPush" for future-proofing

adjust-note
Trent Larson 11 months ago
parent
commit
3bf8fd0c22
  1. 4
      src/App.vue
  2. 2
      src/db/index.ts
  3. 2
      src/db/tables/settings.ts
  4. 22
      src/views/AccountViewView.vue

4
src/App.vue

@ -285,8 +285,8 @@ export default class App extends Vue {
await db.open(); await db.open();
const settings = await db.settings.get(MASTER_SETTINGS_KEY); const settings = await db.settings.get(MASTER_SETTINGS_KEY);
let pushUrl: string = AppString.DEFAULT_PUSH_SERVER; let pushUrl: string = AppString.DEFAULT_PUSH_SERVER;
if (settings?.pushServer) { if (settings?.webPushServer) {
pushUrl = settings.pushServer; pushUrl = settings.webPushServer;
} }
await axios.get(pushUrl + "/web-push/vapid").then((response) => { await axios.get(pushUrl + "/web-push/vapid").then((response) => {

2
src/db/index.ts

@ -47,6 +47,6 @@ db.on("populate", () => {
apiServer: AppString.DEFAULT_ENDORSER_API_SERVER, apiServer: AppString.DEFAULT_ENDORSER_API_SERVER,
// remember that things you add from now on aren't automatically in the DB for old users // remember that things you add from now on aren't automatically in the DB for old users
pushServer: AppString.DEFAULT_PUSH_SERVER, webPushServer: AppString.DEFAULT_PUSH_SERVER,
}); });
}); });

2
src/db/tables/settings.ts

@ -20,7 +20,7 @@ export type Settings = {
lastViewedClaimId?: string; // Last viewed claim ID lastViewedClaimId?: string; // Last viewed claim ID
lastNotifiedClaimId?: string; // Last notified claim ID lastNotifiedClaimId?: string; // Last notified claim ID
isRegistered?: boolean; isRegistered?: boolean;
pushServer?: string; // Push server URL webPushServer?: string; // Web Push server URL
// Array of named search boxes defined by bounding boxes // Array of named search boxes defined by bounding boxes
searchBoxes?: Array<{ searchBoxes?: Array<{

22
src/views/AccountViewView.vue

@ -349,10 +349,10 @@
<input <input
type="text" type="text"
class="block w-full rounded border border-slate-400 px-3 py-2" class="block w-full rounded border border-slate-400 px-3 py-2"
v-model="pushServerInput" v-model="webPushServerInput"
/> />
<button <button
v-if="pushServerInput != pushServer" v-if="webPushServerInput != webPushServer"
class="px-4 rounded bg-red-500 border border-slate-400" class="px-4 rounded bg-red-500 border border-slate-400"
@click="onClickSavePushServer()" @click="onClickSavePushServer()"
> >
@ -360,19 +360,19 @@
</button> </button>
<button <button
class="px-4 rounded bg-slate-200 border border-slate-400" class="px-4 rounded bg-slate-200 border border-slate-400"
@click="pushServerInput = AppConstants.PROD_PUSH_SERVER" @click="webPushServerInput = AppConstants.PROD_PUSH_SERVER"
> >
Use Prod Use Prod
</button> </button>
<button <button
class="px-4 rounded bg-slate-200 border border-slate-400" class="px-4 rounded bg-slate-200 border border-slate-400"
@click="pushServerInput = AppConstants.TEST_PUSH_SERVER" @click="webPushServerInput = AppConstants.TEST_PUSH_SERVER"
> >
Use Test Use Test
</button> </button>
<button <button
class="px-4 rounded bg-slate-200 border border-slate-400" class="px-4 rounded bg-slate-200 border border-slate-400"
@click="pushServerInput = AppConstants.LOCAL_PUSH_SERVER" @click="webPushServerInput = AppConstants.LOCAL_PUSH_SERVER"
> >
Use Local Use Local
</button> </button>
@ -427,8 +427,8 @@ export default class AccountViewView extends Vue {
numAccounts = 0; numAccounts = 0;
publicHex = ""; publicHex = "";
publicBase64 = ""; publicBase64 = "";
pushServer = ""; webPushServer = "";
pushServerInput = ""; webPushServerInput = "";
limits: RateLimits | null = null; limits: RateLimits | null = null;
limitsMessage = ""; limitsMessage = "";
loadingLimits = true; // might as well now that we do it on mount, to avoid flashing the registration message loadingLimits = true; // might as well now that we do it on mount, to avoid flashing the registration message
@ -553,8 +553,8 @@ export default class AccountViewView extends Vue {
(settings?.firstName || "") + (settings?.firstName || "") +
(settings?.lastName ? ` ${settings.lastName}` : ""); // pre v 0.1.3 (settings?.lastName ? ` ${settings.lastName}` : ""); // pre v 0.1.3
this.isRegistered = !!settings?.isRegistered; this.isRegistered = !!settings?.isRegistered;
this.pushServer = (settings?.pushServer as string) || ""; this.webPushServer = (settings?.webPushServer as string) || "";
this.pushServerInput = (settings?.pushServer as string) || ""; this.webPushServerInput = (settings?.webPushServer as string) || "";
this.showContactGives = !!settings?.showContactGivesInline; this.showContactGives = !!settings?.showContactGivesInline;
} }
@ -886,9 +886,9 @@ export default class AccountViewView extends Vue {
async onClickSavePushServer() { async onClickSavePushServer() {
await db.open(); await db.open();
db.settings.update(MASTER_SETTINGS_KEY, { db.settings.update(MASTER_SETTINGS_KEY, {
pushServer: this.pushServerInput, webPushServer: this.webPushServerInput,
}); });
this.pushServer = this.pushServerInput; this.webPushServer = this.webPushServerInput;
} }
} }
</script> </script>

Loading…
Cancel
Save