708 Commits
Author SHA1 Message Date
Sulka Haro bc188d9163 * Disabling tests that interfere with other tests
* Fix view include syntax
* Change Slovenian name to correct language
2021-02-06 19:11:36 +02:00
Sulka Haro 5bf4d5134b * Better unit test for admin notifications.
* Localisable API_SECRET warning
* Fix admin message time display when message is recent
2021-02-06 14:25:19 +02:00
Sulka HaroandGitHub 5bc694d738 Add unit test for socket.io connect (#6845)
* Add unit test for socket.io connect

* Fix white space
2021-02-04 23:07:52 +02:00
Sulka Haro c65916c256 * Fix #6843
* Don't do sync file access on requests to swagger files or service worker
* Adds an API test
2021-02-04 21:46:30 +02:00
Sulka HaroandGitHub d7e011d8f5 Refactoring organisation, bundling and security improvements (#6765)
* * Simplified bundling to just one bundle
* Removed cache invalidation token from bundling
* Generate strong persistent random string on deploy to use for JWT signing
* WIP: moving api-secret and JWT signing to a separate centralized security component
* Moved some server components away from project root
* Fix issues reported by linter

* Ignore detect-object-injection everywhere but the client

* Make admin message button red

* Remove alarms for some security alerts on code

* api_secret is now fully contained in the enclave
2021-02-02 19:53:30 +02:00
Sulka HaroandGitHub 04ca7b240b Unit test teardown improvements (#6821)
* Clear module require()s between tests
Clear profile cache between tests

* Fix authentication for careportal test

* Add logging to see where the careportal test gets to

* Even more logging for headless setup

* Change to use before and after in careportal test

* Add time logging

* Bump headless setup time to a full minute

* More timers to figure out what's slow in GA

* Bump up timeout on failing test
2021-02-01 17:50:48 +02:00
b188a2a565 #6701 Report storage tests (#6814)
* #6701 Report storage tests

Functional and unit tests

* #6701 Test cleanup

* #6701 js-storage teardown

The first time js-storage is required it evaluates if it's running in the browser or not: https://github.com/julien-maurel/js-storage/blob/master/js.storage.js#L423 and will define the localstorage getters and setters accordingly. This becomes an issue if testing localstorage between UI and non-UI tests. reportstorage.test.js was requiring it before hashauth.test.js causing a conflict.

* #6701 false positive test

The page isn't refreshing

Co-authored-by: Sulka Haro <sulka@sulka.net>
2021-01-31 12:41:00 +02:00
bassettbandGitHub c91ec78af4 Round insulin value in treatment tooltip (#6776)
* rename toFixedMin to toRoundedStr

* round the insulin value
2021-01-26 22:08:00 +02:00
f6f7e18888 Allow api3 behind reverse proxy (#5631)
* Allow api3 behind reverse proxy

* fix test

Co-authored-by: Sulka Haro <sulka@sulka.net>
2021-01-17 19:46:28 +02:00
3ee90d6927 feat: disable pump battery alarms at night option (#5359)
* feat: add feature to disable pump battery alarms at night

* add timezone handling for server side

* Update pump.test.js

* Update pump.test.js

* Update pump.test.js

Co-authored-by: Jeremy Cunningham <jpcunningh@gmail.com>
Co-authored-by: Sulka Haro <sulka@sulka.net>
2021-01-17 15:31:31 +02:00
Sulka HaroandGitHub 647ed20de1 Clean statics & bundle more (#6745)
* * Remove unused old version of MFB
* Bundle food, profile editor
* Clean up the static folders

* Fix tests
2021-01-17 12:20:48 +02:00
Sulka HaroandGitHub 44c544a9ac Support pump status upload display override (#6698) 2021-01-12 16:45:23 +02:00
Sulka Haro 1351d35066 * Improved internal API for injecting values into localization keys
* Fix a hard to translate key that was split to two separate values
2021-01-08 16:25:51 +02:00
cfdbaa8bbd APIv3: wrapping all results in JSON (#6703)
* APIv3: isolating documents from tests (not allowing clashes of calculated identifiers)

* removing unused async keyword

* fixing api v3 swagger and moving it to /api3-docs

* APIv3: adding cachedCollection stub of cachedCollection storage implementation

* APIv3: mongo cachedCollection storage implementation

* APIv3: testing and debugging cache updates

* APIv3: more testing on cache updates

* APIv3: fixing bad async functions

* APIv3: finishing cache invalidation tests

* APIv3: wrapping VERSION result

* APIv3: wrapping STATUS result

* APIv3: wrapping DELETE result

* APIv3: wrapping READ result + partially SEARCH and HISTORY

* APIv3: wrapping CREATE result

* APIv3: wrapping UPDATE + PATCH result

* APIv3: wrapping LAST MODIFIED result

* APIv3: updating swagger doc

* APIv3: updating tutorial.md

* APIv3: tuning tests

* APIv3: merge dev

Co-authored-by: Petr Ondrusek <petr.ondrusek@seznam.cz>
Co-authored-by: Petr Ondrůšek <petr.ondrusek@okin.eu>
Co-authored-by: Sulka Haro <sulka@sulka.net>
2021-01-07 22:58:23 +02:00
Sulka HaroandGitHub 914ba78f36 Security improvement batch (#6622)
* Adds a new method for the server to push notifies to the client, which require administration privileges from the user. If there are messages in queue but user is not privileged, she is notified of pending messages

* Fix unit tests

* Increase timeouts on tests

* Add translations

* * Aggregate admin messages
* Send admin message on auth fail
* Sending messages over bus
* XSS filtering of objects sent over the REST API

* Warn users if their instance is world readable

* Fix adminnotifies init()

* Fix couple issues from Codacy
2021-01-07 22:46:55 +02:00
Sulka Haro df6d9aadc3 Re-enable partial report test 2021-01-07 14:45:13 +02:00
Sulka Haro b078394450 * Bump version to 14.1.1
* Allow reducing timer length in delays for security tests
2021-01-07 14:43:53 +02:00
Sulka Haro 46e4d172bb * Additional unit test for the authorization API
* Stop logging the API SECRET
2021-01-04 23:43:16 +02:00
6b28a148ee APIv3: Cache invalidation + refactoring (#6688)
* APIv3: isolating documents from tests (not allowing clashes of calculated identifiers)

* removing unused async keyword

* fixing api v3 swagger and moving it to /api3-docs

* APIv3: adding cachedCollection stub of cachedCollection storage implementation

* APIv3: mongo cachedCollection storage implementation

* APIv3: testing and debugging cache updates

* APIv3: more testing on cache updates

* APIv3: fixing bad async functions

* APIv3: finishing cache invalidation tests

Co-authored-by: Petr Ondrusek <petr.ondrusek@seznam.cz>
Co-authored-by: Petr Ondrůšek <petr.ondrusek@okin.eu>
Co-authored-by: Sulka Haro <sulka@sulka.net>
2021-01-01 19:31:19 +02:00
Sulka Haro d81e342ef0 Fix pushover test 2020-12-14 22:30:21 +02:00
Sulka Haro a0738414f2 Oops, push the unit test changes as well 2020-12-14 22:08:53 +02:00
Sulka HaroandGitHub 7fe8e32152 Refactor core auth (#6596)
* Auth resolve now supports async/await
* Read only tokens can be used for authentication and the UI shows privileges for these accounts correctly
* Failed attempt at authenticating an API_SECRET or token delays subsequent auth attempt by 5000 ms
2020-12-11 00:23:25 +02:00
Sulka Haro f02b8d9bc2 Fix timing issue with a test using async, causing tests to randomly fail 2020-12-10 17:27:30 +02:00
Sulka HaroandGitHub 4ace12594e Move localisation to Crowdin (#6518)
* Update Crowdin configuration file

* Update Crowdin configuration file

* Add languages for pushing

* Update Crowdin configuration file

* Update source file en.json

* New translations en.json (Finnish)

* New translations en.json (Finnish)

* New translations en.json (Romanian)

* New translations en.json (Dutch)

* New translations en.json (Croatian)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Chinese Simplified)

* New translations en.json (Turkish)

* New translations en.json (Swedish)

* New translations en.json (Slovenian)

* New translations en.json (Russian)

* New translations en.json (Polish)

* New translations en.json (Korean)

* New translations en.json (French)

* New translations en.json (Japanese)

* New translations en.json (Italian)

* New translations en.json (Hungarian)

* New translations en.json (Hebrew)

* New translations en.json (Greek)

* New translations en.json (German)

* New translations en.json (Danish)

* New translations en.json (Czech)

* New translations en.json (Bulgarian)

* New translations en.json (Spanish)

* New translations en.json (Norwegian Bokmal)

* New translations en.json (Chinese Traditional)

* New translations en.json (Chinese Simplified)

* Remove folders

* New translations en.json (Romanian)

* New translations en.json (Korean)

* New translations en.json (Croatian)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Turkish)

* New translations en.json (Swedish)

* New translations en.json (Slovenian)

* New translations en.json (Russian)

* New translations en.json (Polish)

* New translations en.json (Dutch)

* New translations en.json (Japanese)

* New translations en.json (French)

* New translations en.json (Italian)

* New translations en.json (Hungarian)

* New translations en.json (Hebrew)

* New translations en.json (Finnish)

* New translations en.json (Greek)

* New translations en.json (German)

* New translations en.json (Danish)

* New translations en.json (Czech)

* New translations en.json (Bulgarian)

* New translations en.json (Norwegian Bokmal)

* New translations en.json (Romanian)

* New translations en.json (Korean)

* New translations en.json (Croatian)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Turkish)

* New translations en.json (Swedish)

* New translations en.json (Slovenian)

* New translations en.json (Russian)

* New translations en.json (Polish)

* New translations en.json (Dutch)

* New translations en.json (Japanese)

* New translations en.json (French)

* New translations en.json (Italian)

* New translations en.json (Hungarian)

* New translations en.json (Hebrew)

* New translations en.json (Finnish)

* New translations en.json (Greek)

* New translations en.json (German)

* New translations en.json (Danish)

* New translations en.json (Czech)

* New translations en.json (Bulgarian)

* New translations en.json (Norwegian Bokmal)

* Update Crowdin configuration file

* New translations en.json (Spanish)

* New translations en.json (Chinese Simplified)

* New translations en.json (Chinese Traditional)

* New translations en.json (Italian)

* New translations en.json (Croatian)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Turkish)

* New translations en.json (Swedish)

* New translations en.json (Slovenian)

* New translations en.json (Russian)

* New translations en.json (Polish)

* New translations en.json (Dutch)

* New translations en.json (Korean)

* New translations en.json (Japanese)

* New translations en.json (Hungarian)

* New translations en.json (Hebrew)

* New translations en.json (Finnish)

* New translations en.json (Greek)

* New translations en.json (German)

* New translations en.json (Danish)

* New translations en.json (Czech)

* New translations en.json (Bulgarian)

* New translations en.json (French)

* New translations en.json (Romanian)

* New translations en.json (Norwegian Bokmal)

* Loading all languages now works

* * Fix unit tests
* Have server load localizations

* Adding some more keys

* New Crowdin updates (#6531)

* New translations en.json (Finnish)

* New translations en.json (Norwegian Bokmal)

* New translations en.json (Finnish)

* New translations en.json (Japanese)

* New translations en.json (Portuguese, Brazilian)

* New translations en.json (Chinese Traditional)

* New translations en.json (Chinese Simplified)

* New translations en.json (Turkish)

* New translations en.json (Swedish)

* New translations en.json (Slovenian)

* New translations en.json (Russian)

* New translations en.json (Polish)

* New translations en.json (Dutch)

* New translations en.json (Korean)

* New translations en.json (Italian)

* New translations en.json (Norwegian Bokmal)

* New translations en.json (Hungarian)

* New translations en.json (Hebrew)

* New translations en.json (Greek)

* New translations en.json (German)

* New translations en.json (Danish)

* New translations en.json (Czech)

* New translations en.json (Bulgarian)

* New translations en.json (Spanish)

* New translations en.json (French)

* New translations en.json (Romanian)

* New translations en.json (Croatian)

* Update source file en.json

* New translations en.json (Norwegian Bokmal)

* New translations en.json (Norwegian Bokmal)

* Remove old translation status tool

* Update CONTRIBUTING
2020-11-17 14:17:17 +02:00
Sulka Haro 384de77714 Fix unit tests 2020-11-14 14:48:10 +02:00
Sulka HaroandGitHub b762ade017 Fix batch (#6248)
* Use the delta plugin data to show the delta in the clock views
* Update Node checks
* Fix disabling the BG alarms for simple alarms
* Load battery and other rare events up to two months back
* Possibly fixes compatibility with ios9 - needs testing
* Unified black and color clock layouts
* Update clock data every 20 seconds
* Update clock time every second
* Fix how CSP policy is set for Helmet, fixes #6260
* Authorization fix for misformatted URLs
* Added unit test for batch upload of CGM entries
* Improved / removed some logging
* Test if user is in read only mode when Nightscout starts and give an error if so
2020-11-10 18:02:28 +02:00
CalebandGitHub 775324174e Corrected setup of dbsize for virtual assistants (#6270)
* Corrected db size config for virtual assistants

* Language fix, improvements, added dbsize to virtAsst config

* Using env

* Added logging

* Debug logging

* Different logging

* More troubleshooting

* Another try

* Reverted stuff, added dbsize to server defaults

* Fixed test

* Fixed another test
2020-10-20 12:23:14 +03:00
d9e63fbe27 Fix broken swagger for APIv3 (#6201)
* APIv3: isolating documents from tests (not allowing clashes of calculated identifiers)

* removing unused async keyword

* fixing api v3 swagger and moving it to /api3-docs

Co-authored-by: Petr Ondrusek <petr.ondrusek@seznam.cz>
Co-authored-by: Petr Ondrůšek <petr.ondrusek@okin.eu>
2020-10-18 20:56:40 +03:00
Sulka Haro 84c245c90f Fix tests 2020-09-25 18:56:36 +03:00
Sulka Haro f8461655bc * Fix security test
* Change boot and caching to expose Mongo connection errors
2020-09-25 12:53:31 +03:00
Sulka Haro 1059232f16 * Add cache update events to websocket API
* Remove the validation for created_at in REST API ;(
2020-09-21 20:46:53 +03:00
Sulka Haro 0c7e9bf456 * Require created_at for Treatments on insert
* Refactoring the cache: moved to another file and support flushing from bus events
2020-09-19 18:17:20 +03:00
Sulka Haro 8a1d6bf84a Fix reports unit test 2020-09-16 11:46:22 +03:00
Sulka HaroandGitHub 801900597a Optimize Nightscout database usage (#5947)
* On periodic polls, only load delta for CGM data, treatments and device statuses
* Serve basic CGM data API queries from in-memory cache. Increases the Nightscout memory footprint but should significantly reduce the Mongo load
* Serve device status, CGM and treatment records from memory cache
* Support count parameter in /profile
2020-09-09 20:11:57 +03:00
Sulka HaroandGitHub 9b048dddb7 Fix audit errors, button order (#5694)
* * Update packages giving npm audit errors
* Fix Mongo test that broke after update (now uses async/await on getting the connection)
* Restore original navigation bar button order

* Disable Node 10 tests
2020-07-12 12:46:06 +03:00
joracineandGitHub 2fc559e5fe Change DISPLAY_UNITS to use readENV's default value and added several tests for DISPLAY_UNITS (#5708)
readENV() was hard coding the default value of DISPLAY_UNITS, and
ignoring the default value for no particular reason. Fixed that. Also, I
added a full test suite for DISPLAY_UNITS environment settings to make
sure that it works as intended. Finally, I've added the console log for
the DISPLAY_UNITS since there's no particular reason why we log that setting
and not others.
2020-07-12 12:38:23 +03:00
802d98684f Fixes #4991 - Now selects basal profile based day by day (#5572)
* Test profile settings

* NPM Version change

* Use console log

* Use console log for client

* Use console log for client.sbx

* Use console log for client.ddata

* Use console log for client again

* revert

* Added multi-profile reporting capabilities

Co-authored-by: VIS TFS Admin <liveid@visualsolution.co.uk>
2020-06-12 17:47:28 +03:00
Jeremy CunninghamandGitHub 7c5a69dd9a Fix d3 portrait to landscape brush failure (#5638)
* fix d3 portrait to landscape brush failure

* fix client.renderer.test for highlighBrushPoints function prototype change

* fix highlightBrush

* move brush reset inside check for valid brush
2020-05-05 22:13:21 +03:00
Sulka Haro 7d95b06c20 Fix settings test 2020-02-22 17:07:21 +02:00
Petr OndrusekandGitHub 65b9f38f88 Trying to fix random fail of APIv3 tests (#5519)
* APIv3: isolating documents from tests (not allowing clashes of calculated identifiers)

* removing unused async keyword
2020-02-11 09:32:22 +02:00
Dominik DzieniaandGitHub 44ab2a79dc Plugin to show database size (% of available space or in MiB) (#5496)
* Database size plugin - pill that displays current mongoDB database size

* Enabled dbsize by default

* Fixed bug with dbsize not shownig when size is (rounded) 0% but real bytes > 0

* Cleanup & update to iconfont generation manual

* Changed how warning/urgent levels are configured - from absolute MiB to percentage of DBSIZE_MAX
2020-02-10 08:56:38 +02:00
JakobandSulka Haro 3a1d9be89d Fix eslint errors and add npm script for eslint (#5427)
* re-enable auth check for device status routes

* Resolve eslint errors

* Add npm script for eslint

* Correct regex for express extension middleware and add tests for expected behaviour

* Resolve lint error in virtual assistant base

* Update index.js

* Update index.js
2020-01-14 15:33:56 +00:00
Sulka HaroandGitHub 64663d2bfc Send coverage reports to Codacy (#5444)
* Send coverage reports to Codacy

* Action secrets may not be read from forks :(

* Let's see if this fixes the path & key passing

* Ok one more try for the Actions env

* Run tests and coverage separately

* Try increasing the admintools test runtime for Node 10

* Run tests only once
2020-01-12 18:49:19 +00:00
JakobandSulka Haro 81d926a989 Increase coverage of tests on units utility and clean up timeago test (#5435)
* Increase coverage of tests on units utility

* clean up timeago test
2020-01-12 18:46:08 +00:00
JakobandSulka Haro 5c152438e0 Restore glucose distribution test (#5434) 2020-01-12 18:39:36 +00:00
Petr OndrusekandSulka Haro 2f60d8d6a1 Api3 output renderers (#5425)
* APIv3: adding framework for various output renderers

* APIv3: adding xml output renderer

* APIv3: adding csv output renderer

* APIv3: documenting supported output renderers

* APIv3: testing output renderers
2020-01-12 15:16:52 +00:00
Petr OndrusekandSulka Haro 0def1f225e Add server teardown ability (#5410)
* adding teardown event to ctx.bus

* adding teardown support for mmconnect and bridge plugins
2020-01-06 11:08:05 +02:00
Sulka Haro 9817b03f57 Remove the server side test 2020-01-01 13:18:52 +02:00
Bartłomiej SzubertandSulka Haro 9718bc748a Fix Alexa Launch and SessionEnded Requests (#5377)
* Fix Alexa Launch Request

* Allow LaunchRequest to handle intent if set, change shouldEndSession from string to bool

* Fix SessionEndedRequest
2020-01-01 11:00:18 +02:00
Sulka HaroandGitHub 7b58a2251f Use auth tokens in api-secret (#5214)
* Allow auth tokens to be passed in the api-secret header and used in the client in place of the API secret

* Fix unit test

* Fix admin test

* Reload page when token is used as a secret
2019-12-06 12:27:54 +02:00