diff --git a/customize.dist/main.css b/customize.dist/main.css index 6ec0172ea..063324504 100644 --- a/customize.dist/main.css +++ b/customize.dist/main.css @@ -603,6 +603,14 @@ html.cp, font-family: lato, Helvetica, sans-serif; font-size: 1.02em; } +.cp .unselectable { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} .cp h1, .cp h2, .cp h3, diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index a475dba00..6499258e0 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -366,6 +366,7 @@ define(function () { out.upload_name = "Nom du fichier"; out.upload_size = "Taille"; out.upload_progress = "État"; + out.download_button = "Déchiffrer et télécharger"; // general warnings out.warn_notPinned = "Ce pad n'est stocké dans aucun CryptDrive. Il va expirer après 3 mois d'inactivité. En savoir plus..."; diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index fd99ba7b7..737b271c9 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -371,6 +371,7 @@ define(function () { out.upload_name = "File name"; out.upload_size = "Size"; out.upload_progress = "Progress"; + out.download_button = "Decrypt & Download"; // general warnings out.warn_notPinned = "This pad is not in anyone's CryptDrive. It will expire after 3 months. Learn more..."; diff --git a/www/file/file.css b/www/file/file.css index f2fd8e6d5..6554a77f0 100644 --- a/www/file/file.css +++ b/www/file/file.css @@ -7,7 +7,8 @@ body { padding: 0px; display: inline-block; } -#file { +#file, +#dl { display: block; height: 100%; width: 100%; @@ -21,7 +22,8 @@ body { position: absolute; z-index: -1; } -#upload-form { +#upload-form, +#download-form { padding: 0px; margin: 0px; position: relative; @@ -31,7 +33,8 @@ body { margin: 50px auto; max-width: 80vw; } -#upload-form label { +#upload-form label, +#download-form label { line-height: 50vh; text-align: center; position: relative; diff --git a/www/file/file.less b/www/file/file.less index db6942596..a7da1bb3e 100644 --- a/www/file/file.less +++ b/www/file/file.less @@ -9,7 +9,7 @@ html, body { padding: 0px; display: inline-block; } -#file { +#file, #dl { display: block; height: 100%; width: 100%; @@ -25,7 +25,7 @@ html, body { z-index: -1; } -#upload-form { +#upload-form, #download-form { padding: 0px; margin: 0px; @@ -35,17 +35,16 @@ html, body { display: block; margin: 50px auto; max-width: 80vw; + label { + line-height: 50vh; + text-align: center; + position: relative; + padding: 10px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } } -#upload-form label { - line-height: 50vh; - text-align: center; - position: relative; - padding: 10px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - .hovering { background-color: rgba(255, 0, 115, 0.5) !important; } diff --git a/www/file/inner.html b/www/file/inner.html index 548ac6a47..a9660b2d3 100644 --- a/www/file/inner.html +++ b/www/file/inner.html @@ -13,9 +13,14 @@ - + +
diff --git a/www/file/main.js b/www/file/main.js index 56b46b1dd..3c25ec070 100644 --- a/www/file/main.js +++ b/www/file/main.js @@ -21,8 +21,9 @@ define([ var ifrw = $('#pad-iframe')[0].contentWindow; var $iframe = $('#pad-iframe').contents(); var $form = $iframe.find('#upload-form'); - //var $progress = $form.find('#progress'); + var $dlform = $iframe.find('#download-form'); var $label = $form.find('label'); + var $dllabel = $dlform.find('label'); var $table = $iframe.find('#status'); Cryptpad.addLoadingScreen(); @@ -100,8 +101,6 @@ define([ var b64Key = Nacl.util.encodeBase64(key); Cryptpad.replaceHash(Cryptpad.getFileHashFromKeys(id, b64Key)); - //$form.hide(); - APP.toolbar.addElement(['fileshare'], {}); var title = document.title = metadata.name; @@ -250,30 +249,38 @@ define([ Title.updateTitle(Cryptpad.initialName || getTitle() || Title.defaultTitle); if (!uploadMode) { - var src = Cryptpad.getBlobPathFromHex(hexFileName); - return Cryptpad.fetch(src, function (e, u8) { - if (e) { return void Cryptpad.alert(e); } - // now decrypt the u8 - var cryptKey = secret.keys && secret.keys.fileKeyStr; - var key = Nacl.util.decodeBase64(cryptKey); - - if (!u8 || !u8.length) { - return void Cryptpad.errorLoadingScreen(e); - } + $dlform.show(); + Cryptpad.removeLoadingScreen(); + $dlform.find('#dl').click(function (e) { + + if (myFile) { exportFile(); } - FileCrypto.decrypt(u8, key, function (e, data) { - if (e) { - Cryptpad.removeLoadingScreen(); - return console.error(e); + var src = Cryptpad.getBlobPathFromHex(hexFileName); + return Cryptpad.fetch(src, function (e, u8) { + if (e) { return void Cryptpad.alert(e); } + // now decrypt the u8 + var cryptKey = secret.keys && secret.keys.fileKeyStr; + var key = Nacl.util.decodeBase64(cryptKey); + + if (!u8 || !u8.length) { + return void Cryptpad.errorLoadingScreen(e); } - console.log(data); - var title = document.title = data.metadata.name; - myFile = data.content; - myDataType = data.metadata.type; - Title.updateTitle(title || Title.defaultTitle); - Cryptpad.removeLoadingScreen(); + + FileCrypto.decrypt(u8, key, function (e, data) { + if (e) { + return console.error(e); + } + console.log(data); + var title = document.title = data.metadata.name; + myFile = data.content; + myDataType = data.metadata.type; + Title.updateTitle(title || Title.defaultTitle); + exportFile(); + }); }); + }); + return; } if (!Cryptpad.isLoggedIn()) {