From e3e8a1db1af7ba38ed825d907e50a3bfcd77faec Mon Sep 17 00:00:00 2001 From: Wim Brand Date: Tue, 6 Oct 2026 01:00:53 +0200 Subject: [PATCH] Move metered billing settings to the subscription tab --- .../src/user_home/HotlinkProgressBar.svelte | 6 +- svelte/src/user_home/Router.svelte | 6 + svelte/src/user_home/SharingSettings.svelte | 105 +----------------- .../src/user_home/StorageProgressBar.svelte | 2 +- svelte/src/user_home/SubscriptionUsage.svelte | 101 +++++++++++++++++ .../src/user_home/dashboard/CardUsage.svelte | 2 +- 6 files changed, 114 insertions(+), 108 deletions(-) create mode 100644 svelte/src/user_home/SubscriptionUsage.svelte diff --git a/svelte/src/user_home/HotlinkProgressBar.svelte b/svelte/src/user_home/HotlinkProgressBar.svelte index 291de41..35c2dbd 100644 --- a/svelte/src/user_home/HotlinkProgressBar.svelte +++ b/svelte/src/user_home/HotlinkProgressBar.svelte @@ -51,7 +51,7 @@ let included = $derived($user === null ? 0 : $user.subscription.monthly_transfer

{#if bill_shock}

- This is your bill shock limit. Increase + This is your bill shock limit. Increase or disable the limit to continue sharing files.

{:else if overdrawn} @@ -65,7 +65,7 @@ let included = $derived($user === null ? 0 : $user.subscription.monthly_transfer {:else}

Upgrade your plan or enable - usage based billing to continue + usage based billing to continue sharing files.

@@ -82,7 +82,7 @@ let included = $derived($user === null ? 0 : $user.subscription.monthly_transfer {#if bill_shock}

This is your bill shock limit, you can change it in the - sharing settings. + subscription settings.

{:else} diff --git a/svelte/src/user_home/Router.svelte b/svelte/src/user_home/Router.svelte index df97938..c29e7dd 100644 --- a/svelte/src/user_home/Router.svelte +++ b/svelte/src/user_home/Router.svelte @@ -11,6 +11,7 @@ import { onMount } from "svelte"; import { get_user, type User } from "lib/NovaAPI"; import SharingSettings from "./SharingSettings.svelte"; import SubscriptionManage from "./SubscriptionManage.svelte"; +import SubscriptionUsage from "./SubscriptionUsage.svelte"; let pages: Tab[] = [ { @@ -39,6 +40,11 @@ let pages: Tab[] = [ title: "Transactions", icon: "receipt", component: Transactions, + }, { + path: "/user/subscription/metered_billing", + title: "Metered billing", + icon: "data_usage", + component: SubscriptionUsage, }, ], }, { diff --git a/svelte/src/user_home/SharingSettings.svelte b/svelte/src/user_home/SharingSettings.svelte index 81304a3..5cd0f8c 100644 --- a/svelte/src/user_home/SharingSettings.svelte +++ b/svelte/src/user_home/SharingSettings.svelte @@ -1,26 +1,18 @@
- {#if $user !== null && $user.subscription.type === "subscription"} -

Usage based billing

-

- When your storage or data transfer goes over the limits of your - plan, uploads and downloads are blocked. With usage based billing - they keep working and the usage above the limits is billed at - {formatEuros($user.subscription.price_per_tb_storage, 2)} per TB per - month for storage and - {formatEuros($user.subscription.price_per_tb_bandwidth, 2)} per TB - for data transfer. -

-

- This usage is charged from your account credit afterwards. When - your balance is more than {formatEuros(period_price($user), 2)} below zero - (the price of your subscription period) the limits of your plan - apply again, until you top up your credit. -

- - {/if} - -

Bill shock limit

-

- Billshock limit in terabytes per month (1 TB = 1000 GB). Set to 0 to - disable. -

-
- -
TB
- -
- -

- Bandwidth used in the last 30 days: {formatDataVolume(transfer_used, 3)}, - new limit: {formatDataVolume(transfer_cap*1e12, 3)} -

- -

- The billshock limit limits how much bandwidth your account can use in a - 30 day window. When this limit is reached your files can't be downloaded - until your usage drops below it, and you will no longer be charged for - bandwidth usage. This is mostly useful with usage based billing, but it - works without it too. Set to 0 to disable the limit. -

-

Embedding controls

Here you can control which websites are allowed to embed your files in @@ -172,12 +77,6 @@ onMount(async () => {

diff --git a/svelte/src/user_home/dashboard/CardUsage.svelte b/svelte/src/user_home/dashboard/CardUsage.svelte index a7747fb..f7e7d00 100644 --- a/svelte/src/user_home/dashboard/CardUsage.svelte +++ b/svelte/src/user_home/dashboard/CardUsage.svelte @@ -59,6 +59,6 @@ onMount(async () => {

Egress used (30 days): - (
set custom limit) + (set custom limit) {/if}