Skip to content

Commit

Permalink
Merge pull request #6905 from nightscout/dev
Browse files Browse the repository at this point in the history
Release 14.2.2

* Merge latest translations from Crowdin
* Clean project root
* Re-introduce a wrapper server.js in the project root
  • Loading branch information
sulkaharo authored Feb 22, 2021
2 parents cbfae75 + 8516fe9 commit 46418c7
Show file tree
Hide file tree
Showing 56 changed files with 237 additions and 175 deletions.
2 changes: 1 addition & 1 deletion .deployment
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[config]
command = bash deploy.sh
command = bash bin/azure-deploy.sh
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
[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://discord.gg/rTKhrqz
[example-env-template]: docs/example-template.env

## Translations

Expand All @@ -49,15 +50,15 @@ Nightscout is a Node.js application. The basic installation of the software for
dependency installation has to be done using a non-root user - _do not use root_ for development and hosting
the software!
3. Get a Mongo database by either installing Mongo locally, or get a free cloud account from mLab or MongoDB Atlas.
4. Configure Nightscout by copying `my.env.template` to `my.env` and run it - see the next chapter in the instructions
4. Configure Nightscout by copying [`docs/example-template.env`][example-env-template] to `my.env` and run it - see the next chapter in the instructions

## Develop on `dev`

We develop on the `dev` branch. All new pull requests should be targeted to `dev`. The `master` branch is only used for distributing the latest version of the tested sources.

You can get the `dev` branch checked out using `git checkout dev`.

Once checked out, install the dependencies using `npm install`, then copy the included `my.env.template`file to `my.env` and edit the file to include your settings (like the Mongo URL). Leave the `NODE_ENV=development` line intact. Once set, run the site using `npm run dev`. This will start Nightscout in the development mode, with different code packaging rules and automatic restarting of the server using nodemon, when you save changed files on disk. The client also hot-reloads new code in, but it's recommended to reload the website after changes due to the way the plugin sandbox works.
Once checked out, install the dependencies using `npm install`, then copy the included [`docs/example-template.env`][example-env-template] to `my.env` file to `my.env` and edit the file to include your settings (like the Mongo URL). Leave the `NODE_ENV=development` line intact. Once set, run the site using `npm run dev`. This will start Nightscout in the development mode, with different code packaging rules and automatic restarting of the server using nodemon, when you save changed files on disk. The client also hot-reloads new code in, but it's recommended to reload the website after changes due to the way the plugin sandbox works.

Note the template sets `INSECURE_USE_HTTP` to `true` to enable the site to work over HTTP in local development.

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md)
[discord-url]: https://discord.gg/rTKhrqz
[heroku-img]: https://www.herokucdn.com/deploy/button.png
[heroku-url]: https://heroku.com/deploy?template=https://github.com/nightscout/cgm-remote-monitor
[update-img]: update.png
[update-img]: docs/update.png
[update-fork]: http://nightscout.github.io/pages/update-fork/
[original]: https://github.com/rnpenguin/cgm-remote-monitor

Expand Down Expand Up @@ -164,7 +164,7 @@ Some features may not work with devices/browsers on the older end of these requi

## Windows installation software requirements:

