1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-06-02 19:35:53 +02:00

Fully support auth in Web UI; persist users in localStorage (for now); add ugly ?auth=... param

This commit is contained in:
Philipp Heckel 2022-02-25 23:25:04 -05:00
parent 6d343c0f1a
commit 530f55c234
16 changed files with 237 additions and 72 deletions

View file

@ -1,11 +1,11 @@
import Connection from "./Connection";
export class ConnectionManager {
class ConnectionManager {
constructor() {
this.connections = new Map();
}
refresh(subscriptions, onNotification) {
refresh(subscriptions, users, onNotification) {
console.log(`[ConnectionManager] Refreshing connections`);
const subscriptionIds = subscriptions.ids();
const deletedIds = Array.from(this.connections.keys()).filter(id => !subscriptionIds.includes(id));
@ -16,8 +16,9 @@ export class ConnectionManager {
if (added) {
const baseUrl = subscription.baseUrl;
const topic = subscription.topic;
const user = users.get(baseUrl);
const since = 0;
const connection = new Connection(id, baseUrl, topic, since, onNotification);
const connection = new Connection(id, baseUrl, topic, user, since, onNotification);
this.connections.set(id, connection);
console.log(`[ConnectionManager] Starting new connection ${id}`);
connection.start();