Fix various issues

pull/1/head
yflory 4 years ago committed by ansuz
parent 2e56e07c24
commit 864beb7136

@ -47,8 +47,8 @@ define([
var href = '/'+ x[0] +'/';
var attr = isEnabled ? { href: href } : {
onclick: function () {
var href = Hash.hashToHref('', 'login');
var url = Hash.getNewPadURL(href, { href: href });
var loginURL = Hash.hashToHref('', 'login');
var url = Hash.getNewPadURL(loginURL, { href: href });
window.location.href = url;
}
};

@ -236,7 +236,7 @@ Version 4: Data URL when not a realtime link yet (new pad or "static" app)
parsed.ownerKey = getOwnerKey(options);
};
// Version 4: only login or newpad options, smae for all the apps
// Version 4: only login or newpad options, same for all the apps
if (hashArr[1] && hashArr[1] === '4') {
parsed.getHash = function (opts) {
if (!opts || !Object.keys(opts).length) { return ''; }
@ -653,9 +653,6 @@ Version 4: Data URL when not a realtime link yet (new pad or "static" app)
// Valid hash?
if (parsed.hash) {
if (!parsed.hashData) { return; }
// New pad: only newPadOpts allowed
if (Object.keys(parsed.hashData).length === 1 &&
parsed.hashData.newPadOpts) { return true; }
// Version should be a number
if (typeof(parsed.hashData.version) === "undefined") { return; }
// pads and files should have a base64 (or hex) key
@ -670,7 +667,7 @@ Version 4: Data URL when not a realtime link yet (new pad or "static" app)
Hash.decodeDataOptions = function (opts) {
var b64 = decodeURIComponent(opts);
var str = Nacl.util.encodeUTF8(Nacl.util.decodeBase64(b64));
return JSON.parse(str);
return Util.tryParse(str) || {};
};
Hash.encodeDataOptions = function (opts) {
var str = JSON.stringify(opts);

@ -94,6 +94,7 @@ define([
localStorage.removeItem(k);
delete localStorage[k];
});
sessionStorage.clear();
try {
Object.keys(localStorage || {}).forEach(function (k) {
// Remvoe everything in localStorage except CACHE and FS_hash

Loading…
Cancel
Save