mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-06-18 10:33:11 +02:00
Add more tests, change endpoint
This commit is contained in:
parent
341e84f643
commit
ff7e894e4c
7 changed files with 176 additions and 27 deletions
web/src/app
|
@ -6,7 +6,7 @@ import {
|
|||
topicUrlAuth,
|
||||
topicUrlJsonPoll,
|
||||
topicUrlJsonPollWithSince,
|
||||
accountWebPushUrl,
|
||||
webPushUrl,
|
||||
} from "./utils";
|
||||
import userManager from "./UserManager";
|
||||
import { fetchOrThrow } from "./errors";
|
||||
|
@ -117,7 +117,7 @@ class Api {
|
|||
|
||||
async updateWebPush(pushSubscription, topics) {
|
||||
const user = await userManager.get(config.base_url);
|
||||
const url = accountWebPushUrl(config.base_url);
|
||||
const url = webPushUrl(config.base_url);
|
||||
console.log(`[Api] Updating Web Push subscription`, { url, topics, endpoint: pushSubscription.endpoint });
|
||||
const serializedSubscription = JSON.parse(JSON.stringify(pushSubscription)); // Ugh ... https://stackoverflow.com/a/40525434/1440785
|
||||
await fetchOrThrow(url, {
|
||||
|
@ -134,7 +134,7 @@ class Api {
|
|||
|
||||
async deleteWebPush(pushSubscription) {
|
||||
const user = await userManager.get(config.base_url);
|
||||
const url = accountWebPushUrl(config.base_url);
|
||||
const url = webPushUrl(config.base_url);
|
||||
console.log(`[Api] Deleting Web Push subscription`, { url, endpoint: pushSubscription.endpoint });
|
||||
await fetchOrThrow(url, {
|
||||
method: "DELETE",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue