mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-20 11:25:56 +00:00
Collect all diagnostics in one click and route reports to the right project
- The diagnostic package now also holds crash reports and small crash dumps from Core/Crashes, Windows' own crash records for the server programs (needed for crashes that bypass the server's crash handler), the newest update journals, the bot, supervisor and updater logs, and a view of which server programs run and from where. The folder with the file opens after export. - JSON files in the package keep valid JSON after secrets are removed. - The problem report asks what the problem is about and opens the new-issue page of the Manager, CoA Companions or SQUID Playerbots, preselecting the bot system that is switched on. One button collects diagnostics and opens the report. - Targets come from the module catalog; only their new-issue pages may be opened. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3f700ee8f4
commit
b3c50a7b39
20 files changed
+637
-58
No files matched your search
+20
-4
@@ -1265,10 +1265,9 @@ 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/", "https://github.com/Corfirean/"];
|
||||
// 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}?"));
|
||||
// A prefilled "new issue" page of one of the places a report can go (the Manager, Companions, SQUID Playerbots): the
|
||||
// address must be exactly that page, and its query may carry `&` between the (percent-encoded) title and text.
|
||||
let issue = coa_core::report::is_new_issue_url(&url);
|
||||
let chars_ok = url.chars().all(|c| c.is_ascii_alphanumeric() || "/:._-?=#%".contains(c) || (issue && c == '&'));
|
||||
// the GitHub page of a module that is in the bundled catalog (some are not ours)
|
||||
let catalog = coa_core::modules::catalog().iter().any(|e| e.repo == url);
|
||||
@@ -1286,6 +1285,16 @@ struct ReportContext {
|
||||
/// "new" for a server the Manager installed, "imported" for one that was added.
|
||||
install_kind: String,
|
||||
server_version: Option<String>,
|
||||
/// Where the form should start: the bot system that is switched on, else the Manager.
|
||||
suggested_target: String,
|
||||
/// The release of whichever bot system is on, for a report that goes to its repository.
|
||||
bots_version: Option<String>,
|
||||
}
|
||||
|
||||
/// The places a report can go, each with its GitHub repository.
|
||||
#[tauri::command]
|
||||
fn report_targets() -> Vec<coa_core::report::Target> {
|
||||
coa_core::report::targets()
|
||||
}
|
||||
|
||||
/// "Windows 11 (build 26200)" from `ver`; empty if it cannot be read.
|
||||
@@ -1312,11 +1321,15 @@ async fn report_context(state: State<'_, AppState>, id: String) -> std::result::
|
||||
let root = path_of(&state, &id)?;
|
||||
blocking(move || {
|
||||
let (_, meta) = install_meta(&root)?;
|
||||
let bots = coa_core::report::bots(&root);
|
||||
let companions = [meta.bots.version.clone(), meta.bots.commit.as_ref().map(|c| c.chars().take(8).collect())].into_iter().flatten().collect::<Vec<String>>().join(" · ");
|
||||
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(),
|
||||
suggested_target: bots.suggested.to_string(),
|
||||
bots_version: if bots.suggested == "squid" { bots.squid_version } else if bots.suggested == "companions" && !companions.is_empty() { Some(companions) } else { None },
|
||||
})
|
||||
})
|
||||
.await
|
||||
@@ -1470,6 +1483,8 @@ async fn export_diagnostics(state: State<'_, AppState>, id: String) -> std::resu
|
||||
let report = coa_core::diag::run(&root, &meta);
|
||||
let out = coa_core::diag::desktop_or_temp().join(format!("CoA-Diagnostics-{}.zip", coa_core::diag::stamp()));
|
||||
coa_core::diag::export_package(&root, &dir, &data_dir().join("logs").join("manager.log"), &meta, &report, &out)?;
|
||||
// Show the file in its folder so nobody has to look for it; failing to open the folder is not a failure.
|
||||
let _ = tauri_plugin_opener::reveal_item_in_dir(&out);
|
||||
Ok(out.to_string_lossy().into_owned())
|
||||
})
|
||||
.await
|
||||
@@ -1579,6 +1594,7 @@ pub fn run() {
|
||||
companions_delete_all,
|
||||
companions_despawn_some,
|
||||
open_link,
|
||||
report_targets,
|
||||
companion_sizes,
|
||||
add_companions,
|
||||
remote_connection,
|
||||
|
||||
Reference in new issue
Block a user