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

actualizacion #7489

Closed
wants to merge 55 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
8fb02e6
Merge pull request #1 from nightscout/master
samihusseingit Nov 3, 2019
0b12d17
Merge pull request #2 from nightscout/dev
samihusseingit May 6, 2020
50110ee
Merge pull request #4 from nightscout/master
samihusseingit Oct 15, 2020
10e7b09
Merge pull request #7 from nightscout/master
samihusseingit Nov 28, 2021
1ad4867
prep development area post 14.2.5 release
bewest Dec 10, 2021
c09616c
Add Arabic as an option to translations
sulkaharo Dec 11, 2021
4b38e32
obscure private device provenance
bewest Dec 14, 2021
a2f2751
de facto standard LOW and HIGH values
bewest Dec 15, 2021
6b98e01
ensure obfuscation only affects rendered values
bewest Dec 15, 2021
0de4b94
Merge branch 'dev' into wip/bewest/obscure-provenance
bewest Dec 15, 2021
4b96124
ensre that objects from api/v2 are also obscured
bewest Dec 15, 2021
4e91c91
Merge branch 'wip/bewest/obscure-provenance' of github.com:nightscout…
bewest Dec 15, 2021
5ceb82d
Merge pull request #7249 from nightscout/wip/bewest/obscure-provenance
bewest Dec 15, 2021
aca8d5a
Fixes an issue where treatment units were all rewritten on load, rega…
sulkaharo Jan 5, 2022
4625050
Change deduping interval
MilosKozak Jan 7, 2022
6dc2b2b
mark compatible with node 14 and node 16
bewest Feb 16, 2022
fabd798
add node 16 to supported list
bewest Feb 16, 2022
9ccba7e
Merge pull request #7285 from nightscout/MilosKozak-patch-2
MilosKozak Feb 20, 2022
ded6fa9
Test against nodejs 16.x
viq Mar 2, 2022
5a96281
Fix expiration time on remote notifications for Loop
ps2 Mar 15, 2022
1a356a0
Special reservoir handling for both Eros and DASH
ps2 Mar 18, 2022
47d1831
reservoir level override
ps2 Mar 19, 2022
74495b1
reservoir level override
ps2 Mar 19, 2022
28bf9e1
reservoir level override
ps2 Mar 19, 2022
6f02d51
Remove debug print
ps2 Mar 21, 2022
c8a1a9c
Show automatic bolus decisions from enacted field
ps2 Mar 28, 2022
9ce3920
fix typo
ps2 Mar 28, 2022
ad1bcbf
Merge pull request #7380 from ps2/omnipod-reservoir
bewest Apr 19, 2022
eb8b71c
Merge branch 'dev' into automatic-bolus
bewest Apr 19, 2022
537ed5e
Add sent-at time to notification payload
ps2 Apr 20, 2022
d080b95
Merge remote-tracking branch 'origin/dev' into fix-apns-expiration
ps2 Apr 20, 2022
d53f574
Merge pull request #7375 from ps2/fix-apns-expiration
bewest Apr 21, 2022
555f699
Merge pull request #7385 from ps2/automatic-bolus
bewest Apr 30, 2022
06012e5
Merge branch 'dev' into wip/bewest/upgrade-node
bewest Apr 30, 2022
30cc5ca
Merge pull request #8 from nightscout/master
samihusseingit Jun 27, 2022
38c9a21
Results could be null and crash the website
samihusseingit Jun 29, 2022
e601717
Merge branch 'dev' into master
sulkaharo Jun 29, 2022
a1a2e74
npm install share2nightscout-bridge@^0.2.9
bewest Jun 30, 2022
5cf72ce
npm install minimed-connect-to-nightscout@^1.5.3
bewest Jun 30, 2022
3e2520b
Merge branch 'viq-patch-2' into wip/bewest/upgrade-node
bewest Jun 30, 2022
e715cd2
give automated tests more time to finish
bewest Jun 30, 2022
e72924c
Merge pull request #7468 from samihusseingit/master
bewest Jun 30, 2022
cef684e
Merge branch 'dev' into wip/bewest/upgrade-node
bewest Jun 30, 2022
ead83e0
npm audit fix
bewest Jun 30, 2022
08e2225
Merge branch 'wip/bewest/upgrade-node' of github.com:nightscout/cgm-r…
bewest Jun 30, 2022
0d1aed7
Revert "npm audit fix" due to test failure
bewest Jun 30, 2022
40b7cbf
Merge pull request #7343 from nightscout/wip/bewest/upgrade-node
bewest Jun 30, 2022
27a882f
rm package-lock.json && npm install
bewest Jul 18, 2022
5d0d320
npm install --no-optional
bewest Jul 18, 2022
39936b9
Fix incorrect appending for loop enacted status
ps2 Jul 18, 2022
cd5c983
Merge pull request #7488 from ps2/loop-enacted-fixes
bewest Jul 18, 2022
3e1f459
Merge branch 'dev' into wip/bewest/issue-7475
bewest Jul 18, 2022
c9f3a12
n 10; rm package-lock.json && npm install
bewest Aug 8, 2022
a9dfc76
Merge branch 'wip/bewest/issue-7475' of github.com:nightscout/cgm-rem…
bewest Aug 8, 2022
b15e436
make github tested workflows and node entines match
bewest Aug 14, 2022
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
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x]
node-version: [12.x, 14.x, 16.x]
mongodb-version: [4.2, 4.4]

