diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 40b1a4d..2ee80e2 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -2976,10 +2976,28 @@ async fn preview_build_module( found.ok_or_else(|| coa_core::Error::Invalid("Failed to locate cached repository sources after intake".into()))? } else { let p = PathBuf::from(&source_url_or_path); - if !p.exists() { + if p.exists() { + p + } else if source_url_or_path.len() >= 7 && source_url_or_path.chars().all(|c| c.is_ascii_hexdigit()) { + // Defensive fallback: search github cache for this digest folder + let mut found = None; + if let Ok(entries) = std::fs::read_dir(cache_dir.join("github")) { + 'outer: for owner_entry in entries.flatten() { + if let Ok(repo_entries) = std::fs::read_dir(owner_entry.path()) { + for repo_entry in repo_entries.flatten() { + let candidate = repo_entry.path().join(&source_url_or_path); + if candidate.is_dir() && candidate.join(".coa_tree_digest").is_file() { + found = Some(candidate); + break 'outer; + } + } + } + } + } + found.ok_or_else(|| coa_core::Error::Invalid(format!("Source path '{}' does not exist", p.display())))? + } else { return Err(coa_core::Error::Invalid(format!("Source path '{}' does not exist", p.display()))); } - p }; coa_core::build_engine::build_module_from_source(&source_dir, &realm_root, None, None) diff --git a/src/screens/ModulesPage.tsx b/src/screens/ModulesPage.tsx index 940dedd..481f7bd 100644 --- a/src/screens/ModulesPage.tsx +++ b/src/screens/ModulesPage.tsx @@ -806,7 +806,7 @@ export function ModulesPage({ } async function startControlledBuild(urlToBuildParam?: string) { - const target = (urlToBuildParam || (report ? report.repository_name : githubUrl)).trim(); + const target = (urlToBuildParam || githubUrl || report?.repository_path || "").trim(); if (!target) return; setBuilding(true); setActiveTab("builds"); @@ -1957,10 +1957,10 @@ export function ModulesPage({ setActiveTab("installed"); setOpenSettings("custom-races"); }} - className="text-xs h-7 px-3" + className="text-xs h-7 px-3 bg-gradient-to-r from-amber-500 to-yellow-600 hover:from-amber-600 hover:to-yellow-700 text-black font-medium" > - - {locale === "ru" ? "Настроить расы" : "Configure Races"} + + {locale === "ru" ? "Установить патч" : "Install Patch"} ) : (