config and plugin
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
// Thin wrapper around /api/scripts pinned to config-kind artifacts. Both
|
||||
// overlays (kind='config') and baselines (kind='baseline') share this endpoint
|
||||
// — the caller sets `kind` in the form (defaults to 'config').
|
||||
import { GET as scriptsGET, POST as scriptsPOST } from '../scripts/+server.js';
|
||||
|
||||
function withDefaultKind(url: URL, fallback: string): URL {
|
||||
if (!url.searchParams.has('kind')) {
|
||||
const clone = new URL(url.href);
|
||||
clone.searchParams.set('kind', fallback);
|
||||
return clone;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
export async function GET(event: { url: URL }) {
|
||||
// Default to listing overlays. Baselines live at /api/configs?kind=baseline.
|
||||
return scriptsGET({ url: withDefaultKind(event.url, 'config') });
|
||||
}
|
||||
|
||||
export async function POST(event: { request: Request; url: URL }) {
|
||||
return scriptsPOST({
|
||||
request: event.request,
|
||||
url: withDefaultKind(event.url, 'config')
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user