1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-06-20 11:31:47 +02:00

Add Dexie for persistence; user management with dexie; this is the way

This commit is contained in:
Philipp Heckel 2022-03-01 21:23:12 -05:00
parent 8036aa2942
commit 23d275acec
16 changed files with 285 additions and 494 deletions
web/src/app

View file

@ -7,9 +7,11 @@ import {
topicShortUrl,
topicUrlJsonPollWithSince
} from "./utils";
import db from "./db";
class Api {
async poll(baseUrl, topic, since, user) {
async poll(baseUrl, topic, since) {
const user = await db.users.get(baseUrl);
const shortUrl = topicShortUrl(baseUrl, topic);
const url = (since)
? topicUrlJsonPollWithSince(baseUrl, topic, since)
@ -24,7 +26,8 @@ class Api {
return messages;
}
async publish(baseUrl, topic, user, message) {
async publish(baseUrl, topic, message) {
const user = await db.users.get(baseUrl);
const url = topicUrl(baseUrl, topic);
console.log(`[Api] Publishing message to ${url}`);
await fetch(url, {