mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-06-05 12:34:34 +02:00
Start work on ephemeral topics
This commit is contained in:
parent
0aefcf29ef
commit
d3462d2905
4 changed files with 31 additions and 14 deletions
web/src/app
|
@ -1,8 +1,9 @@
|
|||
import db from "./db";
|
||||
import {topicUrl} from "./utils";
|
||||
|
||||
class SubscriptionManager {
|
||||
/** All subscriptions, including "new count"; this is a JOIN, see https://dexie.org/docs/API-Reference#joining */
|
||||
async all() {
|
||||
// All subscriptions, including "new count"; this is a JOIN, see https://dexie.org/docs/API-Reference#joining
|
||||
const subscriptions = await db.subscriptions.toArray();
|
||||
await Promise.all(subscriptions.map(async s => {
|
||||
s.new = await db.notifications
|
||||
|
@ -16,8 +17,16 @@ class SubscriptionManager {
|
|||
return await db.subscriptions.get(subscriptionId)
|
||||
}
|
||||
|
||||
async save(subscription) {
|
||||
async add(baseUrl, topic, ephemeral) {
|
||||
const subscription = {
|
||||
id: topicUrl(baseUrl, topic),
|
||||
baseUrl: baseUrl,
|
||||
topic: topic,
|
||||
ephemeral: ephemeral,
|
||||
last: null
|
||||
};
|
||||
await db.subscriptions.put(subscription);
|
||||
return subscription;
|
||||
}
|
||||
|
||||
async updateState(subscriptionId, state) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue