a bit of cleanup, bug fixes, and lint compliance

This commit is contained in:
ansuz 2018-06-21 10:16:16 +02:00
parent c3741f847d
commit c2014c5906
5 changed files with 6 additions and 10 deletions

View File

@ -477,7 +477,7 @@ Version 1
// XXX consider putting Block functions in /common/outer/login-block.js // XXX consider putting Block functions in /common/outer/login-block.js
Hash.createBlockHash = function (href, key) { Hash.createBlockHash = function (href, key) {
if (typeof(href) !== 'string') { return; } if (typeof(href) !== 'string') { return; }
if (!key instanceof Uint8Array) { return; } if (!(key instanceof Uint8Array)) { return; }
// TODO verify inputs // TODO verify inputs
try { return href + '#' + Nacl.util.encodeBase64(key); } try { return href + '#' + Nacl.util.encodeBase64(key); }

View File

@ -139,7 +139,6 @@ define([], function () {
// given a path, asynchronously return an arraybuffer // given a path, asynchronously return an arraybuffer
Util.fetch = function (src, cb) { Util.fetch = function (src, cb) {
var done = false;
var CB = Util.once(cb); var CB = Util.once(cb);
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();

View File

@ -897,7 +897,6 @@ define([
}).nThen(function (waitFor) { }).nThen(function (waitFor) {
var blockHash = LocalStore.getBlockHash(); var blockHash = LocalStore.getBlockHash();
if (blockHash) { if (blockHash) {
console.log(blockHash); console.log(blockHash);
var parsed = Hash.parseBlockHash(blockHash); var parsed = Hash.parseBlockHash(blockHash);
@ -922,9 +921,6 @@ define([
return void console.error("failed to decrypt or decode block content"); return void console.error("failed to decrypt or decode block content");
} }
})); }));
} else {
// XXX debugging
console.error("NO BLOCK HASH");
} }
}).nThen(function (waitFor) { }).nThen(function (waitFor) {
// XXX debugging // XXX debugging

View File

@ -63,7 +63,7 @@ define([
}; };
LocalStore.setBlockHash = function (hash) { LocalStore.setBlockHash = function (hash) {
LocalStorage[Constants.blockHashKey] = hash; localStorage[Constants.blockHashKey] = hash;
}; };
LocalStore.getAccountName = function () { LocalStore.getAccountName = function () {

View File

@ -411,13 +411,13 @@ define([
cb (obj); cb (obj);
}); });
}; };
/*
var removeBlock = function (data, cb) { var removeBlock = function (data, cb) {
sframeChan.query('Q_REMOVE_LOGIN_BLOCK', data, function (err, obj) { sframeChan.query('Q_REMOVE_LOGIN_BLOCK', data, function (err, obj) {
if (err || obj.error) { return void cb ({error: err || obj.error}); } if (err || obj.error) { return void cb ({error: err || obj.error}); }
cb (obj); cb (obj);
}); });
}; };*/
// XXX // XXX
@ -437,9 +437,10 @@ define([
console.log(Block.getBlockHash(keys)); console.log(Block.getBlockHash(keys));
return; return;
/*
removeBlock(Block.remove(keys), function (err, obj) { removeBlock(Block.remove(keys), function (err, obj) {
console.log(err, obj); console.log(err, obj);
}); });*/
}); });
} }