From 85a4ca2c9def2a7562eb86e7069023430a6f01a5 Mon Sep 17 00:00:00 2001
From: Wim Brand
Date: Mon, 27 Sep 2021 12:04:39 +0200
Subject: [PATCH] Warn users if a file is too large to upload
---
res/include/style/modal.css | 2 +-
res/template/home.html | 14 +++++++++++---
svelte/src/home_page/UploadProgressBar.svelte | 11 +++++++++++
svelte/src/util/Modal.svelte | 2 +-
4 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/res/include/style/modal.css b/res/include/style/modal.css
index 95cec9c..2f8e917 100644
--- a/res/include/style/modal.css
+++ b/res/include/style/modal.css
@@ -24,7 +24,7 @@
box-sizing: border-box;
text-align: left;
box-shadow: var(--shadow_color) 0px 0px 50px;
- border-radius: 16px 16px 8px 8px;
+ border-radius: 20px 20px 8px 8px;
overflow: hidden;
}
diff --git a/res/template/home.html b/res/template/home.html
index 8faa20c..79ab99d 100644
--- a/res/template/home.html
+++ b/res/template/home.html
@@ -133,6 +133,14 @@
mission to make content sharing easier, safer and faster for
everyone.
+
+ Pixeldrain uses
+ SI
+ standard units for measuring file sizes. If you are using
+ Windows your files may appear smaller than they actually are.
+
+
Size limit per file
-
5 GB per file
+
5 GB per file (4.66 GiB)
- 15 GB per file
+ 15 GB per file (13.97 GiB)
@@ -276,7 +284,7 @@
{{end}}
-
20 GB max file size
+
20 GB max file size (18.63 GiB)
120 days file expiry
2 TB direct link bandwidth
2 TB storage space
diff --git a/svelte/src/home_page/UploadProgressBar.svelte b/svelte/src/home_page/UploadProgressBar.svelte
index a0f0359..ed5578c 100644
--- a/svelte/src/home_page/UploadProgressBar.svelte
+++ b/svelte/src/home_page/UploadProgressBar.svelte
@@ -78,6 +78,17 @@ const on_failure = (status, message) => {
}
export const start = () => {
+ if (window.user_subscription.file_size_limit === 0) {
+ window.user_subscription.file_size_limit = 5e9
+ }
+ if (job.total_size > window.user_subscription.file_size_limit) {
+ on_failure(
+ "file_too_large",
+ "This file is too large. Check out the Pro subscription to increase the file size limit"
+ )
+ return
+ }
+
start_time = new Date().getTime()
if (stats_interval === null) {
stats_interval = setInterval(on_progress, stats_interval_ms)
diff --git a/svelte/src/util/Modal.svelte b/svelte/src/util/Modal.svelte
index 86e7a95..f99382d 100644
--- a/svelte/src/util/Modal.svelte
+++ b/svelte/src/util/Modal.svelte
@@ -83,7 +83,7 @@ const keydown = e => {
left: 50%;
transform: translate(-50%, -20%);
padding: 0;
- border-radius: 16px 16px 8px 8px;
+ border-radius: 20px 20px 8px 8px;
overflow: hidden;
box-sizing: border-box;
text-align: left;