Report a problem: a tab that prepares a prefilled GitHub bug report

Form (summary, what happened, expected, steps) plus the Manager version, Windows version, install kind and server version filled in
automatically, a redacted diagnostics file to attach, and a button that opens GitHub's new-issue page with the standard template
(the full text goes to the clipboard when it is too long for a link). Nothing is sent from the Manager and no token is needed.
open_link accepts only this project's new-issue page for that.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ДмитрийandClaude Sonnet 5.5 committed 2026-10-01 15:56:53 +05:00
1 parent a4c1080575
commit a79c26ed49
11 files changed
+445 -3

No files matched your search

+8
View File
@@ -167,6 +167,13 @@ export interface Preflight {
free_bytes: number;
}
export interface ReportContext {
manager_version: string;
windows: string;
install_kind: "new" | "imported";
server_version: string | null;
}
export interface InstallRequirements {
download_bytes: number;
unpacked_bytes: number;
@@ -329,6 +336,7 @@ export const api = {
restoreDatabase: (id: string, backupId: string, database: string) => invoke<DbRestore>("restore_backup_database", { id, backupId, database }),
installPreflight: (dest: string, needed?: number) => invoke<Preflight>("install_preflight", { dest, needed: needed ?? null }),
installRequirements: (pkg?: string) => invoke<InstallRequirements>("install_requirements", { package: pkg ?? null }),
reportContext: (id: string) => invoke<ReportContext>("report_context", { id }),
listAccounts: (id: string) => invoke<AccountInfo[]>("list_accounts", { id }),
accountSetPassword: (id: string, name: string, password: string) => invoke<void>("account_set_password", { id, name, password }),
accountSetAccess: (id: string, name: string, level: number) => invoke<void>("account_set_access", { id, name, level }),
+63
View File
@@ -0,0 +1,63 @@
/** The text of a problem report, always in English so whoever reads it on GitHub can follow it; the person's own words go in as typed. */
export interface ReportInput {
managerVersion: string;
windows: string;
installKind: "new" | "imported";
serverVersion: string | null;
what: string;
expected: string;
steps: string;
/** a diagnostics file was created for this report */
diagnostics: boolean;
}
export const NEW_ISSUE_URL = "https://github.com/Corfirean/coa-server-manager/issues/new";
const PRIVACY = "> ⚠️ Please remove passwords, tokens, private IP information or other sensitive data before posting logs.";
export function reportBody(r: ReportInput): string {
const text = (s: string, fallback: string) => (s.trim() ? s.trim() : fallback);
return [
"## 🐛 Bug Report",
"",
`**Manager version:** ${r.managerVersion || "unknown"} `,
`**Windows version:** ${r.windows || "unknown"} `,
`**Fresh install or imported server:** ${r.installKind === "new" ? "Fresh install" : "Imported server"} `,
...(r.serverVersion ? [`**Server version:** ${r.serverVersion} `] : []),
"",
"**What happened?** ",
text(r.what, "Describe the problem."),
"",
"**What did you expect to happen?** ",
text(r.expected, "Describe the expected behaviour."),
"",
"**Steps to reproduce:** ",
text(r.steps, "1.\n2.\n3."),
"",
"**Screenshot / video:** ",
"Attach it if possible.",
"",
"**Logs:** ",
r.diagnostics ? "The diagnostics file from the Manager is attached below (it has passwords and addresses removed)." : "Attach relevant Manager/server logs if available.",
"",
PRIVACY,
"",
].join("\n");
}
/** Percent-encode everything that is not a plain letter, digit or one of . _ - so the link carries nothing the browser could misread. */
export function encodeQuery(s: string): string {
return Array.from(new TextEncoder().encode(s))
.map((b) => {
const c = String.fromCharCode(b);
return /[A-Za-z0-9._-]/.test(c) ? c : "%" + b.toString(16).toUpperCase().padStart(2, "0");
})
.join("");
}
/** A link that opens GitHub's "new issue" page with the title and text filled in. */
export function issueUrl(title: string, body: string): string {
return `${NEW_ISSUE_URL}?labels=bug&title=${encodeQuery(title)}&body=${encodeQuery(body)}`;
}
/** Links longer than this are not reliable in every browser; the full text is then copied to the clipboard instead. */
export const MAX_LINK = 6500;