mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-06-03 19:58:06 +02:00
Navigation access icon
This commit is contained in:
parent
2f725bf80d
commit
2500ce0920
3 changed files with 57 additions and 19 deletions
web/src/app
|
@ -35,7 +35,7 @@ class SubscriptionManager {
|
|||
return subscription;
|
||||
}
|
||||
|
||||
async syncFromRemote(remoteSubscriptions) {
|
||||
async syncFromRemote(remoteSubscriptions, remoteReservations) {
|
||||
console.log(`[SubscriptionManager] Syncing subscriptions from remote`, remoteSubscriptions);
|
||||
|
||||
// Add remote subscriptions
|
||||
|
@ -43,8 +43,10 @@ class SubscriptionManager {
|
|||
for (let i = 0; i < remoteSubscriptions.length; i++) {
|
||||
const remote = remoteSubscriptions[i];
|
||||
const local = await this.add(remote.base_url, remote.topic);
|
||||
const reservation = remoteReservations?.find(r => remote.base_url === config.baseUrl && remote.topic === r.topic) || null;
|
||||
await this.setRemoteId(local.id, remote.id);
|
||||
await this.setDisplayName(local.id, remote.display_name);
|
||||
await this.setReservation(local.id, reservation); // May be null!
|
||||
remoteIds.push(remote.id);
|
||||
}
|
||||
|
||||
|
@ -174,6 +176,12 @@ class SubscriptionManager {
|
|||
});
|
||||
}
|
||||
|
||||
async setReservation(subscriptionId, reservation) {
|
||||
await db.subscriptions.update(subscriptionId, {
|
||||
reservation: reservation
|
||||
});
|
||||
}
|
||||
|
||||
async pruneNotifications(thresholdTimestamp) {
|
||||
await db.notifications
|
||||
.where("time").below(thresholdTimestamp)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue