From f78fa52b5f5a77f26fff9ccc75d51cd26e92e4e0 Mon Sep 17 00:00:00 2001 From: Evanfeenstra Date: Thu, 8 Apr 2021 14:45:23 -0700 Subject: [PATCH] more info in external_tokens --- dist/src/controllers/auth.js | 12 +++++++++--- dist/src/controllers/auth.js.map | 2 +- dist/src/utils/tribes.js | 4 +++- dist/src/utils/tribes.js.map | 2 +- src/controllers/auth.ts | 21 ++++++++++++++++++--- src/utils/tribes.ts | 3 ++- 6 files changed, 34 insertions(+), 10 deletions(-) diff --git a/dist/src/controllers/auth.js b/dist/src/controllers/auth.js index 21941409a..e32a3c28b 100644 --- a/dist/src/controllers/auth.js +++ b/dist/src/controllers/auth.js @@ -24,9 +24,15 @@ function requestExternalTokens(req, res) { if (!memeToken || !tribesToken) { return res_1.failure(res, 'failed to generate token'); } - res_1.success(res, { - memeToken, tribesToken - }); + const result = { + memeToken, + tribesToken, + alias: req.owner.alias, + photoUrl: req.owner.photoUrl, + routeHint: req.owner.routeHint, + contactKey: req.owner.contactKey, + }; + res_1.success(res, result); } catch (e) { res_1.failure(res, e); diff --git a/dist/src/controllers/auth.js.map b/dist/src/controllers/auth.js.map index 531e62128..b6f516ef8 100644 --- a/dist/src/controllers/auth.js.map +++ b/dist/src/controllers/auth.js.map @@ -1 +1 @@ -{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/controllers/auth.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAAsC;AACtC,sCAAgD;AAChD,0CAA0C;AAE1C,SAAsB,qBAAqB,CAAC,GAAG,EAAE,GAAG;;QAClD,IAAI,CAAC,GAAG,CAAC,KAAK;YAAE,OAAO,aAAO,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QAChD,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC;QACnC,IAAI;YACF,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YACnD,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;YAC5D,IAAG,CAAC,SAAS,IAAI,CAAC,WAAW,EAAE;gBAC7B,OAAO,aAAO,CAAC,GAAG,EAAE,0BAA0B,CAAC,CAAA;aAChD;YACD,aAAO,CAAC,GAAG,EAAE;gBACX,SAAS,EAAE,WAAW;aACvB,CAAC,CAAA;SACH;QAAC,OAAO,CAAC,EAAE;YACV,aAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;SACjB;IACH,CAAC;CAAA;AAfD,sDAeC"} \ No newline at end of file +{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/controllers/auth.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAAsC;AACtC,sCAAgD;AAChD,0CAA0C;AAW1C,SAAsB,qBAAqB,CAAC,GAAG,EAAE,GAAG;;QAClD,IAAI,CAAC,GAAG,CAAC,KAAK;YAAE,OAAO,aAAO,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QAChD,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC;QACnC,IAAI;YACF,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YACnD,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;YAC5D,IAAG,CAAC,SAAS,IAAI,CAAC,WAAW,EAAE;gBAC7B,OAAO,aAAO,CAAC,GAAG,EAAE,0BAA0B,CAAC,CAAA;aAChD;YACD,MAAM,MAAM,GAAU;gBACpB,SAAS;gBACT,WAAW;gBACX,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK;gBACtB,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC,QAAQ;gBAC5B,SAAS,EAAE,GAAG,CAAC,KAAK,CAAC,SAAS;gBAC9B,UAAU,EAAE,GAAG,CAAC,KAAK,CAAC,UAAU;aACjC,CAAA;YACD,aAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;SACrB;QAAC,OAAO,CAAC,EAAE;YACV,aAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;SACjB;IACH,CAAC;CAAA;AArBD,sDAqBC"} \ No newline at end of file diff --git a/dist/src/utils/tribes.js b/dist/src/utils/tribes.js index 59bce6939..cd10ea698 100644 --- a/dist/src/utils/tribes.js +++ b/dist/src/utils/tribes.js @@ -65,6 +65,8 @@ function initializeClient(pubkey, host, onMessage) { function reconnect() { return __awaiter(this, void 0, void 0, function* () { const pwd = yield genSignedTimestamp(pubkey); + if (!connected) + return; const url = mqttURL(host); const cl = mqtt.connect(url, { username: pubkey, @@ -110,7 +112,7 @@ function initializeClient(pubkey, host, onMessage) { if (!connected) { reconnect(); } - yield helpers_1.sleep(3000 + Math.round(Math.random() * 10000)); + yield helpers_1.sleep(5000 + Math.round(Math.random() * 8000)); } })); }); diff --git a/dist/src/utils/tribes.js.map b/dist/src/utils/tribes.js.map index 76c116527..84088a927 100644 --- a/dist/src/utils/tribes.js.map +++ b/dist/src/utils/tribes.js.map @@ -1 +1 @@ -{"version":3,"file":"tribes.js","sourceRoot":"","sources":["../../../src/utils/tribes.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iCAAiC;AACjC,qCAAqC;AACrC,mCAAmC;AACnC,6BAA6B;AAE7B,2CAA+B;AAC/B,sCAA8C;AAC9C,2CAAwD;AAO/C,4FAPc,uBAAW,OAOd;AANpB,qCAAsC;AACtC,mCAAkC;AAClC,yCAA+B;AAC/B,qCAAgC;AAChC,wCAAmC;AAInC,MAAM,MAAM,GAAG,mBAAU,EAAE,CAAC;AAE5B,4BAA4B;AAC5B,IAAI,OAAO,GAAkD,EAAE,CAAC;AAEhE,MAAM,IAAI,GAA4B,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;AAEjD,6BAA6B;AAC7B,SAAsB,OAAO,CAAC,SAAmB;;QAC/C,sBAAsB,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;C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\ No newline at end of file +{"version":3,"file":"tribes.js","sourceRoot":"","sources":["../../../src/utils/tribes.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iCAAiC;AACjC,qCAAqC;AACrC,mCAAmC;AACnC,6BAA6B;AAE7B,2CAA+B;AAC/B,sCAA8C;AAC9C,2CAAwD;AAO/C,4FAPc,uBAAW,OAOd;AANpB,qCAAsC;AACtC,mCAAkC;AAClC,yCAA+B;AAC/B,qCAAgC;AAChC,wCAAmC;AAInC,MAAM,MAAM,GAAG,mBAAU,EAAE,CAAC;AAE5B,4BAA4B;AAC5B,IAAI,OAAO,GAAkD,EAAE,CAAC;AAEhE,MAAM,IAAI,GAA4B,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;AAEjD,6BAA6B;AAC7B,SAAsB,OAAO,CAAC,SAAmB;;QAC/C,sBAAsB,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;CAAA;AAFD,0BAEC;AAED,SAAsB,wBAAwB,CAAC,IAAY;;QACzD,MAAM,OAAO,GAAG,eAAO,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;QACxC,IAAI;YACF,MAAM,CAAC,GAAG,MAAM,kBAAS,CAAC,KAAK,CAC7B;;;;uCAIiC,OAAO;;iCAEb,IAAI,GAAG,EAClC;gBACE,KAAK,EAAE,eAAM,CAAC,IAAI;gBAClB,UAAU,EAAE,IAAI;aACjB,CACF,CAAC;YACF,iDAAiD;YACjD,mDAAmD;YACnD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;SACrC;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SAChB;IACH,CAAC;CAAA;AAtBD,4DAsBC;AAED,SAAe,gBAAgB,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS;;QACrD,OAAO,IAAI,OAAO,CAAC,CAAO,OAAO,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,CAAC;SACjB;aAAM;YACL,OAAO,KAAK,CAAC;SACd;IACH,CAAC;CAAA;AAVD,sDAUC;AAED,SAAgB,OAAO;IACrB,OAAO,MAAM,CAAC,WAAW,IAAI,EAAE,CAAC;AAClC,CAAC;AAFD,0BAEC;AAED,SAAS,SAAS,CAAC,GAAG;IACpB,OAAO,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACxE,CAAC;AAED,SAAe,YAAY,CAAC,KAAK,EAAE,QAAQ;;QACzC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YACjD,MAAM,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAC5C;IACH,CAAC;CAAA"} \ No newline at end of file diff --git a/src/controllers/auth.ts b/src/controllers/auth.ts index 19727908a..78488a3d3 100644 --- a/src/controllers/auth.ts +++ b/src/controllers/auth.ts @@ -2,6 +2,15 @@ import * as meme from "../utils/meme"; import { success, failure } from "../utils/res"; import * as tribes from "../utils/tribes"; +interface MeInfo { + memeToken: string + tribesToken: string + photoUrl: string + alias: string + routeHint: string + contactKey: string +} + export async function requestExternalTokens(req, res) { if (!req.owner) return failure(res, "no owner"); const pubkey = req.owner.publicKey; @@ -11,9 +20,15 @@ export async function requestExternalTokens(req, res) { if(!memeToken || !tribesToken) { return failure(res, 'failed to generate token') } - success(res, { - memeToken, tribesToken - }) + const result:MeInfo = { + memeToken, + tribesToken, + alias: req.owner.alias, + photoUrl: req.owner.photoUrl, + routeHint: req.owner.routeHint, + contactKey: req.owner.contactKey, + } + success(res, result) } catch (e) { failure(res, e); } diff --git a/src/utils/tribes.ts b/src/utils/tribes.ts index 886ff42c8..518a9179c 100644 --- a/src/utils/tribes.ts +++ b/src/utils/tribes.ts @@ -55,6 +55,7 @@ async function initializeClient(pubkey, host, onMessage): Promise { let connected = false async function reconnect() { const pwd = await genSignedTimestamp(pubkey); + if (!connected) return const url = mqttURL(host); const cl = mqtt.connect(url, { username: pubkey, @@ -90,7 +91,7 @@ async function initializeClient(pubkey, host, onMessage): Promise { if(!connected) { reconnect(); } - await sleep(3000 + Math.round(Math.random()*10000)) + await sleep(5000 + Math.round(Math.random()*8000)) } }); }