diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 10b58f1..04ac106 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1008,7 +1008,12 @@ struct FriendsStatus { #[tauri::command] fn open_link(url: String) -> std::result::Result<(), UiError> { const ALLOWED: &[&str] = &["https://tailscale.com/", "https://login.tailscale.com/", "https://portforward.com/"]; - if !ALLOWED.iter().any(|p| url.starts_with(p)) || !url.chars().all(|c| c.is_ascii_alphanumeric() || "/:._-?=#%".contains(c)) { + // A prefilled "new issue" page of this project: the address must be exactly that page, and its query may carry + // `&` between the (percent-encoded) title and text. + const NEW_ISSUE: &str = "https://github.com/Corfirean/coa-server-manager/issues/new"; + let issue = url == NEW_ISSUE || url.starts_with(&format!("{NEW_ISSUE}?")); + let chars_ok = url.chars().all(|c| c.is_ascii_alphanumeric() || "/:._-?=#%".contains(c) || (issue && c == '&')); + if !(issue || ALLOWED.iter().any(|p| url.starts_with(p))) || !chars_ok || url.len() > 12_000 { return Err(Error::Invalid("That link is not allowed.".into()).into()); } // explorer.exe opens the address in the default browser without going through a shell. @@ -1016,6 +1021,49 @@ fn open_link(url: String) -> std::result::Result<(), UiError> { Ok(()) } +#[derive(Serialize)] +struct ReportContext { + manager_version: String, + windows: String, + /// "new" for a server the Manager installed, "imported" for one that was added. + install_kind: String, + server_version: Option, +} + +/// "Windows 11 (build 26200)" from `ver`; empty if it cannot be read. +fn windows_version() -> String { + let mut cmd = std::process::Command::new("cmd.exe"); + cmd.args(["/C", "ver"]); + #[cfg(windows)] + { + use std::os::windows::process::CommandExt; + cmd.creation_flags(0x0800_0000); + } + let out = cmd.output().map(|o| String::from_utf8_lossy(&o.stdout).into_owned()).unwrap_or_default(); + let build: Option = out.split("Version").nth(1).and_then(|v| v.trim().trim_end_matches(']').split('.').nth(2)).and_then(|b| b.trim().parse().ok()); + match build { + Some(b) if b >= 22000 => format!("Windows 11 (build {b})"), + Some(b) => format!("Windows 10 (build {b})"), + None => String::new(), + } +} + +/// What the problem report fills in on its own. Nothing here identifies the person or the machine. +#[tauri::command] +async fn report_context(state: State<'_, AppState>, id: String) -> std::result::Result { + let root = path_of(&state, &id)?; + blocking(move || { + let (_, meta) = install_meta(&root)?; + Ok(ReportContext { + manager_version: coa_core::MANAGER_VERSION.to_string(), + windows: windows_version(), + install_kind: if meta.kind == coa_core::registry::InstallKind::New { "new".into() } else { "imported".into() }, + server_version: meta.core.version.clone(), + }) + }) + .await +} + #[tauri::command] async fn friends_status(state: State<'_, AppState>, id: String) -> std::result::Result { let root = path_of(&state, &id)?; @@ -1233,6 +1281,7 @@ pub fn run() { restore_backup_database, install_preflight, install_requirements, + report_context, list_accounts, account_set_password, account_set_access, diff --git a/src/dev/mock.ts b/src/dev/mock.ts index 4317e92..1c74d1e 100644 --- a/src/dev/mock.ts +++ b/src/dev/mock.ts @@ -49,6 +49,9 @@ export {}; if(cmd==="client_download"){await run("scan",4,0);await run("download",40,41e6);w.__client="new";return {path:args.parent+"\\CoA Client",executable:"Ascension.exe",realmlists:[{path:"x",host:"127.0.0.1"}],addon:{installed:true,version:"1",up_to_date:true},other_addons:0};} if(cmd==="client_cancel"){w.__stop=true;return null;} } + if(cmd==="report_context") return {manager_version:"0.3.1",windows:"Windows 11 (build 26200)",install_kind:"new",server_version:"0.261001.10"}; + if(cmd==="open_link"){(window as any).__lastLink=args.url;return null;} + if(cmd==="export_diagnostics") return "C:\\Users\\you\\Desktop\\CoA-Diagnostics-20261001-140000.zip"; if(cmd==="install_preflight") return {ok:true,problems:[],free_bytes:210*2**30}; if(cmd==="install_requirements") return {download_bytes:Math.round(5.9*2**30),unpacked_bytes:Math.round(11.4*2**30),version:"0.2.0"}; if(cmd==="list_accounts"){const w=window as any;w.__acc=w.__acc??[{id:2,name:"ALICE",access:3,online:true,last_login:"2026-10-01 12:04:11",characters:4},{id:5,name:"BOB",access:0,online:false,last_login:null,characters:0},{id:6,name:"CAROL",access:2,online:false,last_login:"2026-09-30 21:40:02",characters:2}];return w.__acc;} diff --git a/src/i18n/locales/de.ts b/src/i18n/locales/de.ts index d10369e..cad8b22 100644 --- a/src/i18n/locales/de.ts +++ b/src/i18n/locales/de.ts @@ -662,6 +662,39 @@ const de: Partial> = { "acc.passwordChanged": "Das Passwort von {name} wurde geändert.", "acc.renamed": "{name} heißt jetzt {new}.", "acc.accessChanged": "{name} ist jetzt: {level}.", + + // Problem report (GitHub issue) + "nav.report": "Problem melden", + "q.report": "Etwas funktioniert nicht?", + "rep.title": "Problem melden", + "rep.intro": "Beschreibe, was schiefgelaufen ist. Der Manager bereitet daraus einen Fehlerbericht für GitHub vor und öffnet ihn im Browser; dort prüfst du ihn, fügst Screenshots hinzu und sendest ihn ab. Du brauchst ein kostenloses GitHub-Konto. Aus diesem Fenster wird nichts gesendet.", + "rep.autoTitle": "Wird automatisch ausgefüllt", + "rep.manager": "Manager-Version", + "rep.windows": "Windows-Version", + "rep.kind": "Server", + "rep.kindNew": "Neu installiert", + "rep.kindImported": "Importierter Server", + "rep.server": "Server-Version", + "rep.summary": "Kurze Zusammenfassung", + "rep.summaryHint": "Zum Beispiel: Ladebildschirm hängt nach dem Erstellen eines Charakters", + "rep.what": "Was ist passiert?", + "rep.whatHint": "Beschreibe das Problem.", + "rep.expected": "Was hast du erwartet?", + "rep.expectedHint": "Beschreibe das erwartete Verhalten.", + "rep.steps": "Schritte zum Nachstellen", + "rep.attachTitle": "Logs und Screenshots", + "rep.attachText": "Erstelle eine Diagnosedatei (Einstellungen und Logs ohne Passwörter und Adressen) und ziehe sie zusammen mit Screenshots oder Videos auf die GitHub-Seite, sobald sie offen ist.", + "rep.makeFile": "Diagnosedatei erstellen", + "rep.fileSaved": "Gespeichert unter {path}. Ziehe diese Datei in das GitHub-Issue.", + "rep.privacy": "Bitte entferne Passwörter, Tokens, private IP-Angaben und andere sensible Daten, bevor du Logs veröffentlichst.", + "rep.open": "Bericht auf GitHub öffnen", + "rep.copy": "Text kopieren", + "rep.preview": "Text ansehen", + "rep.needFields": "Fülle zuerst die Zusammenfassung und „Was ist passiert?“ aus.", + "rep.githubNote": "Der Bericht ist auf Englisch gehalten, damit die Entwickler ihn lesen können; deine eigenen Worte bleiben so, wie du sie geschrieben hast.", + "rep.opened": "GitHub wurde im Browser geöffnet. Prüfe den Text, hänge Dateien an und klicke auf „Submit new issue“.", + "rep.openedLong": "Der Bericht ist für einen Link zu lang und wurde deshalb in die Zwischenablage kopiert. GitHub ist geöffnet: Füge ihn (Strg+V) in die Beschreibung ein, hänge Dateien an und klicke auf „Submit new issue“.", + "rep.copied": "In die Zwischenablage kopiert.", }; export default de; diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index 37fef66..9a7ecef 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -662,6 +662,39 @@ const en = { "acc.passwordChanged": "The password of {name} was changed.", "acc.renamed": "{name} is now called {new}.", "acc.accessChanged": "{name} is now: {level}.", + + // Problem report (GitHub issue) + "nav.report": "Report a problem", + "q.report": "Something not working?", + "rep.title": "Report a problem", + "rep.intro": "Describe what went wrong. The Manager prepares a bug report for GitHub from this and opens it in your browser; you read it, add screenshots and press Submit there. You need a free GitHub account. Nothing is sent from this window.", + "rep.autoTitle": "Filled in automatically", + "rep.manager": "Manager version", + "rep.windows": "Windows version", + "rep.kind": "Server", + "rep.kindNew": "Fresh install", + "rep.kindImported": "Imported server", + "rep.server": "Server version", + "rep.summary": "Short summary", + "rep.summaryHint": "For example: stuck on the loading screen after creating a character", + "rep.what": "What happened?", + "rep.whatHint": "Describe the problem.", + "rep.expected": "What did you expect to happen?", + "rep.expectedHint": "Describe the expected behaviour.", + "rep.steps": "Steps to reproduce", + "rep.attachTitle": "Logs and screenshots", + "rep.attachText": "Create a diagnostics file (settings and logs with passwords and addresses removed) and drag it, together with any screenshot or video, into the GitHub page once it is open.", + "rep.makeFile": "Create the diagnostics file", + "rep.fileSaved": "Saved to {path}. Drag this file into the GitHub issue.", + "rep.privacy": "Please remove passwords, tokens, private IP information or other sensitive data before posting logs.", + "rep.open": "Open the report on GitHub", + "rep.copy": "Copy the text", + "rep.preview": "Preview the text", + "rep.needFields": "Fill in the summary and what happened first.", + "rep.githubNote": "The report is written in English so the developers can read it; your own words stay as you typed them.", + "rep.opened": "GitHub was opened in your browser. Check the text, attach files and press Submit new issue.", + "rep.openedLong": "The report is too long for a link, so it was copied to the clipboard. GitHub is open: paste it (Ctrl+V) into the description, attach files and press Submit new issue.", + "rep.copied": "Copied to the clipboard.", } as const; export default en; diff --git a/src/i18n/locales/es.ts b/src/i18n/locales/es.ts index 4cc2856..3c59c12 100644 --- a/src/i18n/locales/es.ts +++ b/src/i18n/locales/es.ts @@ -662,6 +662,39 @@ const es: Partial> = { "acc.passwordChanged": "Se cambió la contraseña de {name}.", "acc.renamed": "{name} ahora se llama {new}.", "acc.accessChanged": "{name} ahora es: {level}.", + + // Problem report (GitHub issue) + "nav.report": "Informar de un problema", + "q.report": "¿Algo no funciona?", + "rep.title": "Informar de un problema", + "rep.intro": "Describe qué salió mal. El Manager prepara con ello un informe de error para GitHub y lo abre en tu navegador; allí lo revisas, añades capturas y lo envías. Necesitas una cuenta gratuita de GitHub. Desde esta ventana no se envía nada.", + "rep.autoTitle": "Se rellena automáticamente", + "rep.manager": "Versión del Manager", + "rep.windows": "Versión de Windows", + "rep.kind": "Servidor", + "rep.kindNew": "Instalación nueva", + "rep.kindImported": "Servidor importado", + "rep.server": "Versión del servidor", + "rep.summary": "Resumen breve", + "rep.summaryHint": "Por ejemplo: pantalla de carga atascada tras crear un personaje", + "rep.what": "¿Qué pasó?", + "rep.whatHint": "Describe el problema.", + "rep.expected": "¿Qué esperabas que pasara?", + "rep.expectedHint": "Describe el comportamiento esperado.", + "rep.steps": "Pasos para reproducirlo", + "rep.attachTitle": "Registros y capturas", + "rep.attachText": "Crea un archivo de diagnóstico (ajustes y registros sin contraseñas ni direcciones) y arrástralo, junto con capturas o vídeos, a la página de GitHub cuando se abra.", + "rep.makeFile": "Crear el archivo de diagnóstico", + "rep.fileSaved": "Guardado en {path}. Arrastra este archivo al issue de GitHub.", + "rep.privacy": "Elimina contraseñas, tokens, información de IP privada y otros datos sensibles antes de publicar registros.", + "rep.open": "Abrir el informe en GitHub", + "rep.copy": "Copiar el texto", + "rep.preview": "Ver el texto", + "rep.needFields": "Rellena primero el resumen y «¿Qué pasó?».", + "rep.githubNote": "El informe está en inglés para que los desarrolladores puedan leerlo; tus propias palabras se quedan como las escribiste.", + "rep.opened": "GitHub se abrió en tu navegador. Revisa el texto, adjunta archivos y pulsa «Submit new issue».", + "rep.openedLong": "El informe es demasiado largo para un enlace, así que se copió al portapapeles. GitHub está abierto: pégalo (Ctrl+V) en la descripción, adjunta archivos y pulsa «Submit new issue».", + "rep.copied": "Copiado al portapapeles.", }; export default es; diff --git a/src/i18n/locales/fr.ts b/src/i18n/locales/fr.ts index c6bb11b..3560796 100644 --- a/src/i18n/locales/fr.ts +++ b/src/i18n/locales/fr.ts @@ -662,6 +662,39 @@ const fr: Partial> = { "acc.passwordChanged": "Le mot de passe de {name} a été modifié.", "acc.renamed": "{name} s’appelle maintenant {new}.", "acc.accessChanged": "{name} est maintenant : {level}.", + + // Problem report (GitHub issue) + "nav.report": "Signaler un problème", + "q.report": "Quelque chose ne marche pas ?", + "rep.title": "Signaler un problème", + "rep.intro": "Décrivez ce qui s’est mal passé. Le Manager en prépare un rapport de bug pour GitHub et l’ouvre dans votre navigateur ; vous le relisez, ajoutez des captures d’écran et l’envoyez là-bas. Un compte GitHub gratuit est nécessaire. Rien n’est envoyé depuis cette fenêtre.", + "rep.autoTitle": "Rempli automatiquement", + "rep.manager": "Version du Manager", + "rep.windows": "Version de Windows", + "rep.kind": "Serveur", + "rep.kindNew": "Nouvelle installation", + "rep.kindImported": "Serveur importé", + "rep.server": "Version du serveur", + "rep.summary": "Résumé court", + "rep.summaryHint": "Par exemple : écran de chargement bloqué après la création d’un personnage", + "rep.what": "Que s’est-il passé ?", + "rep.whatHint": "Décrivez le problème.", + "rep.expected": "Qu’attendiez-vous ?", + "rep.expectedHint": "Décrivez le comportement attendu.", + "rep.steps": "Étapes pour reproduire", + "rep.attachTitle": "Journaux et captures d’écran", + "rep.attachText": "Créez un fichier de diagnostic (réglages et journaux sans mots de passe ni adresses) et glissez-le, avec vos captures ou vidéos, sur la page GitHub une fois ouverte.", + "rep.makeFile": "Créer le fichier de diagnostic", + "rep.fileSaved": "Enregistré dans {path}. Glissez ce fichier dans l’issue GitHub.", + "rep.privacy": "Veuillez retirer les mots de passe, jetons, adresses IP privées et autres données sensibles avant de publier des journaux.", + "rep.open": "Ouvrir le rapport sur GitHub", + "rep.copy": "Copier le texte", + "rep.preview": "Aperçu du texte", + "rep.needFields": "Remplissez d’abord le résumé et « Que s’est-il passé ? ».", + "rep.githubNote": "Le rapport est rédigé en anglais pour que les développeurs puissent le lire ; vos propres mots restent tels que vous les avez écrits.", + "rep.opened": "GitHub s’est ouvert dans votre navigateur. Vérifiez le texte, joignez les fichiers et appuyez sur « Submit new issue ».", + "rep.openedLong": "Le rapport est trop long pour un lien : il a été copié dans le presse-papiers. GitHub est ouvert : collez-le (Ctrl+V) dans la description, joignez les fichiers et appuyez sur « Submit new issue ».", + "rep.copied": "Copié dans le presse-papiers.", }; export default fr; diff --git a/src/i18n/locales/ru.ts b/src/i18n/locales/ru.ts index 975e34c..33f747c 100644 --- a/src/i18n/locales/ru.ts +++ b/src/i18n/locales/ru.ts @@ -662,6 +662,39 @@ const ru: Partial> = { "acc.passwordChanged": "Пароль {name} изменён.", "acc.renamed": "{name} теперь называется {new}.", "acc.accessChanged": "{name}: теперь {level}.", + + // Problem report (GitHub issue) + "nav.report": "Сообщить о проблеме", + "q.report": "Что-то не работает?", + "rep.title": "Сообщить о проблеме", + "rep.intro": "Опишите, что пошло не так. Менеджер подготовит по этому отчёт об ошибке для GitHub и откроет его в браузере; вы прочитаете его, добавите скриншоты и нажмёте «Submit» уже там. Нужен бесплатный аккаунт GitHub. Из этого окна ничего не отправляется.", + "rep.autoTitle": "Заполняется автоматически", + "rep.manager": "Версия менеджера", + "rep.windows": "Версия Windows", + "rep.kind": "Сервер", + "rep.kindNew": "Новая установка", + "rep.kindImported": "Импортированный сервер", + "rep.server": "Версия сервера", + "rep.summary": "Краткое описание", + "rep.summaryHint": "Например: завис экран загрузки после создания персонажа", + "rep.what": "Что произошло?", + "rep.whatHint": "Опишите проблему.", + "rep.expected": "Что вы ожидали?", + "rep.expectedHint": "Опишите ожидаемое поведение.", + "rep.steps": "Как воспроизвести", + "rep.attachTitle": "Логи и скриншоты", + "rep.attachText": "Создайте файл диагностики (настройки и логи без паролей и адресов) и перетащите его вместе со скриншотами или видео на страницу GitHub, когда она откроется.", + "rep.makeFile": "Создать файл диагностики", + "rep.fileSaved": "Сохранено: {path}. Перетащите этот файл в issue на GitHub.", + "rep.privacy": "Перед публикацией логов удалите пароли, токены, частные IP-адреса и другие личные данные.", + "rep.open": "Открыть отчёт на GitHub", + "rep.copy": "Копировать текст", + "rep.preview": "Показать текст отчёта", + "rep.needFields": "Сначала заполните краткое описание и «Что произошло?».", + "rep.githubNote": "Шаблон отчёта на английском, чтобы его мог прочитать разработчик; ваши формулировки остаются как вы их написали.", + "rep.opened": "GitHub открыт в браузере. Проверьте текст, прикрепите файлы и нажмите «Submit new issue».", + "rep.openedLong": "Отчёт слишком длинный для ссылки, поэтому он скопирован в буфер обмена. GitHub открыт: вставьте текст (Ctrl+V) в описание, прикрепите файлы и нажмите «Submit new issue».", + "rep.copied": "Скопировано в буфер обмена.", }; export default ru; diff --git a/src/lib/api.ts b/src/lib/api.ts index 3d1c91a..8478dc0 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -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("restore_backup_database", { id, backupId, database }), installPreflight: (dest: string, needed?: number) => invoke("install_preflight", { dest, needed: needed ?? null }), installRequirements: (pkg?: string) => invoke("install_requirements", { package: pkg ?? null }), + reportContext: (id: string) => invoke("report_context", { id }), listAccounts: (id: string) => invoke("list_accounts", { id }), accountSetPassword: (id: string, name: string, password: string) => invoke("account_set_password", { id, name, password }), accountSetAccess: (id: string, name: string, level: number) => invoke("account_set_access", { id, name, level }), diff --git a/src/lib/report.ts b/src/lib/report.ts new file mode 100644 index 0000000..bbdd3c0 --- /dev/null +++ b/src/lib/report.ts @@ -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; diff --git a/src/screens/ReportPage.tsx b/src/screens/ReportPage.tsx new file mode 100644 index 0000000..65da14e --- /dev/null +++ b/src/screens/ReportPage.tsx @@ -0,0 +1,150 @@ +import { useEffect, useMemo, useState } from "react"; +import { Loader2 } from "lucide-react"; +import { api, asUiError, type ReportContext, type UiError } from "@/lib/api"; +import { MAX_LINK, issueUrl, reportBody } from "@/lib/report"; +import { Button } from "@/components/ui/button"; +import { Card } from "@/components/ui/card"; +import { useHuman, useT } from "@/i18n"; + +const field = "mt-1 block w-full rounded-md border border-line bg-bg px-3 py-2.5 text-[15px] outline-none focus:border-gold"; + +/** A problem report that becomes a prefilled GitHub issue. Nothing is sent from here: the person reviews and submits it on GitHub. */ +export function ReportPage({ serverId }: { serverId: string }) { + const t = useT(); + const human = useHuman(); + const [ctx, setCtx] = useState(null); + const [title, setTitle] = useState(""); + const [what, setWhat] = useState(""); + const [expected, setExpected] = useState(""); + const [steps, setSteps] = useState(""); + const [file, setFile] = useState(null); + const [busy, setBusy] = useState(false); + const [note, setNote] = useState(null); + const [error, setError] = useState(null); + const [showPreview, setShowPreview] = useState(false); + + useEffect(() => { + void api.reportContext(serverId).then(setCtx).catch(() => setCtx(null)); + }, [serverId]); + + const body = useMemo( + () => + reportBody({ + managerVersion: ctx?.manager_version ?? "", + windows: ctx?.windows ?? "", + installKind: ctx?.install_kind ?? "new", + serverVersion: ctx?.server_version ?? null, + what, + expected, + steps, + diagnostics: file !== null, + }), + [ctx, what, expected, steps, file], + ); + const issueTitle = `[Bug] ${title.trim()}`; + const ready = title.trim().length > 0 && what.trim().length > 0; + + async function makeFile() { + setBusy(true); + setError(null); + try { + setFile(await api.exportDiagnostics(serverId)); + } catch (e) { + setError(asUiError(e)); + } finally { + setBusy(false); + } + } + + async function openIssue() { + setError(null); + setNote(null); + try { + const full = issueUrl(issueTitle, body); + if (full.length <= MAX_LINK) { + await api.openLink(full); + setNote(t("rep.opened")); + } else { + await navigator.clipboard.writeText(body); + await api.openLink(issueUrl(issueTitle, "Paste the report text here (it was copied to the clipboard by CoA Server Manager).")); + setNote(t("rep.openedLong")); + } + } catch (e) { + setError(asUiError(e)); + } + } + + async function copy() { + await navigator.clipboard.writeText(`${issueTitle}\n\n${body}`); + setNote(t("rep.copied")); + } + + return ( +
+

{t("rep.title")}

+

{t("q.report")}

+

{t("rep.intro")}

+ + +

{t("rep.autoTitle")}

+
+
{t("rep.manager")}
+
{ctx?.manager_version ?? "…"}
+
{t("rep.windows")}
+
{ctx ? ctx.windows || "—" : "…"}
+
{t("rep.kind")}
+
{ctx ? (ctx.install_kind === "new" ? t("rep.kindNew") : t("rep.kindImported")) : "…"}
+ {ctx?.server_version && ( + <> +
{t("rep.server")}
+
{ctx.server_version}
+ + )} +
+
+ + +
+ + setTitle(e.target.value)} placeholder={t("rep.summaryHint")} /> +
+
+ +