|
7 | 7 | [](https://goreportcard.com/report/github.com/b0bbywan/go-odio-api) |
8 | 8 | [](https://github.com/sponsors/b0bbywan) |
9 | 9 |
|
10 | | -> Part of the [odio](https://beta.odio.love/) project. |
| 10 | +> Part of the [odio](https://beta.odio.love/) project — [full documentation](https://docs.odio.love/api/). |
11 | 11 |
|
12 | 12 | Odio is an ultra-lightweight Go daemon that exposes a single clean REST API over your Linux user session's D-Bus: MPRIS players (Spotify, VLC, Firefox, MPD, Kodi), PulseAudio/PipeWire, systemd user services, and power management. No root. No hacks. Just Linux primitives. |
13 | 13 |
|
@@ -204,6 +204,24 @@ Bonus: You get to control it through `/pulseaudio/clients` or `/players/` and in |
204 | 204 |
|
205 | 205 | Remote reboot and power-off via the REST API — no SSH needed for day-to-day operations. Disabled by default. Uses `org.freedesktop.login1` D-Bus interface. |
206 | 206 |
|
| 207 | +On desktop systems with a graphical session, logind handles permissions automatically — no extra configuration needed. |
| 208 | + |
| 209 | +On **headless systems**, you need a polkit rule to allow your user to reboot/power-off via D-Bus. Create `/etc/polkit-1/rules.d/10-allow-shutdown.rules`: |
| 210 | + |
| 211 | +```javascript |
| 212 | +polkit.addRule(function(action, subject) { |
| 213 | + if ((action.id == "org.freedesktop.login1.power-off" || |
| 214 | + action.id == "org.freedesktop.login1.power-off-multiple-sessions" || |
| 215 | + action.id == "org.freedesktop.login1.reboot" || |
| 216 | + action.id == "org.freedesktop.login1.reboot-multiple-sessions") && |
| 217 | + subject.user == "<user>") { |
| 218 | + return polkit.Result.YES; |
| 219 | + } |
| 220 | +}); |
| 221 | +``` |
| 222 | + |
| 223 | +Replace `<user>` with the username running odio-api. |
| 224 | + |
207 | 225 | ### Real-time Event Stream (SSE) |
208 | 226 |
|
209 | 227 | `GET /events` streams live state changes to any HTTP client — no polling needed. |
@@ -471,6 +489,14 @@ power: |
471 | 489 | reboot: true |
472 | 490 | ``` |
473 | 491 |
|
| 492 | +#### PulseAudio |
| 493 | + |
| 494 | +```yaml |
| 495 | +pulseaudio: |
| 496 | + enabled: true |
| 497 | + serve_cookie: true # exposes GET /audio/cookie for network audio clients |
| 498 | +``` |
| 499 | + |
474 | 500 | #### Zeroconf / mDNS |
475 | 501 |
|
476 | 502 | ```yaml |
@@ -657,11 +683,7 @@ Systemd control is disabled by default and requires an explicit whitelist. Odio |
657 | 683 | - **Root forbidden by design** — Odio refuses to run as root. |
658 | 684 | - **No preconfigured units** — nothing managed unless explicitly listed. |
659 | 685 |
|
660 | | -- **MPRIS Backend**: Communicates with media players via D-Bus, implements smart caching and real-time updates through D-Bus signals |
661 | | -- **PulseAudio Backend**: Interacts with PulseAudio/PipeWire for audio control, supports real-time event monitoring |
662 | | -- **Systemd Backend**: Manages systemd services via D-Bus with native signal-based monitoring |
663 | 686 | **You must knowingly enable this at your own risk.** Odio is free software and comes with no warranty. |
664 | | -- **Bluetooth Backend**: Act as a Bluetooth audio receiver (A2DP sink) via D-Bus |
665 | 687 |
|
666 | 688 | ### REST API |
667 | 689 |
|
|
0 commit comments