Skip to content

Commit

Permalink
Merge pull request #7237 from nightscout/dev
Browse files Browse the repository at this point in the history
Release 14.2.6
  • Loading branch information
bewest authored Sep 30, 2022
2 parents 4750f13 + 3d9a60d commit 0bf616b
Show file tree
Hide file tree
Showing 16 changed files with 847 additions and 1,389 deletions.
65 changes: 31 additions & 34 deletions .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 All @@ -40,14 +40,19 @@ jobs:
- name: Send Coverage
run: npm run-script coverage

publish_dev:
name: Publish dev branch to Docker Hub
publish:
name: Publish to Docker Hub
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/dev' && github.repository_owner == 'nightscout'
if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev') && github.repository_owner == 'nightscout'
env:
DOCKER_IMAGE: nightscout/cgm-remote-monitor
PLATFORMS: linux/amd64,linux/arm64
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
Expand All @@ -57,37 +62,29 @@ jobs:
if: success()
uses: actions/checkout@v2
- name: Build, tag and push the dev Docker image
if: success()
run: |
docker build --no-cache=true -t ${{ env.DOCKER_IMAGE }}:dev_${{ github.sha }} .
docker image push ${{ env.DOCKER_IMAGE }}:dev_${{ github.sha }}
docker tag ${{ env.DOCKER_IMAGE }}:dev_${{ github.sha }} ${{ env.DOCKER_IMAGE }}:latest_dev
docker image push ${{ env.DOCKER_IMAGE }}:latest_dev
publish_master:
name: Publish master branch to Docker Hub
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' && github.repository_owner == 'nightscout'
env:
DOCKER_IMAGE: nightscout/cgm-remote-monitor
steps:
- name: Login to Docker Hub
uses: docker/login-action@v1
if: success() && github.ref == 'refs/heads/dev'
uses: docker/build-push-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Clean git Checkout
if: success()
uses: actions/checkout@v2
- name: get-npm-version
if: success()
context: .
push: true
no-cache: true
platforms: ${{ env.PLATFORMS }}
tags: |
${{ env.DOCKER_IMAGE }}:dev_${{ github.sha }}
${{ env.DOCKER_IMAGE }}:latest_dev
- name: Get Nightscout release version
if: success() && github.ref == 'refs/heads/master'
id: package-version
uses: martinbeentjes/npm-get-version-action@master
- name: Build, tag and push the master Docker image
if: success()
run: |
docker build --no-cache=true -t ${{ env.DOCKER_IMAGE }}:${{ steps.package-version.outputs.current-version }} .
docker image push ${{ env.DOCKER_IMAGE }}:${{ steps.package-version.outputs.current-version }}
docker tag ${{ env.DOCKER_IMAGE }}:${{ steps.package-version.outputs.current-version }} ${{ env.DOCKER_IMAGE }}:latest
docker image push ${{ env.DOCKER_IMAGE }}:latest
if: success() && github.ref == 'refs/heads/master'
uses: docker/build-push-action@v2
with:
context: .
push: true
no-cache: true
platforms: ${{ env.PLATFORMS }}
tags: |
${{ env.DOCKER_IMAGE }}:${{ steps.package-version.outputs.current-version }}
${{ env.DOCKER_IMAGE }}:latest
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
Loading

0 comments on commit 0bf616b

Please sign in to comment.