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:
syntaxbullet
2026-09-07 11:36:47 +02:00
parent 00729096bf
commit c7aa5a1c65
22 changed files with 2792 additions and 7 deletions

View File

@@ -14,7 +14,7 @@ let sharedImage: Blob | null = null;
let reminderMessage: string | null = null;
const previewDiscord: DiscordFetch = async (url, init) => {
if (url.endsWith("/users/@me/channels")) return Response.json({ id: "523456789012345678" });
if (init?.method === "POST") {
if (init?.method === "POST" || init?.method === "PATCH") {
if (init.body instanceof FormData) sharedImage = init.body.get("files[0]") as Blob;
else reminderMessage = JSON.parse(String(init.body)).content;
return Response.json({ id: "423456789012345678" });