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

publishSyncEvent, Stripe endpoint changes

This commit is contained in:
binwiederhier 2023-01-16 16:35:37 -05:00
parent 7faed3ee1e
commit 83de879894
14 changed files with 424 additions and 262 deletions
web/src/app

View file

@ -264,11 +264,20 @@ class AccountApi {
this.triggerChange(); // Dangle!
}
async createBillingSubscription(tier) {
console.log(`[AccountApi] Creating billing subscription with ${tier}`);
return await this.upsertBillingSubscription("POST", tier)
}
async updateBillingSubscription(tier) {
console.log(`[AccountApi] Updating billing subscription with ${tier}`);
return await this.upsertBillingSubscription("PUT", tier)
}
async upsertBillingSubscription(method, tier) {
const url = accountBillingSubscriptionUrl(config.base_url);
console.log(`[AccountApi] Requesting tier change to ${tier}`);
const response = await fetch(url, {
method: "POST",
method: method,
headers: withBearerAuth({}, session.token()),
body: JSON.stringify({
tier: tier
@ -284,7 +293,7 @@ class AccountApi {
async deleteBillingSubscription() {
const url = accountBillingSubscriptionUrl(config.base_url);
console.log(`[AccountApi] Cancelling paid subscription`);
console.log(`[AccountApi] Cancelling billing subscription`);
const response = await fetch(url, {
method: "DELETE",
headers: withBearerAuth({}, session.token())
@ -345,6 +354,7 @@ class AccountApi {
}
async triggerChange() {
return null;
const account = await this.get();
if (!account.sync_topic) {
return;