c6a7de895d
- JSON import/export with conflict resolution (skip/overwrite) + admin UI - Ping history sparklines on AppWidget and AppCard (24h, 288 points) - Hourly cleanup job for old AppStatus records - User theme preferences (hue, saturation, mode, background, locale) - Settings page with ThemeCustomizer (sliders, toggles, live preview) - Prisma migration for user preference fields - i18n translations for all new strings (EN/RU)
29 lines
623 B
TypeScript
29 lines
623 B
TypeScript
import type { PageServerLoad } from './$types.js';
|
|
import { requireAuth } from '$lib/server/middleware/authenticate.js';
|
|
import { prisma } from '$lib/server/prisma.js';
|
|
|
|
export const load: PageServerLoad = async (event) => {
|
|
const user = requireAuth(event);
|
|
|
|
const dbUser = await prisma.user.findUnique({
|
|
where: { id: user.id },
|
|
select: {
|
|
themeMode: true,
|
|
primaryHue: true,
|
|
primarySaturation: true,
|
|
backgroundType: true,
|
|
locale: true
|
|
}
|
|
});
|
|
|
|
return {
|
|
preferences: dbUser ?? {
|
|
themeMode: null,
|
|
primaryHue: null,
|
|
primarySaturation: null,
|
|
backgroundType: null,
|
|
locale: null
|
|
}
|
|
};
|
|
};
|