From db9eee383ceb5ca3014e542153dc39a99c6e98c2 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 22 Mar 2018 15:16:19 +0100 Subject: [PATCH] Owned profile --- www/common/sframe-common-outer.js | 15 ++++++++++++--- www/profile/main.js | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index 0ba403750..431d1c74f 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -643,10 +643,19 @@ define([ replaceHash(Utils.Hash.getEditHashFromKeys(wc, secret.keys)); } }; - Object.keys(rtConfig).forEach(function (k) { - cpNfCfg[k] = rtConfig[k]; + + nThen(function (waitFor) { + if (isNewFile && cfg.owned && !window.location.hash) { + Cryptpad.getMetadata(waitFor(function (err, m) { + cpNfCfg.owners = [m.priv.edPublic]; + })); + } + }).nThen(function () { + Object.keys(rtConfig).forEach(function (k) { + cpNfCfg[k] = rtConfig[k]; + }); + CpNfOuter.start(cpNfCfg); }); - CpNfOuter.start(cpNfCfg); }; sframeChan.on('Q_CREATE_PAD', function (data, cb) { diff --git a/www/profile/main.js b/www/profile/main.js index 234e28d8a..2449ea96b 100644 --- a/www/profile/main.js +++ b/www/profile/main.js @@ -93,6 +93,7 @@ define([ getSecrets: getSecrets, noHash: true, // Don't add the hash in the URL if it doesn't already exist addRpc: addRpc, + owned: true }); }); });