From d9bf2abcd804baf6ffb15275fc3831245ae62299 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 28 Aug 2017 13:53:24 +0200 Subject: [PATCH 1/3] Fix old hashes not working anymore in pad --- www/common/common-hash.js | 4 ++++ www/common/cryptpad-common.js | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/www/common/common-hash.js b/www/common/common-hash.js index 888c0a338..5ed7ece36 100644 --- a/www/common/common-hash.js +++ b/www/common/common-hash.js @@ -214,6 +214,10 @@ Version 1 Hash.getHashes = function (channel, secret) { var hashes = {}; + if (!secret.keys) { + console.error('e'); + return hashes; + } if (secret.keys.editKeyStr) { hashes.editHash = getEditHashFromKeys(channel, secret.keys); } diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 08d08580a..f1501883a 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -1851,6 +1851,11 @@ define([ if (!parsed.type || !parsed.hashData) { return void cb('E_INVALID_HREF'); } var hashes = common.getHashes(secret.channel, secret); + if (!hashes.editHash && !hashes.viewHash && parsed.hashData && !parsed.hashData.mode) { + // It means we're using an old hash + hashes.editHash = window.location.hash.slice(1); + } + // If we have a stronger version in drive, add it and add a redirect button var stronger = recent && common.findStronger(null, recent); if (stronger) { From 51c065d13c57072979b5e3f034f49a93f24e0fe1 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 28 Aug 2017 14:18:33 +0200 Subject: [PATCH 2/3] Fix link to main in the new toolbar --- www/common/toolbar3.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/www/common/toolbar3.js b/www/common/toolbar3.js index 970dc4c53..a3a6df89b 100644 --- a/www/common/toolbar3.js +++ b/www/common/toolbar3.js @@ -585,7 +585,7 @@ define([ }).appendTo($hoverable).text(config.pageTitle); }; - var createLinkToMain = function (toolbar) { + var createLinkToMain = function (toolbar, config) { var $linkContainer = $('', { 'class': "cryptpad-link" }).appendTo(toolbar.$top); @@ -593,7 +593,9 @@ define([ // We need to override the "a" tag action here because it is inside the iframe! var inDrive = /^\/drive/; - var href = inDrive ? '/index.html' : '/drive/'; + var origin = config.metadataMgr.getPrivateData().origin; + + var href = inDrive ? origin+'/index.html' : origin+'/drive/'; var buttonTitle = inDrive ? Messages.header_homeTitle : Messages.header_logoTitle; var $aTag = $('', { @@ -609,7 +611,7 @@ define([ window.open(href); return; } - window.location = href; + window.top.location = href; }; var onContext = function (e) { e.stopPropagation(); }; From f89015d9ed27a01d2d91ad144715be09faea34bd Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 28 Aug 2017 14:49:33 +0200 Subject: [PATCH 3/3] Update the tab title to match the pad title in pad2 --- www/common/sframe-common-title.js | 1 + www/pad/main.js | 1 + 2 files changed, 2 insertions(+) diff --git a/www/common/sframe-common-title.js b/www/common/sframe-common-title.js index 20f5052ea..7e44d14fd 100644 --- a/www/common/sframe-common-title.js +++ b/www/common/sframe-common-title.js @@ -64,6 +64,7 @@ define(['jquery'], function ($) { var md = metadataMgr.getMetadata(); $title.find('span.title').text(md.title || md.defaultTitle); $title.find('input').val(md.title || md.defaultTitle); + exp.title = md.title; //exp.updateTitle(md.title || md.defaultTitle); }); diff --git a/www/pad/main.js b/www/pad/main.js index 443ac27f2..a01dee3cd 100644 --- a/www/pad/main.js +++ b/www/pad/main.js @@ -127,6 +127,7 @@ define([ }); sframeChan.on('Q_SET_PAD_TITLE_IN_DRIVE', function (newTitle, cb) { + document.title = newTitle; Cryptpad.renamePad(newTitle, undefined, function (err) { if (err) { cb('ERROR'); } else { cb(); } });