From 3ee6a37319c9ee9392fc1ea1e9cf4d07f3ea2f31 Mon Sep 17 00:00:00 2001 From: Wim Brand Date: Wed, 6 Oct 2021 19:31:10 +0200 Subject: [PATCH] Warn users about high storage and bandwidth usage --- svelte/src/admin_panel/Home.svelte | 4 +- svelte/src/home_page/HomePage.svelte | 4 +- svelte/src/user_home/Home.svelte | 72 +++++++++++++++++++++++----- 3 files changed, 65 insertions(+), 15 deletions(-) diff --git a/svelte/src/admin_panel/Home.svelte b/svelte/src/admin_panel/Home.svelte index 3bc22f1..fc6ab77 100644 --- a/svelte/src/admin_panel/Home.svelte +++ b/svelte/src/admin_panel/Home.svelte @@ -125,7 +125,7 @@ onDestroy(() => {
-

Bandwidth and views

+

Bandwidth, hotlinking and views

@@ -145,7 +145,7 @@ onDestroy(() => {
Total usage from {start_time} to {end_time}
{formatDataVolume(total_bandwidth, 3)} bandwidth, - {formatDataVolume(total_hotlink), 3} hotlink bandwidth and + {formatDataVolume(total_hotlink, 3)} hotlink bandwidth and {formatThousands(total_views, 3)} views
diff --git a/svelte/src/home_page/HomePage.svelte b/svelte/src/home_page/HomePage.svelte index 0481fe3..faac02b 100644 --- a/svelte/src/home_page/HomePage.svelte +++ b/svelte/src/home_page/HomePage.svelte @@ -529,8 +529,8 @@ const keydown = (e) => { can upload anything it's hard to find reputable advertisers who want to advertise on pixeldrain. Every month the ad revenue just barely covers the bandwidth costs. If this continues I will have - to resort to adding more shady ads, or reducing the file size - and bandwidth limits. That's not something I would like to do. + to reduce the file size and bandwidth limits even more. That's + not something I would like to do.

Pro costs only €20 per year or €2 per month. You will get diff --git a/svelte/src/user_home/Home.svelte b/svelte/src/user_home/Home.svelte index 189f4e8..bc570ab 100644 --- a/svelte/src/user_home/Home.svelte +++ b/svelte/src/user_home/Home.svelte @@ -64,7 +64,7 @@ let graph_timespan = 0 let update_graphs = (minutes, interval, live) => { if (graph_timeout !== null) { clearTimeout(graph_timeout) } if (live) { - graph_timeout = setTimeout(() => { update_graphs(minutes, interval, true) }, 10000) + graph_timeout = setTimeout(() => { update_graphs(minutes, interval, true) }, 6000) } graph_timespan = minutes @@ -154,7 +154,30 @@ onDestroy(() => {

-
+ + {#if storage_percent > 0.99} +
+ You have used all of your storage space. You won't be able to + upload new files anymore. Please upgrade to a higher support + tier to continue uploading files: +
+ + Upgrade options + +
+ {:else if storage_percent > 0.8} +
+ You have used {(storage_percent*100).toFixed(0)}% of your + storage space. If your storage space runs out you won't be able + to upload new files anymore. Please upgrade to a higher support + tier to continue uploading files: +
+ + Upgrade options + +
+ {/if} + Hotlink bandwidth: {formatDataVolume(direct_link_bandwidth_used, 3)} out of @@ -165,6 +188,32 @@ onDestroy(() => {
+ {#if direct_link_percent > 0.99} +
+ You have used all of your hotlink bandwidth. Other people won't + be able to download your files directly from the API anymore. + Downloads will have to go through the file viewer page. Please + upgrade to a higher support tier to continue hotlinking files: +
+ + Upgrade options + +
+ {:else if direct_link_percent > 0.8} +
+ You have used {(direct_link_percent*100).toFixed(0)}% of your + hotlink bandwidth. If your hotlink bandwidth runs out people + won't be able to download your files directly from the API + anymore. Downloads will have to go through the file viewer page. + Please upgrade to a higher support tier to continue hotlinking + files: +
+ + Upgrade options + +
+ {/if} +

Exports

@@ -259,26 +308,27 @@ onDestroy(() => {
-

Direct link bandwidth

+

Hotlink bandwidth

When a file is downloaded without going through pixeldrain's - download page it counts as a direct download. Because direct - downloads cost us bandwidth and don't generate any ad - revenue we have to limit them. When your direct link - bandwidth runs out people will be asked to do a test before - they can download your files. See our - subscription options to get more direct - linking bandwidth. + download page it counts as a hotlink. Because hotlinking costs us + bandwidth and doesn't generate any ad revenue we have to limit it. + When your hotlink bandwidth runs out people will be asked to do a + test before they can download your files. See our + subscription options to get more hotlink + bandwidth.

- +