feat: Phases 4-7 — Full Feature Expansion (26 features)
Phase 4 — New Widget Types: - Clock/Weather, System Stats, RSS/Feed, Calendar, Markdown, Metric/Counter, Link Group, Camera/Stream widgets - Backend services with caching for each data source - Full creation form with dynamic config fields per type Phase 5 — Visual & Styling Enhancements: - Glassmorphism card style (solid/glass/outline) - Board-level themes with per-board hue/saturation - Animated SVG status rings replacing static dots - Card size options (compact/medium/large) - Custom CSS injection (admin + per-board, sanitized) - Wallpaper backgrounds with blur/overlay/parallax Phase 6 — Functional Features: - Favorites bar with drag-and-drop reordering - Recent apps tracking with privacy toggle - Uptime dashboard page (/status, guest-accessible) - Notifications system (Discord/Slack/Telegram/HTTP webhooks) - App tags with filtering in board view - Multi-URL app cards with expandable sub-links - Personal API tokens with scoped permissions - Audit log with retention and admin viewer Phase 7 — Quality of Life: - Onboarding wizard (5-step first-launch setup) - App URL health preview with favicon/title detection - Board templates (4 built-in + custom import/export) - Keyboard shortcut overlay (j/k nav, 1-9 boards, ? help) 212 files changed, 15641 insertions, 980 deletions. Build, lint, type check, and 222 tests all pass.
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
import { requireAuth } from '$lib/server/middleware/authenticate.js';
|
||||
import * as notificationService from '$lib/server/services/notificationService.js';
|
||||
import { updateNotificationChannelSchema } from '$lib/utils/validators.js';
|
||||
import { success, error } from '$lib/server/utils/response.js';
|
||||
|
||||
/**
|
||||
* GET /api/notifications/channels/:id — Get a single notification channel.
|
||||
*/
|
||||
export const GET: RequestHandler = async (event) => {
|
||||
const user = requireAuth(event);
|
||||
const { id } = event.params;
|
||||
|
||||
try {
|
||||
const channel = await notificationService.getChannelById(id, user.id);
|
||||
return json(success(channel));
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : 'Channel not found';
|
||||
return json(error(message), { status: 404 });
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* PATCH /api/notifications/channels/:id — Update a notification channel.
|
||||
*/
|
||||
export const PATCH: RequestHandler = async (event) => {
|
||||
const user = requireAuth(event);
|
||||
const { id } = event.params;
|
||||
|
||||
let body: unknown;
|
||||
try {
|
||||
body = await event.request.json();
|
||||
} catch {
|
||||
return json(error('Invalid JSON body'), { status: 400 });
|
||||
}
|
||||
|
||||
const parsed = updateNotificationChannelSchema.safeParse(body);
|
||||
if (!parsed.success) {
|
||||
const messages = parsed.error.errors.map((e) => e.message).join(', ');
|
||||
return json(error(messages), { status: 400 });
|
||||
}
|
||||
|
||||
try {
|
||||
const channel = await notificationService.updateChannel(id, user.id, parsed.data);
|
||||
return json(success(channel));
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : 'Failed to update channel';
|
||||
const status = message.includes('not found') ? 404 : 500;
|
||||
return json(error(message), { status });
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* DELETE /api/notifications/channels/:id — Delete a notification channel.
|
||||
*/
|
||||
export const DELETE: RequestHandler = async (event) => {
|
||||
const user = requireAuth(event);
|
||||
const { id } = event.params;
|
||||
|
||||
try {
|
||||
await notificationService.deleteChannel(id, user.id);
|
||||
return json(success(null));
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : 'Failed to delete channel';
|
||||
const status = message.includes('not found') ? 404 : 500;
|
||||
return json(error(message), { status });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
import { requireAuth } from '$lib/server/middleware/authenticate.js';
|
||||
import * as notificationService from '$lib/server/services/notificationService.js';
|
||||
import { success, error } from '$lib/server/utils/response.js';
|
||||
|
||||
/**
|
||||
* POST /api/notifications/channels/:id/test — Send a test notification to a channel.
|
||||
*/
|
||||
export const POST: RequestHandler = async (event) => {
|
||||
const user = requireAuth(event);
|
||||
const { id } = event.params;
|
||||
|
||||
try {
|
||||
await notificationService.sendTestNotification(id, user.id);
|
||||
return json(success({ message: 'Test notification sent' }));
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : 'Failed to send test notification';
|
||||
const status = message.includes('not found') ? 404 : 500;
|
||||
return json(error(message), { status });
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user