- [Node.js](http://nodejs.org/) Latest Node 12 LTS. Node versions that do not have the latest security patches will not work. Use [Install instructions for Node](https://nodejs.org/en/download/package-manager/) or use `setup.sh`)
- [Node.js](http://nodejs.org/) Latest Node 12 LTS. Node versions that do not have the latest security patches will not work. Use [Install instructions for Node](https://nodejs.org/en/download/package-manager/) or use `bin/setup.sh`)
- [MongoDB](https://www.mongodb.com/download-center?jmp=nav#community) 3.x or later. MongoDB 2.4 is only supported for Raspberry Pi.

As a non-root user clone this repo then install dependencies into the root of the project:
Expand Down Expand Up @@ -670,7 +670,7 @@ For remote overrides, the following extended settings must be configured:
* `target_high` - Upper target for correction boluses.
* `target_low` - Lower target for correction boluses.

Some example profiles are [here](example-profiles.md).
Some example profiles are [here](docs/plugins/example-profiles.md).

## Setting environment variables
Easy to emulate on the commandline:
Expand All @@ -690,13 +690,13 @@ Your hosting provider probably has a way to set these through their GUI.
### Vagrant install

Optionally, use [Vagrant](https://www.vagrantup.com/) with the
included `Vagrantfile` and `setup.sh` to install OS and node packages to
included `Vagrantfile` and `bin/setup.sh` to install OS and node packages to
a virtual machine.

```bash
host$ vagrant up
host$ vagrant ssh
vm$ setup.sh
vm$ ./bin/setup.sh
```

The setup script will install OS packages then run `npm install`.
Expand Down
2 changes: 1 addition & 1 deletion deploy.sh → bin/azure-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ echo "\"$SCM_COMMIT_ID\"" > $DEPLOYMENT_SOURCE/scm-commit-id.json

# 1. KuduSync
if [[ "$IN_PLACE_DEPLOYMENT" -ne "1" ]]; then
"$KUDU_SYNC_CMD" -v 50 -f "$DEPLOYMENT_SOURCE" -t "$DEPLOYMENT_TARGET" -n "$NEXT_MANIFEST_PATH" -p "$PREVIOUS_MANIFEST_PATH" -i ".git;.hg;.deployment;deploy.sh"
"$KUDU_SYNC_CMD" -v 50 -f "$DEPLOYMENT_SOURCE" -t "$DEPLOYMENT_TARGET" -n "$NEXT_MANIFEST_PATH" -p "$PREVIOUS_MANIFEST_PATH" -i ".git;.hg;.deployment;bin/azure-deploy.sh"
exitWithMessageOnError "Kudu Sync failed"
fi

Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 0 additions & 4 deletions database_configuration.json

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes
5 changes: 5 additions & 0 deletions lib/adminnotifies.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ function init (ctx) {
const adminnotifies = {};

adminnotifies.addNotify = function addnotify (notify) {
if (!ctx.settings.adminNotifiesEnabled) {
console.log('Admin notifies disabled, skipping notify', notify);
return;
}

if (!notify) return;

notify.title = notify.title || 'No title';
Expand Down
1 change: 1 addition & 0 deletions lib/language.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ function init (fs) {
}

language.set = function set (newlang) {
if (!newlang) return;
language.lang = newlang;

language.languages.forEach(function(l) {
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/batteryage.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function init(ctx) {

var bage = {
name: 'bage'
, label: 'Pump Battery Change'
, label: 'Pump Battery Age'
, pluginType: 'pill-minor'
};

Expand Down
2 changes: 1 addition & 1 deletion lib/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ function create (env, ctx) {
app.locals.bundle = '/devbundle';

const webpack = require('webpack');
var webpack_conf = require('../../webpack.config');
const webpack_conf = require('../../webpack/webpack.config');
const middleware = require('webpack-dev-middleware');
const compiler = webpack(webpack_conf);

Expand Down
1 change: 1 addition & 0 deletions lib/server/bootevent.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function boot (env, language) {
console.log('Executing startBoot');

ctx.runtimeState = 'booting';
ctx.settings = env.settings;
ctx.bus = require('../bus')(env.settings, ctx);
ctx.adminnotifies = require('../adminnotifies')(ctx);
if (env.notifies) {
Expand Down
5 changes: 1 addition & 4 deletions lib/server/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,7 @@ function setStorage () {
env.food_collection = readENV('MONGO_FOOD_COLLECTION', 'food');
env.activity_collection = readENV('MONGO_ACTIVITY_COLLECTION', 'activity');

// TODO: clean up a bit
// Some people prefer to use a json configuration file instead.
// This allows a provided json config to override environment variables
var DB = require('../../database_configuration.json')
var DB = { url: null, collection: null }
, DB_URL = DB.url ? DB.url : env.storageURI
, DB_COLLECTION = DB.collection ? DB.collection : env.entries_collection;
env.storageURI = DB_URL;
Expand Down
2 changes: 1 addition & 1 deletion lib/server/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"info": {
"title": "Nightscout API",
"description": "Own your DData with the Nightscout API",
"version": "14.2.1",
"version": "14.2.2",
"license": {
"name": "AGPL 3",
"url": "https://www.gnu.org/licenses/agpl.txt"
Expand Down
2 changes: 1 addition & 1 deletion lib/server/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ servers:
info:
title: Nightscout API
description: Own your DData with the Nightscout API
version: 14.2.1
version: 14.2.2
license:
name: AGPL 3
url: 'https://www.gnu.org/licenses/agpl.txt'
Expand Down
2 changes: 2 additions & 0 deletions lib/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ function init () {
, frameName7: ''
, frameName8: ''
, authFailDelay: 5000
, adminNotifiesEnabled: true
};

var secureSettings = [
Expand Down Expand Up @@ -105,6 +106,7 @@ function init () {
, bgTargetTop: mapNumber
, bgTargetBottom: mapNumber
, authFailDelay: mapNumber
, adminNotifiesEnabled: mapTruthy
};

function filterObj(obj, secureKeys) {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nightscout",
"version": "14.2.1",
"version": "14.2.2",
"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 @@ -29,14 +29,14 @@
"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 ./ci.test.env nyc --reporter=lcov --reporter=text-summary mocha --require ./tests/hooks.js --exit ./tests/*.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",
"env": "env",
"postinstall": "webpack --mode production --config webpack.config.js && npm run-script generate-keys",
"bundle": "webpack --mode production --config webpack.config.js && npm run-script generate-keys",
"bundle-dev": "webpack --mode development --config webpack.config.js && npm run-script generate-keys",
"bundle-analyzer": "webpack --mode development --config webpack.config.js --profile --json > stats.json && webpack-bundle-analyzer stats.json",
"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",
"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 ./ci.test.env codacy-coverage",
"coverage": "cat ./coverage/lcov.info | env-cmd -f ./tests/ci.test.env codacy-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
26 changes: 26 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* cgm-remote-monitor - web app to broadcast cgm readings
* Copyright (C) 2014 Nightscout contributors. See the COPYRIGHT file
* at the root directory of this distribution and at
* https://github.com/nightscout/cgm-remote-monitor/blob/master/COPYRIGHT
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

// Description: Basic web server to display data from Dexcom G4. Requires a database that contains
// the Dexcom SGV data.
'use strict';

require('./lib/server/server');

Empty file removed test
Empty file.
2 changes: 2 additions & 0 deletions tests/adminnotifies.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const ctx = {};

ctx.bus = {};
ctx.bus.on = function mockOn(channel, f) { };
ctx.settings = {};
ctx.settings.adminNotifiesEnabled = true;

const mockJqueryResults = {};
const mockButton = {};
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions translations/ar_SA.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
"View all treatments": "View all treatments",
"Enable Alarms": "Enable Alarms",
"Pump Battery Change": "Pump Battery Change",
"Pump Battery Age": "Pump Battery Age",
"Pump Battery Low Alarm": "Pump Battery Low Alarm",
"Pump Battery change overdue!": "Pump Battery change overdue!",
"When enabled an alarm may sound.": "When enabled an alarm may sound.",
Expand Down
1 change: 1 addition & 0 deletions translations/bg_BG.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
"View all treatments": "Преглед на всички събития",
"Enable Alarms": "Активни аларми",
"Pump Battery Change": "Смяна на батерия на помпата",
"Pump Battery Age": "Pump Battery Age",
"Pump Battery Low Alarm": "Аларма за слаба батерия на помпата",
"Pump Battery change overdue!": "Смяната на батерията на помпата - наложителна",
"When enabled an alarm may sound.": "Когато е активирано, алармата ще има звук",
Expand Down
1 change: 1 addition & 0 deletions translations/cs_CZ.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
"View all treatments": "Zobraz všechny ošetření",
"Enable Alarms": "Povolit alarmy",
"Pump Battery Change": "Výměna baterie pumpy",
"Pump Battery Age": "Stáří baterie v pumpě",
"Pump Battery Low Alarm": "Upozornění na nízký stav baterie pumpy",
"Pump Battery change overdue!": "Překročen čas pro výměnu baterie!",
"When enabled an alarm may sound.": "Při povoleném alarmu zní zvuk.",
Expand Down
1 change: 1 addition & 0 deletions translations/da_DK.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
"View all treatments": "Se alle behandlinger",
"Enable Alarms": "Aktivere alarmer",
"Pump Battery Change": "Udskiftet pumpebatteri",
"Pump Battery Age": "Pumpe batterialder",
"Pump Battery Low Alarm": "Pumpebatteri lav Alarm",
"Pump Battery change overdue!": "Pumpebatteri skal skiftes!",
"When enabled an alarm may sound.": "Når aktiveret kan en alarm starte.",
Expand Down
1 change: 1 addition & 0 deletions translations/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
"View all treatments": "Zeige alle Behandlungen",
"Enable Alarms": "Alarme einschalten",
"Pump Battery Change": "Pumpenbatterie wechseln",
"Pump Battery Age": "Alter der Pumpenbatterie",
"Pump Battery Low Alarm": "Pumpenbatterie niedrig Alarm",
"Pump Battery change overdue!": "Pumpenbatterie Wechsel überfällig!",
"When enabled an alarm may sound.": "Sofern eingeschaltet ertönt ein Alarm",
Expand Down
Loading

0 comments on commit 46418c7

Please sign in to comment.