diff options
| author | Jules Laplace <jules@okfoc.us> | 2017-02-19 01:23:53 +0100 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2017-02-19 01:23:53 +0100 |
| commit | cf85cc2b75b9c3ead3a693b6fa0feeca5b9e70ba (patch) | |
| tree | 160499d95dac5d1df01b45490b735d2b60e814e1 /lib/okpush/index.js | |
| parent | d6be5583190174bd45c417b934b36e4469ab3441 (diff) | |
counts
Diffstat (limited to 'lib/okpush/index.js')
| -rw-r--r-- | lib/okpush/index.js | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/lib/okpush/index.js b/lib/okpush/index.js index 2fe59932..df9c8265 100644 --- a/lib/okpush/index.js +++ b/lib/okpush/index.js @@ -50,37 +50,40 @@ function OKPush (options) { apn.init(config) db.init(config) - router.use('/admin/', passport.initialize()) +// router.use('/admin/', passport.initialize()) router.use('/public/', express.static(path.join(__dirname, './public'))); // monkeypatch because of app.use(router) .. obnoxious - router.all('/admin/(:path*)?', function (req, res, next) { - req.newUrl = req.url - req.url = req.originalUrl - next() - }) - router.all('/admin/(:path*)?', passport.authenticate('digest', { - session: false - })) - router.all('/admin/(:path*)?', function (req, res, next) { - req.url = req.newUrl - next() - }) +// router.all('/admin/(:path*)?', function (req, res, next) { +// console.log(req.url) +// req.newUrl = req.url +// req.url = req.originalUrl +// next() +// }) +// router.all('/admin/(:path*)?', passport.authenticate('digest', { +// session: false +// })) +// router.all('/admin/(:path*)?', function (req, res, next) { +// req.url = req.newUrl +// next() +// }) // pass in admin middleware! router.get('/admin', function (req, res) { - // change this to get notification counts for each channel db.getNotifications(function(err, notes){ - db.getDeviceCount(function(err, count){ + var channels = Object.keys(config.notifications) + db.getDeviceCount(channels, function(count){ var data = { meta: meta, notifications: config.notifications, - device_count: count, } notes.forEach(function(note){ if (note.key in data.notifications) { data.notifications[ note.key ].last_push = note.last_push } + if (note.key in count) { + data.notifications[ note.key ].count = count[note.key] + } }) templates['index'].render(data).then(function(rendered) { res.send(rendered); |
