mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-01 00:42:49 +08:00
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
1 parent
ff570d9131
commit
00c8cfac06
6 files changed
+106
-3
No files matched your search
+81
-3
@@ -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<FeedbackCategory>("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)}
|
||||
/>
|
||||
</label>
|
||||
{category === "bug" && (
|
||||
<>
|
||||
<label className="ts-dialog-field">
|
||||
{t("feedback.dialog.bug.environment")}
|
||||
<input type="text" value={environment} onChange={(e) => setEnvironment(e.target.value)} />
|
||||
</label>
|
||||
<label className="ts-dialog-field">
|
||||
{t("feedback.dialog.bug.server")}
|
||||
<input type="text" value={bugServer} onChange={(e) => setBugServer(e.target.value)} />
|
||||
</label>
|
||||
<label className="ts-dialog-field">
|
||||
{t("feedback.dialog.bug.steps")}
|
||||
<textarea
|
||||
rows={3}
|
||||
value={steps}
|
||||
placeholder={t("feedback.dialog.bug.stepsPlaceholder")}
|
||||
onChange={(e) => setSteps(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<details className="ts-feedback-hint">
|
||||
<summary>{t("feedback.dialog.bug.diagnostics")}</summary>
|
||||
<pre style={{ whiteSpace: "pre-wrap", wordBreak: "break-all" }}>{diagnostics}</pre>
|
||||
</details>
|
||||
</>
|
||||
)}
|
||||
<label className="ts-dialog-field">
|
||||
{t("feedback.dialog.email")}
|
||||
<input type="email" value={email} onChange={(e) => setEmail(e.target.value)} />
|
||||
@@ -11101,7 +11179,7 @@ function AppInner() {
|
||||
|
||||
<DonateFab />
|
||||
|
||||
{feedbackOpen && <FeedbackDialog onClose={() => setFeedbackOpen(false)} />}
|
||||
{feedbackOpen && <FeedbackDialog onClose={() => setFeedbackOpen(false)} audioState={audioContextRef.current?.state ?? "not started"} />}
|
||||
|
||||
{favoritesDialogMode && (
|
||||
<FavoritesDialog
|
||||
|
||||
@@ -56,6 +56,11 @@
|
||||
"feedback.dialog.publishAsIssue": "Publikovat jako veřejný problém na GitHubu",
|
||||
"feedback.dialog.publishAsIssueHint": "Ponechte nezaškrtnuté, pokud chcete, aby vaše zpětná vazba zůstala soukromá a viditelná pouze správci.",
|
||||
"feedback.dialog.publishAsIssueHintBug": "Hlášení chyb jsou vždy zveřejněna jako veřejný problém na GitHubu.",
|
||||
"feedback.dialog.bug.environment": "Prohlížeč a operační systém",
|
||||
"feedback.dialog.bug.server": "TeamSpeak server (volitelné)",
|
||||
"feedback.dialog.bug.steps": "Co jste dělali těsně předtím? (volitelné)",
|
||||
"feedback.dialog.bug.stepsPlaceholder": "např. vstup do kanálu, změna výstupního zařízení… Pomohlo znovu načíst stránku?",
|
||||
"feedback.dialog.bug.diagnostics": "Odesílané technické údaje",
|
||||
"feedback.dialog.send": "Odeslat",
|
||||
"restartNotice.title": "Krátké přerušení",
|
||||
"restartNotice.body": "Server se za chvíli krátce restartuje. Vaše připojení bude na okamžik přerušeno.",
|
||||
|
||||
@@ -56,6 +56,11 @@
|
||||
"feedback.dialog.publishAsIssue": "Als öffentliches GitHub-Issue veröffentlichen",
|
||||
"feedback.dialog.publishAsIssueHint": "Ohne Haken bleibt dein Feedback privat und geht nur an den Betreiber.",
|
||||
"feedback.dialog.publishAsIssueHintBug": "Fehlermeldungen werden immer als öffentliches GitHub-Issue veröffentlicht.",
|
||||
"feedback.dialog.bug.environment": "Browser & Betriebssystem",
|
||||
"feedback.dialog.bug.server": "TeamSpeak-Server (optional)",
|
||||
"feedback.dialog.bug.steps": "Was hast du direkt davor gemacht? (optional)",
|
||||
"feedback.dialog.bug.stepsPlaceholder": "z. B. Channel betreten, Ausgabegerät gewechselt… Hat Neuladen der Seite geholfen?",
|
||||
"feedback.dialog.bug.diagnostics": "Mitgesendete technische Details",
|
||||
"feedback.dialog.send": "Senden",
|
||||
"feedback.dialog.cancel": "Abbrechen",
|
||||
"restartNotice.title": "Kurze Unterbrechung",
|
||||
|
||||
@@ -56,6 +56,11 @@
|
||||
"feedback.dialog.publishAsIssue": "Publish as a public GitHub issue",
|
||||
"feedback.dialog.publishAsIssueHint": "Leave unchecked to keep your feedback private, visible only to the maintainer.",
|
||||
"feedback.dialog.publishAsIssueHintBug": "Bug reports are always published as a public GitHub issue.",
|
||||
"feedback.dialog.bug.environment": "Browser & operating system",
|
||||
"feedback.dialog.bug.server": "TeamSpeak server (optional)",
|
||||
"feedback.dialog.bug.steps": "What did you do right before? (optional)",
|
||||
"feedback.dialog.bug.stepsPlaceholder": "e.g. joined a channel, switched output device… Did reloading the page help?",
|
||||
"feedback.dialog.bug.diagnostics": "Technical details sent along",
|
||||
"feedback.dialog.send": "Send",
|
||||
"restartNotice.title": "Brief interruption",
|
||||
"restartNotice.body": "The server is about to restart briefly. Your connection will drop for a moment.",
|
||||
|
||||
@@ -56,6 +56,11 @@
|
||||
"feedback.dialog.publishAsIssue": "بهصورت Issue عمومی در گیتهاب منتشر شود",
|
||||
"feedback.dialog.publishAsIssueHint": "اگر تیک نزنی، بازخوردت خصوصی میماند و فقط برای مدیر پروژه قابل مشاهده است.",
|
||||
"feedback.dialog.publishAsIssueHintBug": "گزارش اشکالها همیشه بهصورت Issue عمومی در گیتهاب منتشر میشوند.",
|
||||
"feedback.dialog.bug.environment": "مرورگر و سیستمعامل",
|
||||
"feedback.dialog.bug.server": "سرور TeamSpeak (اختیاری)",
|
||||
"feedback.dialog.bug.steps": "درست قبل از آن چه کاری کردید؟ (اختیاری)",
|
||||
"feedback.dialog.bug.stepsPlaceholder": "مثلاً ورود به کانال، تغییر دستگاه خروجی… آیا بارگذاری مجدد صفحه کمک کرد؟",
|
||||
"feedback.dialog.bug.diagnostics": "جزئیات فنی ارسالشده",
|
||||
"feedback.dialog.send": "ارسال",
|
||||
"restartNotice.title": "وقفه کوتاه",
|
||||
"restartNotice.body": "سرور بهزودی برای مدت کوتاهی مجدداً راهاندازی میشود. اتصال شما لحظهای قطع خواهد شد.",
|
||||
|
||||
@@ -554,6 +554,11 @@
|
||||
"feedback.dialog.publishAsIssue": "作为公开的 GitHub Issue 发布",
|
||||
"feedback.dialog.publishAsIssueHint": "不勾选则反馈保持私密,仅维护者可见。",
|
||||
"feedback.dialog.publishAsIssueHintBug": "错误报告将始终作为公开的 GitHub Issue 发布。",
|
||||
"feedback.dialog.bug.environment": "浏览器和操作系统",
|
||||
"feedback.dialog.bug.server": "TeamSpeak 服务器(可选)",
|
||||
"feedback.dialog.bug.steps": "出问题前你做了什么?(可选)",
|
||||
"feedback.dialog.bug.stepsPlaceholder": "例如:进入频道、切换输出设备…… 刷新页面后是否恢复?",
|
||||
"feedback.dialog.bug.diagnostics": "一并发送的技术信息",
|
||||
"feedback.dialog.send": "发送",
|
||||
"feedback.dialog.cancel": "取消",
|
||||
"feedback.dialog.sending": "发送中…",
|
||||
|
||||
Reference in new issue
Block a user