diff --git a/docs/.vitepress/config.base.ts b/docs/.vitepress/config.base.ts index 2023b17..157d274 100644 --- a/docs/.vitepress/config.base.ts +++ b/docs/.vitepress/config.base.ts @@ -82,6 +82,7 @@ export default defineConfig({ collapsed: true, items: [ { text: 'Dashy', link: '/api/integrations/dashy' }, + { text: 'Glance', link: '/api/integrations/glance' }, { text: 'Home Assistant', link: '/api/integrations/homeassistant' }, { text: 'Homepage', link: '/api/integrations/homepage' }, ], diff --git a/docs/api/integrations/glance.md b/docs/api/integrations/glance.md new file mode 100644 index 0000000..5045a53 --- /dev/null +++ b/docs/api/integrations/glance.md @@ -0,0 +1,61 @@ +# Glance + +LibrisLog can be integrated into [Glance](https://github.com/glanceapp/glance), +a self-hosted dashboard for your services, using its +[custom API widget](https://github.com/glanceapp/glance/blob/main/docs/custom-api.md). + +This widget displays your reading statistics as styled stat cards directly on +your Glance dashboard. + +## Prerequisites + +- A running LibrisLog instance reachable from your Glance server +- An [API key](/api/integrations/#api-keys) with access to the + statistics endpoint + +## Configuration + +Add the following to your Glance `glance.yml` under the widget section: + +```yaml +widgets: + - type: custom-api + title: LibrisLog stats + cache: 1h + url: /api/books/stats + headers: + x-api-key: + Accept: application/json + template: | +
+
+
{{ .JSON.Int "books_read" | formatNumber }}
+
READ
+
+
+
{{ .JSON.Int "books_reading" | formatNumber }}
+
READING
+
+
+
{{ .JSON.Int "books_want_to_read" | formatNumber }}
+
WANT TO READ
+
+
+
{{ .JSON.Int "total_books" | formatNumber }}
+
TOTAL
+
+
+``` + +Replace the placeholders with your own values: + +| Placeholder | Example | Description | +|---|---|---| +| `` | `http://192.168.1.100:8000` | The base URL of your LibrisLog instance (http or https) | +| `` | `lk_nRHsF3jxIBDa9u....` | An API key with access to the statistics endpoint | + +## Result + +![Glance Widget (dark)](/screenshots/integrations-glance.png) + +![Glance Widget (light)](/screenshots/integrations-glance-light.png) diff --git a/docs/api/integrations/index.md b/docs/api/integrations/index.md index 7501750..38d592a 100644 --- a/docs/api/integrations/index.md +++ b/docs/api/integrations/index.md @@ -19,6 +19,9 @@ API key to use them. You can create one either: - [Dashy](/api/integrations/dashy) — Display your LibrisLog statistics as styled stat cards on a [Dashy](https://dashy.to/) dashboard using the HTML embedded widget. +- [Glance](/api/integrations/glance) — Display your LibrisLog statistics on a + [Glance](https://github.com/glanceapp/glance) dashboard using the custom API + widget. - [Home Assistant](/api/integrations/homeassistant) — Expose your LibrisLog reading statistics as sensors in [Home Assistant](https://www.home-assistant.io/) using the RESTful diff --git a/docs/public/screenshots/integrations-glance-light.png b/docs/public/screenshots/integrations-glance-light.png new file mode 100644 index 0000000..7fa2572 Binary files /dev/null and b/docs/public/screenshots/integrations-glance-light.png differ diff --git a/docs/public/screenshots/integrations-glance.png b/docs/public/screenshots/integrations-glance.png new file mode 100644 index 0000000..72403c5 Binary files /dev/null and b/docs/public/screenshots/integrations-glance.png differ