diff --git a/lib/api/index.js b/lib/api/index.js index 3eb16ac826a..a9e5e25f873 100644 --- a/lib/api/index.js +++ b/lib/api/index.js @@ -6,7 +6,7 @@ function create (env, ctx) { , app = express( ) ; - var wares = require('../middleware/')(env); + const wares = ctx.wares; // set up express app with our options app.set('name', env.name); diff --git a/lib/api/notifications-v2.js b/lib/api/notifications-v2.js index 16eac1de975..e21677486bc 100644 --- a/lib/api/notifications-v2.js +++ b/lib/api/notifications-v2.js @@ -7,6 +7,13 @@ function configure (app, ctx) { , api = express.Router( ) ; + api.use(ctx.wares.compression()); + api.use(ctx.wares.rawParser); + api.use(ctx.wares.bodyParser.json({ + limit: '50Mb' + })); + api.use(ctx.wares.urlencodedParser); + api.post('/loop', ctx.authorization.isPermitted('notifications:loop:push'), function (req, res) { ctx.loop.sendNotification(req.body, req.connection.remoteAddress, function (error) { if (error) { diff --git a/lib/server/bootevent.js b/lib/server/bootevent.js index 538fe50520d..e97e2bc6258 100644 --- a/lib/server/bootevent.js +++ b/lib/server/bootevent.js @@ -208,6 +208,8 @@ function boot (env, language) { , levels: ctx.levels }).registerServerDefaults(); + ctx.wares = require('../middleware/')(env); + ctx.pushover = require('../plugins/pushover')(env, ctx); ctx.maker = require('../plugins/maker')(env); ctx.pushnotify = require('./pushnotify')(env, ctx); diff --git a/package-lock.json b/package-lock.json index bb60c260ded..949913d70a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "nightscout", - "version": "14.2.3", + "version": "14.2.4", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index b645e7e57cd..c3271e251f8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nightscout", - "version": "14.2.3", + "version": "14.2.4", "description": "Nightscout acts as a web-based CGM (Continuous Glucose Montinor) to allow multiple caregivers to remotely view a patients glucose data in realtime.", "license": "AGPL-3.0", "author": "Nightscout Team",