Commit Graph
100 Commits
Author SHA1 Message Date
Ben West fd1656f24d housekeeping: make AGPL (affero gpl v3) everywhere
Some basic house keeping, apply a single license consistently
everywhere, as well as actually include a license file.

I got this from:
* http://www.gnu.org/licenses/agpl-3.0.txt
* http://choosealicense.com/licenses/agpl-3.0/
2014-09-25 11:01:47 -07:00
Ben West 1728cdd41c Merge pull request #168 from nightscout/release/v0.4.1
Release/v0.4.1
2014-09-14 14:58:13 -07:00
Ben West 824a12dd23 0.4.1 2014-09-12 22:19:23 -07:00
Ben West 4eae016b39 Release notes for v0.4.1 2014-09-12 22:19:23 -07:00
Ben West 8e7732ece4 quick hack to prevent mbg records from crashing pebble
Process would crash because mbg records would error when formatting
sgv to string.
2014-09-12 22:14:52 -07:00
Ben West aafe285d09 add script to prep release branch 2014-09-12 20:34:57 -07:00
Ben West 492ea9d79a tweak toolbar and button size/placement 2014-09-12 20:26:34 -07:00
Ben West b82a06e61a Merge pull request #128 from nightscout/wip/mbg
Added searching for MBG data from mongo query.
2014-09-12 17:49:04 -07:00
Ben West 1008149653 Merge pull request #166 from nightscout/wip/id-rev
Wip/id rev
2014-09-12 17:48:07 -07:00
Ben West 179f310175 Merge pull request #165 from nightscout/hotfix/pebble-sgv-string
Hotfix/pebble sgv string
2014-09-12 17:47:46 -07:00
Ben West c8cccae5e0 convert sgv to string
On my new pebble with the installed app, the SGV value does not show
up unless it is a string type in the json.
2014-09-11 14:38:22 -07:00
Ben West 46469cd96b add ability to easily id git rev-parse HEAD 2014-09-11 14:12:27 -07:00
Ben West 6555e75126 hack: only consider 'grey' sgv records
Quick hack to force predictor to only use actual sgv records.
2014-09-03 01:27:19 -07:00
Ben West 0a83288a85 v0.3.3 2014-07-31 11:54:47 -07:00
Ben West 868e134c52 force predictor to fade out a bit more 2014-07-31 11:20:45 -07:00
Ben West 3c00a9d5fd Merge branch 'master' into develop 2014-07-30 14:30:45 -07:00
Ben West 5b2fcdc756 tweak travis config yaml
Use string syntax to select node "0.10" instead 0.1.
2014-07-30 14:30:34 -07:00
Ben West 4fc281526f Merge branch 'develop' of github.com:nightscout/cgm-remote-monitor into develop 2014-07-30 14:11:21 -07:00
Ben West 169599612d tweak travis config yaml
Use string syntax to select node "0.10" instead 0.1.
2014-07-30 14:10:40 -07:00
Ben West bdaa78d1c6 add fade out effect to predictions
As time from last known, increases, the confidence aka opacity, decreases.  By
11 minutes, the prediction starts to aggresively deviate towards means in ways
that are not believable, as Adrien de Croy points out.  This makes the
prediction start to fade out by 12 minutes in.  By 30 minutes out, the
prediction is invisible, and requires straining to see after 15 minutes.
2014-07-29 23:34:29 -07:00
Ben West 0fd43bce1e Merge pull request #51 from nightscout/rebase/settings
Add Settings
2014-07-29 02:22:10 -07:00
Ben WestandJason Calabrese 8e56ef1752 migrate to API-SECRET header
@jasoncalabrese pointed out that some agents do odd things with
underscores and that using a hyphen is more common.
This also adds tests to ensure that the API_SECRET handling works as
expected.
2014-07-28 22:46:14 -07:00
Ben West f51b6c3a8b hack to allow DISPLAY_UNITS actually change default
This allows setting DISPLAY_UNITS=mmol in the environment to make
mmols the default view from the server.
2014-07-27 15:36:50 -07:00
Ben West ff84000773 migrate to API-SECRET header
@jasoncalabrese pointed out that some agents do odd things with
underscores and that using a hyphen is more common.
This also adds tests to ensure that the API_SECRET handling works as
expected.
2014-07-27 15:12:40 -07:00
Ben West c7def83762 Merge branch 'fix/deploy' into wip/clock/init 2014-07-27 13:36:55 -07:00
Ben West 5127fda6c2 azure: try fresh deploy.sh
Try regenerating a new default deploy.sh using:
    azure site deploymentscript --node

