fix(catalog): enforce DLL presence for installed status and improve recommended UI

This commit is contained in:
Дмитрий committed 2026-11-03 13:16:04 +05:00
1 parent 86482fe278
commit 4b16157d10
2 files changed
+123 -77

No files matched your search

+39 -11
View File
@@ -247,11 +247,21 @@ fn list_in(cat: &[Entry], root: &Path) -> Vec<ModuleView> {
let plugin_entry = plugin_reg.as_ref().and_then(|r| { let plugin_entry = plugin_reg.as_ref().and_then(|r| {
r.plugins.get(&e.id) r.plugins.get(&e.id)
.or_else(|| r.plugins.get(&e.id.replace('-', "_"))) .or_else(|| r.plugins.get(&e.id.replace('-', "_")))
.or_else(|| r.plugins.get(&format!("mod-{}", e.id)))
.or_else(|| r.plugins.get(&format!("mod-coa-{}", e.id)))
}); });
let dll_present = root.join("plugins").join(format!("{}.dll", e.id)).is_file() let dll_present = root.join("plugins").join(format!("{}.dll", e.id)).is_file()
|| root.join("plugins").join(format!("{}.dll", e.id.replace('-', "_"))).is_file() || root.join("plugins").join(format!("{}.dll", e.id.replace('-', "_"))).is_file()
|| root.join("plugins").join(format!("mod-{}.dll", e.id)).is_file()
|| root.join("plugins").join(format!("mod-{}.dll", e.id.replace('-', "_"))).is_file()
|| root.join("plugins").join(format!("mod-coa-{}.dll", e.id)).is_file()
|| root.join("plugins").join(format!("mod_coa_{}.dll", e.id.replace('-', "_"))).is_file()
|| root.join(".manager/plugins").join(format!("{}.dll", e.id)).is_file() || root.join(".manager/plugins").join(format!("{}.dll", e.id)).is_file()
|| root.join(".manager/plugins").join(format!("{}.dll", e.id.replace('-', "_"))).is_file(); || root.join(".manager/plugins").join(format!("{}.dll", e.id.replace('-', "_"))).is_file()
|| root.join(".manager/plugins").join(format!("mod-{}.dll", e.id)).is_file()
|| root.join(".manager/plugins").join(format!("mod-{}.dll", e.id.replace('-', "_"))).is_file()
|| root.join(".manager/plugins").join(format!("mod-coa-{}.dll", e.id)).is_file()
|| root.join(".manager/plugins").join(format!("mod_coa_{}.dll", e.id.replace('-', "_"))).is_file();
let is_dynamic = plugin_entry.is_some() || dll_present; let is_dynamic = plugin_entry.is_some() || dll_present;
// 2. Classify ComponentType and determine installation strictly // 2. Classify ComponentType and determine installation strictly
@@ -265,16 +275,20 @@ fn list_in(cat: &[Entry], root: &Path) -> Vec<ModuleView> {
|| root.join("Data/enUS/patch-enUS-4.mpq").is_file(); || root.join("Data/enUS/patch-enUS-4.mpq").is_file();
(ComponentType::ClientPatch, has_patch, true) (ComponentType::ClientPatch, has_patch, true)
} else if matches!(e.id.as_str(), "tbc-content" | "wotlk-content") { } else if matches!(e.id.as_str(), "tbc-content" | "wotlk-content") {
let scaling_entry = cat.iter().find(|entry| entry.id == "content-scaling"); let is_scaling_installed = {
let is_scaling_installed = scaling_entry.map(|se| { let se_plugin = plugin_reg.as_ref().and_then(|r| {
let sc_name = conf_name(root, se); r.plugins.get("content-scaling")
let sc_conf = dir(root).join(&sc_name); .or_else(|| r.plugins.get("content_scaling"))
let sc_dist = dir(root).join(format!("{sc_name}.dist")); .or_else(|| r.plugins.get("mod-coa-content-scaling"))
sc_conf.is_file() || sc_dist.is_file() || installed_commits.contains_key("scaling") });
let se_dll = root.join("plugins").join("content-scaling.dll").is_file()
|| root.join("plugins").join("content_scaling.dll").is_file()
|| root.join("plugins").join("mod-coa-content-scaling.dll").is_file() || root.join("plugins").join("mod-coa-content-scaling.dll").is_file()
|| root.join(".manager/plugins").join("mod-coa-content-scaling.dll").is_file() || root.join("plugins").join("mod_coa_content_scaling.dll").is_file()
|| plugin_reg.as_ref().map(|r| r.plugins.contains_key("content-scaling")).unwrap_or(false) || root.join(".manager/plugins").join("content-scaling.dll").is_file()
}).unwrap_or(false); || root.join(".manager/plugins").join("mod-coa-content-scaling.dll").is_file();
se_plugin.is_some() || se_dll || (!is_modular_host && installed_commits.contains_key("scaling"))
};
let has_content = is_scaling_installed && (conf.is_file() || dist.is_file()); let has_content = is_scaling_installed && (conf.is_file() || dist.is_file());
(ComponentType::ContentPack, has_content, false) (ComponentType::ContentPack, has_content, false)
@@ -300,10 +314,24 @@ fn list_in(cat: &[Entry], root: &Path) -> Vec<ModuleView> {
.unwrap_or(false); .unwrap_or(false);
// the active file or plugin registry decides enabled state // the active file or plugin registry decides enabled state
let enabled = if let Some(p) = plugin_entry { let enabled = if !installed {
false
} else if let Some(p) = plugin_entry {
p.enabled p.enabled
} else if matches!(e.id.as_str(), "companions" | "playerbots") { } else if matches!(e.id.as_str(), "companions" | "playerbots") {
bot_enabled(root, &e).unwrap_or(true) bot_enabled(root, &e).unwrap_or(true)
} else if matches!(e.id.as_str(), "tbc-content" | "wotlk-content") {
let sc_entry = cat.iter().find(|entry| entry.id == "content-scaling");
let sc_conf = sc_entry.map(|se| dir(root).join(conf_name(root, se)));
let sc_enabled = sc_conf
.and_then(|p| read(&p))
.and_then(|c| c.get("CoAContentScaling.Enable").map(truthy))
.unwrap_or(true);
sc_enabled && read(&conf)
.or_else(|| read(&dist))
.and_then(|c| c.get(&e.enable_key).map(truthy))
.unwrap_or(e.default_on)
} else { } else {
!e.switchable !e.switchable
|| read(&conf) || read(&conf)
+84 -66
View File
@@ -139,7 +139,7 @@ interface VerifiedCatalogModule {
repo: string; repo: string;
category: "official" | "utility" | "economy" | "social" | "profession" | "scaling"; category: "official" | "utility" | "economy" | "social" | "profession" | "scaling";
description: { ru: string; en: string }; description: { ru: string; en: string };
qualification: "OFFICIAL_CORE" | "INSTALL_VERIFIED" | "LINK_VERIFIED" | "BUILT"; qualification: "OPTIMIZED_COA" | "OFFICIAL_CORE" | "INSTALL_VERIFIED" | "LINK_VERIFIED" | "BUILT";
tier: string; tier: string;
verificationLevel: string; verificationLevel: string;
notes: { ru: string; en: string }; notes: { ru: string; en: string };
@@ -177,7 +177,7 @@ function cleanModuleName(name: string, id: string): string {
} }
const VERIFIED_CATALOG: VerifiedCatalogModule[] = [ const VERIFIED_CATALOG: VerifiedCatalogModule[] = [
// Official Core Modules // Optimized CoA Modules
{ {
id: "companions", id: "companions",
name: "CoA Companions", name: "CoA Companions",
@@ -187,12 +187,12 @@ const VERIFIED_CATALOG: VerifiedCatalogModule[] = [
ru: "Боты-компаньоны для групп, подземелий и гильдии.", ru: "Боты-компаньоны для групп, подземелий и гильдии.",
en: "Companion bots for groups, dungeons and your guild.", en: "Companion bots for groups, dungeons and your guild.",
}, },
qualification: "OFFICIAL_CORE", qualification: "OPTIMIZED_COA",
tier: "Core Module", tier: "Tier 1: Dynamic DLL",
verificationLevel: "PRODUCTION_SUPPORTED", verificationLevel: "PRODUCTION_SUPPORTED",
notes: { notes: {
ru: "Встроенный официальный модуль сервера. Взаимоисключение со SQUID's Playerbots.", ru: "Оптимизированный модуль ботов-компаньонов для сервера. Взаимоисключение со SQUID's Playerbots.",
en: "Official built-in server module. Mutually exclusive with Playerbots.", en: "Optimized companion bots module for server. Mutually exclusive with Playerbots.",
}, },
sqlRequired: false, sqlRequired: false,
canInstall: true, canInstall: true,
@@ -208,12 +208,12 @@ const VERIFIED_CATALOG: VerifiedCatalogModule[] = [
ru: "Подстраивает подземелья и рейды под вашу группу, есть соло-режимы.", ru: "Подстраивает подземелья и рейды под вашу группу, есть соло-режимы.",
en: "Scales dungeons and raids to your group, with solo modes.", en: "Scales dungeons and raids to your group, with solo modes.",
}, },
qualification: "OFFICIAL_CORE", qualification: "OPTIMIZED_COA",
tier: "Core Module", tier: "Tier 1: Dynamic DLL",
verificationLevel: "PRODUCTION_SUPPORTED", verificationLevel: "PRODUCTION_SUPPORTED",
notes: { notes: {
ru: "Встроенный официальный модуль динамического масштабирования подземелий.", ru: "Оптимизированный модуль динамического масштабирования подземелий.",
en: "Official built-in dynamic dungeon scaling module.", en: "Optimized dynamic dungeon scaling module.",
}, },
sqlRequired: false, sqlRequired: false,
canInstall: true, canInstall: true,
@@ -229,12 +229,12 @@ const VERIFIED_CATALOG: VerifiedCatalogModule[] = [
ru: "Подземелья и рейды Запределья, подогнанные под ваши уровни.", ru: "Подземелья и рейды Запределья, подогнанные под ваши уровни.",
en: "Outland dungeons and raids, scaled to your level range.", en: "Outland dungeons and raids, scaled to your level range.",
}, },
qualification: "OFFICIAL_CORE", qualification: "OPTIMIZED_COA",
tier: "Core Module", tier: "Content Pack",
verificationLevel: "PRODUCTION_SUPPORTED", verificationLevel: "PRODUCTION_SUPPORTED",
notes: { notes: {
ru: "Встроенный пакет контента Burning Crusade.", ru: "Оптимизированный пакет контента Burning Crusade для Content Scaling.",
en: "Built-in Burning Crusade content pack.", en: "Optimized Burning Crusade content pack for Content Scaling.",
}, },
sqlRequired: false, sqlRequired: false,
canInstall: true, canInstall: true,
@@ -250,12 +250,12 @@ const VERIFIED_CATALOG: VerifiedCatalogModule[] = [
ru: "Подземелья и рейды Нордскола, подогнанные под ваши уровни.", ru: "Подземелья и рейды Нордскола, подогнанные под ваши уровни.",
en: "Northrend dungeons and raids, scaled to your level range.", en: "Northrend dungeons and raids, scaled to your level range.",
}, },
qualification: "OFFICIAL_CORE", qualification: "OPTIMIZED_COA",
tier: "Core Module", tier: "Content Pack",
verificationLevel: "PRODUCTION_SUPPORTED", verificationLevel: "PRODUCTION_SUPPORTED",
notes: { notes: {
ru: "Встроенный пакет контента Wrath of the Lich King.", ru: "Оптимизированный пакет контента Wrath of the Lich King для Content Scaling.",
en: "Built-in Wrath of the Lich King content pack.", en: "Optimized Wrath of the Lich King content pack for Content Scaling.",
}, },
sqlRequired: false, sqlRequired: false,
canInstall: true, canInstall: true,
@@ -271,12 +271,12 @@ const VERIFIED_CATALOG: VerifiedCatalogModule[] = [
ru: "Альтернативная система ботов со случайными ботами и полным ИИ.", ru: "Альтернативная система ботов со случайными ботами и полным ИИ.",
en: "An alternative bot system with random bots and full AI.", en: "An alternative bot system with random bots and full AI.",
}, },
qualification: "OFFICIAL_CORE", qualification: "OPTIMIZED_COA",
tier: "Core Module", tier: "Tier 1: Dynamic DLL",
verificationLevel: "PRODUCTION_SUPPORTED", verificationLevel: "PRODUCTION_SUPPORTED",
notes: { notes: {
ru: "Встроенная система случайных ботов SQUID. Взаимоисключение с CoA Companions.", ru: "Оптимизированная система случайных ботов SQUID. Взаимоисключение с CoA Companions.",
en: "Built-in SQUID random bots system. Mutually exclusive with CoA Companions.", en: "Optimized SQUID random bots system. Mutually exclusive with CoA Companions.",
}, },
sqlRequired: true, sqlRequired: true,
canInstall: true, canInstall: true,
@@ -292,12 +292,12 @@ const VERIFIED_CATALOG: VerifiedCatalogModule[] = [
ru: "Пользовательские расы (Esteria и другие) с расширенной внешностью и патчем клиента.", ru: "Пользовательские расы (Esteria и другие) с расширенной внешностью и патчем клиента.",
en: "Playable custom races (Esteria and additional races) with extended appearances.", en: "Playable custom races (Esteria and additional races) with extended appearances.",
}, },
qualification: "OFFICIAL_CORE", qualification: "OPTIMIZED_COA",
tier: "Core Module", tier: "Client Patch",
verificationLevel: "PRODUCTION_SUPPORTED", verificationLevel: "PRODUCTION_SUPPORTED",
notes: { notes: {
ru: "Встроенный модуль рас. Требуется установка клиентского MPQ-патча.", ru: "Оптимизированный модуль рас CoA. Требуется клиентский MPQ-патч.",
en: "Built-in custom races module. Requires client MPQ patch.", en: "Optimized CoA custom races module. Requires client MPQ patch.",
}, },
sqlRequired: true, sqlRequired: true,
canInstall: true, canInstall: true,
@@ -313,12 +313,12 @@ const VERIFIED_CATALOG: VerifiedCatalogModule[] = [
ru: "Настройка скорости смены дня и ночи и начального времени игрового мира.", ru: "Настройка скорости смены дня и ночи и начального времени игрового мира.",
en: "Adjust the day and night cycle speed and starting game time.", en: "Adjust the day and night cycle speed and starting game time.",
}, },
qualification: "OFFICIAL_CORE", qualification: "OPTIMIZED_COA",
tier: "Core Module", tier: "Tier 1: Dynamic DLL",
verificationLevel: "PRODUCTION_SUPPORTED", verificationLevel: "PRODUCTION_SUPPORTED",
notes: { notes: {
ru: "Встроенный модуль синхронизации игрового времени с сервером.", ru: "Оптимизированный модуль синхронизации игрового времени с сервером.",
en: "Built-in world time synchronization module.", en: "Optimized world time synchronization module.",
}, },
sqlRequired: false, sqlRequired: false,
canInstall: true, canInstall: true,
@@ -356,12 +356,12 @@ const VERIFIED_CATALOG: VerifiedCatalogModule[] = [
ru: "Наполняет аукцион реалистичными настраиваемыми лотами.", ru: "Наполняет аукцион реалистичными настраиваемыми лотами.",
en: "Fills the auction house with realistic, adjustable listings.", en: "Fills the auction house with realistic, adjustable listings.",
}, },
qualification: "OFFICIAL_CORE", qualification: "OPTIMIZED_COA",
tier: "Core Module", tier: "Tier 1: Dynamic DLL",
verificationLevel: "PRODUCTION_SUPPORTED", verificationLevel: "PRODUCTION_SUPPORTED",
notes: { notes: {
ru: "Встроенный официальный модуль аукциона виртуальных персонажей.", ru: "Оптимизированный модуль аукциона виртуальных персонажей для CoA.",
en: "Built-in official virtual characters auction house module.", en: "Optimized virtual characters auction house module for CoA.",
}, },
sqlRequired: false, sqlRequired: false,
canInstall: true, canInstall: true,
@@ -397,12 +397,12 @@ const VERIFIED_CATALOG: VerifiedCatalogModule[] = [
ru: "НПС, который зачаровывает ваше снаряжение.", ru: "НПС, который зачаровывает ваше снаряжение.",
en: "An NPC that enchants your gear for you.", en: "An NPC that enchants your gear for you.",
}, },
qualification: "OFFICIAL_CORE", qualification: "OPTIMIZED_COA",
tier: "Core Module", tier: "Tier 1: Dynamic DLL",
verificationLevel: "PRODUCTION_SUPPORTED", verificationLevel: "PRODUCTION_SUPPORTED",
notes: { notes: {
ru: "Встроенный официальный модуль зачарования экипировки у НПС.", ru: "Оптимизированный модуль зачарования экипировки у НПС для CoA.",
en: "Built-in official NPC equipment enchanting module.", en: "Optimized NPC equipment enchanting module for CoA.",
}, },
sqlRequired: false, sqlRequired: false,
canInstall: true, canInstall: true,
@@ -1735,7 +1735,7 @@ export function ModulesPage({
catalogFilter === "official" ? "bg-sky-400 text-black font-semibold" : "bg-black/30 text-muted hover:text-ink" catalogFilter === "official" ? "bg-sky-400 text-black font-semibold" : "bg-black/30 text-muted hover:text-ink"
)} )}
> >
{locale === "ru" ? "Официальные ядра" : "Official Core"} ({VERIFIED_CATALOG.filter((c) => c.isOfficial).length}) {locale === "ru" ? "Оптимизированы" : "Optimized"} ({VERIFIED_CATALOG.filter((c) => c.isOfficial).length})
</button> </button>
<button <button
onClick={() => setCatalogFilter("verified")} onClick={() => setCatalogFilter("verified")}
@@ -1803,14 +1803,14 @@ export function ModulesPage({
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<Star className="h-4 w-4 text-gold fill-gold" /> <Star className="h-4 w-4 text-gold fill-gold" />
<h4 className="text-sm font-semibold text-ink uppercase tracking-wide"> <h4 className="text-sm font-semibold text-ink uppercase tracking-wide">
{locale === "ru" ? "Группа A: Рекомендовано для CoA" : "Group A: Recommended for CoA"} {locale === "ru" ? "Рекомендовано" : "Recommended"}
</h4> </h4>
<span className="rounded-full bg-gold/20 text-gold px-2 py-0.5 text-[11px] font-mono font-medium"> <span className="rounded-full bg-gold/20 text-gold px-2 py-0.5 text-[11px] font-mono font-medium">
{filteredVerifiedCatalog.length} {filteredVerifiedCatalog.length}
</span> </span>
</div> </div>
<span className="text-[11px] text-muted"> <span className="text-[11px] text-muted">
{locale === "ru" ? "Проверенная интеграция и поддержка CoA" : "Verified compatibility with CoA"} {locale === "ru" ? "Проверенная интеграция и оптимизация для CoA" : "Verified compatibility and optimization for CoA"}
</span> </span>
</div> </div>
@@ -1843,9 +1843,9 @@ export function ModulesPage({
{/* Qualification Badges */} {/* Qualification Badges */}
<div className="mt-3 flex flex-wrap items-center gap-1.5 text-[11px]"> <div className="mt-3 flex flex-wrap items-center gap-1.5 text-[11px]">
{item.isOfficial ? ( {item.qualification === "OPTIMIZED_COA" || item.isOfficial ? (
<span className="rounded bg-sky-500/10 text-sky-400 border border-sky-500/30 px-2 py-0.5 font-medium"> <span className="rounded bg-sky-500/10 text-sky-400 border border-sky-500/30 px-2 py-0.5 font-medium">
✓ OFFICIAL_CORE ✓ {locale === "ru" ? "Оптимизировано" : "Optimized"}
</span> </span>
) : item.qualification === "INSTALL_VERIFIED" ? ( ) : item.qualification === "INSTALL_VERIFIED" ? (
<span className="rounded bg-ok/10 text-ok border border-ok/30 px-2 py-0.5 font-medium"> <span className="rounded bg-ok/10 text-ok border border-ok/30 px-2 py-0.5 font-medium">
@@ -1912,32 +1912,50 @@ export function ModulesPage({
{locale === "ru" ? "Настроить" : "Configure"} {locale === "ru" ? "Настроить" : "Configure"}
</Button> </Button>
</div> </div>
) : item.isOfficial ? ( ) : item.id === "tbc-content" || item.id === "wotlk-content" ? (
!isScalingInstalled ? (
<Button
size="sm"
variant="ghost"
disabled
className="text-xs h-7 px-2.5 border border-line text-muted/60 cursor-not-allowed"
>
{locale === "ru" ? "Требуется Content Scaling" : "Requires Content Scaling"}
</Button>
) : (
<Button
size="sm"
variant="primary"
onClick={async () => {
try {
await api.moduleSetEnabled(serverId, item.id, true);
setChanged(true);
await load();
setOpenSettings(item.id);
setActiveTab("installed");
onChanged?.();
} catch (e) {
setError(asUiError(e));
}
}}
className="text-xs h-7 px-3"
>
<Plug className="h-3.5 w-3.5 mr-1" />
{locale === "ru" ? "Включить" : "Enable"}
</Button>
)
) : item.id === "custom-races" ? (
<Button <Button
size="sm" size="sm"
variant="primary" variant="primary"
onClick={async () => { onClick={() => {
try { setActiveTab("installed");
const mod = modules?.find((m) => m.id === item.id); setOpenSettings("custom-races");
if (mod && mod.enabled) {
setOpenSettings(mod.id);
setActiveTab("installed");
return;
}
await api.moduleSetEnabled(serverId, item.id, true);
setChanged(true);
await load();
setOpenSettings(item.id);
setActiveTab("installed");
onChanged?.();
} catch (e) {
setError(asUiError(e));
}
}} }}
className="text-xs h-7 px-3" className="text-xs h-7 px-3"
> >
<Plug className="h-3.5 w-3.5 mr-1" /> <Settings2 className="h-3.5 w-3.5 mr-1" />
{locale === "ru" ? "Включить" : "Enable"} {locale === "ru" ? "Настроить расы" : "Configure Races"}
</Button> </Button>
) : ( ) : (
<Button <Button
@@ -1945,10 +1963,10 @@ export function ModulesPage({
variant="primary" variant="primary"
onClick={async () => { onClick={async () => {
setGithubUrl(item.repo); setGithubUrl(item.repo);
setActiveTab("builds");
await runAnalysis(item.repo); await runAnalysis(item.repo);
await startControlledBuild(item.repo);
}} }}
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"
> >
<Hammer className="h-3.5 w-3.5 mr-1" /> <Hammer className="h-3.5 w-3.5 mr-1" />
{locale === "ru" ? "Собрать и установить" : "Build & Install"} {locale === "ru" ? "Собрать и установить" : "Build & Install"}
@@ -1969,7 +1987,7 @@ export function ModulesPage({
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<Puzzle className="h-4 w-4 text-sky-400" /> <Puzzle className="h-4 w-4 text-sky-400" />
<h4 className="text-sm font-semibold text-ink uppercase tracking-wide"> <h4 className="text-sm font-semibold text-ink uppercase tracking-wide">
{locale === "ru" ? "Группа B: Каталог сообщества AzerothCore" : "Group B: AzerothCore Community Modules"} {locale === "ru" ? "Каталог AzerothCore" : "AzerothCore Catalogue"}
</h4> </h4>
<span className="rounded-full bg-white/10 text-muted px-2 py-0.5 text-[11px] font-mono font-medium"> <span className="rounded-full bg-white/10 text-muted px-2 py-0.5 text-[11px] font-mono font-medium">
{filteredCommunityCatalog.length} {filteredCommunityCatalog.length}