Fix #18 + add img and video tags showing the downloaded file

This commit is contained in:
Luc Didry 2015-10-11 15:31:55 +02:00 committed by Luc Didry
parent e9bff89954
commit e6dca37d6b
10 changed files with 82 additions and 20 deletions

View File

@ -45,6 +45,11 @@ msgstr ""
msgid "As Lufi is a free software licensed under of the terms of the <a href=\"https://gnu.org/licenses/agpl.html\" class=\"classic\">AGPLv3</a>, you can install it on you own server. Have a look on the <a href=\"https://git.framasoft.org/luc/lufi/wikis/home\" class=\"classic\">Wiki</a> for the procedure."
msgstr ""
#. (stash('f')
#: themes/default/templates/render.html.ep:22
msgid "Asking for file part XX1 of %1"
msgstr ""
#: themes/default/templates/about.html.ep:21
msgid "Back to homepage"
msgstr ""
@ -89,7 +94,7 @@ msgstr ""
msgid "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."
msgstr ""
#: themes/default/templates/index.html.ep:86 themes/default/templates/render.html.ep:20
#: themes/default/templates/index.html.ep:86 themes/default/templates/render.html.ep:21
msgid "Download"
msgstr ""
@ -205,7 +210,7 @@ msgstr ""
msgid "Information about delays"
msgstr ""
#: themes/default/templates/render.html.ep:18
#: themes/default/templates/render.html.ep:19
msgid "It seems that the key in your URL is incorrect. Please, verify your URL."
msgstr ""
@ -368,11 +373,11 @@ msgstr ""
msgid "You don't need to register yourself to upload files but be aware that, for legal reasons, your IP address will be stored when you send a file. Don't panic, it is normally the case of all sites on which you send files."
msgstr ""
#: themes/default/templates/render.html.ep:21
#: themes/default/templates/render.html.ep:23
msgid "You don't seem to have a key in your URL. You won't be able to decrypt the file. Download canceled."
msgstr ""
#: themes/default/templates/render.html.ep:19
#: themes/default/templates/render.html.ep:20
msgid "You have attempted to leave this page. The download will be canceled. Are you sure?"
msgstr ""

View File

@ -51,6 +51,11 @@ msgstr "À propos"
msgid "As Lufi is a free software licensed under of the terms of the <a href=\"https://gnu.org/licenses/agpl.html\" class=\"classic\">AGPLv3</a>, you can install it on you own server. Have a look on the <a href=\"https://git.framasoft.org/luc/lufi/wikis/home\" class=\"classic\">Wiki</a> for the procedure."
msgstr "Comme Lufi est un logiciel libre soumis aux termes de la license <a href=\"https://gnu.org/licenses/agpl.html\" class=\"classic\">AGPLv3</a>, vous pouvez linstaller sur votre propre serveur. Veuillez consulter le <a href=\"https://git.framasoft.org/luc/lufi/wikis/home\" class=\"classic\">Wiki</a> pour voir la procédure."
#. (stash('f')
#: themes/default/templates/render.html.ep:22
msgid "Asking for file part XX1 of %1"
msgstr "Demande de récupération du fragment de fichier XX1 sur %1"
#: themes/default/templates/about.html.ep:21
msgid "Back to homepage"
msgstr "Retour à la page daccueil"
@ -95,7 +100,7 @@ msgstr "Lien de suppression"
msgid "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."
msgstr "Ne vous inquiétez pas : si un utilisateur commence à télécharger le fichier avant son expiration et que le téléchargement se termine après lexpiration, lutilisateur pourra quand même récupérer le fichier."
#: themes/default/templates/index.html.ep:86 themes/default/templates/render.html.ep:20
#: themes/default/templates/index.html.ep:86 themes/default/templates/render.html.ep:21
msgid "Download"
msgstr "Télécharger"
@ -211,7 +216,7 @@ msgstr "Important : plus dinformations sur les délais"
msgid "Information about delays"
msgstr "Information sur les délais"
#: themes/default/templates/render.html.ep:18
#: themes/default/templates/render.html.ep:19
msgid "It seems that the key in your URL is incorrect. Please, verify your URL."
msgstr "Il semble que la clé dans votre URL soit incorrecte. Veuillez vérifier votre URL."
@ -382,11 +387,11 @@ msgstr "Vous pouvez voir la liste de vos fichiers en cliquant sur le lien « Mes
msgid "You don't need to register yourself to upload files but be aware that, for legal reasons, your IP address will be stored when you send a file. Don't panic, it is normally the case of all sites on which you send files."
msgstr "Vous navez pas besoin de vous enregistrer pour envoyer des fichiers mais notez que, pour des raisons légales, votre adresse IP sera enregistrée quand vous envoyez un fichier. Ne paniquez pas, cest normalement le cas pour tous les sites où vous envoyez des fichiers."
#: themes/default/templates/render.html.ep:21
#: themes/default/templates/render.html.ep:23
msgid "You don't seem to have a key in your URL. You won't be able to decrypt the file. Download canceled."
msgstr "Il semble que vous nayez pas de clé dans votre URL. Vous ne serez pas capable de déchiffrer le fichier. Téléchargement annulé."
#: themes/default/templates/render.html.ep:19
#: themes/default/templates/render.html.ep:20
msgid "You have attempted to leave this page. The download will be canceled. Are you sure?"
msgstr "Vous essayez de quitter la page. Le téléchargement sera annulé. Êtes-vous sûr(e) ?"