The old one caused problems because I re-ordered
things without understanding what Kudu was doing,
fully.  The bower install is now part of the npm
install process, which means this shoudn't really
be necessary.
2014-07-26 19:10:52 -07:00
Ben West aac2dcf886 strike out when data is old 2014-07-26 14:56:24 -07:00
Ben West 9b79e75e48 clock mode with @brandonarbiter 2014-07-25 22:21:59 -07:00
Ben West 629e8cb712 nix spurious console.log 2014-07-25 21:47:16 -07:00
Ben West a5ad4a90e6 cleanup/comment settings api 2014-07-25 21:46:40 -07:00
Ben West b6cd9b5608 tweak settings a bit to be more like profiles 2014-07-25 21:17:25 -07:00
Ben West c83981410e add type=text/css to link elements 2014-07-25 02:12:07 -07:00
Ben West b7ef943572 Merge remote-tracking branch 'origin/master' into rebase/settings
Conflicts:
	static/index.html
2014-07-25 02:11:45 -07:00
Ben West e85b70756e Merge branch 'rebase/settings' of github.com:nightscout/cgm-remote-monitor into rebase/settings 2014-07-25 01:16:31 -07:00
Ben West 1e2cb5d0d5 add jsSHA via bower 2014-07-25 01:16:08 -07:00
Ben West 868dad15d6 Merge branch 'rebase/settings' of github.com:nightscout/cgm-remote-monitor into rebase/settings 2014-07-25 01:07:21 -07:00
Ben West 69d7b4405a tweak comment 2014-07-25 01:07:12 -07:00
Ben West 50d14d9396 api/status: include default units and apiEnabled
Responses look like:
```bash
curl localhost:1337/api/v1/status.json | json
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    87  100    87    0     0  48739      0 --:--:-- --:--:-- --:--:-- 87000
{
  "status": "ok",
  "apiEnabled": true,
  "units": "mg/dl",
  "version": "0.3.0",
  "name": "Nightscout"
}
```
2014-07-25 00:59:31 -07:00
Ben West a2d592734d put version of npm package on the screen 2014-07-22 19:14:48 -07:00
Ben West cf5398a53d Merge branch 'rebase/settings' of github.com:nightscout/cgm-remote-monitor into rebase/settings 2014-07-22 18:49:27 -07:00
Ben West dac829a8a1 Fix bug in paths handling
Believe this will work just like @jasoncalabrese's project-glu now.
2014-07-22 18:48:28 -07:00
Ben West 7a1a83d235 Add version info to rest API
The version and app info is reported in the status endpoint now.
Also, this "phrasing" seems to fix a small bug in the path routing.
2014-07-22 18:46:26 -07:00
Ben West c857a6accf add some basic metadata about the software to env
Export useful information about software's version and name in the environment
object created by the `env` module.
2014-07-22 18:42:53 -07:00
Ben West 9c99b40663 bump package version 2014-07-22 18:16:02 -07:00
Ben West 2126380172 Merge pull request #42 from nightscout/wip/api-modules
Wip/api modules
2014-07-22 17:35:37 -07:00
Ben West 999910498d try to debug travis testg 2014-07-20 17:08:04 -07:00
Ben West b04ed1d0e6 hacky fix of js errors in test 2014-07-20 17:02:36 -07:00
Ben West 7a1996dc2a add tests for how API_SECRET affects the process 2014-07-20 16:55:40 -07:00
Ben West b8193bb816 throw err instead of process.exit
Also some minor clean up of log output during tests.
2014-07-20 16:55:00 -07:00
Ben West ce8abe5e05 require API_SECRET to be at least 12 characters
This changes causes the server to crash if the API_SECRET environment
variable has a value whose length is less than MIN_PASSPHRASE_LENGTH
characters.
The default MIN_PASSPHRASE_LENGTH is 12, so if the API_SECRET variable
is set but less than 12 characters long, the server will crash.

