Introduce token-based author authentication (register/verify API), skill forking with EditGate protection, tag metadata on skills, and download/push stats. Enhanced push scripts with token auth and per-skill filtering. Updated UI with stats, tags, and author info on skill cards.
41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
import { v as verifyToken } from '../../../chunks/tokens_CAzj9Aj8.mjs';
|
|
export { renderers } from '../../../renderers.mjs';
|
|
|
|
const POST = async ({ request }) => {
|
|
let body;
|
|
try {
|
|
body = await request.json();
|
|
} catch {
|
|
return new Response(JSON.stringify({ error: "Invalid JSON" }), {
|
|
status: 400,
|
|
headers: { "Content-Type": "application/json" }
|
|
});
|
|
}
|
|
const { email, token } = body;
|
|
if (!email || !token) {
|
|
return new Response(JSON.stringify({ error: "email and token are required" }), {
|
|
status: 400,
|
|
headers: { "Content-Type": "application/json" }
|
|
});
|
|
}
|
|
const valid = await verifyToken(email, token);
|
|
if (!valid) {
|
|
return new Response(JSON.stringify({ error: "Invalid token" }), {
|
|
status: 403,
|
|
headers: { "Content-Type": "application/json" }
|
|
});
|
|
}
|
|
return new Response(JSON.stringify({ ok: true }), {
|
|
headers: { "Content-Type": "application/json" }
|
|
});
|
|
};
|
|
|
|
const _page = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
__proto__: null,
|
|
POST
|
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
|
|
const page = () => _page;
|
|
|
|
export { page };
|