From a3e0e765b505109bcf380a6298b2f20d9a42bddc Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 2 Jul 2018 11:11:50 +0200 Subject: [PATCH] derive block URI and URL in dedicated functions --- www/common/outer/login-block.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/www/common/outer/login-block.js b/www/common/outer/login-block.js index 36f387bdd..4e62b7717 100644 --- a/www/common/outer/login-block.js +++ b/www/common/outer/login-block.js @@ -105,14 +105,18 @@ define([ return Nacl.util.encodeBase64(u8).replace(/\//g, '-'); }; - Block.getBlockHash = function (keys) { + Block.getBlockUrl = function (keys) { var publicKey = urlSafeB64(keys.sign.publicKey); // 'block/' here is hardcoded because it's hardcoded on the server // if we want to make CryptPad work in server subfolders, we'll need // to update this path derivation - var relative = 'block/' + publicKey.slice(0, 2) + '/' + publicKey; + return ApiConfig.httpUnsafeOrigin + 'block/' + publicKey.slice(0, 2) + '/' + publicKey; + }; + + Block.getBlockHash = function (keys) { + var absolute = Block.getBlockUrl(keys); var symmetric = urlSafeB64(keys.symmetric); - return ApiConfig.httpUnsafeOrigin + relative + '#' + symmetric; + return absolute + '#' + symmetric; }; /*