Add author auth, forking, tags, and stats tracking

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.
This commit is contained in:
Alejandro Martinez
2026-02-12 14:37:40 +01:00
parent 39d8afb251
commit aa477a553b
80 changed files with 3618 additions and 660 deletions

View File

@@ -1,4 +1,7 @@
import { l as listSkills, i as isValidSlug, c as createSkill } from '../../chunks/skills_COWfD5oy.mjs';
import matter from 'gray-matter';
import { l as listSkills, i as isValidSlug, c as createSkill } from '../../chunks/skills_BacVQUiS.mjs';
import { h as hasToken, e as extractBearerToken, v as verifyToken } from '../../chunks/tokens_CAzj9Aj8.mjs';
import { r as recordPush } from '../../chunks/stats_CaDi9y9J.mjs';
export { renderers } from '../../renderers.mjs';
const GET = async () => {
@@ -30,8 +33,21 @@ const POST = async ({ request }) => {
headers: { "Content-Type": "application/json" }
});
}
const parsed = matter(content);
const authorEmail = parsed.data["author-email"] || "";
if (authorEmail && await hasToken(authorEmail)) {
const token = extractBearerToken(request);
const valid = await verifyToken(authorEmail, token);
if (!valid) {
return new Response(JSON.stringify({ error: "Valid token required to create a skill with author-email. Register first via POST /api/auth/register." }), {
status: 403,
headers: { "Content-Type": "application/json" }
});
}
}
try {
const skill = await createSkill(slug, content);
recordPush(slug);
return new Response(JSON.stringify(skill), {
status: 201,
headers: { "Content-Type": "application/json" }