Remove partial files
This commit is contained in:
parent
d92453f950
commit
268f3417ea
|
@ -188,7 +188,6 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
mustZipDOM.onchange = () => {
|
mustZipDOM.onchange = () => {
|
||||||
console.debug(zipNameDOM.classList);
|
|
||||||
if (!mustZipDOM.checked) {
|
if (!mustZipDOM.checked) {
|
||||||
clearZip();
|
clearZip();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -110,24 +110,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
|
||||||
document.querySelector(".drop-zone").onkeydown = (event) => {
|
|
||||||
if(event.key === " ") {
|
|
||||||
document.getElementById("file-browser").click();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
document.querySelector(".info-delete-after-days").onclick = () => {
|
|
||||||
document.querySelector(".modal-delete-after-days").showModal();
|
|
||||||
}
|
|
||||||
|
|
||||||
document.querySelector(".close-modal").onclick = () => {
|
|
||||||
document.querySelector(".modal").close();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="hidden uploaded-zone">
|
<section class="hidden uploaded-zone">
|
||||||
|
@ -211,8 +193,12 @@
|
||||||
|
|
||||||
<dialog class="modal modal-delete-after-days">
|
<dialog class="modal modal-delete-after-days">
|
||||||
% use Number::Bytes::Human qw(format_bytes);
|
% use Number::Bytes::Human qw(format_bytes);
|
||||||
<div class="content">
|
<section>
|
||||||
|
<header>
|
||||||
<h1><%= l('Information about delays') %></h1>
|
<h1><%= l('Information about delays') %></h1>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
<p>
|
<p>
|
||||||
<%= l('If you choose a delay, the file will be deleted after that delay.') %><br>
|
<%= l('If you choose a delay, the file will be deleted after that delay.') %><br>
|
||||||
<%= l('Don\'t worry: if a user begins to download the file before the expiration and the download ends after the expiration, he will be able to get the file.') %>
|
<%= l('Don\'t worry: if a user begins to download the file before the expiration and the download ends after the expiration, he will be able to get the file.') %>
|
||||||
|
@ -246,15 +232,66 @@
|
||||||
</ul>
|
</ul>
|
||||||
% }
|
% }
|
||||||
</div>
|
</div>
|
||||||
<div class="actions">
|
|
||||||
|
<footer class="actions">
|
||||||
<button autofocus class="button close-modal"><%= l('Close') %></button>
|
<button autofocus class="button close-modal"><%= l('Close') %></button>
|
||||||
</div>
|
</footer>
|
||||||
|
</section>
|
||||||
</dialog>
|
</dialog>
|
||||||
% }
|
% }
|
||||||
|
|
||||||
% if (defined stash('invitation')) {
|
<script type="text/javascript">
|
||||||
%= javascript '/partial/index.js?token=' . stash('invitation')->token
|
const ws_url = '<%= url_for('upload')->to_abs() %>';
|
||||||
|
% if (defined($self->config('fixed_domain')) && $self->config('fixed_domain')) {
|
||||||
|
const baseURL = '<%= url_for('/')->host($self->config('fixed_domain'))->to_abs() %>';
|
||||||
% } else {
|
% } else {
|
||||||
%= javascript '/partial/index.js'
|
const baseURL = '<%= url_for('/')->to_abs() %>';
|
||||||
% }
|
% }
|
||||||
|
const actionURL = '<%= url_for('/')->to_abs() %>';
|
||||||
|
const i18n = {
|
||||||
|
enqueued: '<%= l('XXX file has been added to upload queue.') %>',
|
||||||
|
confirmExit: '<%= l('You have attempted to leave this page. The upload will be canceled. Are you sure?') %>',
|
||||||
|
copyAll: '<%= l('Copy all links to clipboard') %>',
|
||||||
|
copySuccess: '<%= l('The link(s) has been copied to your clipboard') %>',
|
||||||
|
copyFail: '<%= l('Unable to copy the link(s) to your clipboard') %>',
|
||||||
|
cpText: '<%= l('Copy to clipboard') %>',
|
||||||
|
delText: '<%= l('Deletion link') %>',
|
||||||
|
dlText: '<%= l('Download link') %>',
|
||||||
|
download: '<%= l('Download') %>',
|
||||||
|
encrypting: '<%= l('Encrypting part XX1 of XX2') %>',
|
||||||
|
expiration: '<%= l('Expiration:') %>',
|
||||||
|
fileUploaded: '<%= l('File uploaded') %>',
|
||||||
|
hit: '<%= l('Hit Enter, then Ctrl+C to copy the download link') %>',
|
||||||
|
hits: '<%= l('Hit Enter, then Ctrl+C to copy all the download links') %>',
|
||||||
|
mailTo: '<%= l('Send all links by email') %>',
|
||||||
|
maxSize: '<%= l('(max size: XXX)') %>',
|
||||||
|
noLimit: '<%= l('No expiration delay') %>',
|
||||||
|
sending: '<%= l('Sending part XX1 of XX2. Please, be patient, the progress bar can take a while to move.') %>',
|
||||||
|
wsProblem: '<%= l('Websocket communication error') %>',
|
||||||
|
};
|
||||||
|
const maxSize = <%= config('max_file_size') || 0 %>;
|
||||||
|
|
||||||
|
% if (defined stash('invitation')) {
|
||||||
|
const isGuest = true;
|
||||||
|
const sendFilesURLsURL = '<%= url_for('guest_send_mail', token => stash('invation')->token)->to_abs() %>';
|
||||||
|
% } else {
|
||||||
|
const isGuest = false;
|
||||||
|
% }
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
document.querySelector(".drop-zone").onkeydown = (event) => {
|
||||||
|
if(event.key === " ") {
|
||||||
|
document.getElementById("file-browser").click();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
document.querySelector(".info-delete-after-days").onclick = () => {
|
||||||
|
document.querySelector(".modal-delete-after-days").showModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
document.querySelector(".close-modal").onclick = () => {
|
||||||
|
document.querySelector(".modal").close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
%= javascript '/js/lufi-upload.js', type => 'module'
|
%= javascript '/js/lufi-upload.js', type => 'module'
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
const ws_url = '<%= url_for('upload')->to_abs() %>';
|
|
||||||
% if (defined($self->config('fixed_domain')) && $self->config('fixed_domain')) {
|
|
||||||
const baseURL = '<%= url_for('/')->host($self->config('fixed_domain'))->to_abs() %>';
|
|
||||||
% } else {
|
|
||||||
const baseURL = '<%= url_for('/')->to_abs() %>';
|
|
||||||
% }
|
|
||||||
const actionURL = '<%= url_for('/')->to_abs() %>';
|
|
||||||
const i18n = {
|
|
||||||
enqueued: '<%= l('XXX file has been added to upload queue.') %>',
|
|
||||||
confirmExit: '<%= l('You have attempted to leave this page. The upload will be canceled. Are you sure?') %>',
|
|
||||||
copyAll: '<%= l('Copy all links to clipboard') %>',
|
|
||||||
copySuccess: '<%= l('The link(s) has been copied to your clipboard') %>',
|
|
||||||
copyFail: '<%= l('Unable to copy the link(s) to your clipboard') %>',
|
|
||||||
cpText: '<%= l('Copy to clipboard') %>',
|
|
||||||
delText: '<%= l('Deletion link') %>',
|
|
||||||
dlText: '<%= l('Download link') %>',
|
|
||||||
download: '<%= l('Download') %>',
|
|
||||||
encrypting: '<%= l('Encrypting part XX1 of XX2') %>',
|
|
||||||
expiration: '<%= l('Expiration:') %>',
|
|
||||||
fileUploaded: '<%= l('File uploaded') %>',
|
|
||||||
hit: '<%= l('Hit Enter, then Ctrl+C to copy the download link') %>',
|
|
||||||
hits: '<%= l('Hit Enter, then Ctrl+C to copy all the download links') %>',
|
|
||||||
mailTo: '<%= l('Send all links by email') %>',
|
|
||||||
maxSize: '<%= l('(max size: XXX)') %>',
|
|
||||||
noLimit: '<%= l('No expiration delay') %>',
|
|
||||||
sending: '<%= l('Sending part XX1 of XX2. Please, be patient, the progress bar can take a while to move.') %>',
|
|
||||||
wsProblem: '<%= l('Websocket communication error') %>',
|
|
||||||
};
|
|
||||||
const maxSize = <%= config('max_file_size') || 0 %>;
|
|
||||||
|
|
||||||
% if (stash('token')) {
|
|
||||||
const isGuest = true;
|
|
||||||
const sendFilesURLsURL = '<%= url_for('guest_send_mail', token => stash('token'))->to_abs() %>';
|
|
||||||
% } else {
|
|
||||||
const isGuest = false;
|
|
||||||
% }
|
|
|
@ -1,64 +0,0 @@
|
||||||
const findItem = (name) => {
|
|
||||||
var files = localStorage.getItem(`${window.prefix}files`);
|
|
||||||
if (files === null) {
|
|
||||||
files = new Array();
|
|
||||||
} else {
|
|
||||||
files = JSON.parse(files);
|
|
||||||
}
|
|
||||||
var i;
|
|
||||||
for (i = 0; i < files.length; i++) {
|
|
||||||
if (files[i].short === name) {
|
|
||||||
return files[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function updateMailtoLink() {
|
|
||||||
var btn = document.getElementById('mailto');
|
|
||||||
var emails = document.getElementById('emails');
|
|
||||||
var subject = document.getElementById('subject');
|
|
||||||
var text = document.getElementById('body');
|
|
||||||
|
|
||||||
btn.href = `mailto:${encodeURIComponent(emails.value)}?subject=${encodeURIComponent(subject.value)}&body=${encodeURIComponent(text.value)}`;
|
|
||||||
}
|
|
||||||
function populateBody() {
|
|
||||||
var links = [
|
|
||||||
% my $ref = ref(stash('links'));
|
|
||||||
% if ($ref eq 'ARRAY') {
|
|
||||||
% for my $link (@{stash('links')}) {
|
|
||||||
'<%= $link %>',
|
|
||||||
% }
|
|
||||||
% } else {
|
|
||||||
'<%= stash('links') %>',
|
|
||||||
% }
|
|
||||||
];
|
|
||||||
var text = "<%== l('Hello,\n\nHere\'s some files I want to share with you:\n') %>";
|
|
||||||
links.forEach(function(name, index, array) {
|
|
||||||
var item = findItem(name);
|
|
||||||
if (item !== null && item !== undefined) {
|
|
||||||
var limit = (item.delay === 0) ? null : formatDate(item.delay * 86400 + item.created_at);
|
|
||||||
text += `- ${item.name}<%= l(':') %> ${item.url}`;
|
|
||||||
if (limit !== null) {
|
|
||||||
text += `\n (<%= l('deadline: ') %>${limit})`;
|
|
||||||
}
|
|
||||||
text += "\n";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
% if (!defined(config('ldap')) && !defined(config('htpasswd'))) {
|
|
||||||
text += "\n-- \n<%= l('Share your files in total privacy on %1', url_for('/')->to_abs) %>";
|
|
||||||
% }
|
|
||||||
tArea = document.getElementById('body').value = text;
|
|
||||||
updateMailtoLink();
|
|
||||||
}
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
% if (stash('populate')) {
|
|
||||||
populateBody();
|
|
||||||
% }
|
|
||||||
|
|
||||||
var emails = document.getElementById('emails');
|
|
||||||
var subject = document.getElementById('subject');
|
|
||||||
var text = document.getElementById('body');
|
|
||||||
emails.addEventListener('change', updateMailtoLink);
|
|
||||||
subject.addEventListener('change', updateMailtoLink);
|
|
||||||
text.addEventListener('change', updateMailtoLink);
|
|
||||||
});
|
|
|
@ -1,14 +0,0 @@
|
||||||
const ws_url = '<%= url_for('download')->to_abs().stash('file') %>';
|
|
||||||
const i18n = {
|
|
||||||
aborted1: '<%= l('Download aborted.') %>',
|
|
||||||
aborted2: '<%= l('Click here to refresh the page and restart the download.') %>',
|
|
||||||
badkey: '<%= l('It seems that the key in your URL is incorrect. Please, verify your URL.') %>',
|
|
||||||
confirmExit: '<%= l('You have attempted to leave this page. The download will be canceled. Are you sure?') %>',
|
|
||||||
download: '<%= l('Get the file') %>',
|
|
||||||
fileDownloaded: '<%= l('File downloaded') %>',
|
|
||||||
loading: '<%= l('Asking for file part XX1 of %1', stash('nbslices')) %>',
|
|
||||||
nokey: '<%= l('You don\'t seem to have a key in your URL. You won\'t be able to decrypt the file. Download canceled.') %>',
|
|
||||||
showZipContent: '<%= l('Show zip content') %>',
|
|
||||||
tooMuchAttempts: '<%= l('Unable to download the file: too much unsuccessful attempts to open a websocket. Please, contact the administrator.') %>',
|
|
||||||
zipContent: '<%= l('Zip content:') %>'
|
|
||||||
}
|
|
|
@ -80,8 +80,24 @@
|
||||||
|
|
||||||
<div class="message-card error"></div>
|
<div class="message-card error"></div>
|
||||||
</article>
|
</article>
|
||||||
%= javascript '/partial/render.js?nbslices='.stash('f')->nbslices.'&file='.stash('f')->short
|
|
||||||
%= javascript '/js/lufi-download.js', type => 'module'
|
|
||||||
% }
|
% }
|
||||||
% }
|
% }
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
const ws_url = '<%= url_for('download')->to_abs().stash('f')->short %>';
|
||||||
|
const i18n = {
|
||||||
|
aborted1: '<%= l('Download aborted.') %>',
|
||||||
|
aborted2: '<%= l('Click here to refresh the page and restart the download.') %>',
|
||||||
|
badkey: '<%= l('It seems that the key in your URL is incorrect. Please, verify your URL.') %>',
|
||||||
|
confirmExit: '<%= l('You have attempted to leave this page. The download will be canceled. Are you sure?') %>',
|
||||||
|
download: '<%= l('Get the file') %>',
|
||||||
|
fileDownloaded: '<%= l('File downloaded') %>',
|
||||||
|
loading: '<%= l('Asking for file part XX1 of %1', stash('f')->nbslices) %>',
|
||||||
|
nokey: '<%= l('You don\'t seem to have a key in your URL. You won\'t be able to decrypt the file. Download canceled.') %>',
|
||||||
|
showZipContent: '<%= l('Show zip content') %>',
|
||||||
|
tooMuchAttempts: '<%= l('Unable to download the file: too much unsuccessful attempts to open a websocket. Please, contact the administrator.') %>',
|
||||||
|
zipContent: '<%= l('Zip content:') %>'
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
%= javascript '/js/lufi-download.js', type => 'module'
|
Loading…
Reference in New Issue