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 Nightscout 2022-01 #8

Merged
merged 70 commits into from
Jan 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
76adc81
New translations en.json (German)
sulkaharo Jun 12, 2021
e82697a
New translations en.json (Polish)
sulkaharo Jun 13, 2021
2e39bbe
New translations en.json (Polish)
sulkaharo Jun 13, 2021
495179c
New translations en.json (Polish)
sulkaharo Jun 16, 2021
3cabb5a
New translations en.json (Polish)
sulkaharo Jun 16, 2021
1ac44da
New translations en.json (Greek)
sulkaharo Aug 19, 2021
f1322cf
New translations en.json (Greek)
sulkaharo Aug 19, 2021
ef19f60
New translations en.json (Greek)
sulkaharo Aug 19, 2021
310da5d
New translations en.json (Hebrew)
sulkaharo Oct 4, 2021
1da75b6
New translations en.json (Arabic)
sulkaharo Oct 9, 2021
38b2b78
New translations en.json (Arabic)
sulkaharo Oct 9, 2021
776a01d
New translations en.json (Arabic)
sulkaharo Oct 9, 2021
72129d5
New translations en.json (Arabic)
sulkaharo Oct 10, 2021
606e5b3
New translations en.json (Arabic)
sulkaharo Oct 10, 2021
b2fb9b3
New translations en.json (Arabic)
sulkaharo Oct 12, 2021
bc44960
New translations en.json (Arabic)
sulkaharo Oct 12, 2021
633c23a
New translations en.json (Arabic)
sulkaharo Oct 13, 2021
0ddcede
New translations en.json (Arabic)
sulkaharo Oct 13, 2021
bb6a7a5
New translations en.json (Arabic)
sulkaharo Oct 13, 2021
6cc9a95
new dev branch starting post 14.2.4 release
bewest Oct 25, 2021
8e476b3
Fix api-secret header name in swagger configuration.
MJDSys Oct 31, 2021
1f747cd
New translations en.json (Turkish)
sulkaharo Nov 3, 2021
811249f
New translations en.json (Turkish)
sulkaharo Nov 3, 2021
753550f
New translations en.json (Turkish)
sulkaharo Nov 4, 2021
a08d2ae
New translations en.json (Turkish)
sulkaharo Nov 5, 2021
cf55034
New translations en.json (Turkish)
sulkaharo Nov 5, 2021
93f5c0b
New translations en.json (Turkish)
sulkaharo Nov 5, 2021
534c117
New translations en.json (Turkish)
sulkaharo Nov 7, 2021
473912c
New translations en.json (Turkish)
sulkaharo Nov 7, 2021
07559b6
New translations en.json (Turkish)
sulkaharo Nov 7, 2021
1b61122
New translations en.json (Turkish)
sulkaharo Nov 7, 2021
fb33420
New translations en.json (Turkish)
sulkaharo Nov 8, 2021
ca7ae17
New translations en.json (Turkish)
sulkaharo Nov 9, 2021
a4fde71
New translations en.json (Polish)
sulkaharo Nov 10, 2021
69aa5ee
New translations en.json (Polish)
sulkaharo Nov 10, 2021
cf92d4d
New translations en.json (Polish)
sulkaharo Nov 11, 2021
f8aa686
New translations en.json (Polish)
sulkaharo Nov 12, 2021
3da5b92
New translations en.json (Polish)
sulkaharo Nov 12, 2021
c65230f
New translations en.json (Polish)
sulkaharo Nov 13, 2021
321592f
New translations en.json (Polish)
sulkaharo Nov 13, 2021
1b780cb
New translations en.json (Polish)
sulkaharo Nov 13, 2021
4e0d8fd
New translations en.json (Portuguese, Brazilian)
sulkaharo Nov 19, 2021
780e5b0
New translations en.json (Portuguese, Brazilian)
sulkaharo Nov 19, 2021
e9b50e7
New translations en.json (Polish)
sulkaharo Nov 22, 2021
39cba5c
New translations en.json (Polish)
sulkaharo Nov 22, 2021
27dd88e
New translations en.json (Turkish)
sulkaharo Nov 27, 2021
8b17eb7
New translations en.json (Turkish)
sulkaharo Nov 27, 2021
c0a566d
New translations en.json (Turkish)
sulkaharo Nov 30, 2021
327051e
New translations en.json (Hebrew)
sulkaharo Nov 30, 2021
55e14fe
update minimum version of share2nightscout-bridge
bewest Dec 2, 2021
513d155
update minimed-connect-to-nightscout updates
bewest Dec 2, 2021
0bd983c
Increase accuracy of mg/dl to mmol/l ratio
cpitchford Dec 2, 2021
44d6cb9
Merge branch 'dev' into wip/cpitchford/increase_mmoll_accuracy
cpitchford Dec 2, 2021
8d83617
Support Dexcom HIGH/LOW when device is share2
cpitchford Dec 2, 2021
4b58cf7
Revert "update minimed-connect-to-nightscout updates"
bewest Dec 3, 2021
b00df3d
use newer version of minimed-connect-to-nightscout
bewest Dec 3, 2021
3def3a4
Merge branch 'dev' into wip/cpitchford/support_high_low_share2_device
bewest Dec 3, 2021
ededfc8
Merge branch 'wip/cpitchford/increase_mmoll_accuracy' of github.com:c…
bewest Dec 3, 2021
1477c79
Merge branch 'fix-swagger-auth' of github.com:mjdsys/cgm-remote-monit…
bewest Dec 3, 2021
cdc18b9
New translations en.json (Chinese Simplified)
sulkaharo Dec 6, 2021
5e0e592
Fixes broken Docker image build
pazaan Dec 6, 2021
0df986f
New translations en.json (Chinese Simplified)
sulkaharo Dec 6, 2021
bf3d90d
Merge branch 'crowdin_incoming' of github.com:nightscout/cgm-remote-m…
bewest Dec 6, 2021
cc392c8
Merge branch 'pazaan/fix-docker-image-build' of git://github.com/paza…
bewest Dec 6, 2021
df4acfa
Generating codacy coverage should not fail build
bewest Dec 6, 2021
a34a58b
Synchronise the dexcom collection times to reduce refresh lag
cpitchford Dec 9, 2021
a19a023
Merge branch 'dev' into wip/cpitchford/synchronize_dexcom_fetch_times
cpitchford Dec 9, 2021
7b9e07b
Merge branch 'dev' into wip/cpitchford/synchronize_dexcom_fetch_times
cpitchford Dec 10, 2021
dc312a8
Update test for new default interval
cpitchford Dec 10, 2021
4750f13
Merge pull request #7231 from cpitchford/wip/cpitchford/synchronize_d…
bewest Dec 10, 2021
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
17 changes: 11 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@ FROM node:14.15.3-alpine