steps:
Expand Down
14 changes: 7 additions & 7 deletions lib/api/entries/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ function configure (app, wares, ctx, env) {
res.entries_err = err;
return next();
});
}, format_entries);
}, wares.obscure_device, format_entries);

/**
* @module get#/entries/:spec
Expand Down Expand Up @@ -389,7 +389,7 @@ function configure (app, wares, ctx, env) {
prepReqModel(req, req.params.model);
query_models(req, res, next);
}
}, format_entries);
}, wares.obscure_device, format_entries);

/**
* @module get#/entries
Expand All @@ -400,7 +400,7 @@ function configure (app, wares, ctx, env) {
* `find[date]`.
*
*/
api.get('/entries', ifModifiedSinceCTX, query_models, format_entries);
api.get('/entries', ifModifiedSinceCTX, query_models, wares.obscure_device, format_entries);

/**
* @function echo_query
Expand Down Expand Up @@ -738,7 +738,7 @@ function configure (app, wares, ctx, env) {
* @routed
* @response 200 /definitions/Entries
*/
api.get('/times/:prefix?/:regex?', prep_storage, prep_pattern_field, prep_patterns, prep_patterns, query_models, format_entries);
api.get('/times/:prefix?/:regex?', prep_storage, prep_pattern_field, prep_patterns, prep_patterns, query_models, wares.obscure_device, format_entries);

api.get('/count/:storage/where', prep_storage, count_records, format_results);

