From 9cb75cc9808fc4cc565d365603aa9e3191678511 Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Tue, 28 Jul 2020 11:44:05 -0400 Subject: [PATCH] gun auth status http endpoint --- src/routes.js | 8 ++++++++ utils/protectedRoutes.js | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/routes.js b/src/routes.js index 4bee66cc..ff88958c 100644 --- a/src/routes.js +++ b/src/routes.js @@ -2382,6 +2382,14 @@ module.exports = async ( }) } }) + + ap.get(`/api/gun/auth`, (_, res) => { + const { isAuthenticated } = require('../services/gunDB/Mediator') + + return res.status(200).json({ + data: isAuthenticated() + }) + }) /** * Return app so that it can be used by express. */ diff --git a/utils/protectedRoutes.js b/utils/protectedRoutes.js index 8ece4f12..e3d53d44 100644 --- a/utils/protectedRoutes.js +++ b/utils/protectedRoutes.js @@ -7,7 +7,9 @@ module.exports = { "/favicon.ico": true, "/api/lnd/connect": true, "/api/lnd/wallet/status": true, - "/api/lnd/auth": true + "/api/lnd/auth": true, + // + "/api/gun/auth": true }, POST: { "/api/lnd/connect": true, @@ -28,5 +30,5 @@ module.exports = { PUT: {}, DELETE: {} }, - nonEncryptedRoutes: ['/api/security/exchangeKeys', '/healthz', '/ping', '/api/lnd/wallet/status'] + nonEncryptedRoutes: ['/api/security/exchangeKeys', '/healthz', '/ping', '/api/lnd/wallet/status', '/api/gun/auth'] } \ No newline at end of file