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

@@ -84,3 +84,18 @@ export const reminderDeliveries = sqliteTable('reminder_deliveries', {
export const reminderWorkerState = sqliteTable('reminder_worker_state', {
id: text('id').primaryKey(), blockedUntil: integer('blocked_until').notNull(),
});
export const liveDiscordCards = sqliteTable('live_discord_cards', {
userId: text('user_id').primaryKey().references(() => users.id, { onDelete: 'cascade' }),
channelId: text('channel_id').notNull(),
messageId: text('message_id'),
messageUrl: text('message_url'),
nonce: text('nonce').notNull(),
theme: text('theme').$type<import('../lib/theme').Theme>().notNull(),
status: text('status').$type<'active' | 'paused' | 'sending' | 'uncertain' | 'error'>().notNull(),
imageHash: text('image_hash'),
dirty: integer('dirty', { mode: 'boolean' }).notNull().default(true),
error: text('error'),
retryAt: integer('retry_at'),
updatedAt: integer('updated_at').notNull(),
});