Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update #12

Merged
merged 119 commits into from
Sep 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
10d623b
mgdl -> mg/dl
AdrianLxM Mar 6, 2018
bde4750
Merge pull request #9 from inventor96/update-virtual-assistants-v2
inventor96 Nov 7, 2019
378406b
Merge pull request #10 from nightscout/dev
inventor96 Dec 7, 2019
e4e417b
Merge branch 'dev' of github.com:inventor96/cgm-remote-monitor into dev
inventor96 Dec 17, 2019
4578e17
Release ref update v2 (#5301)
inventor96 Dec 17, 2019
6021a0a
Fix auth dialog sizing error (#5315)
jpcunningh Dec 17, 2019
721aa02
Fix auth dialog sizing error (#5314)
jpcunningh Dec 18, 2019
14e8c8c
Bump version to 13.0.2-dev
sulkaharo Dec 18, 2019
e0667c9
fix some random test failures (#5341)
jpcunningh Dec 20, 2019
6f43f47
Merge branch 'dev' of github.com:inventor96/cgm-remote-monitor into dev
inventor96 Dec 27, 2019
0c9f819
Added support for asking delta
inventor96 Dec 27, 2019
a4c0425
Added time reference
inventor96 Dec 27, 2019
a7e49b3
Made delta reading more informative
inventor96 Dec 27, 2019
7a1fc6d
Corrected time reference
inventor96 Dec 27, 2019
c9c9495
Try shortening the response
inventor96 Dec 27, 2019
014df85
Revert attempt
inventor96 Dec 27, 2019
6475310
Updated templates and documentation
inventor96 Dec 27, 2019
161c496
Minor improvement in response when delta is 0
inventor96 Dec 27, 2019
23d25a4
German translations improved and added (#5360)
tanja3981 Jan 1, 2020
aeebf0b
Delta support in virtual assistants (#5376)
sulkaharo Jan 1, 2020
9718bc7
Fix Alexa Launch and SessionEnded Requests (#5377)
Bartlomiejsz Jan 1, 2020
a4ce06f
Fix #5149 - discord link on CONTRIBUTING.md doesn't do anything (#5380)
Bartlomiejsz Jan 1, 2020
8139cb9
Fix #5146 - display of treatment with only Fat and Protein set (#5381)
Bartlomiejsz Jan 1, 2020
f7922a6
Basic report page style fixes and updates (#5387)
andrew-dixon Jan 1, 2020
031c5be
Add missing Polish translations and improve existing (#5382)
Bartlomiejsz Jan 1, 2020
1c579a7
Addressed virtual assistant usage with Authentication Roles (#5388)
inventor96 Jan 1, 2020
78be0f6
mgdl -> mg/dl (#3423)
sulkaharo Jan 1, 2020
44519b9
Fix timeago alarms (again). The changes to the rendered had an uninte…
sulkaharo Jan 1, 2020
9817b03
Remove the server side test
sulkaharo Jan 1, 2020
df03577
Merge pull request #5394 from nightscout/fix_timeago
sulkaharo Jan 1, 2020
60be07c
Fix Graph Display Without Recent Devicestatus (#5409)
jpcunningh Jan 6, 2020
ee0b1e8
Update Russian (#5415)
apanasef Jan 6, 2020
0def1f2
Add server teardown ability (#5410)
PetrOndrusek Jan 6, 2020
bb34500
Additional German Translations and corrections (#5405)
herzogmedia Jan 6, 2020
5e47c4d
Fix #5188 - move predictions to bundle and don't render chart on pred…
Bartlomiejsz Jan 6, 2020
ddbda15
Move toolbar and authentication status to partial and include on each…
Bartlomiejsz Jan 6, 2020
4098689
Virtual assistant code simplification (#5400)
inventor96 Jan 11, 2020
4f9f735
Pr/5379 (#5441)
sulkaharo Jan 11, 2020
c49ea37
Volunteer for Polish translations (#5396)
Bartlomiejsz Jan 11, 2020
2f60d8d
Api3 output renderers (#5425)
PetrOndrusek Jan 12, 2020
5c15243
Restore glucose distribution test (#5434)
jakobsandberg Jan 12, 2020
81d926a
Increase coverage of tests on units utility and clean up timeago test…
jakobsandberg Jan 12, 2020
937aa47
Refactor to encapsulate duplicated settings logic (#5426)
jakobsandberg Jan 12, 2020
64663d2
Send coverage reports to Codacy (#5444)
sulkaharo Jan 12, 2020
7dc292e
Resolve unnecessary uses of eslint-ignore (#5436)
jakobsandberg Jan 12, 2020
3a1d9be
Fix eslint errors and add npm script for eslint (#5427)
jakobsandberg Jan 14, 2020
04edbec
Remove redundant checks on entry ID (#5440)
jakobsandberg Jan 14, 2020
d095482
Run CI Action for Pull Requests
sulkaharo Jan 14, 2020
3386ac6
Update DayToDay report for Loop Overrides (#5452)
jonfawcett Jan 18, 2020
baad198
Fix earlier merge error with predictions having moved to the report b…
sulkaharo Jan 18, 2020
6045547
fix brushing loop (#5499)
jpcunningh Feb 1, 2020
c86b890
Update README.md (#5480)
hummelstrand Feb 3, 2020
c0f6b22
Added period of days into headline of glucose distribution and percen…
peterleimbach Feb 3, 2020
82f0076
Move app caching to a service worker (#5504)
sulkaharo Feb 5, 2020
b1ec21c
Added indexes to 'entries' and 'treatments' along with other updates …
a-harrison Feb 5, 2020
765d7f8
Fix: Round interporlated mg/dL value to an integer
sulkaharo Feb 8, 2020
44ab2a7
Plugin to show database size (% of available space or in MiB) (#5496)
dlvoy Feb 10, 2020
65b9f38
Trying to fix random fail of APIv3 tests (#5519)
PetrOndrusek Feb 11, 2020
cd2ad5e
client - mobile - Axis label font is scaled on small screens (#5512)
stephencmorton Feb 16, 2020
77795ca
Split view (#5518)
sulkaharo Feb 16, 2020
729747a
Allow flagging specific settings to be not exposed the /properties an…
sulkaharo Feb 16, 2020
dcf8248
Add more variables to the special list
sulkaharo Feb 16, 2020
43165a0
[DEV][FIX] Fix dbsize plugin to make it hideable again (#5529)
dlvoy Feb 22, 2020
be678c0
Removed duplicate if statement (#5531)
altaired Feb 22, 2020
68fb745
Update Dutch translations (#5532)
Feb 22, 2020
7d95b06
Fix settings test
sulkaharo Feb 22, 2020
32f4791
Update version to 13.1.0
sulkaharo Feb 22, 2020
9611373
Merge branch 'master' into dev for release
sulkaharo Feb 22, 2020
4cdd00d
Fix topbar collapse on small screens (#5562)
sulkaharo Mar 9, 2020
17eb4ae
Option to switch off bolus amount outputs (#5522)
andrew-dixon Apr 14, 2020
7c5a69d
Fix d3 portrait to landscape brush failure (#5638)
jpcunningh May 5, 2020
9236771
Sanitize data from manual careportal entries so only fields with actu…
sulkaharo May 5, 2020
db0e08c
do not redirect to profile editor by default (#5671)
bewest Jun 12, 2020
f3fab56
Fix Issue #5486 - Device Status Days Feature (#5651)
mtfoley Jun 12, 2020
3d6f488
Configurable clock views (#5625)
ireneusz-ptak Jun 12, 2020
5698ae2
Add remote bolus/carbs + otp entry for loop (#5598)
josep1972 Jun 12, 2020
500de79
Sometimes at the very start no profiles provided. (#5591)
GermanBluefox Jun 12, 2020
802d986
Fixes #4991 - Now selects basal profile based day by day (#5572)
fromorbonia Jun 12, 2020
0ae6431
prepare hotfix for MMConnect/EU - 2020-06-28
bewest Jun 28, 2020
f611f1b
bump pointing at right tag
bewest Jun 29, 2020
1062a0d
prepare hotfix for MMConnect/EU - 2020-06-28
bewest Jun 28, 2020
bcd6df2
bump pointing at right tag
bewest Jun 29, 2020
cc1edf2
Merge pull request #5721 from nightscout/wip/bewest/mmconnect-eu
bewest Jun 30, 2020
acf0d39
hotfix attempt 2 - carelink 2020 sso updates
bewest Jun 30, 2020
06982d7
hotfix 3 - attempt 3 at carelink 2020 sso updates
bewest Jun 30, 2020
93c8447
attempt 4 at hotfix for nightscout
bewest Jul 1, 2020
8fba311
hotfix 5 - incorporates latest axios changes
bewest Jul 1, 2020
7283560
Fix for boluscalc issue (#5729)
ireneusz-ptak Jul 2, 2020
9528b79
npm install --save minimed-connect-to-nightscout@^1.4.0
bewest Jul 2, 2020
2fc559e
Change DISPLAY_UNITS to use readENV's default value and added several…
joracine Jul 12, 2020
9b048dd
Fix audit errors, button order (#5694)
sulkaharo Jul 12, 2020
b8e69d9
Fix temporary target cancellation
sulkaharo Aug 18, 2020
356a236
Added documentation on the use of Alpha Testing (#5784)
inventor96 Aug 18, 2020
5ffa5eb
Wip/bewest/mmconnect eu (#5731)
bewest Aug 18, 2020
f4f456a
* Updated several packages to remove issues from NPM audit
sulkaharo Aug 18, 2020
359e6a6
* Limit the default number of profiles returned by the API to fix iss…
sulkaharo Aug 19, 2020
2936559
Upgrade Helmet to 4.0.0
sulkaharo Aug 19, 2020
fd90f4e
CSP and service worker improvements (#5856)
sulkaharo Aug 20, 2020
3e1cc14
Serve the CSP to everyone
sulkaharo Aug 20, 2020
d504a66
Split view CSP support (#5864)
sulkaharo Aug 21, 2020
0c22963
Re-enable CSP configuration (#5867)
sulkaharo Aug 22, 2020
46e3d8f
Merge remote-tracking branch 'official/hotfix/2020-06-28/carelink' in…
bewest Aug 28, 2020
26ebdbd
Bump share2nightscout-bridge plugin
bewest Aug 28, 2020
6613e76
feat Add robots.txt to disallow site crawling
sulkaharo Aug 30, 2020
22d1506
Fix dbsize for usage with Atlas (#5962)
dlvoy Sep 8, 2020
89dfe21
Openaps performance improvement (#5945)
jpcunningh Sep 8, 2020
67fb939
Adapt to MongoDB Atlas (#5893)
aviau Sep 8, 2020
d26091b
Fix Issue #5763 - Change $.ajax to /api/v1/profile (#5704)
mtfoley Sep 8, 2020
0ee3628
Bug fixes for Service Worker (#5970)
pazaan Sep 9, 2020
8019005
Optimize Nightscout database usage (#5947)
sulkaharo Sep 9, 2020
c113424
Bumping version to 14.0.0 given this is a relatively large update and…
sulkaharo Sep 10, 2020
5aef245
Remove logging statements
sulkaharo Sep 10, 2020
be422f0
Add Loop Carbs foodType, absorptionTime to Reports for ISSUE #5701 (#…
kskandispersonal Sep 12, 2020
14621a4
Update README to point to new docs
sulkaharo Sep 13, 2020
e54a6b8
Merge pull request #5526 from nightscout/dev
sulkaharo Sep 13, 2020
3928565
Fix `Treatments` report for `mmol/L` users
pazaan Sep 13, 2020
0c11bf0
Bump version to 14.0.1
sulkaharo Sep 13, 2020
f04e7d7
Merge pull request #5983 from pazaan/pazaan/fix-iquorice-treatment-re…
sulkaharo Sep 13, 2020
4f85e19
Merge pull request #5984 from nightscout/dev
sulkaharo Sep 13, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CI test

on: [push]
on: [push, pull_request]

jobs:
build:
Expand All @@ -9,7 +9,7 @@ jobs:

strategy:
matrix:
node-version: [10.x, 12.x]
node-version: [12.x]

steps:
- uses: actions/checkout@v1
Expand All @@ -21,12 +21,14 @@ jobs:
run: npm install
- name: Install MongoDB
run: |
wget -qO - https://www.mongodb.org/static/pgp/server-3.6.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo apt-get install -y --allow-downgrades mongodb-org=3.6.14 mongodb-org-server=3.6.14 mongodb-org-shell=3.6.14 mongodb-org-mongos=3.6.14 mongodb-org-tools=3.6.14
sudo apt-get install -y --allow-downgrades mongodb-org=4.4.0 mongodb-org-server=4.4.0 mongodb-org-shell=4.4.0 mongodb-org-mongos=4.4.0 mongodb-org-tools=4.4.0
- name: Start MongoDB
run: sudo systemctl start mongod
- name: Run tests
- name: Run Tests
run: npm run-script test-ci
- name: Send Coverage
run: npm run-script coverage
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
[coverage-img]: https://img.shields.io/coveralls/nightscout/cgm-remote-monitor/master.svg
[coverage-url]: https://coveralls.io/r/nightscout/cgm-remote-monitor?branch=master
[discord-img]: https://img.shields.io/discord/629952586895851530?label=discord%20chat
[discord-url]: https://discordapp.com/channels/629952586895851530/629952669967974410
[discord-url]: https://discord.gg/rTKhrqz

## Installation for development

Expand Down Expand Up @@ -181,6 +181,7 @@ Also if you can't code, it's possible to contribute by improving the documentati
[@unsoluble]: https://github.com/unsoluble
[@viderehh]: https://github.com/viderehh
[@OpossumGit]: https://github.com/OpossumGit
[@Bartlomiejsz]: https://github.com/Bartlomiejsz

| Contribution area | List of contributors |
| ------------------------------------- | ---------------------------------- |
Expand Down Expand Up @@ -252,7 +253,7 @@ Languages with less than 90% coverage will be removed in a future Nightscout ver
| 한국어 (`ko`)|Please volunteer|Needs attention: 80.6%|
| Norsk (Bokmål) (`nb`)|Please volunteer|OK|
| Nederlands (`nl`)|[@PieterGit]|OK|
| Polski (`pl`)|Please volunteer|OK|
| Polski (`pl`)|[@Bartlomiejsz]|OK|
| Português (Brasil) (`pt`)|Please volunteer|OK|
| Română (`ro`)|Please volunteer|OK|
| Русский (`ru`)|[@apanasef]|OK|
Expand Down
117 changes: 92 additions & 25 deletions README.md

Large diffs are not rendered by default.

126 changes: 88 additions & 38 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const bodyParser = require('body-parser');

const path = require('path');
const fs = require('fs');
const ejs = require('ejs');

function create (env, ctx) {
var app = express();
Expand All @@ -25,6 +26,9 @@ function create (env, ctx) {
}
});
if (secureHstsHeader) { // Add HSTS (HTTP Strict Transport Security) header

const enableCSP = env.secureCsp ? true : false;

console.info('Enabled SECURE_HSTS_HEADER (HTTP Strict Transport Security)');
const helmet = require('helmet');
var includeSubDomainsValue = env.secureHstsHeaderIncludeSubdomains;
Expand All @@ -36,39 +40,52 @@ function create (env, ctx) {
, preload: preloadValue
}
, frameguard: false
, contentSecurityPolicy: enableCSP
}));
if (env.secureCsp) {

if (enableCSP) {
var secureCspReportOnly = env.secureCspReportOnly;
if (secureCspReportOnly) {
console.info('Enabled SECURE_CSP (Content Security Policy header). Not enforcing. Report only.');
} else {
console.info('Enabled SECURE_CSP (Content Security Policy header). Enforcing.');
}

let frameAncestors = ["'self'"];

for (let i = 0; i <= 8; i++) {
let u = env.settings['frameUrl' + i];
if (u) {
frameAncestors.push(u);
}
}

app.use(helmet.contentSecurityPolicy({ //TODO make NS work without 'unsafe-inline'
directives: {
defaultSrc: ["'self'"]
, styleSrc: ["'self'", 'https://fonts.googleapis.com/', "'unsafe-inline'"]
, styleSrc: ["'self'", 'https://fonts.googleapis.com/', 'https://fonts.gstatic.com/', "'unsafe-inline'"]
, scriptSrc: ["'self'", "'unsafe-inline'"]
, fontSrc: ["'self'", 'https://fonts.gstatic.com/', 'data:']
, fontSrc: ["'self'", 'https://fonts.googleapis.com/', 'https://fonts.gstatic.com/', 'data:']
, imgSrc: ["'self'", 'data:']
, objectSrc: ["'none'"], // Restricts <object>, <embed>, and <applet> elements
reportUri: '/report-violation'
, frameAncestors: ["'none'"], // Clickjacking protection, using frame-ancestors
baseUri: ["'none'"], // Restricts use of the <base> tag
formAction: ["'self'"], // Restricts where <form> contents may be submitted
, objectSrc: ["'none'"] // Restricts <object>, <embed>, and <applet> elements
, reportUri: '/report-violation'
, baseUri: ["'none'"] // Restricts use of the <base> tag
, formAction: ["'self'"] // Restricts where <form> contents may be submitted
, connectSrc: ["'self'", "ws:", "wss:", 'https://fonts.googleapis.com/', 'https://fonts.gstatic.com/']
, frameSrc: ["'self'"]
, frameAncestors: frameAncestors
}
, reportOnly: secureCspReportOnly
}));
app.use(helmet.referrerPolicy({ policy: 'no-referrer' }));
app.use(helmet.featurePolicy({ features: { payment: ["'none'"], } }));
app.use(bodyParser.json({ type: ['json', 'application/csp-report'] }));
app.post('/report-violation', (req, res) => {
if (req.body) {
console.log('CSP Violation: ', req.body)
console.log('CSP Violation: ', req.body);
} else {
console.log('CSP Violation: No data received!')
console.log('CSP Violation: No data received!');
}
res.status(204).end()
res.status(204).end();
})
}
}
Expand All @@ -92,6 +109,20 @@ function create (env, ctx) {
}
app.locals.cachebuster = cacheBuster;

app.get("/robots.txt", (req, res) => {
res.setHeader('Content-Type', 'text/plain');
res.send(['User-agent: *','Disallow: /'].join('\n'));
});

app.get("/sw.js", (req, res) => {
res.setHeader('Content-Type', 'application/javascript');
res.send(ejs.render(fs.readFileSync(
require.resolve(`${__dirname}/views/service-worker.js`),
{ encoding: 'utf-8' }),
{ locals: app.locals}
));
});

if (ctx.bootErrors && ctx.bootErrors.length > 0) {
app.get('*', require('./lib/server/booterror')(ctx));
return app;
Expand Down Expand Up @@ -131,41 +162,58 @@ function create (env, ctx) {
}
}));

const clockviews = require('./lib/server/clocks.js')(env, ctx);
clockviews.setLocals(app.locals);

app.use("/clock", clockviews);

app.get("/", (req, res) => {
res.render("index.html", {
locals: app.locals
});
});

var appPages = {
"/clock-color.html": "clock-color.html"
, "/admin": "adminindex.html"
, "/profile": "profileindex.html"
, "/food": "foodindex.html"
, "/bgclock.html": "bgclock.html"
, "/report": "reportindex.html"
, "/translations": "translationsindex.html"
, "/clock.html": "clock.html"
"/": {
file: "index.html"
, type: "index"
}
, "/admin": {
file: "adminindex.html"
, title: 'Admin Tools'
, type: 'admin'
}
, "/food": {
file: "foodindex.html"
, title: 'Food Editor'
, type: 'food'
}
, "/profile": {
file: "profileindex.html"
, title: 'Profile Editor'
, type: 'profile'
}
, "/report": {
file: "reportindex.html"
, title: 'Nightscout reporting'
, type: 'report'
}
, "/translations": {
file: "translationsindex.html"
, title: 'Nightscout translations'
, type: 'translations'
}
, "/split": {
file: "frame.html"
, title: '8-user view'
, type: 'index'
}
};

Object.keys(appPages).forEach(function(page) {
app.get(page, (req, res) => {
res.render(appPages[page], {
locals: app.locals
res.render(appPages[page].file, {
locals: app.locals,
title: appPages[page].title ? appPages[page].title : '',
type: appPages[page].type ? appPages[page].type : '',
settings: env.settings
});
});
});

app.get("/appcache/*", (req, res) => {
res.render("nightscout.appcache", {
locals: app.locals
});
});
const clockviews = require('./lib/server/clocks.js')(env, ctx);
clockviews.setLocals(app.locals);

app.use("/clock", clockviews);

app.use('/api', bodyParser({
limit: 1048576 * 50
Expand Down Expand Up @@ -199,6 +247,7 @@ function create (env, ctx) {
res.sendFile(__dirname + '/swagger.yaml');
});

/* // FOR DEBUGGING MEMORY LEEAKS
if (env.settings.isEnabled('dumps')) {
var heapdump = require('heapdump');
app.get('/api/v2/dumps/start', function(req, res) {
Expand All @@ -209,6 +258,7 @@ function create (env, ctx) {
res.send('wrote dump to ' + path);
});
}
*/

// app.get('/package.json', software);

Expand Down
15 changes: 12 additions & 3 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@
"value": "180",
"required": false
},
"BOLUS_RENDER_OVER": {
"description": "U value over which the bolus values are rendered on the chart if the 'x U and Over' option is selected.",
"value": "1",
"required": false
},
"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": "",
Expand Down Expand Up @@ -99,7 +104,7 @@
},
"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",
"value": "careportal basal dbsize",
"required": false
},
"MMCONNECT_USER_NAME": {
Expand All @@ -117,6 +122,11 @@
"value": "US",
"required": false
},
"MONGODB_URI": {
"description": "The MongoDB Connection String to connect to your MongoDB cluster",
"value": "",
"required": true
},
"MONGO_COLLECTION": {
"description": "The Mongo collection where CGM data is stored.",
"value": "entries",
Expand All @@ -129,7 +139,7 @@
},
"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",
"value": "careportal dbsize",
"required": false
},
"SHOW_RAWBG": {
Expand All @@ -149,7 +159,6 @@
}
},
"addons": [
"mongolab:sandbox",
"papertrail"
]
}
Loading