mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-19 03:25:56 +00:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
358f9f4f2b | ||
|
|
d86a1676fe | ||
|
|
53a05820c8 | ||
|
|
58c976a388 | ||
|
|
35c4d03bdc | ||
|
|
c45f962d02 | ||
|
|
f52bd8ba5f |
No files matched your search
Generated
+3
-3
@@ -491,7 +491,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "coa-core"
|
||||
version = "0.6.13"
|
||||
version = "0.6.15"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"chrono",
|
||||
@@ -520,7 +520,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "coa-release"
|
||||
version = "0.6.13"
|
||||
version = "0.6.15"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"coa-core",
|
||||
@@ -529,7 +529,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "coa-server-manager"
|
||||
version = "0.6.13"
|
||||
version = "0.6.15"
|
||||
dependencies = [
|
||||
"coa-core",
|
||||
"serde",
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ resolver = "2"
|
||||
members = ["crates/coa-core", "crates/coa-release", "src-tauri"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.6.13"
|
||||
version = "0.6.15"
|
||||
edition = "2021"
|
||||
license = "AGPL-3.0-only"
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: manager
|
||||
type: fixed
|
||||
audience: admins
|
||||
title: Large server updates no longer repeatedly rewrite the recovery journal
|
||||
---
|
||||
Updates containing rebuilt navigation data now prepare all recovery copies before replacing files. Interrupted updates remain recoverable without rewriting the full journal for every file.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: manager
|
||||
type: fixed
|
||||
audience: admins
|
||||
title: Normalize rehearsal server roots to prevent Windows path prefix errors
|
||||
---
|
||||
Server update rehearsals now canonicalize the installation root before collecting files, resolving a "prefix not found" error during rehearsal preparation on Windows.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: bots
|
||||
type: fixed
|
||||
audience: admins
|
||||
title: Disabling custom races for SQUID bots now excludes all nonstandard races
|
||||
---
|
||||
The standard-races preset keeps only the ten original playable races. High elves, worgen and other custom race IDs are excluded, and the displayed setting reads complete race IDs rather than matching number substrings.
|
||||
@@ -55,7 +55,7 @@ pub const RACE_MPQS: &[&str] = &[
|
||||
];
|
||||
|
||||
pub const EXCLUDED_BOT_RACES_RECOMMENDED: &str =
|
||||
"19,27,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128";
|
||||
"9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128";
|
||||
|
||||
pub const EXCLUDED_BOT_RACES_EXPERIMENTAL: &str =
|
||||
"16,19,27,32,50,52,53,65,66,67,68,69,70,71,72,74,77,80,81";
|
||||
@@ -99,7 +99,8 @@ pub fn is_bot_custom_races_allowed(root: &Path) -> Option<bool> {
|
||||
if let Ok(conf) = crate::config::parser::ConfFile::parse_bytes(&bytes) {
|
||||
if let Some(val) = conf.get("AiPlayerbot.ExcludedBotRaces") {
|
||||
let clean = val.trim().trim_matches(['"', '\'']);
|
||||
return Some(!clean.contains("33") && !clean.contains("128"));
|
||||
let excluded: std::collections::BTreeSet<u32> = clean.split(',').filter_map(|race| race.trim().parse().ok()).collect();
|
||||
return Some((1..=128).filter(|race| ![1, 2, 3, 4, 5, 6, 7, 8, 10, 11].contains(race)).any(|race| !excluded.contains(&race)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -617,4 +618,21 @@ mod tests {
|
||||
assert!(client_path.join("dinput8.dll").is_file());
|
||||
assert!(!client_path.join("dinput8.dll.disabled").is_file());
|
||||
}
|
||||
#[test]
|
||||
fn disabling_bot_custom_races_excludes_every_nonstandard_race() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let conf = temp.path().join("Core/configs/modules/playerbots.conf");
|
||||
fs::create_dir_all(conf.parent().unwrap()).unwrap();
|
||||
fs::write(&conf, "AiPlayerbot.ExcludedBotRaces = \"\"\n").unwrap();
|
||||
sync_bot_races_config(temp.path(), false).unwrap();
|
||||
assert_eq!(is_bot_custom_races_allowed(temp.path()), Some(false));
|
||||
let parsed = crate::config::parser::ConfFile::parse_bytes(&fs::read(conf).unwrap()).unwrap();
|
||||
let value = parsed.get("AiPlayerbot.ExcludedBotRaces").unwrap().trim_matches('"');
|
||||
let excluded: Vec<u32> = value.split(',').map(|race| race.parse().unwrap()).collect();
|
||||
for race in 1..=128 {
|
||||
assert_eq!(excluded.contains(&race), ![1, 2, 3, 4, 5, 6, 7, 8, 10, 11].contains(&race), "race {race}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -228,6 +228,8 @@ pub(crate) fn verify(point: &Path, snapshot: &Snapshot) -> Result<()> {
|
||||
|
||||
pub(crate) fn rehearsal_copy(root: &Path, meta: &Path, point: &Path, snapshot: &Snapshot) -> Result<PathBuf> {
|
||||
verify(point, snapshot)?;
|
||||
let canonical = fsx::canonicalize_lenient(root)?;
|
||||
let root = canonical.as_path();
|
||||
let destination = meta.join("rehearsals").join(uuid::Uuid::new_v4().simple().to_string()).join("server");
|
||||
let mut files = BTreeMap::new();
|
||||
let mut directories = vec![root.to_path_buf()];
|
||||
@@ -475,4 +477,17 @@ mod tests {
|
||||
fsx::atomic_write(&root.join("mysql/data/extra.ibd"), b"new data").unwrap();
|
||||
assert!(unchanged(&root, &snapshot).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rehearsal_copy_succeeds_with_nested_directories_and_unnormalized_root() {
|
||||
let (_temp, root, meta, point, snapshot) = fixture();
|
||||
let meta_obj = crate::registry::InstallMeta::new(crate::registry::InstallKind::New, &root);
|
||||
fsx::atomic_write_json(&meta.join("install.json"), &meta_obj).unwrap();
|
||||
fsx::atomic_write(&root.join("Core/worldserver.exe"), b"exe").unwrap();
|
||||
fsx::atomic_write(&root.join("Core/configs/worldserver.conf"), b"conf").unwrap();
|
||||
fsx::atomic_write(&root.join("Settings/repack.json"), b"{}").unwrap();
|
||||
let dest = rehearsal_copy(&root, &meta, &point, &snapshot).unwrap();
|
||||
assert_eq!(fs::read(dest.join("Core/configs/worldserver.conf")).unwrap(), b"conf");
|
||||
assert_eq!(fs::read(dest.join("mysql/data/characters.ibd")).unwrap(), b"saved");
|
||||
}
|
||||
}
|
||||
@@ -687,6 +687,25 @@ fn restore_transaction(root: &Path, meta: &Path, before: &Path, txn: &mut Txn, e
|
||||
}
|
||||
|
||||
fn apply_ops(root: &Path, tree: &Path, before: &Path, files: &[FileEntry], txn: &mut Txn, meta_dir: &Path, fail_after: Option<usize>) -> Result<()> {
|
||||
if fail_after == Some(0) && !txn.ops.is_empty() {
|
||||
return Err(Error::Invalid("simulated failure".into()));
|
||||
}
|
||||
let entries: BTreeMap<_, _> = files.iter().map(|entry| (entry.path.as_str(), entry)).collect();
|
||||
// Prepare every recovery copy before changing any destination. One durable journal
|
||||
// can then cover the entire file phase: recovery restores old files even if their
|
||||
// replacement was not reached, and removes newly created files only by exact hash.
|
||||
// Rewriting the full journal twice per file makes large navigation updates quadratic.
|
||||
for op in &txn.ops {
|
||||
let target = fsx::ensure_within(root, &fsx::safe_join(root, &op.path)?)?;
|
||||
if op.had_previous {
|
||||
let keep = fsx::safe_join(before, &op.path)?;
|
||||
fs::create_dir_all(keep.parent().unwrap())?;
|
||||
fsx::atomic_write(&keep, &fs::read(&target)?)?;
|
||||
txn.recovery_hashes.insert(op.path.clone(), fsx::sha256_file(&keep)?);
|
||||
}
|
||||
}
|
||||
for op in &mut txn.ops { op.started = true; }
|
||||
save(meta_dir, txn)?;
|
||||
let mut completed = 0usize;
|
||||
for i in 0..txn.ops.len() {
|
||||
if fail_after == Some(completed) {
|
||||
@@ -695,17 +714,7 @@ fn apply_ops(root: &Path, tree: &Path, before: &Path, files: &[FileEntry], txn:
|
||||
let (path, action) = (txn.ops[i].path.clone(), txn.ops[i].action);
|
||||
let target = fsx::ensure_within(root, &fsx::safe_join(root, &path)?)?;
|
||||
let staged = fsx::safe_join(tree, &path)?;
|
||||
let entry = files.iter().find(|f| f.path == path).expect("listed");
|
||||
if target.is_file() {
|
||||
let keep = fsx::safe_join(before, &path)?;
|
||||
fs::create_dir_all(keep.parent().unwrap())?;
|
||||
fsx::atomic_write(&keep, &fs::read(&target)?)?;
|
||||
txn.recovery_hashes.insert(path.clone(), fsx::sha256_file(&keep)?);
|
||||
}
|
||||
// Journal only after the old bytes are safely saved; a crash during backup must not
|
||||
// turn an untouched file into a rollback operation with a missing saved copy.
|
||||
txn.ops[i].started = true;
|
||||
save(meta_dir, txn)?;
|
||||
let entry = entries.get(path.as_str()).expect("listed");
|
||||
fs::create_dir_all(target.parent().unwrap())?;
|
||||
match action {
|
||||
Action::Create | Action::Replace => {
|
||||
@@ -730,10 +739,9 @@ fn apply_ops(root: &Path, tree: &Path, before: &Path, files: &[FileEntry], txn:
|
||||
Action::Skip | Action::Conflict => {}
|
||||
}
|
||||
txn.ops[i].done = true;
|
||||
save(meta_dir, txn)?;
|
||||
completed += 1;
|
||||
}
|
||||
Ok(())
|
||||
save(meta_dir, txn)
|
||||
}
|
||||
|
||||
/// Put every touched file back the way it was. Files created by the update (no previous version) are removed only if
|
||||
@@ -1544,6 +1552,46 @@ mod tests {
|
||||
assert_eq!(fs::read(saved).unwrap(), b"my-custom-build", "the replaced custom build is kept for rollback");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn power_loss_during_bulk_files_restores_written_and_unwritten_files() {
|
||||
let d = tempfile::tempdir().unwrap();
|
||||
let root = d.path().join("root");
|
||||
let meta = d.path().join("meta");
|
||||
let tree = d.path().join("tree");
|
||||
let before = meta.join("updates/bulk/before");
|
||||
let mut files = Vec::new();
|
||||
let mut ops = Vec::new();
|
||||
for (path, previous) in [("Data/maps/first.map", true), ("Data/maps/new.map", false), ("Data/maps/last.map", true)] {
|
||||
if previous { write(&root, path, b"old"); }
|
||||
write(&tree, path, b"new");
|
||||
let hash = fsx::sha256_file(&tree.join(path)).unwrap();
|
||||
files.push(FileEntry { path: path.into(), sha256: hash.clone(), size: 3, policy: ReplacePolicy::Replace, owner: crate::manifest::Owner::Core });
|
||||
ops.push(Op { path: path.into(), action: if previous { Action::Replace } else { Action::Create }, reason: None,
|
||||
new_sha256: hash, had_previous: previous, started: false, done: false });
|
||||
}
|
||||
let mut txn = Txn { id: "bulk".into(), state: State::Applying, from_version: Some("1".into()), to_version: "2".into(),
|
||||
recovery_point: None, databases_started: false, ops, message: None, recovery_hashes: BTreeMap::new() };
|
||||
fs::create_dir_all(before.parent().unwrap()).unwrap();
|
||||
assert!(apply_ops(&root, &tree, &before, &files, &mut txn, &meta, Some(2)).is_err());
|
||||
// A power loss sees the pre-write checkpoint, not the in-memory completed flags.
|
||||
let mut durable = load(&meta, "bulk").unwrap();
|
||||
assert!(durable.ops.iter().all(|op| op.started && !op.done));
|
||||
assert_eq!(fs::read(root.join("Data/maps/last.map")).unwrap(), b"old");
|
||||
restore_files(&root, &before, &mut durable).unwrap();
|
||||
assert_eq!(fs::read(root.join("Data/maps/first.map")).unwrap(), b"old");
|
||||
assert_eq!(fs::read(root.join("Data/maps/last.map")).unwrap(), b"old");
|
||||
assert!(!root.join("Data/maps/new.map").exists());
|
||||
// If preparing any recovery copy fails, no destination may be changed.
|
||||
for op in &mut durable.ops { op.started = false; op.done = false; }
|
||||
durable.recovery_hashes.clear();
|
||||
save(&meta, &durable).unwrap();
|
||||
fs::remove_file(root.join("Data/maps/last.map")).unwrap();
|
||||
assert!(apply_ops(&root, &tree, &before, &files, &mut durable, &meta, None).is_err());
|
||||
assert_eq!(fs::read(root.join("Data/maps/first.map")).unwrap(), b"old");
|
||||
assert!(!root.join("Data/maps/new.map").exists());
|
||||
assert!(load(&meta, "bulk").unwrap().ops.iter().all(|op| !op.started));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn failure_in_the_middle_of_applying_restores_every_file_byte_for_byte() {
|
||||
for fail_after in [0usize, 1, 2] {
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "coa-server-manager",
|
||||
"version": "0.6.13",
|
||||
"version": "0.6.15",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "coa-server-manager",
|
||||
"version": "0.6.13",
|
||||
"version": "0.6.15",
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^2.12.0",
|
||||
"@tauri-apps/plugin-dialog": "^2.8.0",
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "coa-server-manager",
|
||||
"private": true,
|
||||
"version": "0.6.13",
|
||||
"version": "0.6.15",
|
||||
"license": "AGPL-3.0-only",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "CoA Server Manager",
|
||||
"version": "0.6.13",
|
||||
"version": "0.6.15",
|
||||
"identifier": "com.coa.servermanager",
|
||||
"build": {
|
||||
"beforeDevCommand": "npm run dev",
|
||||
|
||||
Reference in new issue
Block a user