-
Notifications
You must be signed in to change notification settings - Fork 71.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
1,127 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,8 @@ my.env | |
*.env | ||
static/bower_components/ | ||
.*.sw? | ||
.DS_Store | ||
|
||
.vagrant | ||
.vagrant | ||
/iisnode | ||
/web.config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: node server.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "CGM Remote Monitor", | ||
"repository": "https://github.com/nightscout/cgm-remote-monitor", | ||
"env": { | ||
"MONGO_COLLECTION": { | ||
"description": "The mongo collection to connect to.", | ||
"value": "nightscout" | ||
} | ||
}, | ||
"addons": [ | ||
"mongolab" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
|
||
curl -H "Content-Type: application/json" -XPOST 'http://localhost:1337/api/v1/devicestatus/' -d '{ | ||
"uploaderBattery": 55 | ||
}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
|
||
curl -H "Content-Type: application/json" -XPOST 'http://localhost:1337/api/v1/treatments/' -d '{ | ||
"enteredBy": "Dad", | ||
"eventType":"Site Change", | ||
"glucoseValue": 322, | ||
"glucoseType": "sensor", | ||
"carbsGiven": 0, | ||
"insulinGiven": 1.25, | ||
"notes": "Argh..." | ||
}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
'use strict'; | ||
|
||
var consts = require('../../constants'); | ||
|
||
function configure (app, wares, devicestatus) { | ||
var express = require('express'), | ||
api = express.Router( ); | ||
|
||
// invoke common middleware | ||
api.use(wares.sendJSONStatus); | ||
// text body types get handled as raw buffer stream | ||
api.use(wares.bodyParser.raw( )); | ||
// json body types get handled as parsed json | ||
api.use(wares.bodyParser.json( )); | ||
// also support url-encoded content-type | ||
api.use(wares.bodyParser.urlencoded({ extended: true })); | ||
|
||
// List settings available | ||
api.get('/devicestatus/', function(req, res) { | ||
devicestatus.list(function (err, profiles) { | ||
return res.json(profiles); | ||
}); | ||
}); | ||
|
||
function config_authed (app, api, wares, devicestatus) { | ||
|
||
api.post('/devicestatus/', /*TODO: auth disabled for quick UI testing... wares.verifyAuthorization, */ function(req, res) { | ||
var obj = req.body; | ||
devicestatus.create(obj, function (err, created) { | ||
if (err) | ||
res.sendJSONStatus(res, consts.HTTP_INTERNAL_ERROR, 'Mongo Error', err); | ||
else | ||
res.json(created); | ||
}); | ||
}); | ||
|
||
} | ||
|
||
if (app.enabled('api') || true /*TODO: auth disabled for quick UI testing...*/) { | ||
config_authed(app, api, wares, devicestatus); | ||
} | ||
|
||
return api; | ||
} | ||
|
||
module.exports = configure; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
'use strict'; | ||
|
||
var consts = require('../../constants'); | ||
|
||
function configure (app, wares, treatments) { | ||
var express = require('express'), | ||
api = express.Router( ); | ||
|
||
// invoke common middleware | ||
api.use(wares.sendJSONStatus); | ||
// text body types get handled as raw buffer stream | ||
api.use(wares.bodyParser.raw( )); | ||
// json body types get handled as parsed json | ||
api.use(wares.bodyParser.json( )); | ||
// also support url-encoded content-type | ||
api.use(wares.bodyParser.urlencoded({ extended: true })); | ||
|
||
// List settings available | ||
api.get('/treatments/', function(req, res) { | ||
treatments.list(function (err, profiles) { | ||
return res.json(profiles); | ||
}); | ||
}); | ||
|
||
function config_authed (app, api, wares, treatments) { | ||
|
||
api.post('/treatments/', /*TODO: auth disabled for now, need to get login figured out... wares.verifyAuthorization, */ function(req, res) { | ||
var treatment = req.body; | ||
treatments.create(treatment, function (err, created) { | ||
if (err) | ||
res.sendJSONStatus(res, consts.HTTP_INTERNAL_ERROR, 'Mongo Error', err); | ||
else | ||
res.json(created); | ||
}); | ||
}); | ||
|
||
} | ||
|
||
if (app.enabled('api') && app.enabled('careportal')) { | ||
config_authed(app, api, wares, treatments); | ||
} | ||
|
||
return api; | ||
} | ||
|
||
module.exports = configure; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use strict'; | ||
|
||
function configure (collection, storage) { | ||
|
||
function create (obj, fn) { | ||
obj.created_at = (new Date( )).toISOString( ); | ||
api( ).insert(obj, function (err, doc) { | ||
fn(null, doc); | ||
}); | ||
} | ||
|
||
function last(fn) { | ||
return api( ).find({ }).sort({created_at: -1}).limit(1).toArray(function(err, entries) { | ||
if (entries && entries.length > 0) | ||
fn(err, entries[0]); | ||
else | ||
fn(err, null); | ||
}); | ||
} | ||
|
||
function list (fn) { | ||
return api( ).find({ }).sort({created_at: -1}).toArray(fn); | ||
} | ||
|
||
function api ( ) { | ||
return storage.pool.db.collection(collection); | ||
} | ||
|
||
api.list = list; | ||
api.create = create; | ||
api.last = last; | ||
return api; | ||
} | ||
module.exports = configure; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use strict'; | ||
|
||
var Pushover = require('pushover-notifications'); | ||
|
||
function init(env) { | ||
if (env.pushover_api_token && env.pushover_user_key) { | ||
return new Pushover({ | ||
token: env.pushover_api_token, | ||
user: env.pushover_user_key, | ||
onerror: function (err) { | ||
console.log(err); | ||
} | ||
}); | ||
} else { | ||
return null; | ||
} | ||
} | ||
|
||
module.exports = init; |
Oops, something went wrong.