From 7b112a13d44d4a4410a328fdd553e001221533b5 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Wed, 12 Jan 2022 15:33:04 -0800 Subject: [PATCH 1/3] fix(cors): Fixing bug leading to CORS error --- bin/server.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/server.js b/bin/server.js index d235a15..d6966a4 100644 --- a/bin/server.js +++ b/bin/server.js @@ -68,6 +68,11 @@ class Server { app.use(passport.initialize()) app.use(passport.session()) + // Enable CORS for testing + // THIS IS A SECURITY RISK. COMMENT OUT FOR PRODUCTION + // Dev Note: This line must come BEFORE controllers.attachRESTControllers() + app.use(cors({ origin: '*' })) + // Attach REST API and JSON RPC controllers to the app. const Controllers = require('../src/controllers') const controllers = new Controllers() @@ -75,10 +80,6 @@ class Server { app.controllers = controllers - // Enable CORS for testing - // THIS IS A SECURITY RISK. COMMENT OUT FOR PRODUCTION - app.use(cors({ origin: '*' })) - // MIDDLEWARE END console.log(`Running server in environment: ${config.env}`) From 5fc72be10ce9a82727f94ac96a474321000c18db Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Thu, 20 Jan 2022 07:53:12 -0800 Subject: [PATCH 2/3] fix(fullstack-jwt.js): Got unit test coverage back to 100% --- src/adapters/fullstack-jwt.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/adapters/fullstack-jwt.js b/src/adapters/fullstack-jwt.js index 33d7248..dcd7f1e 100644 --- a/src/adapters/fullstack-jwt.js +++ b/src/adapters/fullstack-jwt.js @@ -52,12 +52,6 @@ class FullStackJWT { // Get's a JWT token from FullStack.cash. async getJWT () { try { - // Skip connecting FullStack.cash auth server to the network if this is an E2E test. - if (process.env.TEST_TYPE === 'e2e') { - this.apiToken = 'faketoken' - return this.apiToken - } - // Log into the auth server. await this.jwtLib.register() From 34a407238438f5062cfc5774c375445a730850ec Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Thu, 20 Jan 2022 07:56:40 -0800 Subject: [PATCH 3/3] fix(restart): Removing code the auto-restarts app after 2 hours --- bin/server.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/bin/server.js b/bin/server.js index d6966a4..4ff8fda 100644 --- a/bin/server.js +++ b/bin/server.js @@ -98,13 +98,6 @@ class Server { await controllers.attachControllers(app) } - // ipfs-coord has a memory leak. This app shuts down after 4 hours. It - // expects to be run by Docker or pm2, which can automatically restart - // the app. - setTimeout(function () { - process.exit(0) - }, 60000 * 60 * 2) // 2 hours - return app } catch (err) { console.error('Could not start server. Error: ', err)