content upgrades, contribution contact

This commit is contained in:
overcuriousity
2025-07-28 11:19:09 +02:00
parent 81bbafeef1
commit 82a3718e3a
7 changed files with 464 additions and 2587 deletions

View File

@@ -23,7 +23,8 @@ const KnowledgebaseContributionSchema = z.object({
uploadedFiles: z.string().transform(str => {
try { return JSON.parse(str); } catch { return []; }
}).pipe(z.array(z.any()).default([])),
reason: z.string().optional().nullable().transform(val => val || undefined)
reason: z.string().optional().nullable().transform(val => val || undefined),
contact: z.string().optional().nullable().transform(val => val || undefined)
});
interface KnowledgebaseContributionData {
@@ -37,6 +38,7 @@ interface KnowledgebaseContributionData {
tags: string[];
uploadedFiles: any[];
reason?: string;
contact?: string;
}
const rateLimitStore = new Map<string, { count: number; resetTime: number }>();

View File

@@ -37,7 +37,8 @@ const ContributionRequestSchema = z.object({
}),
tool: ContributionToolSchema,
metadata: z.object({
reason: z.string().transform(val => val.trim() === '' ? undefined : val).optional()
reason: z.string().transform(val => val.trim() === '' ? undefined : val).optional(),
contact: z.string().transform(val => val.trim() === '' ? undefined : val).optional()
}).optional()
});
@@ -168,7 +169,8 @@ export const POST: APIRoute = async ({ request }) => {
tool: validatedData.tool,
metadata: {
submitter: userEmail,
reason: validatedData.metadata?.reason
reason: validatedData.metadata?.reason,
contact: validatedData.metadata?.contact
}
};