security/privacy review needed
==============================
The API_SECRET is used as a pass phrase in order to generate a unique
token.

The api routes always try to mount themselves.  Before mounting
sensitive routes that allow modifying the application, the secret
token is required to validate the request, or denied.

When the secret token is absent, the sensitive routes should return
404, and should not be mounted.

This change attempts to eliminate some dangerous middle ground between
having a secured api, having a weakly secured api, believing a secure
api is mounted and working when none is, and not having a secure api
mounted.

The only choices available should be:

* secure api mounted
* secure api not mounted

This change hopefully constrains the possibilities to those two
options.
2014-07-20 14:23:45 -07:00
Ben West 09bdb8f063 Merge branch 'wip/api-modules' of github.com:nightscout/cgm-remote-monitor into bewest/api/create-entries 2014-07-19 20:30:04 -07:00
Ben West 174647a594 add some tests for the API 2014-07-19 20:28:53 -07:00
Ben West 122bdb640a cleanup, use strict everywhere 2014-07-18 12:14:40 -07:00
Ben West 873345da7e let test run 2014-07-18 11:19:15 -07:00
Ben West 65a1aceba2 remove api.js in favor of api/ module 2014-07-18 03:28:01 -07:00
Ben West 80ea7c6e9f move all rest components to separate modules 2014-07-18 03:21:31 -07:00
Ben West 93cc66dde1 remove bit of dead code 2014-07-18 03:00:31 -07:00
Ben West c3eca8efd7 move experiments and settings to own modules
Also remove notion of common configured middleware.
2014-07-18 02:42:50 -07:00
Ben West 8b7c088fa6 remove dead code 2014-07-18 02:19:16 -07:00
Ben West 753496c4fc preparing to seperate settings and experiments 2014-07-18 02:18:08 -07:00
Ben West e7b68cca33 quick clean up 2014-07-18 01:56:23 -07:00
Ben West c488682cda move entries api to separate module
Make as few adjustments as needed to get entries api into it's own module.
2014-07-18 01:29:41 -07:00
Ben West 3d5e4377d5 make some breathing room for separate entries 2014-07-17 20:30:40 -07:00
Ben West 4745927cf0 prepping for another re-org
Small hack in order to start separating things out a bit more.
2014-07-17 20:16:37 -07:00
Ben West 3af4dc54b0 quick renaming for clarification
This avoids re-using the same variable name in different contexts.
2014-07-17 14:24:46 -07:00
Ben West 5db7c2cfa1 introduce express.Router( ), small renaming
Rename a few things here and there to help clarify the situation.

This change introduces use of express.Router( ), which provides the routing
functions of express without the full app.
This also shows an experiment observing the interaction betwen express( ) and
express.Router( ).
There are a few reasons for doing this:

Using express.Router( ) allows introspecting existing routes.
As a REST application, our content payloads should include URLs, links to other
resources available from our API.  As a bonus feature, it's often nice for a
meta page to describe the links, status, and version available from this
particular API.  By far, the easiest way to implement this is to introspect the
existing routes.

