From 7b112a13d44d4a4410a328fdd553e001221533b5 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Wed, 12 Jan 2022 15:33:04 -0800 Subject: [PATCH 1/5] 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/5] 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/5] 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) From b5c76aa5fe0378ea53352d349b370934490218d7 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Mon, 31 Jan 2022 10:28:06 -0800 Subject: [PATCH 4/5] fix(ipfs-coord): Bumping to v6.8.12 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a82458c..1a929a6 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "bcryptjs": "2.4.3", "glob": "7.1.6", "ipfs": "0.60.0", - "ipfs-coord": "6.8.10", + "ipfs-coord": "6.8.12", "ipfs-http-client": "55.0.0", "jsonrpc-lite": "2.2.0", "jsonwebtoken": "8.5.1", From b6ab2f02f492a78076347e2d6d1c8dd5efb0b1a5 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Mon, 31 Jan 2022 10:29:45 -0800 Subject: [PATCH 5/5] Updating package-lock --- package-lock.json | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9374d85..03cfb0d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "bcryptjs": "2.4.3", "glob": "7.1.6", "ipfs": "0.60.0", - "ipfs-coord": "6.8.10", + "ipfs-coord": "6.8.12", "ipfs-http-client": "55.0.0", "jsonrpc-lite": "2.2.0", "jsonwebtoken": "8.5.1", @@ -9766,10 +9766,9 @@ } }, "node_modules/ipfs-coord": { - "version": "6.8.10", - "resolved": "http://94.130.170.209:4873/ipfs-coord/-/ipfs-coord-6.8.10.tgz", - "integrity": "sha512-04nlX4AkfqLuuLzpMcHnpv++iOETLRkzFA2GfAmY90r99HynfHt3DypP6loVdAnD34iWgD+tLhKNQ7QQM7cgfQ==", - "license": "MIT", + "version": "6.8.12", + "resolved": "https://registry.npmjs.org/ipfs-coord/-/ipfs-coord-6.8.12.tgz", + "integrity": "sha512-EeehCH8Xl8ZyxlO7F8PBSTJL8HBgBMieQckop2keEL6pkEkzsJEV+sq1RN2lrLUGvr2B/IFWwyenkdgZ3gjgMg==", "dependencies": { "axios": "0.21.4", "bch-encrypt-lib": "2.0.0", @@ -32930,9 +32929,9 @@ } }, "ipfs-coord": { - "version": "6.8.10", - "resolved": "http://94.130.170.209:4873/ipfs-coord/-/ipfs-coord-6.8.10.tgz", - "integrity": "sha512-04nlX4AkfqLuuLzpMcHnpv++iOETLRkzFA2GfAmY90r99HynfHt3DypP6loVdAnD34iWgD+tLhKNQ7QQM7cgfQ==", + "version": "6.8.12", + "resolved": "https://registry.npmjs.org/ipfs-coord/-/ipfs-coord-6.8.12.tgz", + "integrity": "sha512-EeehCH8Xl8ZyxlO7F8PBSTJL8HBgBMieQckop2keEL6pkEkzsJEV+sq1RN2lrLUGvr2B/IFWwyenkdgZ3gjgMg==", "requires": { "axios": "0.21.4", "bch-encrypt-lib": "2.0.0",