feat: add durable asset synchronization worker

This commit is contained in:
jb
2026-09-19 22:15:23 -04:00
parent 2675ea8114
commit fe7d218195
36 changed files with 2218 additions and 189 deletions
+20
View File
@@ -0,0 +1,20 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
import { live, session } from '$lib/server/application';
import { configuration } from '$lib/server/config';
import { capabilityDisabledReason, capabilityEnabled } from '$lib/server/release-gate';
export const GET: RequestHandler = async (event) => {
const config = configuration();
if (!capabilityEnabled('asset_sync', config.capabilityAllowlist)) return json({ error: capabilityDisabledReason('asset_sync') }, { status: 503 });
const current = await session(event);
if (!current) return json({ error: 'Connect an EVE character first.' }, { status: 401 });
const jobId = event.url.searchParams.get('job');
if (!jobId || jobId.length > 128) return json({ error: 'A sync job is required.' }, { status: 400 });
try {
const job = await live().store.syncJob(current.userId, jobId);
return job ? json(job) : json({ error: 'Sync job not found.' }, { status: 404 });
} catch {
return json({ error: 'Synchronization status unavailable.' }, { status: 503 });
}
};