radio: private radio tracker (/trackers/radio): frequencies, UBC125XLT banks + CSV, nets, ISS passes over Gouda, listening log, ntfy reminders
Deploy production / deploy (push) Successful in 1m26s

This commit is contained in:
stan committed 2026-10-26 16:58:29 +00:00
1 parent e24ee7f95d
commit 03574a95a7
37 files changed
+48839 -3

No files matched your search

+51
View File
@@ -0,0 +1,51 @@
import { requireOwner } from '#lib/server/owner.js';
import {
addLog,
deleteFrequency,
deleteLog,
deleteNet,
loadRadio,
saveFrequency,
saveNet,
setChannel,
toggleRemind
} from '#lib/server/radio.js';
import { fail, type RequestEvent } from '@sveltejs/kit';
import type { Actions, PageServerLoad } from './$types';
// /trackers/radio: owner-only. Everyone else gets a 404 (here and in hooks.server.ts via
// ownerOnlyPrefixes); hooks.server.ts also sends cache-control: private, no-store.
export const load: PageServerLoad = async (event) => {
requireOwner(event);
return {
...(await loadRadio()),
now: Date.now(),
seo: {
title: 'radio',
description: 'Frequencies, scanner banks, nets and ISS passes.',
index: false
}
};
};
type Handler = (
form: FormData
) => Promise<{ ok: true; message?: string } | { ok: false; message: string }>;
// Actions don't run the load, so each one checks the owner again.
const action = (name: string, fn: Handler) => async (event: RequestEvent) => {
requireOwner(event);
const r = await fn(await event.request.formData());
if (!r.ok) return fail(400, { action: name, message: r.message });
return { action: name, ok: true as const, message: r.message ?? null };
};
export const actions: Actions = {
saveFreq: action('saveFreq', saveFrequency),
deleteFreq: action('deleteFreq', deleteFrequency),
channel: action('channel', setChannel),
saveNet: action('saveNet', saveNet),
deleteNet: action('deleteNet', deleteNet),
remind: action('remind', toggleRemind),
log: action('log', addLog),
deleteLog: action('deleteLog', deleteLog)
};