Use user timezone for maintenance and official Plutonium manifest

This commit is contained in:
2026-09-21 19:14:40 -04:00
parent 47d6dc07b7
commit ce6861203e
6 changed files with 161 additions and 45 deletions
+4 -3
View File
@@ -1,4 +1,5 @@
import { json } from '@sveltejs/kit';
import { validTimeZone } from '$lib/time-zone.js';
import { cancelMaintenance, checkPlutonium, plutoniumStatus, queueMaintenance, saveMaintenanceSchedule } from '$lib/server/fleet/plutonium.js';
export function GET() { return json(plutoniumStatus()); }
@@ -10,10 +11,10 @@ export async function POST({ request }: { request: Request }) {
if (body.action === 'check') {
await checkPlutonium();
} else if (body.action === 'schedule') {
if (typeof body.enabled !== 'boolean' || typeof body.time !== 'string' || !/^([01]\d|2[0-3]):[0-5]\d$/.test(body.time)) {
return json({ error: 'Provide enabled and a valid UTC time (HH:mm).' }, { status: 400 });
if (typeof body.enabled !== 'boolean' || typeof body.time !== 'string' || !/^([01]\d|2[0-3]):[0-5]\d$/.test(body.time) || !validTimeZone(body.timeZone)) {
return json({ error: 'Provide enabled, a valid time (HH:mm), and a valid timezone.' }, { status: 400 });
}
saveMaintenanceSchedule(body.enabled, body.time);
saveMaintenanceSchedule(body.enabled, body.time, body.timeZone);
} else if (body.action === 'restart') {
if (!Array.isArray(body.servers) || !body.servers.length || body.servers.some((s: unknown) => typeof s !== 'string')) {
return json({ error: 'Choose servers to restart.' }, { status: 400 });