From 6cf4a11283481ea402361931e6af5c2d558b3e55 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Thu, 18 Jan 2018 23:37:43 -0800 Subject: [PATCH] more work on offline capabilities --- package-lock.json | 5 ++ package.json | 1 + routes/_components/LazyTimeline.html | 2 +- routes/_components/Timeline.html | 21 +++---- routes/_static/timelines.js | 7 +++ routes/_utils/asyncModules.js | 7 +-- routes/_utils/database/keyval.js | 2 + routes/_utils/database/statuses.js | 56 ++++++++++++------- routes/_utils/mastodon/timelines.js | 9 ++- routes/_utils/offlineNotification.js | 4 ++ routes/_utils/serviceWorkerClient.js | 22 ++++++++ routes/federated.html | 21 +++++-- routes/index.html | 2 +- routes/local.html | 21 +++++-- routes/notifications.html | 9 ++- routes/settings/instances/[instanceName].html | 4 +- routes/settings/instances/add.html | 4 +- templates/2xx.html | 6 -- templates/main.js | 18 ++---- 19 files changed, 147 insertions(+), 74 deletions(-) create mode 100644 routes/_static/timelines.js create mode 100644 routes/_utils/database/keyval.js create mode 100644 routes/_utils/serviceWorkerClient.js diff --git a/package-lock.json b/package-lock.json index c0863a5f..c787faf9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3282,6 +3282,11 @@ } } }, + "idb-keyval": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/idb-keyval/-/idb-keyval-2.3.0.tgz", + "integrity": "sha1-TURLgMP4b8vNUTIbTcvJJHxZSMA=" + }, "ieee754": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.8.tgz", diff --git a/package.json b/package.json index bab23e21..8e7414fb 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "fg-loadcss": "^2.0.1", "font-awesome-svg-png": "^1.2.2", "glob": "^7.1.2", + "idb-keyval": "^2.3.0", "indexeddb-getall-shim": "^1.3.1", "intersection-observer": "^0.5.0", "intl-relativeformat": "^2.1.0", diff --git a/routes/_components/LazyTimeline.html b/routes/_components/LazyTimeline.html index 135690a3..59c5a111 100644 --- a/routes/_components/LazyTimeline.html +++ b/routes/_components/LazyTimeline.html @@ -7,7 +7,7 @@ {{/if}} {{then constructor}} -<:Component {constructor} :target /> +<:Component {constructor} :timeline /> {{catch error}}
Component failed to load. Please try refreshing! {{error}}
{{/await}} diff --git a/routes/_components/Timeline.html b/routes/_components/Timeline.html index 727afe4d..6b26fa3a 100644 --- a/routes/_components/Timeline.html +++ b/routes/_components/Timeline.html @@ -11,16 +11,18 @@ \ No newline at end of file diff --git a/routes/index.html b/routes/index.html index d7d9c297..95a1a412 100644 --- a/routes/index.html +++ b/routes/index.html @@ -4,7 +4,7 @@ {{#if $isUserLoggedIn}} - + {{else}} {{/if}} diff --git a/routes/local.html b/routes/local.html index de3408b0..2adcf307 100644 --- a/routes/local.html +++ b/routes/local.html @@ -3,16 +3,29 @@ -

Local

+ {{#if $isUserLoggedIn}} + + {{else}} + +

Local

+

Your local timeline will appear here when logged in.

+
+ {{/if}}
\ No newline at end of file diff --git a/routes/notifications.html b/routes/notifications.html index 8a9aef22..6a621e60 100644 --- a/routes/notifications.html +++ b/routes/notifications.html @@ -3,16 +3,21 @@ -

Notifications

+ +

Notifications

+

Your notifications will appear here when logged in.

+
\ No newline at end of file diff --git a/routes/settings/instances/[instanceName].html b/routes/settings/instances/[instanceName].html index 39ceeb1c..35515e08 100644 --- a/routes/settings/instances/[instanceName].html +++ b/routes/settings/instances/[instanceName].html @@ -16,7 +16,7 @@ {{instanceUserAccount.display_name}}

Theme:

-
+ {{#each themes as theme}}
- + {{#if $loggedInInstancesInOrder.length > 1}} diff --git a/templates/2xx.html b/templates/2xx.html index 59a29f1a..a62e46da 100644 --- a/templates/2xx.html +++ b/templates/2xx.html @@ -8,12 +8,6 @@ - -