Skip to content

Commit

Permalink
Merge pull request #5 from nightscout/master
Browse files Browse the repository at this point in the history
Cgm from 10.02.19
  • Loading branch information
alexandra255 authored Feb 10, 2019
2 parents a7dd317 + dc7ea1b commit 9ca3258
Show file tree
Hide file tree
Showing 90 changed files with 8,479 additions and 7,200 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/--bug-report.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: "\U0001F41BBug report"
about: Create a report to help us improve things
label: bug

---

Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.11.x
8.x
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
language: node_js
os: osx
node_js:
- "10"
- "8"
os:
- osx
before_install:
- if [[ `npm --version` != "5.8.0" ]]; then npm install -g npm@latest; npm --version; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
# https://github.com/Homebrew/homebrew-core/issues/26358
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew unlink python; fi
Expand Down
228 changes: 197 additions & 31 deletions CONTRIBUTING.md

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ MOCHA=./node_modules/mocha/bin/_mocha
# Pinned from dependency list.
ISTANBUL=./node_modules/.bin/istanbul
ANALYZED=./coverage/lcov.info
export CODACY_REPO_TOKEN=e29ae5cf671f4f918912d9864316207c
# Following token deprecated
# export CODACY_REPO_TOKEN=e29ae5cf671f4f918912d9864316207c

DOCKER_IMAGE=nightscout/cgm-remote-monitor-travis

Expand Down
99 changes: 65 additions & 34 deletions README.md

Large diffs are not rendered by default.

42 changes: 37 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,39 @@ function create(env, ctx) {
var appInfo = env.name + ' ' + env.version;
app.set('title', appInfo);
app.enable('trust proxy'); // Allows req.secure test on heroku https connections.
var insecureUseHttp = env.insecureUseHttp;
var secureHstsHeader = env.secureHstsHeader;
console.info('Security settings: INSECURE_USE_HTTP=',insecureUseHttp,', SECURE_HSTS_HEADER=',secureHstsHeader);
if (!insecureUseHttp) {
app.use((req, res, next) => {
if (req.header('x-forwarded-proto') !== 'https')
res.redirect(`https://${req.header('host')}${req.url}`);
else
next()
})
if (secureHstsHeader) { // Add HSTS (HTTP Strict Transport Security) header
const helmet = require('helmet');
var includeSubDomainsValue = env.secureHstsHeaderIncludeSubdomains;
var preloadValue = env.secureHstsHeaderPreload;
app.use(helmet({
hsts: {
maxAge: 31536000,
includeSubDomains: includeSubDomainsValue,
preload: preloadValue
}
}))
if (env.secureCsp) {
app.use(helmet.contentSecurityPolicy({ //TODO make NS work without 'unsafe-inline'
directives: {
defaultSrc: ["'self'"],
styleSrc: ["'self'", 'https://fonts.googleapis.com/',"'unsafe-inline'"],
scriptSrc: ["'self'", "'unsafe-inline'"],
fontSrc: [ "'self'", 'https://fonts.gstatic.com/']
}
}));
}
}
}

app.set('view engine', 'ejs');
// this allows you to render .html files as templates in addition to .ejs
Expand Down Expand Up @@ -84,7 +117,7 @@ function create(env, ctx) {
});
});

