mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
Merge branch 'master' into dev
This commit is contained in:
@@ -17,7 +17,7 @@ on:
|
||||
branches: [ dev ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ master ]
|
||||
branches: [ dev ]
|
||||
schedule:
|
||||
- cron: '43 23 * * 3'
|
||||
|
||||
|
||||
+31
-34
@@ -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:
|
||||
@@ -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:
|
||||
@@ -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
|
||||
@@ -45,4 +45,4 @@ function validate (opCtx, doc, storageDoc, options) {
|
||||
return opTools.validateCommon(doc, res, { isPatching });
|
||||
}
|
||||
|
||||
module.exports = validate;
|
||||
module.exports = validate;
|
||||
|
||||
+21
-13
@@ -231,7 +231,7 @@ function init (ctx) {
|
||||
, split: false
|
||||
, targets: false
|
||||
, reasons: reasonconf
|
||||
, otp: true
|
||||
, otp: true
|
||||
, submitHook: postLoopNotification
|
||||
},
|
||||
{
|
||||
@@ -252,16 +252,16 @@ 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
|
||||
}
|
||||
];
|
||||
@@ -269,7 +269,7 @@ function init (ctx) {
|
||||
|
||||
// TODO: Add event listener to customize labels
|
||||
|
||||
|
||||
|
||||
loop.updateVisualisation = function updateVisualisation (sbx) {
|
||||
var prop = sbx.properties.loop;
|
||||
|
||||
@@ -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);
|
||||
|
||||
+11
-8
@@ -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);
|
||||
@@ -130,7 +130,7 @@ function init (ctx) {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (result.extended) {
|
||||
info.push({label: '------------', value: ''});
|
||||
_.forOwn(result.extended, function(value, key) {
|
||||
@@ -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';
|
||||
@@ -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) {
|
||||
@@ -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
|
||||
|
||||
@@ -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');
|
||||
|
||||
+18
-8
@@ -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);
|
||||
@@ -81,21 +81,24 @@ function init (env, ctx) {
|
||||
if (data.otp !== undefined && data.otp.length > 0) {
|
||||
payload["otp"] = ""+data.otp
|
||||
}
|
||||
if (data.created_at !== undefined) {
|
||||
payload['start-time'] = data.created_at;
|
||||
}
|
||||
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;
|
||||
}
|
||||
@@ -112,11 +115,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) => {
|
||||
|
||||
@@ -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'
|
||||
@@ -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'
|
||||
@@ -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) {
|
||||
|
||||
Generated
+774
-1327
File diff suppressed because it is too large
Load Diff
+7
-8
@@ -27,9 +27,9 @@
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node lib/server/server.js",
|
||||
"test": "env-cmd -f ./my.test.env mocha --require ./tests/hooks.js -exit ./tests/*.test.js",
|
||||
"test-single": "env-cmd -f ./my.test.env mocha --require ./tests/hooks.js --exit ./tests/$TEST.test.js",
|
||||
"test-ci": "env-cmd -f ./tests/ci.test.env nyc --reporter=lcov --reporter=text-summary mocha --require ./tests/hooks.js --exit ./tests/*.test.js",
|
||||
"test": "env-cmd -f ./my.test.env mocha --timeout 5000 --require ./tests/hooks.js -exit ./tests/*.test.js",
|
||||
"test-single": "env-cmd -f ./my.test.env mocha --timeout 5000 --require ./tests/hooks.js --exit ./tests/$TEST.test.js",
|
||||
"test-ci": "env-cmd -f ./tests/ci.test.env nyc --reporter=lcov --reporter=text-summary mocha --timeout 5000 --require ./tests/hooks.js --exit ./tests/*.test.js",
|
||||
"env": "env",
|
||||
"postinstall": "webpack --mode production --config webpack/webpack.config.js && npm run-script generate-keys",
|
||||
"bundle": "webpack --mode production --config webpack/webpack.config.js && npm run-script generate-keys",
|
||||
@@ -65,8 +65,7 @@
|
||||
}
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10.22.0 || ^12.18.4",
|
||||
"npm": "^6.14.6"
|
||||
"node": "^16.x || ^14.x || ^12.x"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.11.1",
|
||||
@@ -105,11 +104,11 @@
|
||||
"jquery.tooltips": "^1.0.0",
|
||||
"js-storage": "^1.1.0",
|
||||
"jsdom": "^11.11.0",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"jsonwebtoken": "^9.0.0",
|
||||
"lodash": "^4.17.20",
|
||||
"memory-cache": "^0.2.0",
|
||||
"mime": "^2.4.6",
|
||||
"minimed-connect-to-nightscout": "^1.5.2",
|
||||
"minimed-connect-to-nightscout": "^1.5.3",
|
||||
"moment": "^2.27.0",
|
||||
"moment-locales-webpack-plugin": "^1.2.0",
|
||||
"moment-timezone": "^0.5.31",
|
||||
@@ -125,7 +124,7 @@
|
||||
"random-token": "0.0.8",
|
||||
"request": "^2.88.2",
|
||||
"semver": "^6.3.0",
|
||||
"share2nightscout-bridge": "^0.2.8",
|
||||
"share2nightscout-bridge": "^0.2.9",
|
||||
"shiro-trie": "^0.4.9",
|
||||
"simple-statistics": "^0.7.0",
|
||||
"socket.io": "~2.4.0",
|
||||
|
||||
Reference in New Issue
Block a user