Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/.vitepress/config.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
],
Expand Down
61 changes: 61 additions & 0 deletions docs/api/integrations/glance.md
Original file line number Diff line number Diff line change
@@ -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: <LIBRISLOG-URL>/api/books/stats
headers:
x-api-key: <API-KEY>
Accept: application/json
template: |
<div class="flex justify-between text-center">
<div>
<div class="color-highlight size-h3">{{ .JSON.Int "books_read" | formatNumber }}</div>
<div class="size-h6">READ</div>
</div>
<div>
<div class="color-highlight size-h3">{{ .JSON.Int "books_reading" | formatNumber }}</div>
<div class="size-h6">READING</div>
</div>
<div>
<div class="color-highlight size-h3">{{ .JSON.Int "books_want_to_read" | formatNumber }}</div>
<div class="size-h6">WANT TO READ</div>
</div>
<div>
<div class="color-highlight size-h3">{{ .JSON.Int "total_books" | formatNumber }}</div>
<div class="size-h6">TOTAL</div>
</div>
</div>
```

Replace the placeholders with your own values:

| Placeholder | Example | Description |
|---|---|---|
| `<LIBRISLOG-URL>` | `http://192.168.1.100:8000` | The base URL of your LibrisLog instance (http or https) |
| `<API-KEY>` | `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)
3 changes: 3 additions & 0 deletions docs/api/integrations/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/screenshots/integrations-glance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.