LABEL maintainer="Nightscout Contributors"

RUN mkdir -p /opt/app
ADD . /opt/app
WORKDIR /opt/app
RUN chown -R node:node /opt/app
USER node
ADD . /opt/app

RUN npm install && \
# TODO: We should be able to do `RUN npm install --only=production`.
# For this to work, we need to copy only package.json and things needed for `npm`'s to succeed.
# TODO: Do we need to re-add `npm audit fix`? Or should that be part of a development process/stage?
RUN npm install --cache /tmp/empty-cache && \
npm run postinstall && \
npm run env && \
npm audit fix
rm -rf /tmp/*
# TODO: These should be added in the future to correctly cache express-minify content to disk
# Currently, doing this breaks the browser cache.
# mkdir /tmp/public && \
# chown node:node /tmp/public

USER node
EXPOSE 1337

CMD ["node", "lib/server/server.js"]
2 changes: 1 addition & 1 deletion lib/constants.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"HTTP_BAD_REQUEST": 400,
"ENTRIES_DEFAULT_COUNT" : 10,
"PROFILES_DEFAULT_COUNT" : 10,
"MMOL_TO_MGDL": 18,
"MMOL_TO_MGDL": 18.018018018,
"ONE_DAY" : 86400000,
"TWO_DAYS" : 172800000,
"FIFTEEN_MINUTES": 900000,
Expand Down
47 changes: 43 additions & 4 deletions lib/plugins/bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ function bridged (entries) {
mostRecentRecord = glucose[i].date;
}
}
//console.log("DEXCOM: Most recent entry received; "+new Date(mostRecentRecord).toString());
}
entries.create(glucose, function stored (err) {
if (err) {
Expand All @@ -46,12 +47,12 @@ function options (env) {
, minutes: env.extendedSettings.bridge.minutes || 1440
};

var interval = env.extendedSettings.bridge.interval || 60000 * 2.5; // Default: 2.5 minutes
var interval = env.extendedSettings.bridge.interval || 60000 * 2.6; // Default: 2.6 minutes

if (interval < 1000 || interval > 300000) {
// Invalid interval range. Revert to default
console.error("Invalid interval set: [" + interval + "ms]. Defaulting to 2.5 minutes.")
interval = 60000 * 2.5 // 2.5 minutes
console.error("Invalid interval set: [" + interval + "ms]. Defaulting to 2.6 minutes.")
interval = 60000 * 2.6 // 2.6 minutes
}

return {
Expand All @@ -75,15 +76,53 @@ function create (env, bus) {

bridge.startEngine = function startEngine (entries) {


opts.callback = bridged(entries);

let last_run = new Date(0).getTime();
let last_ondemand = new Date(0).getTime();

function should_run() {
// Time we expect to have to collect again
const msRUN_AFTER = (300+20) * 1000;
const msNow = new Date().getTime();

const next_entry_expected = mostRecentRecord + msRUN_AFTER;

if (next_entry_expected > msNow) {
// we're not due to collect a new slot yet. Use interval
const ms_since_last_run = msNow - last_run;
if (ms_since_last_run < interval) {
return false;
}

last_run = msNow;
last_ondemand = new Date(0).getTime();
console.log("DEXCOM: Running poll");
return true;
}

const ms_since_last_run = msNow - last_ondemand;

if (ms_since_last_run < interval) {
return false;
}
last_run = msNow;
last_ondemand = msNow;
console.log("DEXCOM: Data due, running extra poll");
return true;
}

let timer = setInterval(function () {
if (!should_run()) return;


opts.fetch.minutes = parseInt((new Date() - mostRecentRecord) / 60000);
opts.fetch.maxCount = parseInt((opts.fetch.minutes / 5) + 1);
opts.firstFetchCount = opts.fetch.maxCount;
console.log("Fetching Share Data: ", 'minutes', opts.fetch.minutes, 'maxCount', opts.fetch.maxCount);
engine(opts);
}, interval);
}, 1000 /*interval*/);

