mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-21 11:25:56 +00:00
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:
1 parent
a4c1080575
commit
a79c26ed49
11 files changed
+445
-3
No files matched your search
@@ -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;}
|
||||
|
||||
@@ -662,6 +662,39 @@ const de: Partial<Record<keyof typeof en, string>> = {
|
||||
"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;
|
||||
@@ -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;
|
||||
@@ -662,6 +662,39 @@ const es: Partial<Record<keyof typeof en, string>> = {
|
||||
"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;
|
||||
@@ -662,6 +662,39 @@ const fr: Partial<Record<keyof typeof en, string>> = {
|
||||
"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;
|
||||
@@ -662,6 +662,39 @@ const ru: Partial<Record<keyof typeof en, string>> = {
|
||||
"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;
|
||||
@@ -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 }),
|
||||
|
||||
@@ -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;
|
||||
@@ -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<ReportContext | null>(null);
|
||||
const [title, setTitle] = useState("");
|
||||
const [what, setWhat] = useState("");
|
||||
const [expected, setExpected] = useState("");
|
||||
const [steps, setSteps] = useState("");
|
||||
const [file, setFile] = useState<string | null>(null);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [note, setNote] = useState<string | null>(null);
|
||||
const [error, setError] = useState<UiError | null>(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 (
|
||||
<div className="max-w-2xl">
|
||||
<h1 className="text-2xl font-semibold">{t("rep.title")}</h1>
|
||||
<p className="mt-1 text-muted">{t("q.report")}</p>
|
||||
<p className="mt-3 text-sm text-muted">{t("rep.intro")}</p>
|
||||
|
||||
<Card className="mt-6 p-6">
|
||||
<h2 className="font-semibold">{t("rep.autoTitle")}</h2>
|
||||
<dl className="mt-3 grid grid-cols-[auto_1fr] gap-x-6 gap-y-1 text-sm">
|
||||
<dt className="text-muted">{t("rep.manager")}</dt>
|
||||
<dd>{ctx?.manager_version ?? "…"}</dd>
|
||||
<dt className="text-muted">{t("rep.windows")}</dt>
|
||||
<dd>{ctx ? ctx.windows || "—" : "…"}</dd>
|
||||
<dt className="text-muted">{t("rep.kind")}</dt>
|
||||
<dd>{ctx ? (ctx.install_kind === "new" ? t("rep.kindNew") : t("rep.kindImported")) : "…"}</dd>
|
||||
{ctx?.server_version && (
|
||||
<>
|
||||
<dt className="text-muted">{t("rep.server")}</dt>
|
||||
<dd>{ctx.server_version}</dd>
|
||||
</>
|
||||
)}
|
||||
</dl>
|
||||
</Card>
|
||||
|
||||
<Card className="mt-6 p-6">
|
||||
<div>
|
||||
<label htmlFor="rep-title" className="text-sm text-muted">{t("rep.summary")}</label>
|
||||
<input id="rep-title" className={field} value={title} maxLength={100} onChange={(e) => setTitle(e.target.value)} placeholder={t("rep.summaryHint")} />
|
||||
</div>
|
||||
<div className="mt-4">
|
||||
<label htmlFor="rep-what" className="text-sm text-muted">{t("rep.what")}</label>
|
||||
<textarea id="rep-what" rows={4} className={field} value={what} onChange={(e) => setWhat(e.target.value)} placeholder={t("rep.whatHint")} />
|
||||
</div>
|
||||
<div className="mt-4">
|
||||
<label htmlFor="rep-exp" className="text-sm text-muted">{t("rep.expected")}</label>
|
||||
<textarea id="rep-exp" rows={2} className={field} value={expected} onChange={(e) => setExpected(e.target.value)} placeholder={t("rep.expectedHint")} />
|
||||
</div>
|
||||
<div className="mt-4">
|
||||
<label htmlFor="rep-steps" className="text-sm text-muted">{t("rep.steps")}</label>
|
||||
<textarea id="rep-steps" rows={4} className={field} value={steps} onChange={(e) => setSteps(e.target.value)} placeholder={"1.\n2.\n3."} />
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<Card className="mt-6 p-6">
|
||||
<h2 className="font-semibold">{t("rep.attachTitle")}</h2>
|
||||
<p className="mt-1 text-sm text-muted">{t("rep.attachText")}</p>
|
||||
<Button className="mt-3" size="sm" disabled={busy} onClick={() => void makeFile()}>
|
||||
{busy && <Loader2 className="h-4 w-4 animate-spin" aria-hidden />}
|
||||
{t("rep.makeFile")}
|
||||
</Button>
|
||||
{file && <p className="selectable mt-3 break-all text-sm text-ok" role="status">{t("rep.fileSaved", { path: file })}</p>}
|
||||
<p className="mt-4 text-xs text-warn">{t("rep.privacy")}</p>
|
||||
</Card>
|
||||
|
||||
<div className="mt-6 flex flex-wrap items-center gap-3">
|
||||
<Button variant="primary" disabled={!ready} onClick={() => void openIssue()}>{t("rep.open")}</Button>
|
||||
<Button variant="ghost" disabled={!ready} onClick={() => void copy()}>{t("rep.copy")}</Button>
|
||||
<button onClick={() => setShowPreview((v) => !v)} aria-expanded={showPreview} className="cursor-pointer text-sm text-muted underline hover:text-ink">
|
||||
{t("rep.preview")}
|
||||
</button>
|
||||
</div>
|
||||
{!ready && <p className="mt-2 text-xs text-muted">{t("rep.needFields")}</p>}
|
||||
<p className="mt-2 text-xs text-muted">{t("rep.githubNote")}</p>
|
||||
{note && <p className="mt-3 text-sm text-ok" role="status">{note}</p>}
|
||||
{error && <p className="mt-3 text-sm text-bad" role="alert">{error.human.code === "unknown" ? error.technical : human(error.human).message}</p>}
|
||||
{showPreview && <pre className="selectable mt-3 max-h-80 overflow-auto whitespace-pre-wrap rounded bg-black/40 p-3 text-xs text-muted">{`${issueTitle}\n\n${body}`}</pre>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { Archive, Bot, Gauge, Globe, Server, Settings, Terminal, Users, type LucideIcon } from "lucide-react";
|
||||
import { Archive, Bot, Bug, Gauge, Globe, Server, Settings, Terminal, Users, type LucideIcon } from "lucide-react";
|
||||
import { type ServerSummary } from "@/lib/api";
|
||||
import { useT, type Key } from "@/i18n";
|
||||
import logo from "@/assets/logo.png";
|
||||
@@ -11,12 +11,13 @@ import { BackupsPage } from "@/screens/BackupsPage";
|
||||
import { PlayersPage } from "@/screens/PlayersPage";
|
||||
import { SettingsHome } from "@/screens/SettingsHome";
|
||||
import { FriendsPage } from "@/screens/FriendsPage";
|
||||
import { ReportPage } from "@/screens/ReportPage";
|
||||
import { ConsolePage } from "@/screens/ConsolePage";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { startServerUpdatePolling, useServerUpdate } from "@/lib/serverUpdate";
|
||||
import { startClientPolling } from "@/lib/clientUpdate";
|
||||
|
||||
type Page = "overview" | "bots" | "server" | "players" | "friends" | "backups" | "console" | "settings";
|
||||
type Page = "overview" | "bots" | "server" | "players" | "friends" | "backups" | "console" | "report" | "settings";
|
||||
|
||||
const NAV: { id: Page; label: Key; icon: LucideIcon; question: Key }[] = [
|
||||
{ id: "overview", label: "nav.overview", icon: Gauge, question: "q.overview" },
|
||||
@@ -26,6 +27,7 @@ const NAV: { id: Page; label: Key; icon: LucideIcon; question: Key }[] = [
|
||||
{ id: "friends", label: "nav.friends", icon: Globe, question: "q.friends" },
|
||||
{ id: "backups", label: "nav.backups", icon: Archive, question: "q.backups" },
|
||||
{ id: "console", label: "nav.console", icon: Terminal, question: "q.console" },
|
||||
{ id: "report", label: "nav.report", icon: Bug, question: "q.report" },
|
||||
{ id: "settings", label: "nav.settings", icon: Settings, question: "q.settings" },
|
||||
];
|
||||
|
||||
@@ -108,6 +110,8 @@ export function Shell(props: {
|
||||
<SettingsPage key={`${server.id}-${page}`} serverId={server.id} scope={page} title={t(current.label)} question={t(current.question)} />
|
||||
) : page === "console" ? (
|
||||
<ConsolePage key={server.id} serverId={server.id} />
|
||||
) : page === "report" ? (
|
||||
<ReportPage key={server.id} serverId={server.id} />
|
||||
) : page === "friends" ? (
|
||||
<FriendsPage key={server.id} serverId={server.id} />
|
||||
) : page === "settings" ? (
|
||||
|
||||
Reference in new issue
Block a user