summary |
shortlog | log |
commit |
commitdiff |
tree
first ⋅ prev ⋅ next
Florian Forster [Sun, 4 Feb 2018 08:26:05 +0000 (09:26 +0100)]
Litter the sleep code with debug log entries.
Florian Forster [Fri, 2 Feb 2018 07:49:46 +0000 (08:49 +0100)]
Package fitbit: Return errors instead of logging them.
We ensure that errors are not printed to the user, see
79cc9f9d92197e7286c166978401f99c679932c2
Florian Forster [Fri, 2 Feb 2018 07:48:07 +0000 (08:48 +0100)]
Packages app and gfit: Unify HTTP retries with retry.Transport.
All retrying logic in the gfit package is no longer needed and has been reverted.
Florian Forster [Fri, 2 Feb 2018 07:03:11 +0000 (08:03 +0100)]
sleepNotification(): Actually add converted sleep stages to the activities list.
Florian Forster [Thu, 1 Feb 2018 18:49:58 +0000 (19:49 +0100)]
Package fitbit: Merge the "Data" and "ShortData" sleep stages.
Florian Forster [Thu, 1 Feb 2018 09:18:01 +0000 (10:18 +0100)]
Package gfit: Change Activity.Type to be a string.
This simplifies producing nice debug messages.
Florian Forster [Thu, 1 Feb 2018 09:06:32 +0000 (10:06 +0100)]
Package gfit: Change handling of non-incremental data points.
Florian Forster [Thu, 1 Feb 2018 07:45:23 +0000 (08:45 +0100)]
Avoid taking a pointer of the loop variable.
By taking a pointer of the loop variable, subsequent goroutines will get
their subscription data changed because the loop is continuing.
Florian Forster [Thu, 1 Feb 2018 07:16:36 +0000 (08:16 +0100)]
Disable signature verification due to a problem on Fitbit's side.
Florian Forster [Thu, 1 Feb 2018 07:07:28 +0000 (08:07 +0100)]
Package fitbit: Log signatures on failure.
Also promote "signature mismatch" from warning to error.
Florian Forster [Thu, 1 Feb 2018 06:53:41 +0000 (07:53 +0100)]
Implement sleepNotification() to handle sleep notifications.
Florian Forster [Thu, 1 Feb 2018 06:36:45 +0000 (07:36 +0100)]
Package fitbit: Pass date as time.Time, remove location argument.
Florian Forster [Wed, 31 Jan 2018 15:44:31 +0000 (16:44 +0100)]
Package fitbit: Implement Sleep() to read sleep logs.
Florian Forster [Wed, 31 Jan 2018 15:33:09 +0000 (16:33 +0100)]
Package fitbit: Add documentation.
Florian Forster [Wed, 31 Jan 2018 14:55:40 +0000 (15:55 +0100)]
Package fitbit: Handle errors from ioutil.ReadAll() and fix warning message.
Florian Forster [Wed, 31 Jan 2018 09:53:31 +0000 (10:53 +0100)]
Package fitbit: Fix unsubscribing.
* Fix the expected JSON format. The example given in the documentation is
wrong.
* Add a collection argument to the ListSubscribers() call. Listing all
subscriptions (from all collections) requires all the scopes, which
we don't (want to) have.
* Add sanity checking to ListSubscribers().
Florian Forster [Wed, 31 Jan 2018 09:09:38 +0000 (10:09 +0100)]
fitbitDisconnectHandler(): Add call to c.DeleteToken().
Florian Forster [Wed, 31 Jan 2018 07:11:30 +0000 (08:11 +0100)]
Always print an error when reporting an "internal server error" to the user.
Also only print a reference ID to the user, not the error message.
Florian Forster [Wed, 31 Jan 2018 07:03:49 +0000 (08:03 +0100)]
Package app: Improve error message.
Florian Forster [Wed, 31 Jan 2018 07:02:40 +0000 (08:02 +0100)]
Package fitbit: Implement UnsubscribeAll() and ListSubscriptions().
Florian Forster [Wed, 31 Jan 2018 06:59:24 +0000 (07:59 +0100)]
Connect handlers: don't call {fitbit,gfit}.NewClient().
Those constructors try to load the OAuth token from datastore, which
doesn't exist yet when these handlers are called.
Florian Forster [Tue, 30 Jan 2018 21:08:08 +0000 (22:08 +0100)]
Package fitbit: Append the collection type to the subscriber ID.
Turns out, subscriber IDs must be unique, even for subscriptions to
multiple collections of the same user.
Florian Forster [Tue, 30 Jan 2018 19:45:32 +0000 (20:45 +0100)]
Log notification payloads to debug logs.
Florian Forster [Tue, 30 Jan 2018 19:42:25 +0000 (20:42 +0100)]
Replace CSRF token with tokens based on the user's ID.
Florian Forster [Tue, 30 Jan 2018 19:31:33 +0000 (20:31 +0100)]
Package app: Load the ID with the rest of the user data.
Florian Forster [Tue, 30 Jan 2018 09:13:25 +0000 (10:13 +0100)]
Disconnect handler: don't print success message after failure.
Florian Forster [Tue, 30 Jan 2018 09:12:09 +0000 (10:12 +0100)]
Package fitbit: Ignore 404 (Not Found) errors when unsubscribing.
Florian Forster [Tue, 30 Jan 2018 09:09:36 +0000 (10:09 +0100)]
Unsubscribe from Fitbit subscriptions individually.
Unsubscribing from the generic URL fails with insufficient OAuth scopes.
*sigh*
Florian Forster [Tue, 30 Jan 2018 08:59:33 +0000 (09:59 +0100)]
templates/main.html: Fix login link.
Florian Forster [Tue, 30 Jan 2018 08:58:13 +0000 (09:58 +0100)]
Add test that is parsing templates and complains about syntax errors.
Florian Forster [Tue, 30 Jan 2018 08:57:49 +0000 (09:57 +0100)]
templates/navbar.html: Fix template syntax.
Florian Forster [Tue, 30 Jan 2018 08:53:26 +0000 (09:53 +0100)]
templates/loggedin.html: s/endf/end/
Florian Forster [Tue, 30 Jan 2018 08:49:52 +0000 (09:49 +0100)]
Implement a /login handler.
Florian Forster [Tue, 30 Jan 2018 08:46:51 +0000 (09:46 +0100)]
Use html/template to generate HTML output.
This also removes the authentication requirement.
Florian Forster [Tue, 30 Jan 2018 08:44:35 +0000 (09:44 +0100)]
Implement Fitbit and Google Fit disconnect handlers.
These allow users to actively delete their tokens. This change also
includes:
* Rename the "setup" endpoints to "connect".
* Enforce authentication for the "connect" endpoints, even though they
don't really require it. It's better to handle authentication before
redirecting users to the OAuth screen.
Florian Forster [Tue, 30 Jan 2018 08:40:36 +0000 (09:40 +0100)]
Package gfit: Implement Client.DeleteToken().
Florian Forster [Tue, 30 Jan 2018 08:33:19 +0000 (09:33 +0100)]
Package fitbit: Implement Client.Unsubscribe() and Client.DeleteToken()
Florian Forster [Tue, 30 Jan 2018 08:32:48 +0000 (09:32 +0100)]
Package app: Implement User.DeleteToken() and User.String()
Florian Forster [Tue, 30 Jan 2018 08:32:06 +0000 (09:32 +0100)]
Import templates.
Florian Forster [Tue, 30 Jan 2018 06:48:35 +0000 (07:48 +0100)]
Add static assets.
Florian Forster [Mon, 29 Jan 2018 13:51:06 +0000 (14:51 +0100)]
Package gfit: Retry failing API calls.
To this end, wrap all API calls in utility functions (this was already
done for DataSource.Create and Dataset.Patch; Dataset.Get was added).
Use the "retry" package inside these functions to retry temporary
(HTTP 5xx) errors.
Florian Forster [Mon, 29 Jan 2018 11:44:51 +0000 (12:44 +0100)]
handleNotification(): Fix format string.
Florian Forster [Mon, 29 Jan 2018 10:54:22 +0000 (11:54 +0100)]
Add warning message on Fitbit signature mismatch.
Florian Forster [Mon, 29 Jan 2018 10:54:02 +0000 (11:54 +0100)]
Packages fitbit and gfit: Initialize oauth2.Config at runtime.
Florian Forster [Mon, 29 Jan 2018 09:53:30 +0000 (10:53 +0100)]
Don't use context.Background().
AppEngine panics when you use a non-AppEngine context. Instead, we need
to load the config at request time.
Florian Forster [Mon, 29 Jan 2018 09:27:16 +0000 (10:27 +0100)]
Read runtime configuration from datastore.
Florian Forster [Sun, 28 Jan 2018 20:03:25 +0000 (21:03 +0100)]
Rename the "gfitsync" package to "kraftakt".
Florian Forster [Sun, 28 Jan 2018 19:58:33 +0000 (20:58 +0100)]
Package gfit: Unify debug messages for easier reading.
Florian Forster [Sun, 28 Jan 2018 19:57:57 +0000 (20:57 +0100)]
Package gfit: Create the "activity segment" data source.
Florian Forster [Sun, 28 Jan 2018 19:56:59 +0000 (20:56 +0100)]
Package gfit: Improve Create error message.
Florian Forster [Sun, 28 Jan 2018 19:56:28 +0000 (20:56 +0100)]
Warn about unexpected notification types.
Florian Forster [Sun, 28 Jan 2018 19:54:45 +0000 (20:54 +0100)]
Fix parsing of activity times.
Florian Forster [Sun, 28 Jan 2018 19:54:14 +0000 (20:54 +0100)]
Unify subscription calls.
Florian Forster [Fri, 26 Jan 2018 20:43:27 +0000 (21:43 +0100)]
Package fitbit: Don't treat Conflict (409) as an error.
Florian Forster [Thu, 25 Jan 2018 19:46:42 +0000 (20:46 +0100)]
Also subscribe to the "sleep" Fitbit collection.
Florian Forster [Wed, 24 Jan 2018 19:51:09 +0000 (20:51 +0100)]
Package gfit: Return immediately when no activities are set.
Florian Forster [Wed, 24 Jan 2018 19:50:26 +0000 (20:50 +0100)]
Defer wg.Done().
Florian Forster [Wed, 24 Jan 2018 19:42:07 +0000 (20:42 +0100)]
Package gfit: Add debug output to SetActivities().
Florian Forster [Wed, 24 Jan 2018 19:35:18 +0000 (20:35 +0100)]
Implement exporting of activities.
Florian Forster [Wed, 24 Jan 2018 19:32:36 +0000 (20:32 +0100)]
Package gfit: Implement SetActivities().
Florian Forster [Wed, 24 Jan 2018 19:31:02 +0000 (20:31 +0100)]
Package fitbit: Add the ActivityParentName, LastModified, StartDate fields.
Florian Forster [Mon, 22 Jan 2018 21:12:48 +0000 (22:12 +0100)]
Package gfit: Check return value of readCumulative() for errors.
Florian Forster [Mon, 22 Jan 2018 21:11:13 +0000 (22:11 +0100)]
Package gfit: Include the DataStreamName in the DataStreadID.
Florian Forster [Mon, 22 Jan 2018 21:10:28 +0000 (22:10 +0100)]
Call ActivitySummary() and Profile() concurrently.
Florian Forster [Mon, 22 Jan 2018 19:41:06 +0000 (20:41 +0100)]
Return errs only if it contains at least one error.
Florian Forster [Mon, 22 Jan 2018 08:04:48 +0000 (09:04 +0100)]
Package fitbit: ActivitySummery(): Log full response.
Florian Forster [Mon, 22 Jan 2018 08:01:19 +0000 (09:01 +0100)]
Package app: Check all fields of the OAuth token for equality.
It appears that refresh tokens don't always change. Check the AccessToken
field, too, and the rest of the struct for completeness sake.
Florian Forster [Mon, 22 Jan 2018 07:37:22 +0000 (08:37 +0100)]
Write Google Fit entries concurrently.
Florian Forster [Mon, 22 Jan 2018 07:34:51 +0000 (08:34 +0100)]
Package app: Add mutex to persistingTokenSource.
Florian Forster [Tue, 16 Jan 2018 21:37:42 +0000 (22:37 +0100)]
Implement distance conversion.
Florian Forster [Tue, 16 Jan 2018 21:37:01 +0000 (22:37 +0100)]
Fixup: Pass RestingHeartRate to SetHeartRate().
Florian Forster [Tue, 16 Jan 2018 21:35:29 +0000 (22:35 +0100)]
Package gfit: Calculate "average" heart rate.
JSON does not support NaN data points.
Florian Forster [Tue, 16 Jan 2018 19:24:49 +0000 (20:24 +0100)]
Package fitbit: Don't URL-decode Fitbit's signature.
The documentation states that that should be done, but then the signature
may include "+", which URL decode turns into a space …
Florian Forster [Tue, 16 Jan 2018 16:14:58 +0000 (17:14 +0100)]
Implement mapping of heart rate zones.
Florian Forster [Tue, 16 Jan 2018 16:11:39 +0000 (17:11 +0100)]
Rebrand as "Kraftakt".
Florian Forster [Mon, 15 Jan 2018 09:02:19 +0000 (10:02 +0100)]
Refactor writing of step values via the generic methods.
Florian Forster [Mon, 15 Jan 2018 08:55:42 +0000 (09:55 +0100)]
Implement storing of calories expended.
Florian Forster [Sat, 13 Jan 2018 21:35:12 +0000 (22:35 +0100)]
Package gfit: Steps: Calculate diff to previously stored data point.
Google Fit will happily store multiple data points with the exact same
dataSourceID and start and end times. The web frontend then seems to
discard duplicate entries.
This commit reads existing data points and then calculates the
difference to the existing entries.
Florian Forster [Fri, 12 Jan 2018 12:57:54 +0000 (13:57 +0100)]
Package fitbit: Implement the Profile() method.
Florian Forster [Fri, 12 Jan 2018 09:53:45 +0000 (10:53 +0100)]
Package gfit: API fixes.
* Add calculation of DataStreamID().
* Don't treat http.StatusConflict as an error when creating DataSources.
Florian Forster [Thu, 11 Jan 2018 20:45:43 +0000 (21:45 +0100)]
Write step count summary to Google Fit.
Florian Forster [Thu, 11 Jan 2018 12:19:56 +0000 (13:19 +0100)]
Package gfit: Implement initial client code for Google Fit.
Florian Forster [Thu, 11 Jan 2018 11:56:30 +0000 (12:56 +0100)]
Package app: Wrap oauth2.TokenSource to ensure datastore is always updated.
Florian Forster [Thu, 11 Jan 2018 07:39:16 +0000 (08:39 +0100)]
Package fitbit: Update RefreshToken in Datastore after refreshing OAuth token.
Florian Forster [Wed, 10 Jan 2018 21:06:55 +0000 (22:06 +0100)]
Package fitbit: Fix activity summary URL.
Florian Forster [Wed, 10 Jan 2018 21:03:15 +0000 (22:03 +0100)]
Small cleanup.
Florian Forster [Wed, 10 Jan 2018 21:02:50 +0000 (22:02 +0100)]
Package app: Add email address to User object.
Florian Forster [Wed, 10 Jan 2018 20:48:25 +0000 (21:48 +0100)]
Move more logic into the "fitbit" and (new) "app" packages.
Florian Forster [Wed, 10 Jan 2018 19:15:43 +0000 (20:15 +0100)]
More trial-and-error fixes.
* datastore.Key.Encode is too long for a subscriber ID, which appears
limited to 50 characters / bytes.
* Use UUID as subscriber ID.
* Rename fitbitNotification to fitbitSubscription.
* Implement parsing of the "activity summary" in a separate package.
Florian Forster [Wed, 10 Jan 2018 13:53:14 +0000 (14:53 +0100)]
Improve user visible status.
Florian Forster [Wed, 10 Jan 2018 13:52:33 +0000 (14:52 +0100)]
Check status code when calling the subscription API.
Florian Forster [Wed, 10 Jan 2018 13:52:15 +0000 (14:52 +0100)]
Remove query string when redirecting user.
Florian Forster [Wed, 10 Jan 2018 10:33:54 +0000 (11:33 +0100)]
Initial commit.