Remove webPushDefaultEnabled
This commit is contained in:
parent
46f34ca1e3
commit
03aa67ed68
6 changed files with 8 additions and 80 deletions
|
@ -31,15 +31,6 @@ class Prefs {
|
|||
const deleteAfter = await this.db.prefs.get("deleteAfter");
|
||||
return deleteAfter ? Number(deleteAfter.value) : 604800; // Default is one week
|
||||
}
|
||||
|
||||
async webPushDefaultEnabled() {
|
||||
const obj = await this.db.prefs.get("webPushDefaultEnabled");
|
||||
return obj?.value ?? "initial";
|
||||
}
|
||||
|
||||
async setWebPushDefaultEnabled(enabled) {
|
||||
await this.db.prefs.put({ key: "webPushDefaultEnabled", value: enabled ? "enabled" : "disabled" });
|
||||
}
|
||||
}
|
||||
|
||||
const prefs = new Prefs(getDb());
|
||||
|
|
|
@ -78,16 +78,12 @@ class SubscriptionManager {
|
|||
async syncFromRemote(remoteSubscriptions, remoteReservations) {
|
||||
console.log(`[SubscriptionManager] Syncing subscriptions from remote`, remoteSubscriptions);
|
||||
|
||||
const webPushEnabled = (await prefs.webPushDefaultEnabled()) === "enabled";
|
||||
|
||||
// Add remote subscriptions
|
||||
const remoteIds = await Promise.all(
|
||||
remoteSubscriptions.map(async (remote) => {
|
||||
const reservation = remoteReservations?.find((r) => remote.base_url === config.base_url && remote.topic === r.topic) || null;
|
||||
|
||||
const local = await this.add(remote.base_url, remote.topic, {
|
||||
// only if same-origin subscription
|
||||
webPushEnabled: webPushEnabled && remote.base_url === config.base_url,
|
||||
displayName: remote.display_name, // May be undefined
|
||||
reservation, // May be null!
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue