From 00c8cfac06358aa87509ac81c44b3f97c5770861 Mon Sep 17 00:00:00 2001 From: Moepchi Date: Thu, 22 Oct 2026 12:04:25 +0000 Subject: [PATCH] Feedback: ask bug reports for browser/OS, server and steps Bug reports now prefill a detected browser/OS (editable), offer optional server and steps fields, and append a visible block of technical details (page, user agent, language, audio context state, setSinkId support). Everything is folded into the message, so gateway and storage are unchanged. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU --- web/src/App.tsx | 84 ++++++++++++++++++++++++++++++++++++-- web/src/locales/cs-CZ.json | 5 +++ web/src/locales/de.json | 5 +++ web/src/locales/en.json | 5 +++ web/src/locales/fa.json | 5 +++ web/src/locales/zh-CN.json | 5 +++ 6 files changed, 106 insertions(+), 3 deletions(-) diff --git a/web/src/App.tsx b/web/src/App.tsx index adadfa1..19d0b54 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -2599,11 +2599,52 @@ function DonateFab() { type FeedbackCategory = "bug" | "idea" | "other" | "report"; -function FeedbackDialog({ onClose }: { onClose: () => void }) { +/** Best-effort "Chrome 141 · Windows" from the UA, prefilled into bug reports + * so users don't have to know it themselves - they can still correct it. */ +function detectBrowserAndOs(): string { + const ua = navigator.userAgent; + const pick = (re: RegExp, name: string) => { + const m = re.exec(ua); + return m ? `${name} ${m[1]}` : null; + }; + const browser = + pick(/Edg\/(\d+)/, "Edge") ?? + pick(/OPR\/(\d+)/, "Opera") ?? + pick(/Firefox\/(\d+)/, "Firefox") ?? + pick(/Chrome\/(\d+)/, "Chrome") ?? + pick(/Version\/([\d.]+).*Safari/, "Safari") ?? + "?"; + const os = /iPhone|iPad/.test(ua) + ? "iOS" + : /Android/.test(ua) + ? "Android" + : /Windows/.test(ua) + ? "Windows" + : /Mac OS X/.test(ua) + ? "macOS" + : /Linux/.test(ua) + ? "Linux" + : "?"; + return `${browser} · ${os}`; +} + +function FeedbackDialog({ onClose, audioState }: { onClose: () => void; audioState: string }) { const t = useT(); const backdrop = useBackdropDismiss(onClose); const [category, setCategory] = useState("bug"); const [message, setMessage] = useState(""); + // Bug-only extras, appended to the message so neither the gateway nor the + // private storage needs a schema change. + const [environment, setEnvironment] = useState(detectBrowserAndOs); + const [bugServer, setBugServer] = useState(""); + const [steps, setSteps] = useState(""); + const diagnostics = [ + `Page: ${window.location.host}`, + `User agent: ${navigator.userAgent}`, + `Language: ${navigator.language}`, + `Audio: ${audioState}`, + `Output device switching: ${"setSinkId" in HTMLMediaElement.prototype ? "yes" : "no"}`, + ].join("\n"); const [email, setEmail] = useState(""); // Bugs always get filed as a GitHub issue - the checkbox is forced on and // locked while "bug" is selected (see the select's onChange below), so the @@ -2626,7 +2667,19 @@ function FeedbackDialog({ onClose }: { onClose: () => void }) { headers: { "Content-Type": "application/json" }, body: JSON.stringify({ category, - message: trimmed, + message: + category === "bug" + ? [ + trimmed, + "", + "---", + `**Browser / OS:** ${environment.trim() || "?"}`, + ...(bugServer.trim() ? [`**Server:** ${bugServer.trim()}`] : []), + ...(steps.trim() ? [`**Steps:** ${steps.trim()}`] : []), + "", + diagnostics, + ].join("\n") + : trimmed, email: email.trim() || undefined, publishAsIssue, website, @@ -2715,6 +2768,31 @@ function FeedbackDialog({ onClose }: { onClose: () => void }) { onChange={(e) => setMessage(e.target.value)} /> + {category === "bug" && ( + <> + + +