From 2d7996570ef75f5694126b1b328ece3f417c9f4e Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sat, 20 Oct 2018 17:57:21 +0200 Subject: [PATCH] typos, documentation --- js/privatebin.js | 29 +++++++++++++++-------------- tpl/bootstrap.php | 2 +- tpl/page.php | 2 +- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index 020cdd3..6b801da 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -697,6 +697,7 @@ jQuery.PrivateBin = (function($, sjcl, RawDeflate) { * compress, then encrypt message with given key and password * * @name CryptTool.cipher + * @async * @function * @param {string} key * @param {string} password @@ -772,6 +773,7 @@ jQuery.PrivateBin = (function($, sjcl, RawDeflate) { * decrypt message with key, then decompress * * @name CryptTool.decipher + * @async * @function * @param {string} key * @param {string} password @@ -3952,8 +3954,8 @@ jQuery.PrivateBin = (function($, sjcl, RawDeflate) { /** * send a reply in a discussion * - * @async * @name PasteEncrypter.sendComment + * @async * @function */ me.sendComment = async function() @@ -4027,8 +4029,8 @@ jQuery.PrivateBin = (function($, sjcl, RawDeflate) { /** * sends a new paste to server * - * @async * @name PasteEncrypter.sendPaste + * @async * @function */ me.sendPaste = async function() @@ -4141,7 +4143,7 @@ jQuery.PrivateBin = (function($, sjcl, RawDeflate) { async function decryptOrPromptPassword(key, password, cipherdata) { // try decryption without password - var plaindata = await CryptTool.decipher(key, password, cipherdata); + const plaindata = await CryptTool.decipher(key, password, cipherdata); // if it fails, request password if (plaindata.length === 0 && password.length === 0) { @@ -4212,8 +4214,8 @@ jQuery.PrivateBin = (function($, sjcl, RawDeflate) { */ async function decryptAttachment(paste, key, password) { - let attachmentPromise = decryptOrPromptPassword(key, password, paste.attachment); - let attachmentNamePromise = decryptOrPromptPassword(key, password, paste.attachmentname); + const attachmentPromise = decryptOrPromptPassword(key, password, paste.attachment), + attachmentNamePromise = decryptOrPromptPassword(key, password, paste.attachmentname); attachmentPromise.catch((err) => { displayDecryptionError('failed to decipher attachment: ' + err); }) @@ -4249,7 +4251,7 @@ jQuery.PrivateBin = (function($, sjcl, RawDeflate) { let commentDecryptionPromises = []; // iterate over comments - for (var i = 0; i < paste.comments.length; ++i) { + for (let i = 0; i < paste.comments.length; ++i) { commentDecryptionPromises.push( Promise.all([ CryptTool.decipher(key, password, paste.comments[i].data), @@ -4260,12 +4262,11 @@ jQuery.PrivateBin = (function($, sjcl, RawDeflate) { ); } return Promise.all(commentDecryptionPromises).then((plaintexts) => { - for (var i = 0; i < paste.comments.length; ++i) { + for (let i = 0; i < paste.comments.length; ++i) { if (plaintexts[i][0].length === 0) { continue; } - var comment = paste.comments[i]; - console.log(plaintexts); + const comment = paste.comments[i]; DiscussionViewer.addComment( comment, plaintexts[i][0], @@ -4317,7 +4318,7 @@ jQuery.PrivateBin = (function($, sjcl, RawDeflate) { let key = Model.getPasteKey(), password = Prompt.getPassword(), - decrytionPromises = []; + decryptionPromises = []; TopNav.setRetryCallback(function () { TopNav.hideRetryButton(); @@ -4328,7 +4329,7 @@ jQuery.PrivateBin = (function($, sjcl, RawDeflate) { if (paste.attachment && AttachmentViewer.hasAttachmentData()) { // try to decrypt paste and if it fails (because the password is // missing) return to let JS continue and wait for user - decrytionPromises.push( + decryptionPromises.push( decryptAttachment(paste, key, password).then((attachementIsDecrypted) => { if (attachementIsDecrypted) { // ignore empty paste, as this is allowed when pasting attachments @@ -4337,18 +4338,18 @@ jQuery.PrivateBin = (function($, sjcl, RawDeflate) { }) ); } else { - decrytionPromises.push(decryptPaste(paste, key, password)) + decryptionPromises.push(decryptPaste(paste, key, password)) } // if the discussion is opened on this paste, display it if (paste.meta.opendiscussion) { - decrytionPromises.push(decryptComments(paste, key, password)); + decryptionPromises.push(decryptComments(paste, key, password)); } // shows the remaining time (until) deletion PasteStatus.showRemainingTime(paste.meta); - Promise.all(decrytionPromises).then(() => { + Promise.all(decryptionPromises).then(() => { Alert.hideLoading(); TopNav.showViewButtons(); }); diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 6241396..59ba51f 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -71,7 +71,7 @@ if ($MARKDOWN): endif; ?> - + diff --git a/tpl/page.php b/tpl/page.php index ef10500..2382eb7 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -49,7 +49,7 @@ if ($MARKDOWN): endif; ?> - +