if (bus) {
bus.on('teardown', function serverTeardown () {
Expand Down
2 changes: 1 addition & 1 deletion lib/sandbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ function init () {
};

sbx.displayBg = function displayBg (entry) {
var isDex = entry && (!entry.device || entry.device === 'dexcom');
var isDex = entry && (!entry.device || entry.device === 'dexcom' || entry.device === 'share2');
if (isDex && Number(entry.mgdl) === 39) {
return 'LOW';
} else if (isDex && Number(entry.mgdl) === 401) {
Expand Down
2 changes: 1 addition & 1 deletion lib/server/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@
"securitySchemes": {
"api_secret": {
"type": "apiKey",
"name": "api_secret",
"name": "api-secret",
"in": "header",
"description": "The hash of the API_SECRET env var"
},
Expand Down
2 changes: 1 addition & 1 deletion lib/server/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ components:
securitySchemes:
api_secret:
type: apiKey
name: api_secret
name: api-secret
in: header
description: The hash of the API_SECRET env var
token_in_url:
Expand Down
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nightscout",
"version": "14.2.4",
"version": "14.2.5",
"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",
Expand Down Expand Up @@ -36,7 +36,7 @@
"bundle-dev": "webpack --mode development --config webpack/webpack.config.js && npm run-script generate-keys",
"bundle-analyzer": "webpack --mode development --config webpack/webpack.config.js --profile --json > stats.json && webpack-bundle-analyzer stats.json",
"generate-keys": "node bin/generateRandomString.js >tmp/randomString",
"coverage": "cat ./coverage/lcov.info | env-cmd -f ./tests/ci.test.env codacy-coverage",
"coverage": "cat ./coverage/lcov.info | env-cmd -f ./tests/ci.test.env codacy-coverage || echo NO COVERAGE",
"dev": "env-cmd -f ./my.env nodemon --inspect lib/server/server.js 0.0.0.0",
"dev-test": "env-cmd -f ./my.devtest.env nodemon --inspect lib/server/server.js 0.0.0.0",
"prod": "env-cmd -f ./my.prod.env node lib/server/server.js 0.0.0.0",
Expand Down Expand Up @@ -109,7 +109,7 @@
"lodash": "^4.17.20",
"memory-cache": "^0.2.0",
"mime": "^2.4.6",
"minimed-connect-to-nightscout": "^1.5.0",
"minimed-connect-to-nightscout": "^1.5.2",
"moment": "^2.27.0",
"moment-locales-webpack-plugin": "^1.2.0",
"moment-timezone": "^0.5.31",
Expand All @@ -125,7 +125,7 @@
"random-token": "0.0.8",
"request": "^2.88.2",
"semver": "^6.3.0",
"share2nightscout-bridge": "^0.2.5",
"share2nightscout-bridge": "^0.2.8",
"shiro-trie": "^0.4.9",
"simple-statistics": "^0.7.0",
"socket.io": "~2.4.0",
Expand Down
6 changes: 3 additions & 3 deletions tests/bridge.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('bridge', function ( ) {
var opts = bridge.options(tooLowInterval);
should.exist(opts);

opts.interval.should.equal(150000);
opts.interval.should.equal(156000);
});

it('set too high bridge interval option from env', function () {
Expand All @@ -64,7 +64,7 @@ describe('bridge', function ( ) {
var opts = bridge.options(tooHighInterval);
should.exist(opts);

opts.interval.should.equal(150000);
opts.interval.should.equal(156000);
});

it('set no bridge interval option from env', function () {
Expand All @@ -77,7 +77,7 @@ describe('bridge', function ( ) {
var opts = bridge.options(noInterval);
should.exist(opts);

opts.interval.should.equal(150000);
opts.interval.should.equal(156000);
});

});
Loading