feat: add live Discord sharing functionality with dynamic habit progress images
- Implemented live card image generation for user habits using canvas. - Created API endpoints for starting and managing live Discord sharing sessions. - Added tests for live Discord sharing to ensure functionality and reliability. - Introduced CSS styles for the live Discord sharing interface. - Enhanced error handling and state management for Discord message updates.
This commit is contained in:
@@ -405,3 +405,11 @@ The disposable `SHARE_PREVIEW=1 bun scripts/dashboard-preview.ts` mode also runs
|
||||
reminder worker against a local transport stub. Set a reminder to `14:00` (its fixed
|
||||
Europe/Belgrade time), leave a habit unfinished, and inspect delivery status in
|
||||
settings or `/__preview/reminder`. No real Discord messages are sent in this mode.
|
||||
|
||||
### Live Discord image
|
||||
|
||||
Open **Share progress → Live image · 16:9** to preview/download a 1920×1080 PNG with every active habit and a rolling 30-day history. **Share live image** posts the attachment through the configured bot; later changes replace the attachment on that same Discord message after a two-second trailing debounce. There is no public live link. Display name, habit names, and progress are shared; task details remain private. Newly created active habits are included automatically.
|
||||
|
||||
Rendering and updates run on the server even when the dashboard is closed. Identical card content skips Discord edits. Message IDs, themes, and retry state persist in SQLite; known messages resume after restart. Rate-limited edits honor Discord's retry delay. When an update confirms the old message was deleted, the bot posts a replacement and saves its new message ID. Missing channels or permissions do not trigger replacement posts. An unconfirmed initial or replacement post is never automatically repeated. **Stop updates** leaves the last image in Discord; **Resume updates** edits the original message again.
|
||||
|
||||
Development uses `bun --watch` so source edits restart the process and recreate the background worker; in-process hot reload can leave its timers stalled. The worker assumes one Bun API process per database. Reverse proxies need no special streaming configuration. Run the normal migrations/build/start workflow to install the live-image table and bundle its font; the server uses `@napi-rs/canvas` for PNG rendering. The previous experimental public-link table is removed by migration 0010.
|
||||
|
||||
Reference in New Issue
Block a user