View File

@ -393,8 +393,9 @@
"labels.less",
"alerts.less",
"progress-bars.less",
"list-group.less"
"list-group.less",
"responsive-embed.less"
],
"js": [],
"customizerUrl": "http://getbootstrap.com/customize/?id=524bae2807d3b239cf66"
"customizerUrl": "http://getbootstrap.com/customize/?id=a91c594ef35f35061756"
}

View File

@ -5,8 +5,8 @@
*/
/*!
* Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=524bae2807d3b239cf66)
* Config saved to config.json and https://gist.github.com/524bae2807d3b239cf66
* Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=a91c594ef35f35061756)
* Config saved to config.json and https://gist.github.com/a91c594ef35f35061756
*/
/*!
* Bootstrap v3.3.5 (http://getbootstrap.com)

View File

@ -5,8 +5,8 @@
*/
/*!
* Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=524bae2807d3b239cf66)
* Config saved to config.json and https://gist.github.com/524bae2807d3b239cf66
* Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=a91c594ef35f35061756)
* Config saved to config.json and https://gist.github.com/a91c594ef35f35061756
*//*!
* Bootstrap v3.3.5 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.

View File

@ -5,8 +5,8 @@
*/
/*!
* Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=524bae2807d3b239cf66)
* Config saved to config.json and https://gist.github.com/524bae2807d3b239cf66
* Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=a91c594ef35f35061756)
* Config saved to config.json and https://gist.github.com/a91c594ef35f35061756
*/
/*!
* Bootstrap v3.3.5 (http://getbootstrap.com)
@ -3548,6 +3548,32 @@ button.list-group-item-danger.active:focus {
margin-bottom: 0;
line-height: 1.3;
}
.embed-responsive {
position: relative;
display: block;
height: 0;
padding: 0;
overflow: hidden;
}
.embed-responsive .embed-responsive-item,
.embed-responsive iframe,
.embed-responsive embed,
.embed-responsive object,
.embed-responsive video {
position: absolute;
top: 0;
left: 0;
bottom: 0;
height: 100%;
width: 100%;
border: 0;
}
.embed-responsive-16by9 {
padding-bottom: 56.25%;
}
.embed-responsive-4by3 {
padding-bottom: 75%;
}
.clearfix:before,
.clearfix:after,
.dl-horizontal dd:before,

File diff suppressed because one or more lines are too long

View File

@ -37,3 +37,9 @@ a.classic:focus {
@-moz-document url-prefix() {
fieldset { display: table-cell; }
}
#render-image {
max-width: 100%;
max-height: 200px;
margin-left: auto;
margin-right: auto;
}

View File

@ -46,6 +46,9 @@ function spawnWebsocket(pa) {
var ws = new WebSocket(ws_url);
ws.onopen = function() {
console.log('Connection is established!');
var l = document.getElementById('loading');
l.innerHTML = i18n.loading.replace(/XX1/, pa);
window.ws.send('{"part":'+pa+'}');
};
ws.onclose = function() {
@ -79,15 +82,29 @@ function spawnWebsocket(pa) {
var blob = new File(a, data.name, {type: data.type});
document.getElementById('please-wait').remove();
document.getElementById('loading').remove();
var pbd = document.getElementById('pbd');
pbd.setAttribute('class', '');
pbd.innerHTML = '<a href="'+URL.createObjectURL(blob)+'" class="btn btn-primary" download="'+data.name+'">'+i18n.download+'</a>';
var blobURL = URL.createObjectURL(blob);
var innerHTML = '<p><a href="'+blobURL+'" class="btn btn-primary" download="'+data.name+'">'+i18n.download+'</a></p>';
if (data.type.match(/^image\//) !== null) {
innerHTML += '<img id="render-image" class="img-responsive" alt="'+data.name+'" src="'+blobURL+'">';
} else if (data.type.match(/^video\//) !== null) {
innerHTML += '<div class="embed-responsive embed-responsive-16by9">'
+'<video class="embed-responsive-item" controls>'
+' <source src="'+blobURL+'" type="'+data.type+'">'
+'</video></div>';
}
pbd.innerHTML = innerHTML;
window.ws.send('{"ended":true}');
window.onbeforeunload = null;
window.completed = true;
} else {
var l = document.getElementById('loading');
l.innerHTML = i18n.loading.replace(/XX1/, (data.part + 1));
if (ws.readyState === 3) {
window.ws = spawnWebsocket(data.part + 1);
} else {

View File

@ -7,6 +7,7 @@
<div class="alert alert-danger"><%= stash('msg') %></div>
% } else {
<p id="please-wait"><%= l('Please wait while we are getting your file') %></p>
<p id="loading"></p>
<div class="progress" id="pbd">
<div id="pb" class="progress-bar progress-bar-info progress-bar-striped active" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0;">
<span id="pbt" class="sr-only">0%</span>
@ -18,6 +19,7 @@ var i18n = {
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('Download') %>',
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.') %>',
}
% end