From c2014c59062e3cfdab3eb6a9882196822f9b93bd Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 21 Jun 2018 10:16:16 +0200 Subject: [PATCH] a bit of cleanup, bug fixes, and lint compliance --- www/common/common-hash.js | 2 +- www/common/common-util.js | 1 - www/common/cryptpad-common.js | 4 ---- www/common/outer/local-store.js | 2 +- www/settings/inner.js | 7 ++++--- 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/www/common/common-hash.js b/www/common/common-hash.js index e283d2525..af0fd03d2 100644 --- a/www/common/common-hash.js +++ b/www/common/common-hash.js @@ -477,7 +477,7 @@ Version 1 // XXX consider putting Block functions in /common/outer/login-block.js Hash.createBlockHash = function (href, key) { if (typeof(href) !== 'string') { return; } - if (!key instanceof Uint8Array) { return; } + if (!(key instanceof Uint8Array)) { return; } // TODO verify inputs try { return href + '#' + Nacl.util.encodeBase64(key); } diff --git a/www/common/common-util.js b/www/common/common-util.js index cc56cd0d5..072bfb851 100644 --- a/www/common/common-util.js +++ b/www/common/common-util.js @@ -139,7 +139,6 @@ define([], function () { // given a path, asynchronously return an arraybuffer Util.fetch = function (src, cb) { - var done = false; var CB = Util.once(cb); var xhr = new XMLHttpRequest(); diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index bbd0a9428..c08b40888 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -897,7 +897,6 @@ define([ }).nThen(function (waitFor) { var blockHash = LocalStore.getBlockHash(); - if (blockHash) { console.log(blockHash); var parsed = Hash.parseBlockHash(blockHash); @@ -922,9 +921,6 @@ define([ return void console.error("failed to decrypt or decode block content"); } })); - } else { - // XXX debugging - console.error("NO BLOCK HASH"); } }).nThen(function (waitFor) { // XXX debugging diff --git a/www/common/outer/local-store.js b/www/common/outer/local-store.js index 28f94b62b..c8f58e1f6 100644 --- a/www/common/outer/local-store.js +++ b/www/common/outer/local-store.js @@ -63,7 +63,7 @@ define([ }; LocalStore.setBlockHash = function (hash) { - LocalStorage[Constants.blockHashKey] = hash; + localStorage[Constants.blockHashKey] = hash; }; LocalStore.getAccountName = function () { diff --git a/www/settings/inner.js b/www/settings/inner.js index 8fd852858..d88b0daa2 100644 --- a/www/settings/inner.js +++ b/www/settings/inner.js @@ -411,13 +411,13 @@ define([ cb (obj); }); }; - +/* var removeBlock = function (data, cb) { sframeChan.query('Q_REMOVE_LOGIN_BLOCK', data, function (err, obj) { if (err || obj.error) { return void cb ({error: err || obj.error}); } cb (obj); }); - }; + };*/ // XXX @@ -437,9 +437,10 @@ define([ console.log(Block.getBlockHash(keys)); return; + /* removeBlock(Block.remove(keys), function (err, obj) { console.log(err, obj); - }); + });*/ }); }