From 6e3862d8ce287d1003e92d514384574146565b31 Mon Sep 17 00:00:00 2001 From: CaramelKat <32065563+caramelkat@users.noreply.github.com> Date: Thu, 14 May 2020 23:35:34 -0500 Subject: [PATCH] added debugging to /v1/posts and /v1/endpoint --- src/services/miiverse-api/routes/discovery.js | 2 +- src/util/authentication.js | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/services/miiverse-api/routes/discovery.js b/src/services/miiverse-api/routes/discovery.js index af5d2ab..b21ad96 100644 --- a/src/services/miiverse-api/routes/discovery.js +++ b/src/services/miiverse-api/routes/discovery.js @@ -34,7 +34,7 @@ router.get('/', function (req, res) { } catch (e) { - //console.error(e); + console.error(e); } const discovery = await database.getDiscoveryHosts(); switch(discovery.has_error) diff --git a/src/util/authentication.js b/src/util/authentication.js index 208f48d..fe40197 100644 --- a/src/util/authentication.js +++ b/src/util/authentication.js @@ -62,9 +62,16 @@ let methods = { return out; }, processServiceToken: function(token) { - let B64token = Buffer.from(token, 'base64'); - let decryptedToken = this.decryptToken(B64token); - return decryptedToken.readUInt32LE(0x2); + try + { + let B64token = Buffer.from(token, 'base64'); + let decryptedToken = this.decryptToken(B64token); + return decryptedToken.readUInt32LE(0x2); + } + catch(e) + { + console.log(e); + } },