From 1f5061a278e6efafd4642165c82bd02668c644f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Friedger=20M=C3=BCffke?= Date: Sun, 8 Dec 2019 23:21:35 +0100 Subject: [PATCH 1/2] add appsMeta with pubKey to profile (for storageConnected apps) --- app/js/auth/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/js/auth/index.js b/app/js/auth/index.js index 78b5f5c40..cfaa8a9e1 100644 --- a/app/js/auth/index.js +++ b/app/js/auth/index.js @@ -319,6 +319,11 @@ class AuthPage extends React.Component { apps = profile.apps } + let appsMeta = {} + if (profile.hasOwnProperty('appsMeta')) { + appsMeta = profile.appsMeta + } + if (storageConnected) { const hubUrl = this.props.api.gaiaHubUrl getAppBucketUrl(hubUrl, appPrivateKey) @@ -327,12 +332,18 @@ class AuthPage extends React.Component { `componentWillReceiveProps: appBucketUrl ${appBucketUrl}` ) apps[appDomain] = appBucketUrl + if (appsMeta.hasOwnProperty(appDomain)) { + appsMeta[appDomain] = { ...appsMeta[appDomain], publicKey: getPublicKeyFromPrivate(appPrivateKey) } + } else { + appsMeta[appDomain] = { publicKey: getPublicKeyFromPrivate(appPrivateKey) } + } logger.debug( `componentWillReceiveProps: new apps array ${JSON.stringify( apps )}` ) profile.apps = apps + profile.appsMeta = appsMeta const signedProfileTokenData = signProfileForUpload( profile, nextProps.identityKeypairs[identityIndex], From 34adc9b532ff9c8144b475ee97b0921a1e155231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Friedger=20M=C3=BCffke?= Date: Mon, 9 Dec 2019 08:58:40 +0100 Subject: [PATCH 2/2] add appsMeta.storage property --- app/js/auth/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/js/auth/index.js b/app/js/auth/index.js index cfaa8a9e1..68c607bba 100644 --- a/app/js/auth/index.js +++ b/app/js/auth/index.js @@ -332,10 +332,14 @@ class AuthPage extends React.Component { `componentWillReceiveProps: appBucketUrl ${appBucketUrl}` ) apps[appDomain] = appBucketUrl + const metaForDomain = { + publicKey: getPublicKeyFromPrivate(appPrivateKey), + storage: appBucketUrl + } if (appsMeta.hasOwnProperty(appDomain)) { - appsMeta[appDomain] = { ...appsMeta[appDomain], publicKey: getPublicKeyFromPrivate(appPrivateKey) } + appsMeta[appDomain] = { ...appsMeta[appDomain], ...metaForDomain } } else { - appsMeta[appDomain] = { publicKey: getPublicKeyFromPrivate(appPrivateKey) } + appsMeta[appDomain] = { ...metaForDomain } } logger.debug( `componentWillReceiveProps: new apps array ${JSON.stringify(