Separating the code makes testing easier.
This lays the ground work for breaking apart the code into smaller, more
testable modules.
2014-07-17 14:18:36 -07:00
Ben West 07a14385f9 Merge pull request #40 from nightscout/bewest/api/create-entries
Bewest/api/create entries
2014-07-15 21:32:38 -07:00
Ben West 9cddb11bea don't forget to expose persist 2014-07-15 16:43:27 -07:00
Ben West 58c276a697 make deploy executable 2014-07-15 16:04:43 -07:00
Ben West b1ecbe3c91 introduce sgvdata, use it in api and storage
Clean up and comment a bunch of code.
2014-07-15 15:10:49 -07:00
Ben West b35853bcaa s/svg/sgv/g - serum glucose value typo 2014-07-14 17:08:19 -07:00
Ben West 8485027c93 quick tweak, remove dead code, return value
The api function now returns something useful in addition to doing a little bit
of work.
It used to do a little bit of work, now it returns the result.
2014-07-14 02:38:56 -07:00
Ben West 54802c6fd3 very basic insertion of records 2014-07-13 21:13:34 -07:00
Ben West 8300fa0d0a some very simple helper scripts to work with the api 2014-07-13 20:46:54 -07:00
Ben West e11a6b3162 Merge branch 'feature/base-api' of github.com:nightscout/cgm-remote-monitor into feature/base-api 2014-07-13 12:00:51 -07:00
Ben West 3be898cff5 experiment with content-negotiation 2014-07-13 12:00:32 -07:00
Ben West 203ec9217f remove unused mongo require 2014-07-13 01:48:44 -07:00
Ben West bcab3d4f2f remove "store" from api dependencies
The entries and settings modules are used directly.
2014-07-13 01:44:56 -07:00
Ben West c2ffe60039 websocket uses entries
Actually record the change to use entries in websockets.
2014-07-13 01:44:24 -07:00
Ben West bb4fa2b18c re-use entries in websocket
Address some of @jason.calabrese's feedback.
2014-07-13 01:29:46 -07:00
Ben West 3b617e31bb use entries backend storage for pebble data
Code re-use is nice.
2014-07-13 01:17:20 -07:00
Ben West eee39b8a7e tweak cleanup 2014-07-12 21:44:20 -07:00
Ben West b22dfe2556 remove logging 2014-07-12 21:33:44 -07:00
Ben West 95c8168755 use slightly more configurable query interface 2014-07-12 21:32:48 -07:00
Ben West 746e04f5e7 remove logging 2014-07-12 21:04:13 -07:00
Ben West edb62abfec save/update settings correctly 2014-07-12 21:03:08 -07:00
Ben West 6f2d274ed9 clean up server, move requireSSL to middleware
Some simple clean up, hopefully tightening up server.js.
2014-07-12 20:37:15 -07:00
Ben West 5bb4aa7378 WIP: more refactoring
Work a little bit with storing settings.
2014-07-12 20:32:40 -07:00
Ben West 15b62d9c88 clean up api a bit 2014-07-12 18:31:11 -07:00
Ben West 44e63407d0 use shared db connection/store everywhere 2014-07-12 18:26:37 -07:00
Ben West fc2ac3f91f use store in server.js 2014-07-12 17:08:11 -07:00
Ben West f0e19c07dd WIP: record progress, re-using mongo connections
This allows websocket and api and everything else to share the same mongo
connection.
2014-07-12 17:06:03 -07:00
Ben West 26a0eac69c make pebble use less data 2014-07-11 19:08:32 -07:00
Ben West 4ae5716eac Use env module to point to static files
Also, the NIGHTSCOUT_STATIC_FILES environment variable can be used to point to
an arbitrary location of files to serve.
By default, it uses the `static` directory included in the package.

Also try to encourage trimming columns to <80.
2014-07-11 13:29:42 -07:00
Ben West 01bb477337 use env module everywhere
Remove the global environment variables holding configuration.
Instead, this allows the server to consistently refer to the same
configuration everywhere.
2014-07-11 13:09:39 -07:00
Ben West 54bad62b5e env variables, simple shared secret, demo auth
This sets up two additional API endpoints explicitly used for testing.
Also, constrain all parsing of environment variables to a single
location.

This change also creates no API at all unless there is an API secret
defined.

Also the API_SECRET is really just a shared key private key, we
actually use the sha1 sum digest of the key.
2014-07-05 18:33:41 -07:00
Ben West 233f1befe9 Merge pull request #26 from brianhanifin/express-cache
Express migration + website caching - merge fantastic work from @brianhanifin
2014-07-01 16:37:02 -07:00
Ben West be57b35094 get sign in bg delta correct 2014-06-30 18:25:09 -07:00
Ben West ae83e210d3 actually show bgdelta
The first bgdelta was always 0, which is incorrect.
This allows the first item to have a delta.
2014-06-30 18:19:25 -07:00
Ben West 514718fcee manually bust cache
A number of people using recent sources experimenting with
caches will need to bust the cache at least once.  While we have
correct caching implemented now, the previous caching
implementation requires one busting in order to clear things
through.
2014-06-30 14:34:48 -07:00