* Added sanity check for the bridge interval value, setting minimum allowed value to 30 seconds and maximum to 5 minutes. This is to avoid input of very low values which might overload the dexcom servers.
* Added missin ';'
* Fixed typoe in comment
* Added test for default interval (not set in config)
* Set lower limit to 1 second
* Run tests using GitHub Actions
* Node 10
* Test CI fails
* Use npm to run tests
* Fix package json to run tests
* Enable v3 TEST api for both development env and CI
* Run CI on both Node 10 and 12
* Allow downgrading Mongo
* Fix continuous suspension of the timeago alerts
The default hearbeat-setting is 60 seconds, so the delta between two
timeago-checks will always be >15 seconds and the timeago-alarms will
always be suspended (that's what Papertrail also shows).
To fix this, make the delta-check heartbeat-setting-dependant and also simplify
the code by using just 1 variable.
* Add test that verifies the hibernation detection behaviour
The real-world test would be to actually wait for a couple of minutes (with 2 *
heartbeat of default settings) in the unit test, but this is not feasible, so
just modify the heartbeat-setting to a lower value.
I tested it by only running tests inside `tests/timeago.test.js` and by actually
deploying this code and testing the alarms with Pushover and reading the logs in
Papertrail.
Before this change, I saw a 'Hibernation detected' log every minute. After this
change, I didn't see it anymore, probably because the app wasn't actually
hibernated (yet).
* Take sulkaharo's feedback into account and differentiate
between client and server (by introducing it in sandbox.js).
On the client the behaviour is different from the server:
> On client, the issue is browsers stop the execution of JS if the window is not
> visible and the alarm is falsely triggered immediately when the execution is
> resumed, so we need to suspend the alarm for ~10 seconds after the execution has
> resumed to give the client time to update the data to prevent false alarms.
While on the server, the default heartbeat from 60s needs to be taken
into account to prevent the timeago alarm from falsely triggering.
So detect hibernation there if the last check was more than 2 heartbeats ago.
* Fix the tests by adding settings to the context,
which is now required by timeago.
Also, change the timeago test a bit so that it both succeeds
when testing in isolation as when testing it along with the other tests.
* Fix layouting and load data in one go. Bonus points if you can fix the rendering for this
* fix focus target lines and high and low lines
* Remove debug logging. Change profile functions to clear the cache on new data, instead of calculating heavy hashes
* Remove unused code
* Fix tests
* Have Travis run tests on Node 10 and 12, not 13
* * Fix reporting test to match the new output
* Fix number formatter to return the expected 0 when data is NaN
* Remove excessive logging during test runs from cob plugin
* Run all tests in one go
* Fixes D3 invocations for tests. Note this also removes transition timers (most of which seemed to be timed so fast they actually had no effect as the timer was faster than what it takes to draw a frame in Nightscout)
* Run tests independently
* Try not running tap-set-exit
* Remove tap-set-exit
* Copied work done by mdomox
* Updates and fixes to CONTRIBUTING.md
* Spacing unification
* One more fix for CONTRIBUTING.md
* Minor code formatting improvements
* One more time...
* Renamed Alexa stuff to virtAsst for generic-ness
* Corrected missed translate() text
* Updated googlehome plugin to mimic the alexa plugin
* Changed order of operations
* Fixed parameter referencing in googlehome
* Yet another CONTRIBUTING fix
* Removed extra google stuff
* Migrated standalone intents to MetricNow intent
* Simplified route handling
* Added logging
* Added forgotten path selector
* Separated instructions for adding virtual assistant support in a plugin
* A few typo fixes
* Improved logging
* Updated Google Home plugin instructions
* Attempt to trigger download of template file
* Small wording tweaks
* Updated Alexa plugin documentation
* Updated test files
* Re-added handler count tests so devs are prompted to write tests for new handlers
* Updated Alexa documentation
* Small typo fix
* Clarification
* Further clarifications and typos
* Added language info to Google Home plugin doc
* URL correction
* URL fix v2
* Wording clarification
* Ugh...
* Minor instruction fix
* Sub steps fix
* Fixed Alexa references in Google Home
* Added a couple steps for improved user experience
* One more forgotten step
* Updated pump reservoir handler to handle undefined values
* Updated titles and unknown-value responses
* Modified forecast responses to use translate()
* Updated tests
* Improved training phrases
* Wording improvements
* Google Home setup instruction corrections
* Corrected how metric selection is found
* extended .gitignore for Visual Studio 2017
* creating a lib for api3 and exposing it's swagger file
* adding pilot test (for /swagger.yaml)
* implementing public GET /version
* setting api version to 3.0.0-alpha
* creating authorization skeleton + fetching some API env variables
* reusing authorization library
* implementing security
* forcing HTTPS and removing x-powered-by from response
* moving messages to constants, creating https instance fixture
* testing HTTPS requiring
* testing Date header
* testing permission check
* testing allowed operation
* refactoring + storage stub
* create architecture for generic operations
* beginning of READ operation
* tidying the code up
* basic READ part
* going further with READ operation
* DELETE operation
* handling fields parameter
* refactoring to classes
* going further with SEARCH operation
* refactoring file structure
* filtering for SEARCH operation
* preparations for fallback deduplication
* CREATE operation
* UPDATE operation
* PATCH operation
* HISTORY operation
* creating more precise variant of HISTORY operation
* autopruning
* long for timestamps in swagger
* bug fix (when search fields=srvCreated)
* creating skeleton for generic collection API test
* specific HISTORY skeleton
* distinguish between collection logical and storage name
* renaming operation to LAST MODIFIED and getting it to work
* fallback for LAST MODIFIED operation
* tidying a bit
* LAST MODIFIED documentation
* bugfix + emitting data-received
* adding some validations
* bugfix - remove 'token' parameter from filtering
* testing and debugging generic workflow
* test fix for empty db
* fixing security test fixture
* trying to fix Travis CI testing DB problem
* multiple auth callback bugfix + adding user field on authed create/update
* messages for Travis CI debugging
* messages for Travis CI debugging
* messages for Travis CI debugging
* test fix (to be prepared for future dates in db)
* test fix
* adding fallback created_at filling on each create/update
* STATUS operation with API permissions
* querying srvDate from storage + include storage version info
* bugfix of missing apiConst require
* getting mongo version with read-only user rights
* getting mongo current date with read-only user rights
* trying to diagnose travis CI timeout
* refactoring storage version caching (due to some environments problems)
* making VERSION work on empty database
* more fixes
* skipping API HTTPS test for node 8
* making code more readable using ES6 (Promises, async + await)
* extending treatments collection docs by inspecting the careportal code
* tidying existing API3 tests up to allow further grow
* tidying the authorization code up to increase readability and performance a bit
* more refactoring to ES6 and making APIv3 files structure more extendable
* normalizing incoming dates to UTC and storing utcOffset
* fixing srvDate to be of node.js server, not the mongo DB
* preparing test fixtures for permissions testing + skeleton for CREATE operation test
* intensive CREATE operation testing + minor bug fixes
* correcting the deduplication test
* more deduplication testing of CREATE operation
* adding test skeletons for other generic operations
* added variability in filtering by date, created_at, srvModified, srvCreated fields
* fixing test accordingly to previous commit
* adding new collection settings for centralized apps' settings storage
* trying to solve travis CI testing problem - adding default collections names
* another attempt to travis CI test fix
* adding some tests for READ operation
* adding custom error handler (overriding bodyparser's errors)
* securing settings collection more and updating swagger accordingly
* making HISTORY timestamp parameter more flexible + updating swagger documentation
* more testing and bug fixing
* sending only HTTP status with empty body, when there is no message + minor bug fixing
* more refactoring and testing (especially of UPDATE operation)
* PATCH testing + adding userModified field for troubleshooting purposes
* basic SEARCH operation testing
* more SEARCH operation testing
* adding alternative 'now' query parameter to 'Date' header to make GET easier
* adding 'now' to reserved query parameters for SEARCH operation
* more testing
* renaming field user to subject (and modifiedBy)
* bugfix - fixing RFC 2822 constant for moment parsing
* storageSocket: creating skeleton for new Socket.IO namespace
* storageSocket: authentication by accessToken
* storageSocket: authorizing to subscribe rooms
* storageSocket: emitting create, update and delete events
* APIv3: adding support for swagger UI at /api/v3/swagger-ui-dist
* solving some problems detected by eslint
* solving some problems detected by eslint
* APIv3: testing and debugging Socket.IO
* APIv3: testing and debugging Socket.IO
* APIv3: Socket.IO documentation
* APIv3: making the sample real
* APIv3: starting to create a simple tutorial MD file
* APIv3: small corrections
* APIv3: minor corrections after dev merge
* APIv3: adding CREATE and READ operations to the tutorial.md
* APIv3: adding SEARCH, LAST MODIFIED, UPDATE operations to the tutorial.md
* APIv3: finishing the tutorial.md
* APIv3: minor bugfix (bad location after upsert)
* APIv3: refactoring SEARCH complexity
* APIv3: refactoring mongoCollection complexity
* APIv3: refactoring complexity
* APIv3: tidying up a bit
* APIv3: refactoring security (start)
* APIv3: refactoring lastModified
* APIv3: refactoring create (start)
* APIv3: refactoring create (finish)
* APIv3: refactoring delete
* APIv3: refactoring history
* APIv3: refactoring update
* APIv3: refactoring patch
* APIv3: refactoring read
* APIv3: refactoring search + removing deprecated authorizationBuilder
* APIv3: adding best practise for identifier constructing
* APIv3: refactoring and enhancing the validation (immutable fields)
* APIv3: adding security.md documentation file
* APIv3: refactoring - splitting index.js into multiple files
* APIv3: calculating identifier on server side + deduplicating
* APIv3: refactoring cosmetics
* APIv3: updating the documentation
* APIv3: making basic and security tests more readable using async/await
* APIv3: making the rest of tests more readable using async/await
* APIv3: adapting test of previous API
* APIv3: adapting test of previous API
* Normalize Treatment object dates to be all in UTC Strings, as expected by the codebase
* Also normalize the device status data
* Sort the results so results with mixed dates are returned in correct order
* Use MomentJS to correctly parse the offsets & output the offset to objects at all times
* Removing a debug console log message causing excessive logging
* Use UTC date values for queries even if client asks for zoned dates
* Remove extra sorting based on date. Code clarifications
* * Add missing parseZone() call to treatments
* Check isValid() date on entries
* Use isValid() to check date validity for device status data
* Adds API to plugin manager that calls plugins to visualize alarms
* Refactoring how the translation object is managed after discovering every server-side plugin had it's own instance of the translations and the language code wasn't propagated to any code that generated alarms
* Add more missing translations
* Some more localization fixes
Update Finnish to 100% localized
Change Mongo connection to not stop retrying connecting
* Better scaling for mmol
Fix bug in detecting new BG values
* Delta calculation was the wrong way round :D
* add missing dutch translations
* Have tests bail early & tell Mocha to exit at the end of the run
* Try if Travis likes running tests one by one better
* Enable blocking IO for Travis
* upgrade mocha from 3.5.3 to 5.0.5
This resolves these security issues
Low Regular Expression Denial of Service
Package debug
Dependency of mocha [dev]
Path mocha > debug
More info https://nodesecurity.io/advisories/534
Critical Command Injection
Package growl
Dependency of mocha [dev]
Path mocha > growl
More info https://nodesecurity.io/advisories/146
* upgrade mocha and start modularizing lodash to make sure tests pass
* more lodash modularization
* upgrade mqtt to 2.18.3
* allow npm 6.2
* upgrade share2nightscout-bridge
* incorporate express-extension-to-accept into Nightscout
the packages seems not maintained (github page is 404) and has a security issue with mime package. so upgraded and included into Nightscout code.
if somebody knows a more efficient way of programming this with express4 please PR
* update jsdom for security fixes
* prevent wrapping of hour labels by removing the space
* Revert "update jsdom for security fixes"
This reverts commit 04f1f39d636d8d79c6b01b5f298f9a6cea3dc645.
* Revert "more lodash modularization"
This reverts commit c4fa5304db9f16b94f15c2b44793a5a11d595885.
* remove forever dependency
* Revert "Revert "more lodash modularization""
This reverts commit b13c274ebff0b5c3a48ffc0e610ca85a9f8d25bc.
* fix report.test.js with newer packages
sometimes a fix is very easy. This is to prevent:
```
Deprecation warning: value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.
Arguments:
[0] _isAMomentObject: true, _isUTC: true, _useUTC: true, _l: undefined, _i: T00:00:00, _f: undefined, _strict: undefined, _locale: [object Object]
Error
at Function.createFromInputFallback (XXX\cgm-remote-monitor\tmp\js\bundle.js:117408:98)
at configFromString (XXX\cgm-remote-monitor\tmp\js\bundle.js:119456:15)
```
We must use ISO8601 formatted strings and not use slashes in dates, see https://github.com/moment/moment/issues/1407#issuecomment-155630060
* upgrade webpack to 4.16.2
* Update package.json
* Fixes issue https://github.com/nightscout/cgm-remote-monitor/issues/3660
* Fix OpenAPS temporary targets using mg/dl on mmol users
* Fixes a bug with saving
* Fix changed entry data order in API
* Clean formatting
* Fix mmol conversion on treatment save
because it times out with 40000ms on Travis with Node 10. See https://travis-ci.org/PieterGit/cgm-remote-monitor/jobs/401307860
not ok 192 pluginbase does stuff
AssertionError: expected -1 to be above -1
at Assertion.fail (node_modules/should/cjs/should.js:275:17)
at Assertion.value (node_modules/should/cjs/should.js:356:19)
at containsLine (tests/hashauth.test.js:163:41)
at Window.mockConfirm [as alert] (tests/hashauth.test.js:165:7)
at Object.u.addBasals (tmp/js/bundle.js:9:2577816)
at Object.o.scroll (tmp/js/bundle.js:9:2485436)
at V (tmp/js/bundle.js:9:3092518)
at Timeout.e [as _onTimeout] (tmp/js/bundle.js:9:3106675)
# tests 192
# pass 191
# fail 1