app.get("/nightscout.appcache", (req, res) => {
app.get("/appcache/*", (req, res) => {
res.render("nightscout.appcache", {
locals: app.locals
});
Expand Down Expand Up @@ -141,7 +174,8 @@ function create(env, ctx) {
// serve the static content
app.use(staticFiles);

var swaggerFiles = express.static(env.swagger_files, {
const swaggerUiAssetPath = require("swagger-ui-dist").getAbsoluteFSPath();
var swaggerFiles = express.static(swaggerUiAssetPath, {
maxAge: maxAge
});

Expand All @@ -160,7 +194,6 @@ function create(env, ctx) {
console.log('Production environment detected, enabling Minify');

var minify = require('express-minify');
var myUglifyJS = require('uglify-js');
var myCssmin = require('cssmin');

app.use(minify({
Expand All @@ -171,7 +204,6 @@ function create(env, ctx) {
stylus_match: /stylus/,
coffee_match: /coffeescript/,
json_match: /json/,
uglifyJS: myUglifyJS,
cssmin: myCssmin,
cache: __dirname + '/tmp',
onerror: undefined,
Expand Down Expand Up @@ -208,4 +240,4 @@ function create(env, ctx) {
//}
return app;
}
module.exports = create;
module.exports = create;
189 changes: 92 additions & 97 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,155 +2,150 @@
"name": "CGM Remote Monitor",
"repository": "https://github.com/nightscout/cgm-remote-monitor",
"env": {
"MONGO_COLLECTION": {
"description": "REQUIRED: The mongo collection used for CGM data. Default value is 'entries'. Most users should use the default.",
"value": "entries",
"required": true
"ALARM_HIGH": {
"description": "Default setting for new browser views, for the High alarm (triggered when BG crosses BG_TARGET_TOP). ('on' or 'off')",
"value": "on",
"required": false
},
"API_SECRET": {
"description": "REQUIRED: A secret passphrase that must be at least 12 characters long, required to enable POST and PUT; also required for the Care Portal.",
"value": "",
"required": true
"ALARM_LOW": {
"description": "Default setting for new browser views, for the Low alarm (triggered when BG crosses BG_TARGET_BOTTOM). ('on' or 'off')",
"value": "on",
"required": false
},
"DISPLAY_UNITS": {
"description": "Choices: mg/dl and mmol. Setting to mmol puts the entire server into mmol mode by default, no further settings needed.",
"value": "",
"ALARM_TIMEAGO_URGENT": {
"description": "Default setting for new browser views, for an urgent alarm when CGM data hasn't been received in the number of minutes set in ALARM_TIMEAGO_URGENT_MINS. ('on' or 'off')",
"value": "on",
"required": false
},
"ENABLE": {
"description": "Used to enable optional features, expects a space delimited list, such as: careportal rawbg iob, see https://github.com/nightscout/cgm-remote-monitor/blob/master/README.md for more info.",
"value": "",
"ALARM_TIMEAGO_URGENT_MINS": {
"description": "Default setting for new browser views, for the number of minutes since the last CGM reading to trigger an ALARM_TIMEAGO_URGENT alarm.",
"value": "30",
"required": false
},
"DISABLE": {
"description": "Used to disable default features, expects a space delimited list, such as: direction upbat, see https://github.com/nightscout/cgm-remote-monitor/blob/master/README.md for more info.",
"value": "",
"ALARM_TIMEAGO_WARN": {
"description": "Default setting for new browser views, for a warning alarm when CGM data hasn't been received in the number of minutes set in ALARM_TIMEAGO_WARN_MINS. ('on' or 'off')",
"value": "on",
"required": false
},
"ALARM_TIMEAGO_WARN_MINS": {
"description": "Default setting for new browser views, for the number of minutes since the last CGM reading to trigger an ALARM_TIMEAGO_WARN alarm.",
"value": "15",
"required": false
},
"ALARM_TYPES": {
"description": "Alarm behavior currently 2 alarm types are supported simple and predict, and can be used independently or combined. The simple alarm type only compares the current BG to BG_ thresholds above, the predict alarm type uses highly tuned formula that forecasts where the BG is going based on it's trend. predict DOES NOT currently use any of the BG_* ENV's",
"value": "",
"description": "'simple' and/or 'predict'. Simple alarms trigger when BG crosses the various thresholds set below. Predict alarms use a formula that forecasts where the BG is going based on its trend. You will *not* get warnings when crossing the BG thresholds set below when using the predict type.",
"value": "simple",
"required": false
},
"BG_HIGH": {
"description": "Urgent high BG alarm. Default null value implies 260. Must be set in mg/dL (multiply with 18 if you have a value in mmol/L). Only used with simple alarms.",
"value": "",
"ALARM_URGENT_HIGH": {
"description": "Default setting for new browser views, for the Urgent High alarm (triggered when BG crosses BG_HIGH). ('on' or 'off')",
"value": "on",
"required": false
},
"ALARM_URGENT_LOW": {
"description": "Default setting for new browser views, for the Urgent Low alarm (triggered when BG crosses BG_LOW). ('on' or 'off')",
"value": "on",
"required": false
},
"BG_TARGET_TOP": {
"description": "Non-urgent high BG alarm, the top of your target range. Default null value implies 180. Must be set in mg/dL (multiply with 18 if you have a value in mmol/L). Only used with simple alarms.",
"API_SECRET": {
"description": "A passphrase that must be at least 12 characters long. Avoid 'special' characters, which can cause problems in some cases.",
"value": "",
"required": true
},
"BG_HIGH": {
"description": "Urgent High BG threshold, triggers the ALARM_URGENT_HIGH alarm. Must be set in mg/dL, even if you use mmol/L (multiply a mmol/L value by 18 to change it to mg/dl).",
"value": "260",
"required": false
},
"BG_LOW": {
"description": "Urgent Low BG threshold, triggers the ALARM_URGENT_LOW alarm. Must be set in mg/dL, even if you use mmol/L (multiply a mmol/L value by 18 to change it to mg/dl).",
"value": "55",
"required": false
},
"BG_TARGET_BOTTOM": {
"description": "Non urgent low BG alarm, the bottom of your target range. Default null value implies 80. Must be set in mg/dL (multiply with 18 if you have a value in mmol/L). Only used with simple alarms.",
"value": "",
"description": "Low BG threshold, triggers the ALARM_LOW alarm. Must be set in mg/dL, even if you use mmol/L (multiply a mmol/L value by 18 to change it to mg/dl).",
"value": "80",
"required": false
},
"BG_LOW": {
"description": "Urgent Low BG alarm. Default null value implies 55. Must be set in mg/dL (multiply with 18 if you have a value in mmol/L). Only used with simple alarms.",
"value": "",
"BG_TARGET_TOP": {
"description": "High BG threshold, triggers the ALARM_HIGH alarm. Must be set in mg/dL, even if you use mmol/L (multiply a mmol/L value by 18 to change it to mg/dl).",
"value": "180",
"required": false
},
"PUSHOVER_API_TOKEN": {
"description": "Pushover API token, required for Pushover notifications. Leave blank if not using Pushover.",
"BRIDGE_PASSWORD": {
"description": "Your Dexcom account password, to receive CGM data from the Dexcom Share service. Also make sure to include 'bridge' in your ENABLE line.",
"value": "",
"required": false
},
"PUSHOVER_USER_KEY": {
"description": "Pushover user key, required for Pushover notifications. Leave blank if not using Pushover.",
"value": "",
"BRIDGE_SERVER": {
"description": "If you are bridging from the Dexcom Share service, and are anywhere *outside* the US, change this to EU. ('US' or 'EU')",
"value": "US",
"required": false
},
"PUSHOVER_ANNOUNCEMENT_KEY": {
"description": "An optional Pushover user/group key, will be used for system wide user generated announcements. If not defined this will fallback to `PUSHOVER_USER_KEY`. A possible use for this is sending important messages and alarms to a CWD that you don't want to send all notification too. This also support a space delimited list of keys. Leave blank if not using Pushover",
"BRIDGE_USER_NAME": {
"description": "Your Dexcom account username, to receive CGM data from the Dexcom Share service. Also make sure to include 'bridge' in your ENABLE line.",
"value": "",
"required": false
},
"CUSTOM_TITLE": {
"description": "Customize the name of the website, usually the name of T1.",
"description": "The display name for the Nightscout site. Appears in the upper left of the main view. Often set to the name of the CGM wearer.",
"value": "",
"required": false
},
"BRIDGE_USER_NAME": {
"description": "Share bridge - Your user name for the Share service. ENSURE bridge is in ENABLE if you want to use the share bridge.",
"DISPLAY_UNITS": {
"description": "Preferred BG units for the site:'mg/dl' or 'mmol'. (Note that it is *not* 'mmol/L')",
"value": "mg/dl",
"required": false
},
"ENABLE": {
"description": "Plugins to enable for your site. Must be a space-delimited, lower-case list. Include the word 'bridge' here if you are receiving data from the Dexcom Share service. Include 'mmconnect' if you are bridging from the MiniMed CareLink service.",
"value": "careportal basal",
"required": false
},
"MMCONNECT_USER_NAME": {
"description": "Your CareLink account username, to receive CGM data from the CareLink service. Also make sure to include 'mmconnect' in your ENABLE line.",
"value": "",
"required": false
},
"BRIDGE_PASSWORD": {
"description": "Share bridge - Your password for the Share service. ENSURE bridge is in ENABLE if you want to use the share bridge.",
"MMCONNECT_PASSWORD": {
"description": "Your CareLink account password, to receive CGM data from the CareLink service. Also make sure to include 'mmconnect' in your ENABLE line.",
"value": "",
"required": false
},
"TIME_FORMAT": {
"description": "Browser default time mode. Valid settings are 12 or 24",
"value": "12",
"required": false
"MMCONNECT_SERVER": {
"description": "If you are bridging from the CareLink service, and are anywhere *outside* the US, change this to EU. ('US' or 'EU')",
"value": "US",
"required": false
},
"MONGO_COLLECTION": {
"description": "The Mongo collection where CGM data is stored.",
"value": "entries",
"required": true
},
"NIGHT_MODE": {
"description": "Browser defaults to night mode. Valid settings are on or off",
"description": "Default setting for new browser views, for whether Night Mode should be enabled. ('on' or 'off')",
"value": "off",
"required": false
},
"SHOW_PLUGINS": {
"description": "Default setting for whether or not these plugins are checked (active) by default, not merely enabled. Include plugins here as in the ENABLE line; space-separated and lower-case.",
"value": "careportal",
"required": false
},
"SHOW_RAWBG": {
"description": "Browser default raw display mode. Valid settings are always, never, or noise",
"description": "Default setting for new browser views, for the display of raw CGM data (if available). ('always', 'never', or 'noise')",
"value": "never",
"required": false
},
"THEME": {
"description": "Browser default theme setting. Valid settings are default, colors, or colorblindfriendly",
"value": "default",
"description": "Default setting for new browser views, for the color theme of the CGM graph. ('default', 'colors', or 'colorblindfriendly')",
"value": "colors",
"required": false
},
"ALARM_URGENT_HIGH": {
"description": "Browser default urgent high alarm enabled. Valid settings are on or off",
"value": "on",
"TIME_FORMAT": {
"description": "Default setting for new browser views, for the time mode. ('12' or '24')",
"value": "12",
"required": false
},
"ALARM_HIGH": {
"description": "Browser default high alarm enabled. Valid settings are on or off",
"value": "on",
"required": false
},
"ALARM_LOW": {
"description": "Browser default low alarm enabled. Valid settings are on or off",
"value": "on",
"required": false
},
"ALARM_URGENT_LOW": {
"description": "Browser default urgent low alarm enabled. Valid settings are on or off",
"value": "on",
"required": false
},
"ALARM_TIMEAGO_WARN": {
"description": "Browser default warn after time of last data exceeds ALARM_TIMEAGO_WARN_MINS alarm enabled. Valid settings are on or off",
"value": "on",
"required": false
},
"ALARM_TIMEAGO_WARN_MINS": {
"description": "Browser default minutes since the last reading to trigger a warning.",
"value": "15",
"required": false
},
"ALARM_TIMEAGO_URGENT": {
"description": "Browser default urgent warning after time of last data exceeds ALARM_TIMEAGO_URGENT_MINS alarm enabled. Valid settings are on or off",
"value": "on",
"required": false
},
"ALARM_TIMEAGO_URGENT_MINS": {
"description": "Browser default minutes since last reading to trigger an urgent alarm.",
"value": "30",
"required": false
},
"MAKER_KEY": {
"description": "Maker Key - Set this to your secret key Note for additional info see https://github.com/nightscout/cgm-remote-monitor/blob/dev/README.md#ifttt-maker , maker should be added to enable if you want to use maker, Leave blank if not using maker",
"value": "",
"required": false
},
"MAKER_ANNOUNCEMENT_KEY": {
"description": "Maker Announcement Key - Set this to your secret key for announcements Note for additional info see https://github.com/nightscout/cgm-remote-monitor/blob/dev/README.md#ifttt-maker , maker should be added to enable if you want to use maker Leave blank if not using maker",
"value": "",
"required": false
}
},
"addons": [
Expand Down
17 changes: 0 additions & 17 deletions bundle/index.js

This file was deleted.

Loading

0 comments on commit 9ca3258

Please sign in to comment.