Expand All @@ -753,7 +753,7 @@ function configure (app, wares, ctx, env) {
/api/v1/slice/entries/dateString/mbg/2015.json
```
*/
api.get('/slice/:storage/:field/:type?/:prefix?/:regex?', prep_storage, prep_pattern_field, prep_patterns, query_models, format_entries);
api.get('/slice/:storage/:field/:type?/:prefix?/:regex?', prep_storage, prep_pattern_field, prep_patterns, query_models, wares.obscure_device, format_entries);

/**
* @module post#/entries/preview
Expand All @@ -765,7 +765,7 @@ function configure (app, wares, ctx, env) {
// setting this flag tells insert_entries to not actually store the results
req.persist_entries = false;
next();
}, insert_entries, format_entries);
}, insert_entries, wares.obscure_device, format_entries);

// Protect endpoints with authenticated api.
if (app.enabled('api')) {
Expand All @@ -780,7 +780,7 @@ function configure (app, wares, ctx, env) {
// setting this flag tells insert_entries to store the results
req.persist_entries = true;
next();
}, insert_entries, format_entries);
}, insert_entries, wares.obscure_device, format_entries);

/**
* @module delete#/entries/:spec
Expand Down
5 changes: 3 additions & 2 deletions lib/data/dataloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ function loadEntries(ddata, ctx, callback) {
}
};

var obscureDeviceProvenance = ctx.settings.obscureDeviceProvenance;
ctx.entries.list(q, function(err, results) {

if (err) {
Expand All @@ -213,15 +214,15 @@ function loadEntries(ddata, ctx, callback) {
_id: element._id,
mgdl: Number(element.mbg),
mills: element.date,
device: element.device,
device: obscureDeviceProvenance || element.device,
type: 'mbg'
});
} else if (element.sgv) {
sgvs.push({
_id: element._id,
mgdl: Number(element.sgv),
mills: element.date,
device: element.device,
device: obscureDeviceProvenance || element.device,
direction: element.direction,
filtered: element.filtered,
unfiltered: element.unfiltered,
Expand Down
6 changes: 5 additions & 1 deletion lib/data/ddata.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,11 @@ function init () {
ddata.tempbasalTreatments = ddata.processDurations(tempbasalTreatments, false);

// filter temp target
var tempTargetTreatments = ddata.treatments.filter(function filterTargets (t) {
var tempTargetTreatments = ddata.treatments.filter(function filterTargets (tt) {

// Clone the treatment before modifying it
let t = _.cloneDeep(tt);

//check for a units being sent
if (t.units) {
if (t.units == 'mmol') {
Expand Down
3 changes: 2 additions & 1 deletion lib/language.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ function init (fs) {
language.lang = 'en';

language.languages = [
{ code: 'bg', file: 'bg_BG', language: 'Български', speechCode: 'bg-BG' }
{ code: 'ar', file: 'ar_SA', language: 'اللغة العربية', speechCode: 'ar-SA' }
, { code: 'bg', file: 'bg_BG', language: 'Български', speechCode: 'bg-BG' }
, { code: 'cs', file: 'cs_CZ', language: 'Čeština', speechCode: 'cs-CZ' }
, { code: 'de', file: 'de_DE', language: 'Deutsch', speechCode: 'de-DE' }
, { code: 'dk', file: 'da_DK', language: 'Dansk', speechCode: 'dk-DK' }
Expand Down
6 changes: 4 additions & 2 deletions lib/middleware/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
var wares = {
sendJSONStatus : require('./send-json-status'),
bodyParser : require('body-parser'),
compression : require('compression')
compression : require('compression'),
obscureDeviceProvenance: require('./obscure-provenance')
};

function extensions (list) {
Expand All @@ -26,7 +27,8 @@ function configure (env) {
limit: '1Mb'
}),
compression: wares.compression,
extensions: extensions
extensions: extensions,
obscure_device: wares.obscureDeviceProvenance(env)
};
}

Expand Down
15 changes: 15 additions & 0 deletions lib/middleware/obscure-provenance.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var _ = require('lodash');

module.exports = function create_device_obscurity (env) {
function obscure_device (req, res, next) {
if (res.entries && env.settings.obscureDeviceProvenance) {
var entries = _.cloneDeep(res.entries);
for (var i = 0; i < entries.length; i++) {
entries[i].device = env.settings.obscureDeviceProvenance;
}
res.entries = entries;
}
next( );
}
return obscure_device;
}
34 changes: 21 additions & 13 deletions lib/plugins/loop.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ function init (ctx) {
, split: false
, targets: false
, reasons: reasonconf
, otp: true
, otp: true
, submitHook: postLoopNotification
},
{
Expand All @@ -252,24 +252,24 @@ function init (ctx) {
{
val: 'Remote Carbs Entry'
, name: 'Remote Carbs Entry'
, remoteCarbs: true
, remoteAbsorption: true
, otp: true
, remoteCarbs: true
, remoteAbsorption: true
, otp: true
, submitHook: postLoopNotification
},
{
val: 'Remote Bolus Entry'
, name: 'Remote Bolus Entry'
, remoteBolus: true
, otp: true
, remoteBolus: true
, otp: true
, submitHook: postLoopNotification
}
];
};

// TODO: Add event listener to customize labels


loop.updateVisualisation = function updateVisualisation (sbx) {
var prop = sbx.properties.loop;

Expand Down Expand Up @@ -356,13 +356,21 @@ function init (ctx) {

function addLastEnacted () {
if (prop.lastEnacted) {
var canceled = prop.lastEnacted.rate === 0 && prop.lastEnacted.duration === 0;
var valueParts = []

var valueParts = [
'<b>Temp Basal' + (canceled ? ' Canceled' : ' Started') + '</b>'
, canceled ? '' : ' ' + prop.lastEnacted.rate.toFixed(2) + 'U/hour for ' + prop.lastEnacted.duration + 'm'
, valueString(', ', prop.lastEnacted.reason)
];
if (prop.lastEnacted.bolusVolume) {
valueParts.push('<b>Automatic Bolus</b>')
valueParts.push(' ' + prop.lastEnacted.bolusVolume + 'U')
if (prop.lastEnacted.rate === 0 && prop.lastEnacted.duration === 0) {
valueParts.push(' (Temp Basal Canceled)')
}
} else if (prop.lastEnacted.rate === 0 && prop.lastEnacted.duration === 0) {
valueParts.push('<b>Temp Basal Canceled</b>')
} else if (prop.lastEnacted.rate != null) {
valueParts.push('<b>Temp Basal Started</b>')
valueParts.push(' ' + prop.lastEnacted.rate.toFixed(2) + 'U/hour for ' + prop.lastEnacted.duration + 'm')
}
valueParts.push(valueString(', ', prop.lastEnacted.reason))

valueParts = concatIOB(valueParts);
valueParts = concatCOB(valueParts);
Expand Down
19 changes: 11 additions & 8 deletions lib/plugins/pump.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function init (ctx) {
var prefs = pump.getPrefs(sbx);

if (!prefs.enableAlerts) { return; }

pump.warnOnSuspend = prefs.warnOnSuspend;

var data = prepareData(sbx.properties.pump, prefs, sbx);
Expand Down Expand Up @@ -130,7 +130,7 @@ function init (ctx) {
}
}
});

if (result.extended) {
info.push({label: '------------', value: ''});
_.forOwn(result.extended, function(value, key) {
Expand Down Expand Up @@ -236,11 +236,7 @@ function init (ctx) {
function updateReservoir (prefs, result) {
if (result.reservoir) {
result.reservoir.label = 'Reservoir';
if (result.reservoir_display_override) {
result.reservoir.display = result.reservoir_display_override;
} else {
result.reservoir.display = result.reservoir.value.toPrecision(3) + 'U';
}
result.reservoir.display = result.reservoir.value.toPrecision(3) + 'U';
if (result.reservoir.value < prefs.urgentRes) {
result.reservoir.level = levels.URGENT;
result.reservoir.message = 'URGENT: Pump Reservoir Low';
Expand All @@ -250,11 +246,17 @@ function init (ctx) {
} else {
result.reservoir.level = levels.NONE;
}
} else if (result.manufacturer === 'Insulet' && result.model === 'Eros') {
} else if (result.manufacturer === 'Insulet') {
result.reservoir = {
label: 'Reservoir', display: '50+ U'
}
}
if (result.reservoir_display_override) {
result.reservoir.display = result.reservoir_display_override;
}
if (result.reservoir_level_override) {
result.reservoir.level = result.reservoir_level_override;
}
}

function updateBattery (type, prefs, result, batteryWarn) {
Expand Down Expand Up @@ -319,6 +321,7 @@ function init (ctx) {
, clock: pump.clock ? { value: moment(pump.clock) } : null
, reservoir: pump.reservoir || pump.reservoir === 0 ? { value: pump.reservoir } : null
, reservoir_display_override: pump.reservoir_display_override || null
, reservoir_level_override: pump.reservoir_level_override || null
, manufacturer: pump.manufacturer
, model: pump.model
, extended: pump.extended || null
Expand Down
5 changes: 2 additions & 3 deletions lib/sandbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,9 @@ function init () {
};

sbx.displayBg = function displayBg (entry) {
var isDex = entry && (!entry.device || entry.device === 'dexcom' || entry.device === 'share2');
if (isDex && Number(entry.mgdl) === 39) {
if (Number(entry.mgdl) === 39) {
return 'LOW';
} else if (isDex && Number(entry.mgdl) === 401) {
} else if (Number(entry.mgdl) === 401) {
return 'HIGH';
} else {
return sbx.scaleEntry(entry);
Expand Down
2 changes: 1 addition & 1 deletion lib/server/bootevent.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function boot (env, language) {

const isLTS = process.release.lts ? true : false;

if (isLTS && (semver.satisfies(nodeVersion, '^14.0.0') || semver.satisfies(nodeVersion, '^12.0.0') || semver.satisfies(nodeVersion, '^10.0.0'))) {
if (isLTS && (semver.satisfies(nodeVersion, '^16.0.0') || semver.satisfies(nodeVersion, '^14.0.0') || semver.satisfies(nodeVersion, '^12.0.0') || semver.satisfies(nodeVersion, '^10.0.0'))) {
//Latest Node 10 LTS and Node 12 LTS are recommended and supported.
//Require at least Node 8 LTS and Node 10 LTS without known security issues
console.debug('Node LTS version ' + nodeVersion + ' is supported');
Expand Down
23 changes: 15 additions & 8 deletions lib/server/loop.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ function init (env, ctx) {
payload["override-duration-minutes"] = parseInt(data.duration);
}
alert = data.reasonDisplay + " Temporary Override";
} else if (data.eventType === 'Remote Carbs Entry') {
} else if (data.eventType === 'Remote Carbs Entry') {
payload["carbs-entry"] = parseFloat(data.remoteCarbs);
if(payload["carbs-entry"] > 0.0 ) {
if(payload["carbs-entry"] > 0.0 ) {
payload["absorption-time"] = 3.0;
if (data.remoteAbsorption !== undefined && parseFloat(data.remoteAbsorption) > 0.0) {
payload["absorption-time"] = parseFloat(data.remoteAbsorption);
Expand All @@ -83,19 +83,19 @@ function init (env, ctx) {
}
alert = "Remote Carbs Entry: "+payload["carbs-entry"]+" grams\n";
alert += "Absorption Time: "+payload["absorption-time"]+" hours";
} else {
} else {
completion("Loop remote carbs failed. Incorrect carbs entry: ", data.remoteCarbs);
return;
}
} else if (data.eventType === 'Remote Bolus Entry') {

} else if (data.eventType === 'Remote Bolus Entry') {
payload["bolus-entry"] = parseFloat(data.remoteBolus);
if(payload["bolus-entry"] > 0.0 ) {
if(payload["bolus-entry"] > 0.0 ) {
alert = "Remote Bolus Entry: "+payload["bolus-entry"]+" U\n";
if (data.otp !== undefined && data.otp.length > 0) {
payload["otp"] = ""+data.otp
}
} else {
} else {
completion("Loop remote bolus failed. Incorrect bolus entry: ", data.remoteBolus);
return;
}
Expand All @@ -112,11 +112,18 @@ function init (env, ctx) {
alert += " - " + data.enteredBy
}

// Track time notification was sent
let now = new Date()
payload['sent-at'] = now.toISOString();

// Expire after 5 minutes.
let expiration = new Date(now.getTime() + 5 * 60 * 1000)
payload['expiration'] = expiration.toISOString();

let notification = new apn.Notification();
notification.alert = alert;
notification.topic = loopSettings.bundleIdentifier;
notification.contentAvailable = 1;
notification.expiry = Math.round((Date.now() / 1000)) + 60 * 5; // Allow this to enact within 5 minutes.
notification.payload = payload;

provider.send(notification, [loopSettings.deviceToken]).then( (response) => {
Expand Down
6 changes: 3 additions & 3 deletions lib/server/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ function init (env, ctx, server) {
ctx.store.collection(collection).findOne({ '_id': id }
, function(err, results) {
console.log('Got results', results);
if (!err) {
if (!err && results !== null) {
ctx.bus.emit('data-update', {
type: data.collection
, op: 'update'
Expand Down Expand Up @@ -266,7 +266,7 @@ function init (env, ctx, server) {
ctx.store.collection(collection).findOne({ '_id': objId }
, function(err, results) {
console.log('Got results', results);
if (!err) {
if (!err && results !== null) {
ctx.bus.emit('data-update', {
type: data.collection
, op: 'update'
Expand Down Expand Up @@ -294,7 +294,7 @@ function init (env, ctx, server) {
socket.on('dbAdd', function dbAdd (data, callback) {
console.log(LOG_WS + 'dbAdd client ID: ', socket.client.id, ' data: ', data);
var collection = supportedCollections[data.collection];
var maxtimediff = times.mins(1).msecs;
var maxtimediff = times.secs(2).msecs;

var check = checkConditions('dbAdd', data);
if (check) {
Expand Down
Loading