From e8bf35f95da85f9e390464352278a5bb20d7f55f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?=
Date: Tue, 24 Nov 2026 13:54:48 +0500
Subject: [PATCH] Bot deploy shows the module's refusal; modules update only
when the owner asks
- Deploy: a refusal text of the bot module (switched off, rejected, 0 created) is an
error, not a started job; the outdated-module message points to the Modules page.
- Modules: a module whose build differs from the commit the core recommends shows
an Update button. Nothing updates by itself, not even on a core change. Needs the
world stopped, merges the module's settings.
Co-Authored-By: Claude Sonnet 5.5
---
.../20261124-bot-creation-refusal-shown.md | 7 +++
.../20261124-module-update-on-request.md | 7 +++
crates/coa-core/src/error.rs | 2 +-
crates/coa-core/src/modules.rs | 9 +++
crates/coa-core/src/ra.rs | 49 +++++++++++++++
crates/coa-core/src/rebuild.rs | 62 ++++++++++++++++++-
src-tauri/src/lib.rs | 18 ++++++
src/dev/mock.ts | 1 +
src/i18n/locales/de.ts | 7 ++-
src/i18n/locales/en.ts | 7 ++-
src/i18n/locales/es.ts | 7 ++-
src/i18n/locales/fr.ts | 7 ++-
src/i18n/locales/ru.ts | 7 ++-
src/i18n/locales/zh.ts | 7 ++-
src/lib/api.ts | 3 +
src/screens/ModulesPage.tsx | 41 ++++++++++++
16 files changed, 233 insertions(+), 8 deletions(-)
create mode 100644 changelog.d/20261124-bot-creation-refusal-shown.md
create mode 100644 changelog.d/20261124-module-update-on-request.md
diff --git a/changelog.d/20261124-bot-creation-refusal-shown.md b/changelog.d/20261124-bot-creation-refusal-shown.md
new file mode 100644
index 0000000..513dffa
--- /dev/null
+++ b/changelog.d/20261124-bot-creation-refusal-shown.md
@@ -0,0 +1,7 @@
+---
+area: manager
+type: fixed
+audience: admins
+title: Deploying companions shows why the server refused, instead of a bar stuck at 0
+---
+When the bot module refused a Deploy request, the page kept showing "Creating bots 0 / N" forever. It now shows the module's own reply, and the message for an outdated bot module points to the Modules page.
diff --git a/changelog.d/20261124-module-update-on-request.md b/changelog.d/20261124-module-update-on-request.md
new file mode 100644
index 0000000..41d3c38
--- /dev/null
+++ b/changelog.d/20261124-module-update-on-request.md
@@ -0,0 +1,7 @@
+---
+area: manager
+type: added
+audience: admins
+title: Update an installed module to the build your server recommends, when you choose
+---
+The Modules page now says when your server recommends a newer build of an installed module and offers an Update button. Nothing updates on its own, not even with a new server core; the server must be stopped, and the module's settings are kept.
diff --git a/crates/coa-core/src/error.rs b/crates/coa-core/src/error.rs
index 5e648f8..ce3f6d9 100644
--- a/crates/coa-core/src/error.rs
+++ b/crates/coa-core/src/error.rs
@@ -178,7 +178,7 @@ impl ErrorCode {
),
ErrorCode::CompanionCommandUnsupported => (
"This server version can not do that yet",
- "The bot module of this server build has no such command. Update the server, or restart it to stop what is running.",
+ "The bot module on this server is older than this Manager and does not know this command. Update the bot module on the Modules page (or update the server), then restart the world.",
&[ShowDetails],
),
ErrorCode::Unknown => ("Something went wrong", "See the technical details.", &[ShowDetails]),
diff --git a/crates/coa-core/src/modules.rs b/crates/coa-core/src/modules.rs
index 282fb9b..1f50a04 100644
--- a/crates/coa-core/src/modules.rs
+++ b/crates/coa-core/src/modules.rs
@@ -168,6 +168,9 @@ pub struct ModuleView {
pub component_type: ComponentType,
pub can_remove: bool,
pub source_commit: Option,
+ /// A newer build of this module is recommended by the server's core; updating is the owner's choice.
+ #[serde(default)]
+ pub available_commit: Option,
pub part_of: Option,
}
@@ -493,6 +496,7 @@ fn list_in(cat: &[Entry], root: &Path) -> Vec {
component_type,
can_remove,
source_commit,
+ available_commit: None,
part_of: e.part_of,
}
})
@@ -523,6 +527,10 @@ fn list_in(cat: &[Entry], root: &Path) -> Vec {
views[idx].version = Some(plugin_entry.version.clone());
views[idx].component_type = ComponentType::DynamicDll;
views[idx].can_remove = true;
+ if views[idx].source_commit.is_none() {
+ views[idx].source_commit = crate::build_engine::read_build_recipe(root, plugin_id).and_then(|r| r.source_commit);
+ }
+ views[idx].available_commit = crate::rebuild::available_update(root, plugin_id);
continue;
}
@@ -592,6 +600,7 @@ fn list_in(cat: &[Entry], root: &Path) -> Vec {
component_type: ComponentType::DynamicDll,
can_remove: true,
source_commit,
+ available_commit: None,
part_of: None,
});
}
diff --git a/crates/coa-core/src/ra.rs b/crates/coa-core/src/ra.rs
index 2df6d72..98c75e2 100644
--- a/crates/coa-core/src/ra.rs
+++ b/crates/coa-core/src/ra.rs
@@ -286,9 +286,13 @@ impl Ra {
));
}
let out = self.command(&format!("botcmd spawnleveled {count}"))?;
+ if is_unsupported_command(&out) {
+ return Err(Error::CompanionCommandUnsupported);
+ }
if out.to_lowercase().contains("no usable template characters") {
return Err(Error::CompanionTemplatesMissing);
}
+ refused_spawn(&out)?;
Ok(out.lines().last().unwrap_or("").to_string())
}
@@ -318,6 +322,7 @@ impl Ra {
cmd.push_str(&format!(" {c}"));
}
let out = self.bot_command(&cmd)?;
+ refused_spawn(&out)?;
Ok(out.lines().last().unwrap_or("").to_string())
}
@@ -402,6 +407,28 @@ fn is_unsupported_command(out: &str) -> bool {
|| l.contains("unknown command")
}
+/// The bot module answers a request it cannot carry out with an ordinary line of text, not with an error, so the
+/// caller must read it: otherwise the page shows "creating bots" for ever. Returns the module's own words.
+fn refused_spawn(out: &str) -> Result<()> {
+ let l = out.to_lowercase();
+ let refused = l.contains("switched off")
+ || l.contains("rejected")
+ || l.contains("nothing to do")
+ || l.contains("aborting")
+ || l.contains("created and spawned 0 of")
+ || l.contains("giving up");
+ if refused {
+ let line = out
+ .lines()
+ .rev()
+ .find(|x| !x.trim().is_empty())
+ .unwrap_or(out)
+ .trim();
+ return Err(Error::Invalid(format!("The bot module did not create the bots: {line}")));
+ }
+ Ok(())
+}
+
fn first_number(text: &str) -> u32 {
text.split(|c: char| !c.is_ascii_digit())
.find(|t| !t.is_empty())
@@ -625,6 +652,28 @@ AC>";
assert_eq!(h.join().unwrap()[2], "botcmd spawnleveled 50");
}
+ #[test]
+ fn a_refusal_of_the_bot_module_is_an_error_not_a_started_job() {
+ let _lock = serial();
+ for reply in [
+ "BotMgr: companions are switched off (CoaBots.Enable = 0).",
+ "BotMgr: spawncustom rejected: level 60 is above this realm's cap.",
+ "BotMgr: spawncustom created and spawned 0 of 50 bots (level 60, class 0, spec 0).",
+ ] {
+ let (port, h) = fake_ra(reply);
+ let mut ra = Ra::connect_to(port, "u", "p").unwrap();
+ let err = ra.spawn_custom(50, 60, None, None, None).unwrap_err().to_string();
+ assert!(err.contains("did not create"), "{reply}: {err}");
+ drop(ra);
+ h.join().unwrap();
+ }
+ let (port, h) = fake_ra("BotMgr: spawncustom created and spawned 50 of 50 bots (level 60, class 0, spec 0).");
+ let mut ra = Ra::connect_to(port, "u", "p").unwrap();
+ assert!(ra.spawn_custom(50, 60, None, None, None).unwrap().contains("50 of 50"));
+ drop(ra);
+ h.join().unwrap();
+ }
+
#[test]
fn duplicate_account_and_input_validation() {
let _lock = serial();
diff --git a/crates/coa-core/src/rebuild.rs b/crates/coa-core/src/rebuild.rs
index 21577a7..c3fd8ca 100644
--- a/crates/coa-core/src/rebuild.rs
+++ b/crates/coa-core/src/rebuild.rs
@@ -311,7 +311,36 @@ fn install_recommended(realm_root: &Path, progress: &dyn Fn(&str, &str)) -> Vec<
out
}
+/// The commit this core recommends for an installed module when it differs from the one the module was built
+/// from. Never acted on by itself: the owner decides when to update (the Modules page asks).
+pub fn available_update(realm_root: &Path, id: &str) -> Option {
+ let rec = recommended(realm_root)?;
+ let want = &rec.modules.iter().find(|m| m.id == id)?.commit;
+ let have = build_engine::read_build_recipe(realm_root, id)?.source_commit?;
+ let same = have.starts_with(want.as_str()) || want.starts_with(have.as_str());
+ (!same).then(|| want.clone())
+}
+
+/// Rebuild one installed module from the commit this core recommends and swap it in (the world must be stopped).
+/// The module's settings are merged, not reset, and the previous build stays in the plugin store.
+pub fn update_to_recommended(realm_root: &Path, id: &str) -> std::result::Result {
+ let rec = recommended(realm_root).ok_or("this server's core does not list recommended modules")?;
+ let m = rec.modules.iter().find(|m| m.id == id).ok_or_else(|| format!("'{id}' is not a recommended module of this core"))?;
+ if !plugins::load_registry(realm_root).map_err(|e| e.to_string())?.plugins.contains_key(id) {
+ return Err(format!("'{id}' is not installed"));
+ }
+ install_module_sources(realm_root, m, true)?;
+ let mut handled = load_handled(realm_root);
+ handled.insert(m.id.clone(), m.commit.clone());
+ save_handled(realm_root, &handled);
+ Ok(m.commit.clone())
+}
+
fn install_one(realm_root: &Path, m: &RecommendedModule) -> std::result::Result<(), String> {
+ install_module_sources(realm_root, m, false)
+}
+
+fn install_module_sources(realm_root: &Path, m: &RecommendedModule, update: bool) -> std::result::Result<(), String> {
let cache = source_cache();
let (owner, name) = split_repo(&m.repo)?;
let primary = crate::module_sources::fetch_pinned(owner, name, &m.commit, &cache).map_err(|e| e.to_string())?;
@@ -337,7 +366,11 @@ fn install_one(realm_root: &Path, m: &RecommendedModule) -> std::result::Result<
}
let (meta, dll, confs) = crate::preview::built_package(realm_root, &m.id, &built.version).map_err(|e| e.to_string())?;
let confs: Vec<(String, &[u8])> = confs.iter().map(|(n, b)| (n.clone(), b.as_slice())).collect();
- plugins::install(realm_root, meta, &dll, None, &confs, true).map_err(|e| e.to_string())
+ if update {
+ plugins::update(realm_root, meta, &dll, None, &confs).map_err(|e| e.to_string())
+ } else {
+ plugins::install(realm_root, meta, &dll, None, &confs, true).map_err(|e| e.to_string())
+ }
}
@@ -497,6 +530,33 @@ mod tests {
assert!(rebuild_for_current_core(server, &|_, _| panic!("nothing is built")).unwrap().is_empty());
}
+ #[test]
+ fn a_newer_recommended_build_is_offered_never_applied_by_itself() {
+ let dir = tempfile::tempdir().unwrap();
+ let server = dir.path();
+ fs::create_dir_all(server.join("Core/plugins")).unwrap();
+ fs::write(server.join("Core/plugins/recommended.json"), r#"{"schema":1,"modules":[
+ {"id":"companions","repo":"Corfirean/mod-coa-playerbots","commit":"178a7fde6abe1c3c8813d338073b2c83835da497"}]}"#).unwrap();
+ // no recipe: the manager cannot tell what is installed, so it offers nothing
+ assert_eq!(available_update(server, "companions"), None);
+ let recipes = plugins::meta_dir(server).join("build-recipes");
+ fs::create_dir_all(&recipes).unwrap();
+ let recipe = |commit: &str| {
+ format!(r#"{{"schema":1,"source_dir":"x","bundled":[],"source_commit":"{commit}"}}"#)
+ };
+ fs::write(recipes.join("companions.json"), recipe("447558bc27d6bb447aaf10eefcb2e85ac2b15c32")).unwrap();
+ assert_eq!(
+ available_update(server, "companions").as_deref(),
+ Some("178a7fde6abe1c3c8813d338073b2c83835da497")
+ );
+ // already built from the recommended commit (a short form counts too)
+ fs::write(recipes.join("companions.json"), recipe("178a7fde")).unwrap();
+ assert_eq!(available_update(server, "companions"), None);
+ assert_eq!(available_update(server, "unknown-module"), None);
+ // a core change rebuilds the old sources and does not move the module to the newer commit
+ assert!(load_handled(server).is_empty());
+ }
+
/// Real run: COA_TEST_RECOMMENDED_REALM is a plugin-host realm with Core/plugins/recommended.json (or
/// plugins/recommended.json); the modules are downloaded from GitHub, built and switched on.
#[test]
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index a99c90d..946d573 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -1654,6 +1654,23 @@ async fn repair_server(
.await
}
+/// Rebuild an installed module from the commit this server's core recommends. Only ever called by the owner's
+/// click on "Update": nothing updates a module on its own. The world must be stopped; settings are merged.
+#[tauri::command]
+async fn module_update(
+ state: State<'_, AppState>,
+ id: String,
+ module: String,
+) -> std::result::Result {
+ let root = path_of(&state, &id)?;
+ let _guard = BusyGuard::acquire(&state, &id)?;
+ blocking(move || {
+ coa_core::plugins::require_server_stopped(&root)?;
+ coa_core::rebuild::update_to_recommended(&root, &module).map_err(Error::Invalid)
+ })
+ .await
+}
+
#[tauri::command]
async fn module_set_enabled(
state: State<'_, AppState>,
@@ -3826,6 +3843,7 @@ pub fn run() {
repair_server,
plugins_repair,
module_set_enabled,
+ module_update,
module_settings,
module_save_settings,
all_settings,
diff --git a/src/dev/mock.ts b/src/dev/mock.ts
index 167b5c4..f41223e 100644
--- a/src/dev/mock.ts
+++ b/src/dev/mock.ts
@@ -85,6 +85,7 @@ export {};
if(cmd==="realmlist_delete"){const rl=(window as any).__rl;rl.profiles=rl.profiles.filter((x: any)=>x.id!==args.profileId);return null;}
if(cmd==="account_delete") return null;
if(cmd==="modules_list") return [{id:"companions",name:"CoA Companions",description:{en:"Companion bots for groups, dungeons and your guild.",ru:"Боты-компаньоны для групп, подземелий и гильдии."},repo:"https://github.com/Corfirean/mod-coa-playerbots",installed:true,enabled:modState["companions"],switchable:true,status:"beta",icon:"bot",page:"bots"},{id:"content-scaling",name:"Content Scaling",description:{en:"Scales dungeons and raids to your group, with solo modes.",ru:"Подстраивает подземелья и рейды под вашу группу, есть соло-режимы."},repo:"https://github.com/Corfirean/mod-coa-content-scaling",installed:true,enabled:modState["content-scaling"],switchable:true,status:"early",icon:"scaling",page:null},{id:"tbc-content",name:"TBC Content",description:{en:"Outland dungeons and raids, scaled to your level range.",ru:"Подземелья и рейды Запределья, подогнанные под ваши уровни."},repo:"https://github.com/Corfirean/mod-coa-content-scaling/tree/main/content-packs/mod-coa-tbc-content",installed:true,enabled:modState["tbc-content"],switchable:true,status:"early",icon:"tbc",page:null},{id:"wotlk-content",name:"WotLK Content",description:{en:"Northrend dungeons and raids, scaled to your level range.",ru:"Подземелья и рейды Нордскола, подогнанные под ваши уровни."},repo:"https://github.com/Corfirean/mod-coa-content-scaling/tree/main/content-packs/mod-coa-wotlk-content",installed:true,enabled:modState["wotlk-content"],switchable:true,status:"early",icon:"wotlk",page:null},{id:"ah-bot",name:"Auction House Bot",description:{en:"Fills the auction house with realistic, adjustable listings.",ru:"Наполняет аукцион реалистичными настраиваемыми лотами."},repo:"https://github.com/Corfirean/azerothcore-wotlk-coa",installed:true,enabled:modState["ah-bot"] ?? false,switchable:true,status:"early",icon:"gavel",page:null,hidden:false},{id:"npc-enchanter",name:"NPC Enchanter",description:{en:"An NPC that enchants your gear for you.",ru:"НПС, который зачаровывает ваше снаряжение."},repo:"https://github.com/azerothcore/mod-npc-enchanter",installed:true,enabled:modState["npc-enchanter"],switchable:true,status:"early",icon:"sparkles",page:null,hidden:false},{id:"playerbots",name:"SQUID's Playerbots",description:{en:"An alternative bot system with random bots and full AI.",ru:"Альтернативная система ботов со случайными ботами и полным ИИ."},repo:"https://github.com/Zyth45/mod-playerbots",installed:true,enabled:modState["playerbots"] ?? false,switchable:true,status:"early",icon:"swords",page:"bots",hidden:false},{id:"client-compat",name:"Client compatibility",description:{en:"Client-server link and appearance unlocks.",ru:"Связь клиента с сервером и разблокировка внешних видов."},repo:"https://github.com/Corfirean/azerothcore-wotlk-coa",installed:true,enabled:modState["client-compat"],switchable:false,status:"release",icon:"plug",page:null,hidden:true}, ...moduleCatalog.modules.filter(m => ["time-is-time", "custom-races", "subclass", "dev-menu"].includes(m.id)).map(m => ({...m, installed:true, enabled:modState[m.id] ?? true, switchable:true, page:null, hidden:(m as any).hidden ?? false}))].map(m => ({...m, has_settings: !["tbc-content", "wotlk-content"].includes(m.id), compatibility: realm !== "coa" ? (["companions", "playerbots"].includes(m.id) ? "unsupported" : m.id === "client-compat" ? "compatible" : "experimental") : "compatible", switchable: realm !== "coa" && ["companions", "playerbots"].includes(m.id) ? false : m.switchable}));
+ if(cmd==="module_update"){ return "178a7fde6abe1c3c8813d338073b2c83835da497"; }
if(cmd==="module_set_enabled"){ if(args.enabled && ["companions","playerbots"].includes(args.module) && modState[args.module === "companions" ? "playerbots" : "companions"]) throw {human:{code:"bot_modules_conflict",title:"",message:"",actions:[]},technical:"Only one bot system may be enabled."}; modState[args.module]=args.enabled; return null; }
if(cmd==="all_settings") return [{key:"Visibility.Distance.Continents",value:"100",default:"90",doc:"Description: Visibility distance on continents. Range: 45-250 Default: 90",changed:true},{key:"Death.SicknessLevel",value:"11",default:"11",doc:"Description: Character level up to which characters get resurrection sickness. Default: 11",changed:false},{key:"Rate.Drop.Item.Epic",value:"3",default:"1",doc:"Description: Drop rates for money and items based on quality. Default: 1",changed:true},{key:"Instance.ResetTimeHour",value:"4",default:"4",doc:"Description: Hour of the day when the global instance reset occurs. Range: 0-23 Default: 4 - (04:00 AM)",changed:false},{key:"PlayerLimit",value:"1000",default:"1000",doc:"Description: Maximum number of players in the world.",changed:false}];
if(cmd==="all_settings_save") return Object.keys(args&&args.changes||{});
diff --git a/src/i18n/locales/de.ts b/src/i18n/locales/de.ts
index d3cfe96..c5b964a 100644
--- a/src/i18n/locales/de.ts
+++ b/src/i18n/locales/de.ts
@@ -628,7 +628,7 @@ const de: Partial> = {
"comp.deleteConfirm": "Alle {n} Begleiter endgültig löschen? Zuvor wird ein Wiederherstellungspunkt gespeichert. Deine eigenen Charaktere bleiben unberührt.",
"comp.deleteDone": "Alle Begleiter wurden gelöscht. Zuvor wurde ein Wiederherstellungspunkt gespeichert.",
"err.companion_command_unsupported.title": "Diese Serverversion kann das noch nicht",
- "err.companion_command_unsupported.message": "Das Bot-Modul dieses Server-Builds kennt diesen Befehl nicht. Aktualisiere den Server oder starte ihn neu, um Laufendes zu stoppen.",
+ "err.companion_command_unsupported.message": "Das Bot-Modul dieses Servers ist älter als dieser Manager und kennt diesen Befehl nicht. Aktualisiere das Bot-Modul auf der Seite „Module“ (oder den Server) und starte die Welt neu.",
// Despawn some
"comp.despawnSome": "{n} Bots entfernen",
@@ -846,6 +846,11 @@ const de: Partial> = {
"mod.restart": "Änderungen werden nach einem Neustart des Weltservers wirksam.",
"mod.switch": "{name} ein- oder ausschalten",
"mod.notHere": "Nicht Teil dieses Servers",
+ "mod.update.available": "Neuere Version verfügbar: {from} → {to}.",
+ "mod.update.hint": "Nichts wird von selbst aktualisiert. Der Server muss gestoppt sein; die Einstellungen des Moduls bleiben erhalten.",
+ "mod.update.do": "Aktualisieren",
+ "mod.update.working": "Wird aktualisiert…",
+ "mod.update.done": "Modul {id} auf {commit} aktualisiert. Starte den Server, um es zu nutzen.",
"mod.github": "GitHub",
"mod.settings": "Einstellungen",
"mod.default": "Zurück zum Standard ({v})",
diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts
index d54939b..20b4ceb 100644
--- a/src/i18n/locales/en.ts
+++ b/src/i18n/locales/en.ts
@@ -750,7 +750,7 @@ const en = {
"comp.deleteConfirm": "Delete all {n} companions for good? A recovery point is saved first. Your own characters are not touched.",
"comp.deleteDone": "All companions were deleted. A recovery point was saved first.",
"err.companion_command_unsupported.title": "This server version can not do that yet",
- "err.companion_command_unsupported.message": "The bot module of this server build has no such command. Update the server, or restart it to stop what is running.",
+ "err.companion_command_unsupported.message": "The bot module on this server is older than this Manager and does not know this command. Update the bot module on the Modules page (or update the server), then restart the world.",
// Despawn some
"comp.despawnSome": "Despawn {n} bots",
@@ -951,6 +951,11 @@ const en = {
"mod.restart": "Changes apply after the world server restarts.",
"mod.switch": "Turn {name} on or off",
"mod.notHere": "Not part of this server",
+ "mod.update.available": "Newer build available: {from} → {to}.",
+ "mod.update.hint": "Nothing updates on its own. The server must be stopped; the module’s settings are kept.",
+ "mod.update.do": "Update",
+ "mod.update.working": "Updating…",
+ "mod.update.done": "Module {id} updated to {commit}. Start the server to use it.",
"mod.github": "GitHub",
"mod.settings": "Settings",
"mod.default": "Back to the default ({v})",
diff --git a/src/i18n/locales/es.ts b/src/i18n/locales/es.ts
index 0041010..cae9f5e 100644
--- a/src/i18n/locales/es.ts
+++ b/src/i18n/locales/es.ts
@@ -628,7 +628,7 @@ const es: Partial> = {
"comp.deleteConfirm": "¿Eliminar definitivamente los {n} compañeros? Antes se guarda un punto de recuperación. Tus propios personajes no se tocan.",
"comp.deleteDone": "Se eliminaron todos los compañeros. Antes se guardó un punto de recuperación.",
"err.companion_command_unsupported.title": "Esta versión del servidor aún no puede hacerlo",
- "err.companion_command_unsupported.message": "El módulo de bots de esta versión del servidor no tiene ese comando. Actualiza el servidor o reinícialo para detener lo que esté en marcha.",
+ "err.companion_command_unsupported.message": "El módulo de bots de este servidor es más antiguo que este Manager y no conoce ese comando. Actualiza el módulo de bots en la página «Módulos» (o el servidor) y reinicia el mundo.",
// Despawn some
"comp.despawnSome": "Retirar {n} bots",
@@ -846,6 +846,11 @@ const es: Partial> = {
"mod.restart": "Los cambios se aplican al reiniciar el servidor del mundo.",
"mod.switch": "Activar o desactivar {name}",
"mod.notHere": "No forma parte de este servidor",
+ "mod.update.available": "Hay una versión más reciente: {from} → {to}.",
+ "mod.update.hint": "Nada se actualiza solo. El servidor debe estar detenido; los ajustes del módulo se conservan.",
+ "mod.update.do": "Actualizar",
+ "mod.update.working": "Actualizando…",
+ "mod.update.done": "Módulo {id} actualizado a {commit}. Inicia el servidor para usarlo.",
"mod.github": "GitHub",
"mod.settings": "Ajustes",
"mod.default": "Volver al valor por defecto ({v})",
diff --git a/src/i18n/locales/fr.ts b/src/i18n/locales/fr.ts
index 641650c..838cc76 100644
--- a/src/i18n/locales/fr.ts
+++ b/src/i18n/locales/fr.ts
@@ -628,7 +628,7 @@ const fr: Partial> = {
"comp.deleteConfirm": "Supprimer définitivement les {n} compagnons ? Un point de restauration est d’abord enregistré. Vos propres personnages ne sont pas touchés.",
"comp.deleteDone": "Tous les compagnons ont été supprimés. Un point de restauration a été enregistré d’abord.",
"err.companion_command_unsupported.title": "Cette version du serveur ne sait pas encore le faire",
- "err.companion_command_unsupported.message": "Le module de bots de cette version du serveur n’a pas cette commande. Mettez le serveur à jour ou redémarrez-le pour arrêter ce qui est en cours.",
+ "err.companion_command_unsupported.message": "Le module de bots de ce serveur est plus ancien que ce Manager et ne connaît pas cette commande. Mettez à jour le module de bots dans la page « Modules » (ou le serveur), puis redémarrez le monde.",
// Despawn some
"comp.despawnSome": "Retirer {n} bots",
@@ -846,6 +846,11 @@ const fr: Partial> = {
"mod.restart": "Les changements s’appliquent après le redémarrage du serveur de monde.",
"mod.switch": "Activer ou désactiver {name}",
"mod.notHere": "Ne fait pas partie de ce serveur",
+ "mod.update.available": "Une version plus récente est disponible : {from} → {to}.",
+ "mod.update.hint": "Rien ne se met à jour tout seul. Le serveur doit être arrêté ; les réglages du module sont conservés.",
+ "mod.update.do": "Mettre à jour",
+ "mod.update.working": "Mise à jour…",
+ "mod.update.done": "Module {id} mis à jour vers {commit}. Démarrez le serveur pour l’utiliser.",
"mod.github": "GitHub",
"mod.settings": "Réglages",
"mod.default": "Revenir à la valeur par défaut ({v})",
diff --git a/src/i18n/locales/ru.ts b/src/i18n/locales/ru.ts
index 767d21d..b575cbc 100644
--- a/src/i18n/locales/ru.ts
+++ b/src/i18n/locales/ru.ts
@@ -734,7 +734,7 @@ const ru: Partial> = {
"comp.deleteConfirm": "Удалить всех компаньонов ({n}) навсегда? Сначала сохраняется точка восстановления. Ваши собственные персонажи не затрагиваются.",
"comp.deleteDone": "Все компаньоны удалены. Сначала была сохранена точка восстановления.",
"err.companion_command_unsupported.title": "Эта версия сервера пока этого не умеет",
- "err.companion_command_unsupported.message": "В модуле ботов этой сборки сервера нет такой команды. Обновите сервер или перезапустите его, чтобы остановить текущую работу.",
+ "err.companion_command_unsupported.message": "Модуль ботов на этом сервере старше Менеджера и не знает эту команду. Обновите модуль ботов на странице «Модули» (или обновите сервер) и перезапустите мир.",
// Despawn some
"comp.despawnSome": "Убрать ботов: {n}",
@@ -935,6 +935,11 @@ const ru: Partial> = {
"mod.restart": "Изменения применятся после перезапуска игрового сервера.",
"mod.switch": "Включить или выключить {name}",
"mod.notHere": "Нет в этом сервере",
+ "mod.update.available": "Доступна новая сборка: {from} → {to}.",
+ "mod.update.hint": "Сами модули не обновляются. Сервер должен быть остановлен; настройки модуля сохраняются.",
+ "mod.update.do": "Обновить",
+ "mod.update.working": "Обновление…",
+ "mod.update.done": "Модуль {id} обновлён до {commit}. Запустите сервер, чтобы он заработал.",
"mod.github": "GitHub",
"mod.settings": "Настройки",
"mod.default": "Вернуть по умолчанию ({v})",
diff --git a/src/i18n/locales/zh.ts b/src/i18n/locales/zh.ts
index cc3c204..8594650 100644
--- a/src/i18n/locales/zh.ts
+++ b/src/i18n/locales/zh.ts
@@ -690,7 +690,7 @@ const zh = {
"comp.deleteConfirm": "是否彻底删除所有 {n} 名随从?系统会先自动保存恢复点。你自己的玩家角色绝不会受影响。",
"comp.deleteDone": "所有随从已成功删除。操作前已保存安全恢复点。",
"err.companion_command_unsupported.title": "当前服务器核心版本不支持该命令",
- "err.companion_command_unsupported.message": "当前构建版本的随从模块缺少该指令。请更新服务器,或通过重启服务器来中止当前任务。",
+ "err.companion_command_unsupported.message": "此服务器上的随从模块比当前管理器版本旧,不认识该指令。请在“模块”页面更新随从模块(或更新服务器),然后重启世界服务器。",
// Despawn some
"comp.despawnSome": "减少 {n} 名随从",
@@ -846,6 +846,11 @@ const zh = {
"mod.restart": "更改将在世界服务器重启后生效。",
"mod.switch": "开启或关闭 {name}",
"mod.notHere": "未包含在当前服务器中",
+ "mod.update.available": "有更新的版本:{from} → {to}。",
+ "mod.update.hint": "模块不会自动更新。需先停止服务器;模块设置会保留。",
+ "mod.update.do": "更新",
+ "mod.update.working": "正在更新…",
+ "mod.update.done": "模块 {id} 已更新到 {commit}。启动服务器后生效。",
"mod.github": "GitHub 页面",
"mod.settings": "模块设置",
"mod.default": "恢复为默认值 ({v})",
diff --git a/src/lib/api.ts b/src/lib/api.ts
index e74092d..85d2485 100644
--- a/src/lib/api.ts
+++ b/src/lib/api.ts
@@ -260,6 +260,8 @@ export interface ModuleView {
component_type?: ComponentType;
can_remove?: boolean;
source_commit?: string | null;
+ /** a newer build of the module is recommended by the server's core; the owner chooses when to update */
+ available_commit?: string | null;
part_of?: string | null;
}
@@ -794,6 +796,7 @@ export const api = {
analyzeGithubModule: (url: string, realmId: string) =>
invoke("analyze_github_module", { url, realmId }),
moduleSetEnabled: (id: string, module: string, enabled: boolean) => invoke("module_set_enabled", { id, module, enabled }),
+ moduleUpdate: (id: string, module: string) => invoke("module_update", { id, module }),
pluginsRepair: (id: string) => invoke("plugins_repair", { id }),
moduleSettings: (id: string, module: string) => invoke("module_settings", { id, module }),
moduleSaveSettings: (id: string, module: string, changes: Record) => invoke("module_save_settings", { id, module, changes }),
diff --git a/src/screens/ModulesPage.tsx b/src/screens/ModulesPage.tsx
index f52df78..6ae45d1 100644
--- a/src/screens/ModulesPage.tsx
+++ b/src/screens/ModulesPage.tsx
@@ -632,6 +632,8 @@ export function ModulesPage({
const [parts, setParts] = useState([]);
const toggleLock = useRef(false);
const [toggling, setToggling] = useState(null);
+ const [updatingModule, setUpdatingModule] = useState(null);
+ const [updatedNote, setUpdatedNote] = useState(null);
const [changed, setChanged] = useState(false);
const [racesPatchStatus, setRacesPatchStatus] = useState(null);
const [raceChars, setRaceChars] = useState(null);
@@ -804,6 +806,23 @@ export function ModulesPage({
};
}, []);
+ /** Updates one module to the build this server's core recommends. Only ever started by the owner's click. */
+ async function updateModule(id: string) {
+ setUpdatingModule(id);
+ setUpdatedNote(null);
+ setError(null);
+ try {
+ const commit = await api.moduleUpdate(serverId, id);
+ setUpdatedNote(t("mod.update.done", { id, commit: commit.slice(0, 8) }));
+ await load();
+ onChanged?.();
+ } catch (e) {
+ setError(asUiError(e));
+ } finally {
+ setUpdatingModule(null);
+ }
+ }
+
async function installClientPatch() {
setRacesInstalling(true);
setError(null);
@@ -1345,6 +1364,10 @@ export function ModulesPage({
)}
+ {updatedNote && (
+
{updatedNote}
+ )}
+
{cacheOpen && setCacheOpen(false)} />}
{/* Build tools: said only when something is missing */}
@@ -1690,6 +1713,24 @@ export function ModulesPage({