mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-19 03:25:56 +00:00
Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a7a2069c0 | ||
|
|
736333d23d | ||
|
|
d86a1676fe | ||
|
|
53a05820c8 | ||
|
|
58c976a388 | ||
|
|
35c4d03bdc | ||
|
|
c45f962d02 | ||
|
|
f52bd8ba5f | ||
|
|
247159e56c | ||
|
|
cdd5be2365 | ||
|
|
7e170744bf | ||
|
|
10daa9b74d | ||
|
|
ed7bf7262b | ||
|
|
7c866b116d | ||
|
|
cfea54e203 |
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: added
|
||||
audience: players
|
||||
title: Players can install custom race patches when connecting to a friend
|
||||
---
|
||||
Install the custom race client patch directly from the Game client section without hosting a server.
|
||||
@@ -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: Graceful server shutdowns no longer trigger crash recovery
|
||||
---
|
||||
Automatic crash recovery requires a confirmed abnormal exit. Normal shutdowns and scheduled restarts are not counted as crashes.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: manager
|
||||
type: added
|
||||
audience: admins
|
||||
title: Configure the visual day and night cycle from Modules
|
||||
---
|
||||
Modules now offers TimeIsTime clock settings when supported by the installed server.
|
||||
@@ -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: manager
|
||||
type: added
|
||||
audience: admins
|
||||
title: Select parallel or global scaling and remove item class requirements
|
||||
---
|
||||
The scaling settings now offer the parallel and global progression modes and a switch for class-restricted equipment, including tier sets.
|
||||
@@ -341,6 +341,20 @@ fn save_settings_in(cat: &[Entry], root: &Path, meta: &Path, id: &str, changes:
|
||||
for (key, value) in changes {
|
||||
let value = value.trim();
|
||||
if let Some(field) = fields.get(key) { crate::squid::validate(field, value)?; }
|
||||
if id == "time-is-time" {
|
||||
let bounds = match key.as_str() {
|
||||
"TimeIsTime.SpeedRate" => Some((0.01, 60.0)),
|
||||
"TimeIsTime.HourOffset" => Some((-24.0, 24.0)),
|
||||
"TimeIsTime.TimeStart" => Some((0.0, 2147483647.0)),
|
||||
_ => None,
|
||||
};
|
||||
if let Some((min, max)) = bounds {
|
||||
let number = value.parse::<f64>().map_err(|_| Error::Invalid(format!("{key} must be a number.")))?;
|
||||
if !number.is_finite() || number < min || number > max || (key == "TimeIsTime.TimeStart" && number.fract() != 0.0) {
|
||||
return Err(Error::Invalid(format!("{key} must be between {min} and {max}.")));
|
||||
}
|
||||
}
|
||||
}
|
||||
if e.switchable && key == &e.enable_key {
|
||||
return Err(Error::Invalid("Use the module switch to turn this module on or off.".into()));
|
||||
}
|
||||
@@ -397,6 +411,24 @@ fn save_settings_in(cat: &[Entry], root: &Path, meta: &Path, id: &str, changes:
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn time_settings_are_validated_before_writing() {
|
||||
let d = tempfile::tempdir().unwrap();
|
||||
let root = d.path();
|
||||
fs::create_dir_all(dir(root)).unwrap();
|
||||
fs::write(dir(root).join("mod-time_is_time.conf.dist"), "TimeIsTime.Enable = 0\nTimeIsTime.SpeedRate = 1\nTimeIsTime.HourOffset = 0\nTimeIsTime.TimeStart = 0\n").unwrap();
|
||||
let cat = catalog();
|
||||
for (key, value) in [("TimeIsTime.SpeedRate", "NaN"), ("TimeIsTime.SpeedRate", "0"),
|
||||
("TimeIsTime.HourOffset", "25"), ("TimeIsTime.TimeStart", "1.5")] {
|
||||
assert!(save_settings_in(&cat, root, root, "time-is-time", &BTreeMap::from([
|
||||
(key.into(), value.into())
|
||||
])).is_err());
|
||||
}
|
||||
assert!(save_settings_in(&cat, root, root, "time-is-time", &BTreeMap::from([
|
||||
("TimeIsTime.SpeedRate".into(), "60".into())
|
||||
])).is_ok());
|
||||
}
|
||||
|
||||
fn test_catalog() -> Vec<Entry> {
|
||||
let one = |id: &str, name: &str, conf: &str, key: &str| Entry {
|
||||
id: id.into(),
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,24 @@ pub fn read_state_record(root: &Path, name: &str) -> Option<ProcessIdentity> {
|
||||
fsx::read_json(&root.join(".state").join(format!("{name}.json"))).ok()
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct ProcessExit {
|
||||
process: ProcessIdentity,
|
||||
exit_code: i64,
|
||||
}
|
||||
|
||||
fn exited_state(root: &Path, name: &str, expected: &[String]) -> ServiceState {
|
||||
let exit: Option<ProcessExit> = fsx::read_json(&root.join(".state").join(format!("{name}-exit.json"))).ok();
|
||||
let record = read_state_record(root, name);
|
||||
match (exit, record) {
|
||||
(Some(exit), Some(record))
|
||||
if exit.process.same_as(&record)
|
||||
&& expected.iter().any(|exe| record.exe.eq_ignore_ascii_case(exe))
|
||||
&& exit.exit_code != 0 && exit.exit_code != 2 => ServiceState::Crashed,
|
||||
_ => ServiceState::Stopped,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
mod sys {
|
||||
use super::ProcessIdentity;
|
||||
@@ -304,7 +322,7 @@ fn service_with(root: &Path, name: &'static str, exe: PathBuf, alternatives: &[P
|
||||
(None, Some(o)) => {
|
||||
(ServiceState::Stopped, false, Some(PortConflict { port, pid: o, exe: identity(o).map(|i| i.exe) }))
|
||||
}
|
||||
(None, None) => (ServiceState::Stopped, false, None),
|
||||
(None, None) => (exited_state(root, name, &expected), false, None),
|
||||
};
|
||||
ServiceStatus {
|
||||
name,
|
||||
@@ -400,4 +418,25 @@ mod tests {
|
||||
assert_eq!(o.world.state, ServiceState::Stopped);
|
||||
assert!(o.world.pid.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn only_matching_abnormal_exits_are_crashes() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let state = dir.path().join(".state");
|
||||
std::fs::create_dir_all(&state).unwrap();
|
||||
let record = ProcessIdentity { pid: 42, created: 123, exe: "C:\\server\\worldserver.exe".into() };
|
||||
let expected = vec![record.exe.clone()];
|
||||
std::fs::write(state.join("world.json"), serde_json::to_vec(&record).unwrap()).unwrap();
|
||||
for (code, want) in [(0i64, ServiceState::Stopped), (2, ServiceState::Stopped), (1, ServiceState::Crashed),
|
||||
(3221225477, ServiceState::Crashed)] {
|
||||
std::fs::write(state.join("world-exit.json"), serde_json::to_vec(&serde_json::json!({
|
||||
"process": record, "exit_code": code
|
||||
})).unwrap()).unwrap();
|
||||
assert_eq!(exited_state(dir.path(), "world", &expected), want);
|
||||
}
|
||||
let newer = ProcessIdentity { created: 124, ..record };
|
||||
std::fs::write(state.join("world.json"), serde_json::to_vec(&newer).unwrap()).unwrap();
|
||||
assert_eq!(exited_state(dir.path(), "world", &expected), ServiceState::Stopped);
|
||||
assert_eq!(exited_state(dir.path(), "world", &["C:\\other.exe".into()]), ServiceState::Stopped);
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,14 @@ pub fn qualify_upgrade(base: &Path, source: &Path, candidate: &Path, fixture: &P
|
||||
if fixture.exists() || !fixture.file_name().is_some_and(|name| name.to_string_lossy().starts_with("coa-schema-fixture-")) {
|
||||
return Err(Error::Invalid("Upgrade qualification requires a new disposable coa-schema-fixture-* directory.".into()));
|
||||
}
|
||||
let fixture_root = std::path::absolute(fixture)?;
|
||||
let fixture = fixture_root.as_path();
|
||||
let base_root = fsx::canonicalize_lenient(base)?;
|
||||
let base = base_root.as_path();
|
||||
let source_root = fsx::canonicalize_lenient(source)?;
|
||||
let source = source_root.as_path();
|
||||
let candidate_root = fsx::canonicalize_lenient(candidate)?;
|
||||
let candidate = candidate_root.as_path();
|
||||
let metadata = crate::registry::metadata_dir_for(fixture)?;
|
||||
if metadata.exists() { return Err(Error::Invalid("Upgrade fixture metadata already exists.".into())); }
|
||||
let (base_manifest, base_bytes) = pkgsource::fetch_manifest(&pkgsource::Source::Dir(base.into()), trusted_key)?;
|
||||
@@ -157,6 +165,10 @@ pub fn validate_startup(fixture: &Path, tree: &Path, base: &Path, trusted_key: &
|
||||
|| std::fs::read(fixture.join(MARKER)).ok().as_deref() != Some(b"disposable release-schema fixture") {
|
||||
return Err(Error::Invalid("Startup qualification requires a disposable release-schema fixture.".into()));
|
||||
}
|
||||
let fixture_root = fsx::canonicalize_lenient(fixture)?;
|
||||
let fixture = fixture_root.as_path();
|
||||
let tree_root = fsx::canonicalize_lenient(tree)?;
|
||||
let tree = tree_root.as_path();
|
||||
let metadata = crate::registry::metadata_dir_for(fixture)?;
|
||||
if metadata.exists() { return Err(Error::Invalid("Startup fixture already has Manager metadata; use a fresh fixture.".into())); }
|
||||
schema_check::require_release_contract(tree)?;
|
||||
@@ -190,7 +202,11 @@ pub fn validate_startup(fixture: &Path, tree: &Path, base: &Path, trusted_key: &
|
||||
package::extract_selected(base, &manifest, fixture, &|path| path.starts_with("Data/"), &|_, _| {})?;
|
||||
for relative in files {
|
||||
let target = fsx::ensure_within(fixture, &fixture.join(&relative))?;
|
||||
fsx::atomic_write(&target, &std::fs::read(tree.join(relative))?)?;
|
||||
fsx::atomic_write(&target, &std::fs::read(tree.join(&relative))?)?;
|
||||
let expected = fsx::sha256_file(&tree.join(relative))?;
|
||||
if fsx::sha256_file(&target)? != expected {
|
||||
return Err(Error::Invalid("Startup candidate copy failed verification.".into()));
|
||||
}
|
||||
}
|
||||
let meta = crate::registry::InstallMeta::new(crate::registry::InstallKind::New, fixture);
|
||||
crate::registry::MetaDir::create(fixture, &meta)?;
|
||||
@@ -233,6 +249,19 @@ mod tests {
|
||||
use base64::{engine::general_purpose::STANDARD, Engine};
|
||||
use ed25519_dalek::{Signer, SigningKey};
|
||||
|
||||
#[test]
|
||||
fn relative_startup_fixture_targets_replace_the_original_location() {
|
||||
let directory = tempfile::Builder::new().prefix("coa-schema-fixture-path-test-").tempdir_in(".").unwrap();
|
||||
let current = std::env::current_dir().unwrap();
|
||||
let relative = directory.path().strip_prefix(¤t).unwrap();
|
||||
fsx::atomic_write(&relative.join("Core/worldserver.exe"), b"old").unwrap();
|
||||
let root = fsx::canonicalize_lenient(relative).unwrap();
|
||||
let target = fsx::ensure_within(&root, &root.join("Core/worldserver.exe")).unwrap();
|
||||
fsx::atomic_write(&target, b"candidate").unwrap();
|
||||
assert_eq!(std::fs::read(relative.join("Core/worldserver.exe")).unwrap(), b"candidate");
|
||||
assert!(!root.join(relative).join("Core/worldserver.exe").exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn startup_qualification_refuses_real_server_folders_before_writes() {
|
||||
let directory = tempfile::tempdir().unwrap();
|
||||
|
||||
@@ -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] {
|
||||
|
||||
@@ -1,6 +1,24 @@
|
||||
{
|
||||
"schema": 1,
|
||||
"modules": [
|
||||
{
|
||||
"id": "time-is-time",
|
||||
"name": "TimeIsTime",
|
||||
"description": {
|
||||
"en": "Adjust the visual day and night cycle without changing server timers.",
|
||||
"ru": "Настройка визуального цикла дня и ночи без изменения серверных таймеров.",
|
||||
"de": "Passt den sichtbaren Tag-Nacht-Zyklus an, ohne Serverzeiten zu ändern.",
|
||||
"fr": "Ajuste le cycle visuel jour-nuit sans modifier les minuteries du serveur.",
|
||||
"es": "Ajusta el ciclo visual día-noche sin cambiar los temporizadores del servidor."
|
||||
},
|
||||
"repo": "https://github.com/dunjeon/mod-TimeIsTime",
|
||||
"conf": "mod-time_is_time.conf",
|
||||
"enable_key": "TimeIsTime.Enable",
|
||||
"switchable": true,
|
||||
"default_on": false,
|
||||
"status": "beta",
|
||||
"icon": "clock"
|
||||
},
|
||||
{
|
||||
"id": "companions",
|
||||
"name": "CoA Companions",
|
||||
|
||||
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": {
|
||||
|
||||
@@ -668,9 +668,9 @@ async fn module_set_enabled(state: State<'_, AppState>, id: String, module: Stri
|
||||
|
||||
#[tauri::command]
|
||||
async fn custom_races_status(state: State<'_, AppState>, id: String) -> std::result::Result<Option<coa_core::custom_races::ClientPatchStatus>, UiError> {
|
||||
let root = path_of(&state, &id)?;
|
||||
let ctx = client_context(&state, &id)?;
|
||||
blocking(move || {
|
||||
let client = linked_client(&root)?;
|
||||
let client = ctx.linked();
|
||||
Ok(client.as_deref().map(coa_core::custom_races::client_patch_status))
|
||||
})
|
||||
.await
|
||||
@@ -678,12 +678,12 @@ async fn custom_races_status(state: State<'_, AppState>, id: String) -> std::res
|
||||
|
||||
#[tauri::command]
|
||||
async fn custom_races_install(app: AppHandle, state: State<'_, AppState>, id: String) -> std::result::Result<(), UiError> {
|
||||
let root = path_of(&state, &id)?;
|
||||
let ctx = client_context(&state, &id)?;
|
||||
let _guard = BusyGuard::acquire(&state, &id)?;
|
||||
let cancel = begin_client_job(&state)?;
|
||||
let sid = id.clone();
|
||||
let result = blocking(move || {
|
||||
let client = linked_client(&root)?.ok_or_else(|| Error::Invalid("No game client is linked to this server.".into()))?;
|
||||
let client = ctx.require()?;
|
||||
coa_core::custom_races::install_client_patches(&client, &cancel, &|step, percent| {
|
||||
let _ = app.emit("custom-races-progress", serde_json::json!({
|
||||
"id": sid,
|
||||
@@ -691,7 +691,7 @@ async fn custom_races_install(app: AppHandle, state: State<'_, AppState>, id: St
|
||||
"percent": percent,
|
||||
}));
|
||||
})?;
|
||||
let enabled = coa_core::modules::list(&root).iter().any(|module| module.id == "custom-races" && module.enabled);
|
||||
let enabled = ctx.root.as_ref().map_or(true, |root| coa_core::modules::list(root).iter().any(|module| module.id == "custom-races" && module.enabled));
|
||||
coa_core::custom_races::set_client_patch_enabled(&client, enabled)
|
||||
})
|
||||
.await;
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -195,6 +195,7 @@ const de: Partial<Record<keyof typeof en, string>> = {
|
||||
"comp.saved": "Gespeichert. {n} Begleiter werden beim Serverstart erstellt.",
|
||||
|
||||
// Client
|
||||
"client.races.install": "Patch für benutzerdefinierte Völker installieren",
|
||||
"client.title": "Spielclient",
|
||||
"client.looking": "Suche …",
|
||||
"client.intro": "Sag dem Manager, wo dein Spiel installiert ist, um einen SPIELEN-Button zu erhalten. Deine Spieldateien werden nie geändert, außer der Serveradresse und dem Begleiter-Addon.",
|
||||
|
||||
@@ -238,6 +238,7 @@ const en = {
|
||||
"comp.saved": "Saved. {n} companions will be created when the server starts.",
|
||||
|
||||
// Client
|
||||
"client.races.install": "Install custom race patch",
|
||||
"client.title": "Game client",
|
||||
"client.looking": "Looking…",
|
||||
"client.intro": "Tell Manager where your game is installed to get a PLAY button. Your game files are never changed except the server address and the companion addon.",
|
||||
|
||||
@@ -195,6 +195,7 @@ const es: Partial<Record<keyof typeof en, string>> = {
|
||||
"comp.saved": "Guardado. Se crearán {n} compañeros cuando se inicie el servidor.",
|
||||
|
||||
// Client
|
||||
"client.races.install": "Instalar parche de razas personalizadas",
|
||||
"client.title": "Cliente del juego",
|
||||
"client.looking": "Buscando…",
|
||||
"client.intro": "Indica al Manager dónde está instalado el juego para obtener un botón JUGAR. Tus archivos del juego nunca se modifican, salvo la dirección del servidor y el addon de compañeros.",
|
||||
|
||||
@@ -195,6 +195,7 @@ const fr: Partial<Record<keyof typeof en, string>> = {
|
||||
"comp.saved": "Enregistré. {n} compagnons seront créés au démarrage du serveur.",
|
||||
|
||||
// Client
|
||||
"client.races.install": "Installer le patch des races personnalisées",
|
||||
"client.title": "Client du jeu",
|
||||
"client.looking": "Recherche…",
|
||||
"client.intro": "Indiquez au Manager où le jeu est installé pour obtenir un bouton JOUER. Vos fichiers de jeu ne sont jamais modifiés, sauf l’adresse du serveur et l’addon des compagnons.",
|
||||
|
||||
@@ -228,6 +228,7 @@ const ru: Partial<Record<keyof typeof en, string>> = {
|
||||
"comp.saved": "Сохранено. Компаньоны ({n}) будут созданы при запуске сервера.",
|
||||
|
||||
// Client
|
||||
"client.races.install": "Установить патч кастомных рас",
|
||||
"client.title": "Клиент игры",
|
||||
"client.looking": "Ищу…",
|
||||
"client.intro": "Укажите, где установлена игра, чтобы появилась кнопка «Играть». Файлы игры не изменяются, кроме адреса сервера и аддона компаньонов.",
|
||||
|
||||
@@ -207,6 +207,7 @@ const zh = {
|
||||
"comp.saved": "已保存。{n} 名随从将在服务器启动时创建。",
|
||||
|
||||
// Client
|
||||
"client.races.install": "安装自定义种族补丁",
|
||||
"client.title": "游戏客户端",
|
||||
"client.looking": "正在寻找…",
|
||||
"client.intro": "指定游戏客户端安装路径即可启用“开始游戏”按钮。除服务器地址和随从插件外,你的游戏文件绝不会被修改。",
|
||||
|
||||
@@ -14,6 +14,10 @@ const text = (values: string[], locale: Locale) => values[locales.indexOf(locale
|
||||
type Entry = { key: string; type: string; title: string[]; description: string[]; min?: number; max?: number; advanced?: boolean; options?: { value: string; label: string[] }[] };
|
||||
export const moduleSettingDefinitions: Entry[] = [];
|
||||
const fields = moduleSettingDefinitions;
|
||||
add("TimeIsTime.Announce", "bool", ["Announce on login", "Сообщение при входе"], ["Show a module notice when a character logs in.", "Показывать сообщение о модуле при входе персонажа."]);
|
||||
add("TimeIsTime.SpeedRate", "float", ["Day/night speed", "Скорость смены дня и ночи"], ["1 follows real time; 60 gives one game day every 24 minutes. Changes only the client visual clock.", "1 — реальное время; 60 — игровые сутки за 24 минуты. Меняет только визуальное время клиента."], { min: 0.01, max: 60 });
|
||||
add("TimeIsTime.HourOffset", "float", ["Hour offset", "Смещение часов"], ["Offset applied to the visual client clock, in hours.", "Смещение визуальных часов клиента в часах."], { min: -24, max: 24 });
|
||||
add("TimeIsTime.TimeStart", "int", ["Starting time", "Начальное время"], ["Unix timestamp used at every login; 0 uses the server clock.", "Unix-время при каждом входе; 0 использует часы сервера."], { min: 0, max: 2147483647 });
|
||||
function add(key: string, type: string, title: string[], description: string[], extra: Partial<Entry> = {}) {
|
||||
fields.push({ key, type, title, description, ...extra });
|
||||
}
|
||||
@@ -69,8 +73,11 @@ add(scaling + "LFG.DefaultChallengeSize", "int", ["Challenge group size", "Ра
|
||||
add(scaling + "GroupScaling.LockOnEncounterStart", "bool", ["Lock scaling during combat", "Фиксировать скейлинг на время боя", "Skalierung im Kampf sperren", "Figer l’adaptation en combat", "Fijar ajuste durante combate", "战斗期间锁定缩放"], ["Joining or leaving during a boss fight does not change its scaling.", "Вход и выход игроков во время боя с боссом не меняют скейлинг.", "Beitreten oder Verlassen während eines Bosskampfs ändert die Skalierung nicht.", "Les arrivées et départs pendant un boss ne changent pas l’adaptation.", "Entrar o salir durante un jefe no cambia el ajuste.", "首领战期间玩家进出不会改变缩放。"], { advanced: true });
|
||||
add(scaling + "Progression.Mode", "enum", ["Progression boundaries", "Границы прогрессии", "Fortschrittsgrenzen", "Limites de progression", "Límites de progresión", "进度边界"], ["Automatic boundaries follow the level cap and enabled expansions. Custom uses the levels below.", "Автоматические границы зависят от максимального уровня и включённых дополнений. Ручные используют уровни ниже.", "Automatisch folgt der Maximalstufe und Erweiterungen. Benutzerdefiniert nutzt die folgenden Stufen.", "Automatique suit le niveau maximal et les extensions. Manuel utilise les niveaux ci-dessous.", "Automático sigue el nivel máximo y las expansiones. Manual usa los niveles siguientes.", "自动边界按等级上限和启用的资料片计算,自定义使用以下等级。"], { advanced: true, options: [
|
||||
{ value: "Auto", label: ["Automatic", "Автоматически", "Automatisch", "Automatique", "Automático", "自动"] },
|
||||
{ value: "Parallel", label: ["Parallel: Classic 1–60, TBC/WotLK 45–60", "Параллельно: классика 1–60, БК/ЛК 45–60", "Parallel: Classic 1–60, TBC/WotLK 45–60", "Parallèle : Classic 1–60, TBC/WotLK 45–60", "Paralelo: Classic 1–60, TBC/WotLK 45–60", "并行:经典1–60,TBC/WotLK45–60"] },
|
||||
{ value: "Global", label: ["Global: all eras 1–60", "Всё содержимое 1–60", "Alle Erweiterungen 1–60", "Toutes les extensions 1–60", "Todas las expansiones 1–60", "全部资料片1–60"] },
|
||||
{ value: "Custom", label: ["Custom", "Вручную", "Benutzerdefiniert", "Manuel", "Manual", "自定义"] },
|
||||
] });
|
||||
add(scaling + "Items.RemoveClassRestrictions", "bool", ["Remove item class requirements", "Убрать классовые ограничения предметов"], ["Allow all classes to equip class-restricted items, including tier sets. Requires a world server restart.", "Разрешает всем классам надевать предметы с классовыми ограничениями, включая комплекты T10. Требуется перезапуск игрового сервера."]);
|
||||
for (const era of ["Classic", "Tbc"]) add(scaling + `Progression.${era}End`, "int", [`${era} last level`, `Последний уровень ${era}`, `${era}-Endstufe`, `Dernier niveau ${era}`, `Último nivel ${era}`, `${era} 最高等级`], ["Used in custom progression. 0 chooses automatically.", "Для ручной прогрессии. 0 — автоматически.", "Für benutzerdefinierten Fortschritt. 0 wählt automatisch.", "Pour la progression manuelle. 0 choisit automatiquement.", "Para progresión manual. 0 elige automáticamente.", "用于自定义进度,0为自动。"], { min: 0, max: 80, advanced: true });
|
||||
add(scaling + "Debug", "bool", ["Detailed scaling logs", "Подробные логи скейлинга", "Ausführliche Skalierungsprotokolle", "Journaux détaillés", "Registros detallados", "详细缩放日志"], ["Log scaling calculations for troubleshooting.", "Записывает расчёты скейлинга для диагностики.", "Protokolliert Berechnungen zur Fehleranalyse.", "Enregistre les calculs pour le diagnostic.", "Registra cálculos para diagnóstico.", "记录缩放计算以排查问题。"], { advanced: true });
|
||||
|
||||
@@ -203,6 +210,6 @@ export function canonicalModuleValue(key: string, value: string): string {
|
||||
const v = value.trim().replace(/^"|"$/g, "");
|
||||
if (key === scaling + "SoloAssist.Mode") return ({ "0": "None", "1": "Light", "2": "Full", none: "None", light: "Light", full: "Full" } as Record<string, string>)[v.toLowerCase()] ?? v;
|
||||
if (key === scaling + "LFG.DefaultMode") return ({ "0": "Matchmaking", "1": "BotFill", "2": "CurrentParty", matchmaking: "Matchmaking", botfill: "BotFill", currentparty: "CurrentParty" } as Record<string, string>)[v.toLowerCase()] ?? v;
|
||||
if (key === scaling + "Progression.Mode") return v.toLowerCase() === "auto" ? "Auto" : v.toLowerCase() === "custom" ? "Custom" : v;
|
||||
if (key === scaling + "Progression.Mode") return ({ auto: "Auto", custom: "Custom", parallel: "Parallel", global: "Global" } as Record<string, string>)[v.toLowerCase()] ?? v;
|
||||
return v;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
import { open } from "@tauri-apps/plugin-dialog";
|
||||
import { api, asUiError, type ClientInfo, type ClientStatus, type UiError } from "@/lib/api";
|
||||
import { checkClient } from "@/lib/clientUpdate";
|
||||
@@ -16,6 +17,7 @@ export function ClientCard({ serverId, remote = false }: { serverId: string; rem
|
||||
const [note, setNote] = useState<string | null>(null);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [status, setStatus] = useState<ClientStatus | null>(null);
|
||||
const [patchProgress, setPatchProgress] = useState<string | null>(null);
|
||||
const [dialog, setDialog] = useState<ClientDialogMode | null>(null);
|
||||
const [playAfter, setPlayAfter] = useStartAfterUpdate("client", serverId);
|
||||
|
||||
@@ -25,6 +27,10 @@ export function ClientCard({ serverId, remote = false }: { serverId: string; rem
|
||||
};
|
||||
useEffect(() => {
|
||||
void refresh();
|
||||
const unlisten = listen<{ id: string; step: string; percent: number }>("custom-races-progress", e => {
|
||||
if (e.payload.id === serverId) setPatchProgress(`${e.payload.step} (${Math.round(e.payload.percent * 100)}%)`);
|
||||
});
|
||||
return () => { void unlisten.then(f => f()); };
|
||||
}, [serverId]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
async function run(fn: () => Promise<string | void>) {
|
||||
@@ -40,6 +46,7 @@ export function ClientCard({ serverId, remote = false }: { serverId: string; rem
|
||||
setError(asUiError(e));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
setPatchProgress(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,11 +118,13 @@ export function ClientCard({ serverId, remote = false }: { serverId: string; rem
|
||||
{status && !status.managed && (
|
||||
<Button size="sm" disabled={busy} onClick={() => setDialog("track")}>{t("client.track.button")}</Button>
|
||||
)}
|
||||
{remote && <Button size="sm" disabled={busy} onClick={() => void run(() => api.customRacesInstall(serverId))}>{t("client.races.install")}</Button>}
|
||||
<Button size="sm" variant="ghost" disabled={busy} onClick={() => void choose()}>{t("client.changeFolder")}</Button>
|
||||
<Button size="sm" variant="ghost" disabled={busy} onClick={() => setDialog("setup")}>{t("client.downloadInstead")}</Button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
{patchProgress && <p className="mt-3 text-sm text-muted" role="status">{patchProgress}</p>}
|
||||
{note && <p className="mt-3 text-sm text-ok" role="status">{note}</p>}
|
||||
{error && <p className="mt-3 text-sm text-bad" role="alert">{error.human.code === "unknown" ? error.technical : human(error.human).message}</p>}
|
||||
{dialog && (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Fragment, useCallback, useEffect, useRef, useState, type ComponentType, type ReactNode } from "react";
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
import { Bot, Flame, Gavel, Loader2, Plug, Puzzle, Scaling, Settings2, Snowflake, Sparkles, Swords, Users, type LucideProps } from "lucide-react";
|
||||
import { Bot, Clock, Flame, Gavel, Loader2, Plug, Puzzle, Scaling, Settings2, Snowflake, Sparkles, Swords, Users, type LucideProps } from "lucide-react";
|
||||
import { api, asUiError, type CustomRacesClientStatus, type CustomRacesProgress, type ModuleSetting, type ModuleView, type UiError } from "@/lib/api";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -21,6 +21,7 @@ function GithubMark(props: { className?: string }) {
|
||||
|
||||
/** Icon and colours of a module's square tile, by the name the catalog gives it. */
|
||||
const TILES: Record<string, { icon: ComponentType<LucideProps>; from: string; to: string }> = {
|
||||
clock: { icon: Clock, from: "from-amber-500", to: "to-indigo-700" },
|
||||
bot: { icon: Bot, from: "from-emerald-500", to: "to-teal-700" },
|
||||
scaling: { icon: Scaling, from: "from-violet-500", to: "to-indigo-700" },
|
||||
plug: { icon: Plug, from: "from-amber-500", to: "to-orange-700" },
|
||||
|
||||
@@ -196,6 +196,7 @@ export function Overview({ server, companions = true, onForget, onOpenUpdates, o
|
||||
if (alive.current) setPop(null);
|
||||
if (
|
||||
wasWorldRunningRef.current &&
|
||||
s.observed.world.state === "crashed" &&
|
||||
!userStoppedRef.current &&
|
||||
actionRef.current === null
|
||||
) {
|
||||
|
||||
Reference in new issue
Block a user