Remove window.location.hash and window.location.href from common-hash

pull/1/head
yflory 5 years ago
parent 99beeca8fd
commit e3f5c89333

@ -198,7 +198,13 @@ Version 1
parsed.version = 2; parsed.version = 2;
parsed.app = hashArr[2]; parsed.app = hashArr[2];
parsed.mode = hashArr[3]; parsed.mode = hashArr[3];
// Check if the key is a channel ID
if (/^[a-f0-9]{32,34}$/.test(hashArr[4])) {
parsed.channel = hashArr[4];
} else {
parsed.key = hashArr[4]; parsed.key = hashArr[4];
}
options = hashArr.slice(5); options = hashArr.slice(5);
parsed.password = options.indexOf('p') !== -1; parsed.password = options.indexOf('p') !== -1;
@ -345,7 +351,7 @@ Version 1
secret.version = 2; secret.version = 2;
secret.type = type; secret.type = type;
}; };
if (!secretHash && !window.location.hash) { //!/#/.test(window.location.href)) { if (!secretHash) {
generate(); generate();
return secret; return secret;
} else { } else {
@ -355,12 +361,7 @@ Version 1
if (!type) { throw new Error("getSecrets with a hash requires a type parameter"); } if (!type) { throw new Error("getSecrets with a hash requires a type parameter"); }
parsed = parseTypeHash(type, secretHash); parsed = parseTypeHash(type, secretHash);
hash = secretHash; hash = secretHash;
} else {
var pHref = parsePadUrl(window.location.href);
parsed = pHref.hashData;
hash = pHref.hash;
} }
//var hash = secretHash || window.location.hash.slice(1);
if (hash.length === 0) { if (hash.length === 0) {
generate(); generate();
return secret; return secret;

Loading…
Cancel
Save