Commit Graph
32 Commits
Author SHA1 Message Date
Sulka Haro 7f05018df7 * Creates new V2 API to load minimized current system state in one request for use in watchfaces and other display-only applications
* Cleans V2 API implementation
* Removes unnecessary server init calls in API calls that were unnecessary
* Expose latest SBX state through the CTX object
2023-06-04 17:48:48 +03:00
Ben West 41fdb8e88f respect per route body-parser configuration
This change allows each route to express policies for interpreting and parsing
the request body.  Before this change uploads to entries or treatments api
would error if they were larger than 100Kb due to the preference being set for
the whole server.  This change removes the global preference in favor of
allowing each route to choose it's own request size limit.

We also refactor usage of body-parser to be more consistent throughout the code
base.  Most routes can use jsonParser, rawPraser, and urlencodedParser provided
by the common wares component.  Anything doing something else should be called
out as such.  For example, treatments, activity, and entries allow uploads up
to 50Mb.  Other v1 endpoints are using the common configuration set to 1Mb.
2021-10-12 22:57:03 -07:00
Sulka Haro ebb58141cd Fix json decoding for some api endpoints 2021-02-09 12:52:23 +02:00
CalebandGitHub 76b9de9a8e Use lodash.get() in virtual assistant API endpoints (v2) (#6199)
* Fixed #5632 - Improved value resolution

* More value resolution improvements

* Fixed a couple object paths
2020-10-20 11:57:36 +03: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
CalebandSulka Haro 40986896e1 Virtual assistant code simplification (#5400)
* Moved duplicate plugin code to single location, and small improvements

* Defined _each()
2020-01-11 11:08:41 +00: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
inventor96 161c496af1 Minor improvement in response when delta is 0 2019-12-27 03:25:20 -07:00
inventor96 014df8518c Revert attempt 2019-12-27 01:49:33 -07:00
inventor96 c9c9495abe Try shortening the response 2019-12-27 01:11:59 -07:00
inventor96 7a1fc6d64a Corrected time reference 2019-12-27 01:01:19 -07:00
inventor96 a7e49b3766 Made delta reading more informative 2019-12-27 00:55:31 -07:00
inventor96 a4c0425d2b Added time reference 2019-12-27 00:21:45 -07:00
inventor96 0c9f819d74 Added support for asking delta 2019-12-27 00:06:02 -07:00
inventor96 c33aebbbd5 Migrated static intent titles to use translate() 2019-11-05 14:29:51 -07:00
inventor96 7770ff91b4 Improved logic to handle Alexa intents 2019-10-21 13:21:40 -07:00
inventor96 3cb3f47c50 Corrected how metric selection is found 2019-10-20 01:30:35 -07:00
inventor96 f74d6a8c95 Improved logging 2019-09-08 01:00:33 -06:00
inventor96 b3a47b36e0 Simplified route handling 2019-09-07 23:39:17 -06:00
inventor96 58162c2183 Updated googlehome plugin to mimic the alexa plugin 2019-09-07 19:30:35 -06:00
inventor96 51c8d2cdda Corrected missed translate() text 2019-09-07 18:39:55 -06:00
inventor96 efa35c4616 Renamed Alexa stuff to virtAsst for generic-ness 2019-09-07 17:51:31 -06:00
inventor96 a7bf320042 Minor code formatting improvements 2019-09-07 00:06:32 -06:00
PieterGitandSulka Haro 71103bb4b7 resolve npm audit security fixes (#3721)
* 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
2018-07-24 20:25:44 +03:00
Tanja Schmidt 1643b96fc2 alexa translations 2017-07-25 22:33:20 +02:00
Jason Calabrese d7eccc492d ignore some direction like None and Not Computable 2016-11-30 20:10:39 -08:00
dexterbootyandJason Calabrese dec0f5c535 Update index.js 2016-11-26 14:48:19 -08:00
dexterbootyandJason Calabrese d130301eeb Update index.js 2016-11-26 14:47:57 -08:00
Jason Calabrese dc1aaee68f check that alexa requests have readable permissions (with token support); bug fix 2016-11-12 14:02:58 -08:00
Jason Calabrese 9e57218e7e replace more fromNow's 2016-11-12 13:15:43 -08:00
Jason Calabrese f4919d76b0 fix some codacy warnings 2016-11-06 18:28:34 -08:00
Jason Calabrese a47d8e0cbf Alexa integration from some friends of Nightscout 2016-11-06 00:41:15 -07:00