Warn users if a file is too large to upload

This commit is contained in:
2021-09-27 12:04:39 +02:00
parent 3c478720c9
commit 85a4ca2c9d
4 changed files with 24 additions and 5 deletions

View File

@@ -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;
}

View File

@@ -133,6 +133,14 @@
mission to make content sharing easier, safer and faster for
everyone.
</p>
<p>
Pixeldrain uses
<a
href="https://en.wikipedia.org/wiki/Byte#Multiple-byte_units" target="_blank">SI
standard units</a> for measuring file sizes. If you are using
Windows your files may appear smaller than they actually are.
</p>
<br/>
<div class="feat_table">
<div>
<div></div>
@@ -141,9 +149,9 @@
</div>
<div>
<div class="feat_label">Size limit per file</div>
<div class="feat_normal">5 GB per file</div>
<div class="feat_normal">5 GB per file (4.66 GiB)</div>
<div class="feat_pro">
<span class="text_highlight">15 GB</span> per file
<span class="text_highlight">15 GB</span> per file (13.97 GiB)
</div>
</div>
<div>
@@ -276,7 +284,7 @@
{{end}}
</div>
<div class="feat_pro features_cell round_tr">
<div><span class="text_highlight">20 GB</span> max file size<br/></div>
<div><span class="text_highlight">20 GB</span> max file size (18.63 GiB)<br/></div>
<div><span class="text_highlight">120 days</span> file expiry</div>
<div><span class="text_highlight">2 TB</span> direct link bandwidth<br/></div>
<div><span class="text_highlight">2 TB</span> storage space<br/></div>

View File

@@ -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)

View File

@@ -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;