// Feedback form → GitHub issue. Pure functions, so tests can run them without // Cloudflare or GitHub (site/test/feedback.test.mjs). export const KINDS = { bug: { label: "bug", title: "Bug report" }, idea: { label: "enhancement", title: "Idea" }, question: { label: "question", title: "Question" }, other: { label: null, title: "Other feedback" }, }; export const LIMITS = { title: [5, 120], message: [10, 5000], field: 120 }; // Anyone who fills the form in under this many milliseconds is a script. export const MIN_FILL_MS = 3000; const GITHUB_LOGIN = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?$/; const oneLine = (value, max) => String(value ?? "").replace(/\s+/g, " ").trim().slice(0, max); // Mentions in someone else's text would ping strangers, and issue references // (#1, owner/repo#1, GH-1, github.com links) would add backlinks to other // people's issues, so break them all with a zero-width space. Escaping & first // stops @ and # from turning back into @ and # when GitHub renders, // and escaping < keeps out raw HTML such as an unclosed