From aacf5a7195281976276e6ece640615c4fe5667b4 Mon Sep 17 00:00:00 2001 From: Evan Reichard Date: Mon, 30 Oct 2023 19:23:38 -0400 Subject: [PATCH] [fix] login PWA styling, [add] login local link, [add] home local link --- README.md | 12 ++++++++- api/api.go | 4 +-- api/app-routes.go | 4 +-- assets/{offline => local}/index.html | 6 ++--- assets/{offline => local}/index.js | 4 +-- assets/reader/index.js | 2 +- assets/style.css | 4 +++ assets/sw.js | 10 +++---- tailwind.config.js | 2 +- templates/base.html | 18 +++++++++++++ templates/login.html | 39 +++++++++++++++++++++++++--- 11 files changed, 84 insertions(+), 21 deletions(-) rename assets/{offline => local}/index.html (99%) rename assets/{offline => local}/index.js (98%) diff --git a/README.md b/README.md index 891a476..00d333d 100644 --- a/README.md +++ b/README.md @@ -44,12 +44,22 @@ In additional to the compatible KOSync API's, we add: - Book metadata scraping (Thanks [OpenLibrary](https://openlibrary.org/) & [Google Books API](https://developers.google.com/books/docs/v1/getting_started)) - Limited JavaScript use. Server-Side Rendering is used wherever possible. The main app is fully operational without any JS. JS is only required for: - EPUB Reader - - Offline Mode / Service Worker + - Local / Offline Mode + - Service Worker # Server Docker Image: `docker pull gitea.va.reichard.io/evan/bookmanager:latest` +## Local / Offline Reader + +The Local / Offline reader allows you to use any BookManager server as a standalone offline accessible reading app! Some features: + +- Add local EPUB documents +- Read both local and any cached server documents +- Maintains progress for all types of documents (server / local) +- Uploads any progress or activity for cached server documents once the internet is accessible + ## KOSync API The KOSync compatible API endpoint is located at: `http(s):///api/ko` diff --git a/api/api.go b/api/api.go index 73e6471..9b6a562 100644 --- a/api/api.go +++ b/api/api.go @@ -93,8 +93,8 @@ func (api *API) registerWebAppRoutes() { api.Router.GET("/manifest.json", api.webManifest) api.Router.GET("/sw.js", api.serviceWorker) - // Offline Static Pages (No Template) - api.Router.GET("/offline", api.offlineDocuments) + // Local / Offline Static Pages (No Template) + api.Router.GET("/local", api.localDocuments) api.Router.GET("/reader", api.documentReader) // Template App diff --git a/api/app-routes.go b/api/app-routes.go index 8de023f..7ff4bca 100644 --- a/api/app-routes.go +++ b/api/app-routes.go @@ -76,8 +76,8 @@ func (api *API) serviceWorker(c *gin.Context) { c.File("./assets/sw.js") } -func (api *API) offlineDocuments(c *gin.Context) { - c.File("./assets/offline/index.html") +func (api *API) localDocuments(c *gin.Context) { + c.File("./assets/local/index.html") } func (api *API) documentReader(c *gin.Context) { diff --git a/assets/offline/index.html b/assets/local/index.html similarity index 99% rename from assets/offline/index.html rename to assets/local/index.html index 9cb1424..474fe00 100644 --- a/assets/offline/index.html +++ b/assets/local/index.html @@ -22,7 +22,7 @@ media="(prefers-color-scheme: dark)" /> - Book Manager - Offline + Book Manager - Local @@ -32,7 +32,7 @@ - +
@@ -113,9 +141,8 @@ {{end}} - {{ if .RegistrationEnabled }}
- {{ if .Register }} + {{ if .RegistrationEnabled }} {{ if .Register }}

Trying to login? @@ -129,9 +156,13 @@ Register here.

- {{end}} + {{end}} {{ end }} +

+ + Offline / Local Mode + +

- {{ end }}