Browse Source

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

adjust-note
Trent Larson 1 year 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();
const settings = await db.settings.get(MASTER_SETTINGS_KEY);
let pushUrl: string = AppString.DEFAULT_PUSH_SERVER;
if (settings?.pushServer) {
pushUrl = settings.pushServer;
if (settings?.webPushServer) {
pushUrl = settings.webPushServer;
}
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,
// 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
lastNotifiedClaimId?: string; // Last notified claim ID
isRegistered?: boolean;
pushServer?: string; // Push server URL
webPushServer?: string; // Web Push server URL
// Array of named search boxes defined by bounding boxes
searchBoxes?: Array<{

22
src/views/AccountViewView.vue

@ -349,10 +349,10 @@
<input
type="text"
class="block w-full rounded border border-slate-400 px-3 py-2"
v-model="pushServerInput"
v-model="webPushServerInput"
/>
<button
v-if="pushServerInput != pushServer"
v-if="webPushServerInput != webPushServer"
class="px-4 rounded bg-red-500 border border-slate-400"
@click="onClickSavePushServer()"
>
@ -360,19 +360,19 @@
</button>
<button
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
</button>
<button
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
</button>
<button
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
</button>
@ -427,8 +427,8 @@ export default class AccountViewView extends Vue {
numAccounts = 0;
publicHex = "";
publicBase64 = "";
pushServer = "";
pushServerInput = "";
webPushServer = "";
webPushServerInput = "";
limits: RateLimits | null = null;
limitsMessage = "";
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?.lastName ? ` ${settings.lastName}` : ""); // pre v 0.1.3
this.isRegistered = !!settings?.isRegistered;
this.pushServer = (settings?.pushServer as string) || "";
this.pushServerInput = (settings?.pushServer as string) || "";
this.webPushServer = (settings?.webPushServer as string) || "";
this.webPushServerInput = (settings?.webPushServer as string) || "";
this.showContactGives = !!settings?.showContactGivesInline;
}
@ -886,9 +886,9 @@ export default class AccountViewView extends Vue {
async onClickSavePushServer() {
await db.open();
db.settings.update(MASTER_SETTINGS_KEY, {
pushServer: this.pushServerInput,
webPushServer: this.webPushServerInput,
});
this.pushServer = this.pushServerInput;
this.webPushServer = this.webPushServerInput;
}
}
</script>

Loading…
Cancel
Save