diff --git a/src/upload.rs b/src/upload.rs index 02cb518..b06e012 100644 --- a/src/upload.rs +++ b/src/upload.rs @@ -139,7 +139,7 @@ struct UploadManifest { enum ServerMessage { Ready { code: String }, TooBig { max_size: u64 }, - TooLong { max_lifetime: u16 }, + TooLong { max_days: u16 }, IncorrectPassword, Error { details: String }, } @@ -150,8 +150,8 @@ impl From<&Error> for ServerMessage { Error::TooBig(max_size) => ServerMessage::TooBig { max_size: *max_size, }, - Error::TooLong(max_lifetime) => ServerMessage::TooLong { - max_lifetime: *max_lifetime, + Error::TooLong(max_days) => ServerMessage::TooLong { + max_days: *max_days, }, Error::IncorrectPassword => ServerMessage::IncorrectPassword, _ => ServerMessage::Error { diff --git a/static/css/states.css b/static/css/states.css index 165854f..748c4a3 100644 --- a/static/css/states.css +++ b/static/css/states.css @@ -2,7 +2,6 @@ * List of classes the body can have: * * landing: haven't entered upload password yet - * uploads_closed: uploading is currently unavailable * no_files: no files are selected * selecting: upload hasn't started yet * uploading: upload is in progress @@ -16,11 +15,7 @@ body.landing .section_heading { display: revert; } #download { display: none; } body.landing #download { display: revert; } -#uploads_closed_notice { display: none; } -body.uploads_closed #uploads_closed_notice { display: revert; } - body.noscript #upload { display: none; } -body.uploads_closed #upload { display: none; } #message { display: none; } body.completed #message { diff --git a/static/css/transbeam.css b/static/css/transbeam.css index 1ca0dfe..8dab70e 100644 --- a/static/css/transbeam.css +++ b/static/css/transbeam.css @@ -60,7 +60,7 @@ body { width: 18px; height: 18px; background-color: #333; - mask-image: url("../images/feather-icons/copy.svg"); + mask-image: url("images/feather-icons/copy.svg"); mask-size: contain; mask-repeat: no-repeat; } @@ -108,7 +108,7 @@ td { .delete_button { background-color: #888; - mask-image: url("../images/feather-icons/x.svg"); + mask-image: url("images/feather-icons/x.svg"); mask-size: contain; mask-repeat: no-repeat; mask-position: center; diff --git a/static/index.html b/static/index.html index 58ecd49..ff438e6 100644 --- a/static/index.html +++ b/static/index.html @@ -29,9 +29,6 @@ -
-

Uploading is currently closed.

-

Upload

diff --git a/static/js/upload.js b/static/js/upload.js index c61c1b9..6cca00c 100644 --- a/static/js/upload.js +++ b/static/js/upload.js @@ -23,7 +23,7 @@ let progress; let progressBar; document.addEventListener('DOMContentLoaded', () => { - document.body.className = 'landing'; + document.body.className = "landing"; messageBox = document.getElementById('message'); fileInput = document.getElementById('file_input'); @@ -34,17 +34,6 @@ document.addEventListener('DOMContentLoaded', () => { progress = document.getElementById('progress'); progressBar = document.getElementById('progress_bar'); - fetch('/upload/limits.json') - .then((res) => res.json()) - .then((limits) => { - if (limits.open === false) { - document.body.className = 'uploads_closed landing'; - return; - } - maxSize = limits.max_size; - updateMaxLifetime(limits.max_lifetime); - }); - const uploadPasswordInput = document.getElementById('upload_password'); const uploadPasswordForm = document.getElementById('upload_password_form'); uploadPasswordForm.addEventListener('submit', (e) => { @@ -204,8 +193,17 @@ function handleMessage(msg) { maxSize = reply.max_size; updateFiles(); } else if (reply.type === 'too_long') { - updateMaxLifetime(reply.max_lifetime); - displayError(`The maximum retention time for uploads is ${reply.max_lifetime} days`); + let options = Array.from(lifetimeInput.options); + options.reverse(); + for (const option of options) { + if (option.value > reply.max_days) { + option.disabled = true; + } else { + option.selected = true; + break; + } + } + displayError(`The maximum retention time for uploads is ${reply.max_days} days`); } else if (reply.type === 'incorrect_password') { messageBox.textContent = ('Incorrect password'); document.body.className = 'error landing'; @@ -223,19 +221,6 @@ function handleMessage(msg) { } } -function updateMaxLifetime(lifetime) { - let options = Array.from(lifetimeInput.options); - options.reverse(); - for (const option of options) { - if (option.value > lifetime) { - option.disabled = true; - } else { - option.selected = true; - break; - } - } -} - function sendData() { if (fileIndex >= files.length) { finishSending();