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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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
}
};

View File

@ -171,6 +171,18 @@ const sortedTools = data.tools.sort((a: any, b: any) => a.name.localeCompare(b.n
class="form-input"
></textarea>
</div>
<div class="form-group">
<label for="contact" class="form-label">Kontakt (Optional)</label>
<input
type="text"
id="contact"
name="contact"
placeholder="Discord: @username, Telegram: @username, oder andere Kontaktmöglichkeit"
class="form-input"
/>
<small class="form-help">Wird nur im Git-Issue angezeigt, falls Nachfragen entstehen</small>
</div>
</div>
<div class="form-actions">

View File

@ -232,6 +232,15 @@ const isEdit = !!editTool;
<span id="reason-count">0</span>/500
</div>
</div>
<div style="margin-bottom: 1.5rem;">
<label for="contact" style="display: block; margin-bottom: 0.5rem; font-weight: 600;">Kontakt (Optional)</label>
<input type="text" id="contact" name="contact"
placeholder="Discord: @username, Telegram: @username, oder andere Kontaktmöglichkeit"
class="form-input" />
<small style="display: block; margin-top: 0.25rem; color: var(--color-text-secondary); font-size: 0.8125rem;">
Wird nur im Git-Issue angezeigt, falls Nachfragen entstehen
</small>
</div>
</div>
<div style="border: 1px solid var(--color-border); border-radius: 0.5rem; padding: 1.5rem; margin-bottom: 2rem;">

View File

@ -25,6 +25,7 @@ export interface ContributionData {
metadata: {
submitter: string;
reason?: string;
contact?: string;
};
}
@ -47,6 +48,7 @@ interface KnowledgebaseContribution {
uploadedFiles?: { name: string; url: string }[];
submitter: string;
reason?: string;
contact?: string;
}
interface GitConfig {
@ -274,6 +276,10 @@ ${data.tool.phases?.length ? `- **Phases:** ${data.tool.phases.join(', ')}` : ''
${data.metadata.reason ? `### Reason
${data.metadata.reason}
` : ''}${data.metadata.contact ? `### Contact
${data.metadata.contact}
` : ''}### Copy-Paste YAML
\`\`\`yaml
@ -299,6 +305,7 @@ ${data.metadata.reason}
sections.push(`## Knowledge Base Article: ${data.title ?? 'Untitled'}`);
sections.push('');
sections.push(`**Submitted by:** ${data.submitter}`);
if (data.contact) sections.push(`**Contact:** ${data.contact}`);
if (data.toolName) sections.push(`**Related Tool:** ${data.toolName}`);
if (data.difficulty) sections.push(`**Difficulty:** ${data.difficulty}`);
sections.push('');