mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-23 03:25:56 +00:00
Merge integrate/manager-0.9.14 into preview: V2 parts inside Custom Races, every addon in the list
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # crates/coa-core/src/modules.rs # src/lib/api.ts # src/screens/ModulesPage.tsx
This commit is contained in:
commit
06b606c100
15 files changed
+124
-20
No files matched your search
@@ -76,6 +76,8 @@ pub struct AddonView {
|
||||
pub update_available: bool,
|
||||
/// Folders of this addon that are in the client but were not installed by the Manager.
|
||||
pub foreign_folders: Vec<String>,
|
||||
/// Installed by something else, shown so nobody looks for it twice: `custom-races` (the client patch).
|
||||
pub bundled: Option<String>,
|
||||
}
|
||||
|
||||
fn catalog() -> Result<Vec<Entry>> {
|
||||
@@ -128,11 +130,42 @@ pub fn list(client: &Path) -> Result<Vec<AddonView>> {
|
||||
license: entry.license,
|
||||
needs: entry.needs,
|
||||
repo: entry.repo,
|
||||
bundled: None,
|
||||
}
|
||||
})
|
||||
.chain(std::iter::once(dev_menu(&dir)))
|
||||
.collect())
|
||||
}
|
||||
|
||||
/// The /dev menu addon of Custom Races V2: the client patch installs it and switches it with the patch.
|
||||
fn dev_menu(dir: &Path) -> AddonView {
|
||||
let mut description = BTreeMap::new();
|
||||
for (lang, text) in [
|
||||
("en", "The in-game /dev editor for game masters. It comes with the Custom Races V2 client patch and is switched with it."),
|
||||
("ru", "Внутриигровой редактор /dev для гейм-мастеров. Ставится вместе с клиентским патчем Custom Races V2 и включается вместе с ним."),
|
||||
("de", "Der /dev-Editor im Spiel für Spielleiter. Er kommt mit dem Client-Patch Custom Races V2 und wird mit ihm geschaltet."),
|
||||
("fr", "L'éditeur /dev en jeu pour les maîtres du jeu. Il vient avec le patch client Custom Races V2 et s'active avec lui."),
|
||||
("es", "El editor /dev del juego para los máster. Viene con el parche de cliente Custom Races V2 y se activa con él."),
|
||||
("zh", "供游戏管理员使用的游戏内 /dev 编辑器。随 Custom Races V2 客户端补丁安装,并随补丁一起开关。"),
|
||||
] {
|
||||
description.insert(lang.to_string(), text.to_string());
|
||||
}
|
||||
AddonView {
|
||||
id: "coa-dev-menu".into(),
|
||||
name: "CoA Dev Menu".into(),
|
||||
description,
|
||||
author: "ilusixn".into(),
|
||||
license: "see repository".into(),
|
||||
needs: None,
|
||||
repo: "https://github.com/ilusixn/ilusixn-dev-menu".into(),
|
||||
size: 0,
|
||||
installed: dir.join("CoA_DevMenu/CoA_DevMenu.toc").is_file(),
|
||||
update_available: false,
|
||||
foreign_folders: Vec::new(),
|
||||
bundled: Some("custom-races".into()),
|
||||
}
|
||||
}
|
||||
|
||||
/// The git blob id of `bytes` (what the catalog records for each file).
|
||||
fn git_blob_sha1(bytes: &[u8]) -> String {
|
||||
let mut hasher = Sha1::new();
|
||||
@@ -364,6 +397,8 @@ mod tests {
|
||||
fn the_catalog_is_valid_and_pins_every_addon() {
|
||||
let entries = catalog().unwrap();
|
||||
assert!(entries.len() >= 4);
|
||||
let views = list(Path::new("C:/no-such-client")).unwrap();
|
||||
assert_eq!(views.iter().filter(|v| v.bundled.is_some()).count(), 1, "the dev menu is shown, not installable");
|
||||
for e in &entries {
|
||||
assert_eq!(e.commit.len(), 40, "{}", e.id);
|
||||
assert!(e.archive.starts_with("https://codeload.github.com/") && e.archive.ends_with(&e.commit));
|
||||
|
||||
@@ -48,6 +48,10 @@ pub struct Entry {
|
||||
/// Not shown on the Modules page; its settings are offered elsewhere (a server setting card).
|
||||
#[serde(default)]
|
||||
pub hidden: bool,
|
||||
/// A part of another module, switched and set up inside that module's settings (Custom Races V2 brings
|
||||
/// subclasses and the /dev menu).
|
||||
#[serde(default)]
|
||||
pub part_of: Option<String>,
|
||||
}
|
||||
|
||||
fn yes() -> bool {
|
||||
@@ -164,6 +168,7 @@ pub struct ModuleView {
|
||||
pub component_type: ComponentType,
|
||||
pub can_remove: bool,
|
||||
pub source_commit: Option<String>,
|
||||
pub part_of: Option<String>,
|
||||
}
|
||||
|
||||
pub fn list(root: &Path) -> Vec<ModuleView> {
|
||||
@@ -460,6 +465,7 @@ fn list_in(cat: &[Entry], root: &Path) -> Vec<ModuleView> {
|
||||
component_type,
|
||||
can_remove,
|
||||
source_commit,
|
||||
part_of: e.part_of,
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
@@ -558,6 +564,7 @@ fn list_in(cat: &[Entry], root: &Path) -> Vec<ModuleView> {
|
||||
component_type: ComponentType::DynamicDll,
|
||||
can_remove: true,
|
||||
source_commit,
|
||||
part_of: None,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1162,6 +1169,7 @@ mod tests {
|
||||
icon: String::new(),
|
||||
page: None,
|
||||
hidden: false,
|
||||
part_of: None,
|
||||
};
|
||||
vec![
|
||||
one(
|
||||
@@ -1807,6 +1815,7 @@ mod tests {
|
||||
icon: String::new(),
|
||||
page: None,
|
||||
hidden: false,
|
||||
part_of: None,
|
||||
};
|
||||
let cat = vec![compat];
|
||||
let v = list_in(&cat, &root).remove(0);
|
||||
|
||||
Reference in new issue
Block a user