mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-20 19:25:56 +00:00
Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
316ef078e8 | ||
|
|
1974ff54e3 | ||
|
|
de3af82e5d | ||
|
|
802bde220c | ||
|
|
dfe7ac656b | ||
|
|
cee5139879 | ||
|
|
1ea2c8318b | ||
|
|
2b7dbf8e1e | ||
|
|
4ff190f6d1 | ||
|
|
bff5248591 | ||
|
|
f5205662a9 | ||
|
|
169d8b8977 | ||
|
|
41977442e9 | ||
|
|
c75785d13e | ||
|
|
2b9021ce07 |
No files matched your search
@@ -8,6 +8,12 @@ Published releases and previews. Pre-release entries do not change the stable up
|
||||
|
||||
Dates follow GitHub publication (UTC); legacy records retain their archived dates. Newest releases first.
|
||||
|
||||
## 0.9.15 — 2026-11-19
|
||||
|
||||
- The Custom Races client update brings version 2.0.2.
|
||||
|
||||
[Release](https://github.com/Corfirean/coa-server-manager/releases/tag/v0.9.15) · [Source changes](https://github.com/Corfirean/coa-server-manager/compare/v0.9.14...v0.9.15)
|
||||
|
||||
## 0.9.14 — 2026-11-16
|
||||
|
||||
- Install community addons from the Manager.
|
||||
|
||||
Generated
+4
-4
@@ -586,7 +586,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "coa-core"
|
||||
version = "0.9.14"
|
||||
version = "0.9.16"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"chrono",
|
||||
@@ -621,7 +621,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "coa-launcher"
|
||||
version = "0.9.14"
|
||||
version = "0.9.16"
|
||||
dependencies = [
|
||||
"coa-core",
|
||||
"serde_json",
|
||||
@@ -644,7 +644,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "coa-release"
|
||||
version = "0.9.14"
|
||||
version = "0.9.16"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"coa-core",
|
||||
@@ -653,7 +653,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "coa-server-manager"
|
||||
version = "0.9.14"
|
||||
version = "0.9.16"
|
||||
dependencies = [
|
||||
"coa-control-proto",
|
||||
"coa-core",
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ members = ["crates/coa-core", "crates/coa-launcher", "crates/coa-release", "crat
|
||||
exclude = ["services/coa-registry", "services/coa-registry-e2e", "services/coa-coordinator", "services/coa-relay"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.9.14"
|
||||
version = "0.9.16"
|
||||
edition = "2021"
|
||||
license = "AGPL-3.0-only"
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: manager
|
||||
type: changed
|
||||
audience: players
|
||||
title: The game client now comes from the community launcher, not from the Manager
|
||||
---
|
||||
The client download moved behind the community launcher's sign-in, so the Manager's built-in download and update are removed. Get the launcher at coa-development.org, then choose your game folder in the Manager.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: manager
|
||||
type: changed
|
||||
audience: players
|
||||
title: The Custom Races client update brings version 2.0.2
|
||||
---
|
||||
Updating the Custom Races client installs 2.0.2, including the retail body models, subclass and HD patches and the Two-Players bar. About 4.4 GB of new files are fetched. Update the Manager before the server.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: manager
|
||||
type: changed
|
||||
audience: players
|
||||
title: Client setup says where to switch HD graphics; Custom Races patch card is translated
|
||||
---
|
||||
HD or standard graphics is a launcher setting; the client setup dialog now says so. The Custom Races client patch status and buttons are now translated into every language the Manager offers.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: manager
|
||||
type: added
|
||||
audience: admins
|
||||
title: Clean server logs by hand or automatically when they grow too big
|
||||
---
|
||||
Server logging settings show how much the logs take and clean them with one button. Optionally the Manager cleans them above a size you choose; logs the running server uses are kept.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: manager
|
||||
type: changed
|
||||
audience: players
|
||||
title: The startup limit for companions now creates the ones that are missing
|
||||
---
|
||||
With 50 companions and a startup limit of 300, the Manager now creates the missing 250 instead of logging in only 50. Companions that exist are never created again. Up to 2000 are created at a time.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: manager
|
||||
type: added
|
||||
audience: admins
|
||||
title: Restart the world every week on a chosen day and time
|
||||
---
|
||||
Next to the daily restart, pick a weekday, a time and the in-game countdown in the scheduled restart settings. Existing daily schedules keep working.
|
||||
+13
-1
@@ -190,7 +190,8 @@
|
||||
"Corfirean/coa-server-manager:20261115-scheduled-restart.md",
|
||||
"Corfirean/coa-server-manager:20261115-v2-feature-switches.md",
|
||||
"Corfirean/coa-server-manager:20261116-companions-wildcard-reborn.md",
|
||||
"Corfirean/coa-server-manager:20261116-custom-race-characters-off.md"
|
||||
"Corfirean/coa-server-manager:20261116-custom-race-characters-off.md",
|
||||
"Corfirean/coa-server-manager:20261118-custom-races-2-0-2-client.md"
|
||||
],
|
||||
"releases": [
|
||||
{
|
||||
@@ -970,6 +971,17 @@
|
||||
],
|
||||
"commit": "1f64da3ae064b3f02d2bb11d818c44d26a557045",
|
||||
"compare": "https://github.com/Corfirean/coa-server-manager/compare/v0.9.13...v0.9.14"
|
||||
},
|
||||
{
|
||||
"tag": "v0.9.15",
|
||||
"version": "0.9.15",
|
||||
"date": "2026-11-19",
|
||||
"url": "https://github.com/Corfirean/coa-server-manager/releases/tag/v0.9.15",
|
||||
"notes": [
|
||||
"The Custom Races client update brings version 2.0.2"
|
||||
],
|
||||
"commit": "2b9021ce072e3b6c7e9c8106f8a54f59f1b37424",
|
||||
"compare": "https://github.com/Corfirean/coa-server-manager/compare/v0.9.14...v0.9.15"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
//! Live check of the client download path against the community launcher's public server:
|
||||
//! reads the manifest and downloads the few smallest files into a temp folder (never a real client).
|
||||
//! Usage: cargo run -p coa-core --example client_probe (PROBE_SKIP=n skips the n smallest files)
|
||||
|
||||
use coa_core::clientdl::{self, Apply, Manifest};
|
||||
use coa_core::download::{Cancel, HttpTransport};
|
||||
|
||||
fn main() {
|
||||
let full = clientdl::fetch_latest().expect("manifest");
|
||||
println!(
|
||||
"version {} · {} files · {:.1} GB",
|
||||
full.version,
|
||||
full.files.len(),
|
||||
full.total_bytes() as f64 / 1e9
|
||||
);
|
||||
let mut small = full.files.clone();
|
||||
small.sort_by_key(|f| f.size);
|
||||
let skip: usize = std::env::var("PROBE_SKIP")
|
||||
.ok()
|
||||
.and_then(|v| v.parse().ok())
|
||||
.unwrap_or(0);
|
||||
let small: Vec<_> = small.into_iter().skip(skip).take(6).collect();
|
||||
let manifest = Manifest {
|
||||
version: full.version.clone(),
|
||||
published_at: None,
|
||||
files: small,
|
||||
};
|
||||
|
||||
let dir = std::env::temp_dir().join(format!("coa-client-probe-{}", std::process::id()));
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
let cancel = Cancel::default();
|
||||
let plan = clientdl::plan(&dir, &manifest, &Default::default(), &cancel, &|_| {}).unwrap();
|
||||
println!(
|
||||
"plan: {} files, {} bytes",
|
||||
plan.items.len(),
|
||||
plan.download_bytes
|
||||
);
|
||||
let transport = HttpTransport::new().unwrap();
|
||||
clientdl::apply(
|
||||
&Apply {
|
||||
client: &dir,
|
||||
manifest: &manifest,
|
||||
plan: &plan,
|
||||
keep_modified: false,
|
||||
transport: &transport,
|
||||
objects_url: clientdl::OBJECTS_URL,
|
||||
cancel: &cancel,
|
||||
},
|
||||
&|s| {
|
||||
println!(
|
||||
"{} {}/{} {}",
|
||||
s.phase,
|
||||
s.done,
|
||||
s.total,
|
||||
s.file.unwrap_or_default()
|
||||
)
|
||||
},
|
||||
)
|
||||
.expect("apply");
|
||||
let again = clientdl::plan(
|
||||
&dir,
|
||||
&manifest,
|
||||
&clientdl::load_state(&dir).unwrap(),
|
||||
&cancel,
|
||||
&|_| {},
|
||||
)
|
||||
.unwrap();
|
||||
println!(
|
||||
"second plan: {} to do, {} up to date, version {:?}",
|
||||
again.items.len(),
|
||||
again.up_to_date_files,
|
||||
clientdl::local(&dir).version
|
||||
);
|
||||
std::fs::remove_dir_all(&dir).unwrap();
|
||||
}
|
||||
@@ -1,975 +0,0 @@
|
||||
//! Download and update of the game client from the community launcher's public manifest.
|
||||
//!
|
||||
//! The manifest lists every file with its size and SHA-256; each file is fetched by hash and verified before it is
|
||||
//! moved into place (`download::fetch_with`, resumable). The Manager keeps a small state file inside the client
|
||||
//! folder (`.coa-manager/client-state.json`) so that later checks are cheap and so that files the player changed
|
||||
//! are recognised: they are never overwritten without being asked, and a replaced file is moved aside, not deleted.
|
||||
//! WTF, Cache, other addons, logs and `realmlist.wtf` are not part of what the Manager synchronises.
|
||||
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
use std::fs::{self, File};
|
||||
use std::io::Read;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::time::{Instant, UNIX_EPOCH};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sha2::{Digest, Sha256};
|
||||
|
||||
use crate::download::{self, Cancel, HttpTransport, Job, Transport};
|
||||
use crate::error::{Error, Result};
|
||||
use crate::fsx;
|
||||
|
||||
pub const MANIFEST_URL: &str =
|
||||
"https://launcher-api.coa-development.org/downloads/client/latest.json";
|
||||
pub const OBJECTS_URL: &str = "https://launcher-api.coa-development.org/downloads/client/objects";
|
||||
const STATE_DIR: &str = ".coa-manager";
|
||||
const MAX_MANIFEST_BYTES: u64 = 16 * 1024 * 1024;
|
||||
const MAX_FILE_BYTES: u64 = 16 * 1024 * 1024 * 1024;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ManifestFile {
|
||||
pub path: String,
|
||||
pub size: u64,
|
||||
pub sha256: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct Manifest {
|
||||
pub version: String,
|
||||
pub published_at: Option<String>,
|
||||
pub files: Vec<ManifestFile>,
|
||||
}
|
||||
|
||||
impl Manifest {
|
||||
pub fn total_bytes(&self) -> u64 {
|
||||
self.files.iter().map(|f| f.size).sum()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct RawManifest {
|
||||
schema: u32,
|
||||
version: String,
|
||||
#[serde(rename = "publishedAt")]
|
||||
published_at: Option<String>,
|
||||
files: Vec<ManifestFile>,
|
||||
}
|
||||
|
||||
/// Things the Manager never writes, even if a manifest lists them: logs, the realmlist, the player's own settings,
|
||||
/// caches and the companion addon (those have their own safe paths).
|
||||
fn is_excluded(path: &str) -> bool {
|
||||
let p = path.replace('\\', "/").to_ascii_lowercase();
|
||||
p.ends_with(".log")
|
||||
|| p.rsplit('/').next() == Some("realmlist.wtf")
|
||||
|| p.starts_with("wtf/")
|
||||
|| p.starts_with("cache/")
|
||||
|| p.starts_with("errors/")
|
||||
|| p.starts_with("logs/")
|
||||
|| p.starts_with(".coa-manager/")
|
||||
|| p.starts_with("interface/addons/coabotui/")
|
||||
}
|
||||
|
||||
/// Files players customise: graphics wrappers and their configuration. If one exists and differs from the published
|
||||
/// file it is left exactly as it is, whatever the "keep my files" choice; it is only created when missing.
|
||||
fn is_player_owned(path: &str) -> bool {
|
||||
let name = path.rsplit('/').next().unwrap_or(path).to_ascii_lowercase();
|
||||
matches!(
|
||||
name.as_str(),
|
||||
"d3d8.dll" | "d3d9.dll" | "d3d10core.dll" | "d3d11.dll" | "dxgi.dll" | "dxvk.conf"
|
||||
) || matches!(
|
||||
name.rsplit('.').next(),
|
||||
Some("ini" | "conf" | "cfg" | "wtf")
|
||||
)
|
||||
}
|
||||
|
||||
pub fn parse_manifest(text: &str) -> Result<Manifest> {
|
||||
let raw: RawManifest = serde_json::from_str(text)
|
||||
.map_err(|e| Error::Invalid(format!("The client list could not be read: {e}")))?;
|
||||
if raw.schema != 1 {
|
||||
return Err(Error::Invalid(format!(
|
||||
"The client list uses a newer format ({}); update the Manager.",
|
||||
raw.schema
|
||||
)));
|
||||
}
|
||||
if raw.version.trim().is_empty() || raw.version.len() > 64 {
|
||||
return Err(Error::Invalid("The client list has no version.".into()));
|
||||
}
|
||||
let root = Path::new("client-root");
|
||||
let mut files = Vec::with_capacity(raw.files.len());
|
||||
for f in raw.files {
|
||||
fsx::safe_join(root, &f.path)?;
|
||||
let hash_ok = f.sha256.len() == 64 && f.sha256.bytes().all(|b| b.is_ascii_hexdigit());
|
||||
if !hash_ok || f.size > MAX_FILE_BYTES {
|
||||
return Err(Error::Invalid(format!(
|
||||
"The client list has a bad entry for {}.",
|
||||
f.path
|
||||
)));
|
||||
}
|
||||
if is_excluded(&f.path) {
|
||||
continue;
|
||||
}
|
||||
files.push(ManifestFile {
|
||||
path: f.path.replace('\\', "/"),
|
||||
size: f.size,
|
||||
sha256: f.sha256.to_ascii_lowercase(),
|
||||
});
|
||||
}
|
||||
if files.is_empty() {
|
||||
return Err(Error::Invalid("The client list is empty.".into()));
|
||||
}
|
||||
Ok(Manifest {
|
||||
version: raw.version,
|
||||
published_at: raw.published_at,
|
||||
files,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn fetch_manifest(transport: &dyn Transport, url: &str) -> Result<Manifest> {
|
||||
let mut reply = transport
|
||||
.get(url, 0)
|
||||
.map_err(|e| Error::Invalid(format!("Could not reach the client download server: {e}")))?;
|
||||
if reply.status != 200 {
|
||||
return Err(Error::Invalid(format!(
|
||||
"The client download server answered {}.",
|
||||
reply.status
|
||||
)));
|
||||
}
|
||||
let mut text = String::new();
|
||||
reply
|
||||
.body
|
||||
.by_ref()
|
||||
.take(MAX_MANIFEST_BYTES)
|
||||
.read_to_string(&mut text)
|
||||
.map_err(|e| Error::Invalid(format!("Could not read the client list: {e}")))?;
|
||||
parse_manifest(&text)
|
||||
}
|
||||
|
||||
pub fn fetch_latest() -> Result<Manifest> {
|
||||
download::check_url(MANIFEST_URL)?;
|
||||
fetch_manifest(&HttpTransport::with_total_timeout(30)?, MANIFEST_URL)
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Entry {
|
||||
pub size: u64,
|
||||
pub mtime: u64,
|
||||
pub sha256: String,
|
||||
/// The player chose to keep this file although the manifest has a different one (this is the manifest hash
|
||||
/// they were asked about; a newer manifest asks again).
|
||||
#[serde(default)]
|
||||
pub kept_against: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
||||
pub struct State {
|
||||
/// The manifest version this folder was brought to; None while a download is unfinished.
|
||||
pub version: Option<String>,
|
||||
pub files: BTreeMap<String, Entry>,
|
||||
}
|
||||
|
||||
fn state_path(client: &Path) -> PathBuf {
|
||||
client.join(STATE_DIR).join("client-state.json")
|
||||
}
|
||||
|
||||
pub fn load_state(client: &Path) -> Option<State> {
|
||||
fsx::read_json(&state_path(client)).ok()
|
||||
}
|
||||
|
||||
fn save_state(client: &Path, state: &State) -> Result<()> {
|
||||
fsx::atomic_write_json(&state_path(client), state)
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct Local {
|
||||
/// The Manager downloaded or adopted this folder (a state file exists).
|
||||
pub managed: bool,
|
||||
pub version: Option<String>,
|
||||
}
|
||||
|
||||
pub fn local(client: &Path) -> Local {
|
||||
let s = load_state(client);
|
||||
Local {
|
||||
managed: s.is_some(),
|
||||
version: s.and_then(|s| s.version),
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum Kind {
|
||||
/// Not in the folder.
|
||||
Missing,
|
||||
/// Still as the Manager left it; the manifest has a newer file.
|
||||
Changed,
|
||||
/// Different from the manifest and not as the Manager left it (changed by the player or by something else).
|
||||
Modified,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct Item {
|
||||
pub path: String,
|
||||
pub size: u64,
|
||||
pub kind: Kind,
|
||||
#[serde(skip)]
|
||||
sha256: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct Plan {
|
||||
pub version: String,
|
||||
pub items: Vec<Item>,
|
||||
pub download_bytes: u64,
|
||||
pub total_files: usize,
|
||||
pub up_to_date_files: usize,
|
||||
pub kept_files: usize,
|
||||
#[serde(skip)]
|
||||
confirmed: BTreeMap<String, Entry>,
|
||||
}
|
||||
|
||||
impl Plan {
|
||||
pub fn modified(&self) -> Vec<&Item> {
|
||||
self.items
|
||||
.iter()
|
||||
.filter(|i| i.kind == Kind::Modified)
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct Step {
|
||||
/// "scan" while comparing files, "download" while fetching, "finish" at the end.
|
||||
pub phase: &'static str,
|
||||
pub done: u64,
|
||||
pub total: u64,
|
||||
pub bytes_per_sec: u64,
|
||||
pub file: Option<String>,
|
||||
}
|
||||
|
||||
fn cancelled() -> Error {
|
||||
Error::Invalid("Download cancelled.".into())
|
||||
}
|
||||
|
||||
fn mtime_secs(m: &fs::Metadata) -> u64 {
|
||||
m.modified()
|
||||
.ok()
|
||||
.and_then(|t| t.duration_since(UNIX_EPOCH).ok())
|
||||
.map(|d| d.as_secs())
|
||||
.unwrap_or(0)
|
||||
}
|
||||
|
||||
fn hash_file(path: &Path, cancel: &Cancel, on_bytes: &mut dyn FnMut(u64)) -> Result<String> {
|
||||
let mut f = File::open(path)?;
|
||||
let mut hasher = Sha256::new();
|
||||
let mut buf = vec![0u8; 1 << 20];
|
||||
loop {
|
||||
if cancel.is_set() {
|
||||
return Err(cancelled());
|
||||
}
|
||||
let n = f.read(&mut buf)?;
|
||||
if n == 0 {
|
||||
return Ok(hex::encode(hasher.finalize()));
|
||||
}
|
||||
hasher.update(&buf[..n]);
|
||||
on_bytes(n as u64);
|
||||
}
|
||||
}
|
||||
|
||||
/// Compare the folder with the manifest. Files are hashed only when their size or modification time no longer
|
||||
/// matches what the state file recorded, so a routine check of a managed folder is quick.
|
||||
pub fn plan(
|
||||
client: &Path,
|
||||
m: &Manifest,
|
||||
state: &State,
|
||||
cancel: &Cancel,
|
||||
on_step: &dyn Fn(Step),
|
||||
) -> Result<Plan> {
|
||||
let total = m.total_bytes();
|
||||
let mut done = 0u64;
|
||||
let mut items = Vec::new();
|
||||
let mut confirmed = BTreeMap::new();
|
||||
let (mut up_to_date, mut kept) = (0usize, 0usize);
|
||||
for f in &m.files {
|
||||
if cancel.is_set() {
|
||||
return Err(cancelled());
|
||||
}
|
||||
on_step(Step {
|
||||
phase: "scan",
|
||||
done,
|
||||
total,
|
||||
bytes_per_sec: 0,
|
||||
file: Some(f.path.clone()),
|
||||
});
|
||||
if crate::client_graphics::disabled(client, &f.path)? {
|
||||
kept += 1;
|
||||
done += f.size;
|
||||
continue;
|
||||
}
|
||||
let path = fsx::safe_join(client, &f.path)?;
|
||||
let meta = match fs::metadata(&path) {
|
||||
Ok(meta) if meta.is_file() => meta,
|
||||
_ => {
|
||||
items.push(Item {
|
||||
path: f.path.clone(),
|
||||
size: f.size,
|
||||
kind: Kind::Missing,
|
||||
sha256: f.sha256.clone(),
|
||||
});
|
||||
done += f.size;
|
||||
continue;
|
||||
}
|
||||
};
|
||||
let (size, mtime) = (meta.len(), mtime_secs(&meta));
|
||||
let entry = state.files.get(&f.path);
|
||||
let trusted = entry.filter(|e| e.size == size && e.mtime == mtime);
|
||||
let local: Option<String> = if let Some(e) = trusted {
|
||||
Some(e.sha256.clone())
|
||||
} else if size == f.size || entry.map(|e| e.size == size).unwrap_or(false) {
|
||||
let base = done;
|
||||
let mut seen = 0u64;
|
||||
let h = hash_file(&path, cancel, &mut |n| {
|
||||
seen += n;
|
||||
on_step(Step {
|
||||
phase: "scan",
|
||||
done: base + seen.min(f.size),
|
||||
total,
|
||||
bytes_per_sec: 0,
|
||||
file: Some(f.path.clone()),
|
||||
});
|
||||
})?;
|
||||
Some(h)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
done += f.size;
|
||||
if is_player_owned(&f.path) && local.as_deref() != Some(f.sha256.as_str()) {
|
||||
let sha = match local {
|
||||
Some(h) => h,
|
||||
None => hash_file(&path, cancel, &mut |_| {})?,
|
||||
};
|
||||
kept += 1;
|
||||
confirmed.insert(
|
||||
f.path.clone(),
|
||||
Entry {
|
||||
size,
|
||||
mtime,
|
||||
sha256: sha,
|
||||
kept_against: Some(f.sha256.clone()),
|
||||
},
|
||||
);
|
||||
continue;
|
||||
}
|
||||
if local.as_deref() == Some(f.sha256.as_str()) {
|
||||
up_to_date += 1;
|
||||
confirmed.insert(
|
||||
f.path.clone(),
|
||||
Entry {
|
||||
size,
|
||||
mtime,
|
||||
sha256: f.sha256.clone(),
|
||||
kept_against: None,
|
||||
},
|
||||
);
|
||||
continue;
|
||||
}
|
||||
let as_left = entry.filter(|e| local.as_deref() == Some(e.sha256.as_str()));
|
||||
match as_left {
|
||||
Some(e) if e.kept_against.as_deref() == Some(f.sha256.as_str()) => {
|
||||
kept += 1;
|
||||
confirmed.insert(
|
||||
f.path.clone(),
|
||||
Entry {
|
||||
size,
|
||||
mtime,
|
||||
sha256: e.sha256.clone(),
|
||||
kept_against: e.kept_against.clone(),
|
||||
},
|
||||
);
|
||||
}
|
||||
Some(e) if e.kept_against.is_none() => {
|
||||
items.push(Item {
|
||||
path: f.path.clone(),
|
||||
size: f.size,
|
||||
kind: Kind::Changed,
|
||||
sha256: f.sha256.clone(),
|
||||
});
|
||||
}
|
||||
_ => items.push(Item {
|
||||
path: f.path.clone(),
|
||||
size: f.size,
|
||||
kind: Kind::Modified,
|
||||
sha256: f.sha256.clone(),
|
||||
}),
|
||||
}
|
||||
}
|
||||
on_step(Step {
|
||||
phase: "scan",
|
||||
done: total,
|
||||
total,
|
||||
bytes_per_sec: 0,
|
||||
file: None,
|
||||
});
|
||||
let download_bytes = items.iter().map(|i| i.size).sum();
|
||||
Ok(Plan {
|
||||
version: m.version.clone(),
|
||||
items,
|
||||
download_bytes,
|
||||
total_files: m.files.len(),
|
||||
up_to_date_files: up_to_date,
|
||||
kept_files: kept,
|
||||
confirmed,
|
||||
})
|
||||
}
|
||||
|
||||
pub struct Apply<'a> {
|
||||
pub client: &'a Path,
|
||||
pub manifest: &'a Manifest,
|
||||
pub plan: &'a Plan,
|
||||
/// Leave files the player changed alone (they are remembered, and asked about again only when the manifest changes).
|
||||
pub keep_modified: bool,
|
||||
pub transport: &'a dyn Transport,
|
||||
pub objects_url: &'a str,
|
||||
pub cancel: &'a Cancel,
|
||||
}
|
||||
|
||||
fn blocked(path: &str, e: std::io::Error) -> Error {
|
||||
Error::Invalid(format!("Could not replace {path}: {e}. Close the game and anything else using the client, then try again."))
|
||||
}
|
||||
|
||||
/// Download what the plan lists. Progress is saved after every file, so an interrupted run resumes where it stopped.
|
||||
pub fn apply(a: &Apply, on_step: &dyn Fn(Step)) -> Result<()> {
|
||||
let mut state = State {
|
||||
version: None,
|
||||
files: a.plan.confirmed.clone(),
|
||||
};
|
||||
save_state(a.client, &state)?;
|
||||
|
||||
let mut todo = Vec::new();
|
||||
for item in &a.plan.items {
|
||||
if crate::client_graphics::disabled(a.client, &item.path)? {
|
||||
continue;
|
||||
}
|
||||
if item.kind == Kind::Modified && a.keep_modified {
|
||||
let path = fsx::safe_join(a.client, &item.path)?;
|
||||
let meta = fs::metadata(&path)?;
|
||||
let sha = hash_file(&path, a.cancel, &mut |_| {})?;
|
||||
state.files.insert(
|
||||
item.path.clone(),
|
||||
Entry {
|
||||
size: meta.len(),
|
||||
mtime: mtime_secs(&meta),
|
||||
sha256: sha,
|
||||
kept_against: Some(item.sha256.clone()),
|
||||
},
|
||||
);
|
||||
} else {
|
||||
todo.push(item);
|
||||
}
|
||||
}
|
||||
let total: u64 = todo.iter().map(|i| i.size).sum();
|
||||
fsx::require_space(a.client, total)?;
|
||||
|
||||
let staging = a.client.join(STATE_DIR).join("staging");
|
||||
let replaced = a
|
||||
.client
|
||||
.join(STATE_DIR)
|
||||
.join("replaced")
|
||||
.join(chrono::Utc::now().format("%Y%m%d-%H%M%S").to_string());
|
||||
let mut done = 0u64;
|
||||
let mut placed: HashMap<&str, PathBuf> = HashMap::new();
|
||||
for item in todo {
|
||||
if a.cancel.is_set() {
|
||||
save_state(a.client, &state)?;
|
||||
return Err(cancelled());
|
||||
}
|
||||
let target = fsx::safe_join(a.client, &item.path)?;
|
||||
let started = Instant::now();
|
||||
let staged = staging.join(&item.sha256);
|
||||
let copy_from = placed.get(item.sha256.as_str()).cloned();
|
||||
if copy_from.is_none() {
|
||||
let job = Job {
|
||||
url: format!("{}/{}", a.objects_url, item.sha256),
|
||||
dest: staged.clone(),
|
||||
sha256: item.sha256.clone(),
|
||||
size: item.size,
|
||||
};
|
||||
let base = done;
|
||||
let result = download::fetch_with(a.transport, &job, a.cancel, &|p| {
|
||||
on_step(Step {
|
||||
phase: "download",
|
||||
done: base + p.downloaded,
|
||||
total,
|
||||
bytes_per_sec: p.bytes_per_sec,
|
||||
file: Some(item.path.clone()),
|
||||
});
|
||||
});
|
||||
if let Err(e) = result {
|
||||
let _ = save_state(a.client, &state);
|
||||
return Err(e);
|
||||
}
|
||||
}
|
||||
if let Some(parent) = target.parent() {
|
||||
fs::create_dir_all(parent)?;
|
||||
}
|
||||
if target.exists() {
|
||||
if item.kind == Kind::Modified {
|
||||
let keep = fsx::safe_join(&replaced, &item.path)?;
|
||||
if let Some(parent) = keep.parent() {
|
||||
fs::create_dir_all(parent)?;
|
||||
}
|
||||
fs::rename(&target, &keep).map_err(|e| blocked(&item.path, e))?;
|
||||
} else {
|
||||
fs::remove_file(&target).map_err(|e| blocked(&item.path, e))?;
|
||||
}
|
||||
}
|
||||
match copy_from {
|
||||
Some(src) => {
|
||||
fs::copy(&src, &target).map_err(|e| blocked(&item.path, e))?;
|
||||
}
|
||||
None => fs::rename(&staged, &target).map_err(|e| blocked(&item.path, e))?,
|
||||
}
|
||||
placed.insert(&item.sha256, target.clone());
|
||||
let meta = fs::metadata(&target)?;
|
||||
state.files.insert(
|
||||
item.path.clone(),
|
||||
Entry {
|
||||
size: meta.len(),
|
||||
mtime: mtime_secs(&meta),
|
||||
sha256: item.sha256.clone(),
|
||||
kept_against: None,
|
||||
},
|
||||
);
|
||||
save_state(a.client, &state)?;
|
||||
done += item.size;
|
||||
let secs = started.elapsed().as_secs_f64().max(0.001);
|
||||
on_step(Step {
|
||||
phase: "download",
|
||||
done,
|
||||
total,
|
||||
bytes_per_sec: (item.size as f64 / secs) as u64,
|
||||
file: Some(item.path.clone()),
|
||||
});
|
||||
}
|
||||
state.version = Some(a.manifest.version.clone());
|
||||
save_state(a.client, &state)?;
|
||||
let _ = fs::remove_dir_all(&staging);
|
||||
on_step(Step {
|
||||
phase: "finish",
|
||||
done: total,
|
||||
total,
|
||||
bytes_per_sec: 0,
|
||||
file: None,
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::download::Reply;
|
||||
use std::io::Cursor;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::Mutex;
|
||||
|
||||
/// Serves objects by hash; remembers what was requested and can fail after N objects.
|
||||
struct Server {
|
||||
objects: Mutex<HashMap<String, Vec<u8>>>,
|
||||
requested: Mutex<Vec<String>>,
|
||||
cancel_after: Option<(AtomicUsize, Cancel)>,
|
||||
}
|
||||
|
||||
impl Server {
|
||||
fn new(files: &[(&str, &[u8])]) -> Self {
|
||||
let s = Server {
|
||||
objects: Default::default(),
|
||||
requested: Default::default(),
|
||||
cancel_after: None,
|
||||
};
|
||||
for (_, body) in files {
|
||||
s.objects
|
||||
.lock()
|
||||
.unwrap()
|
||||
.insert(fsx::sha256_bytes(body), body.to_vec());
|
||||
}
|
||||
s
|
||||
}
|
||||
}
|
||||
|
||||
impl Transport for Server {
|
||||
fn get(&self, url: &str, from: u64) -> std::result::Result<Reply, String> {
|
||||
let sha = url.rsplit('/').next().unwrap().to_string();
|
||||
self.requested.lock().unwrap().push(sha.clone());
|
||||
if let Some((left, cancel)) = &self.cancel_after {
|
||||
if left.fetch_sub(1, Ordering::SeqCst) == 1 {
|
||||
cancel.cancel();
|
||||
}
|
||||
}
|
||||
let body = self
|
||||
.objects
|
||||
.lock()
|
||||
.unwrap()
|
||||
.get(&sha)
|
||||
.cloned()
|
||||
.ok_or("404")?;
|
||||
let (status, start) = if from > 0 {
|
||||
(206, from as usize)
|
||||
} else {
|
||||
(200, 0)
|
||||
};
|
||||
let cr = (from > 0).then(|| format!("bytes {from}-{}/{}", body.len() - 1, body.len()));
|
||||
Ok(Reply {
|
||||
status,
|
||||
content_range: cr,
|
||||
body: Box::new(Cursor::new(body[start..].to_vec())),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn manifest(version: &str, files: &[(&str, &[u8])]) -> Manifest {
|
||||
Manifest {
|
||||
version: version.into(),
|
||||
published_at: None,
|
||||
files: files
|
||||
.iter()
|
||||
.map(|(p, b)| ManifestFile {
|
||||
path: p.to_string(),
|
||||
size: b.len() as u64,
|
||||
sha256: fsx::sha256_bytes(b),
|
||||
})
|
||||
.collect(),
|
||||
}
|
||||
}
|
||||
|
||||
const V1: [(&str, &[u8]); 4] = [
|
||||
("Wow.exe", b"exe-1"),
|
||||
("Data/common.MPQ", b"common-mpq-data"),
|
||||
("Data/patch-A.MPQ", b"patch-a-1"),
|
||||
("Data/enUS/locale.MPQ", b"locale"),
|
||||
];
|
||||
|
||||
fn sync(dir: &Path, m: &Manifest, server: &Server, keep: bool) -> Result<Plan> {
|
||||
let state = load_state(dir).unwrap_or_default();
|
||||
let cancel = Cancel::default();
|
||||
let p = plan(dir, m, &state, &cancel, &|_| {})?;
|
||||
apply(
|
||||
&Apply {
|
||||
client: dir,
|
||||
manifest: m,
|
||||
plan: &p,
|
||||
keep_modified: keep,
|
||||
transport: server,
|
||||
objects_url: "https://x.invalid/objects",
|
||||
cancel: &cancel,
|
||||
},
|
||||
&|_| {},
|
||||
)?;
|
||||
Ok(p)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn manifest_rejects_traversal_and_bad_entries_and_skips_personal_files() {
|
||||
let ok = r#"{"schema":1,"version":"v1","files":[
|
||||
{"path":"Wow.exe","size":3,"sha256":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"},
|
||||
{"path":"Data/enUS/realmlist.wtf","size":3,"sha256":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"},
|
||||
{"path":"WTF/Config.wtf","size":3,"sha256":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"},
|
||||
{"path":"Interface/AddOns/CoABotUI/x.lua","size":3,"sha256":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"},
|
||||
{"path":"MemoryBridge.log","size":3,"sha256":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}]}"#;
|
||||
let m = parse_manifest(ok).unwrap();
|
||||
assert_eq!(
|
||||
m.files.iter().map(|f| f.path.as_str()).collect::<Vec<_>>(),
|
||||
["Wow.exe"]
|
||||
);
|
||||
for bad in [
|
||||
r#"{"schema":1,"version":"v","files":[{"path":"../evil.dll","size":1,"sha256":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}]}"#,
|
||||
r#"{"schema":1,"version":"v","files":[{"path":"C:/evil.dll","size":1,"sha256":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}]}"#,
|
||||
r#"{"schema":1,"version":"v","files":[{"path":"a.dll","size":1,"sha256":"short"}]}"#,
|
||||
r#"{"schema":2,"version":"v","files":[]}"#,
|
||||
r#"{"schema":1,"version":"v","files":[]}"#,
|
||||
] {
|
||||
assert!(parse_manifest(bad).is_err(), "{bad}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fresh_download_installs_every_file_verified_and_leaves_nothing_behind() {
|
||||
let d = tempfile::tempdir().unwrap();
|
||||
let (m, s) = (manifest("v1", &V1), Server::new(&V1));
|
||||
let p = sync(d.path(), &m, &s, false).unwrap();
|
||||
assert_eq!(p.items.len(), 4);
|
||||
for (path, body) in V1 {
|
||||
assert_eq!(fs::read(d.path().join(path)).unwrap(), body);
|
||||
}
|
||||
let st = load_state(d.path()).unwrap();
|
||||
assert_eq!(st.version.as_deref(), Some("v1"));
|
||||
assert_eq!(st.files.len(), 4);
|
||||
assert!(!d.path().join(".coa-manager/staging").exists());
|
||||
assert!(local(d.path()).managed);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_update_downloads_only_what_changed_and_a_second_check_is_empty() {
|
||||
let d = tempfile::tempdir().unwrap();
|
||||
sync(d.path(), &manifest("v1", &V1), &Server::new(&V1), false).unwrap();
|
||||
let mut v2 = V1.to_vec();
|
||||
v2[2] = ("Data/patch-A.MPQ", b"patch-a-2-longer");
|
||||
v2.push(("Data/new.MPQ", b"brand new"));
|
||||
let (m2, s2) = (manifest("v2", &v2), Server::new(&v2));
|
||||
let p = sync(d.path(), &m2, &s2, false).unwrap();
|
||||
let kinds: Vec<_> = p.items.iter().map(|i| (i.path.as_str(), i.kind)).collect();
|
||||
assert_eq!(
|
||||
kinds,
|
||||
[
|
||||
("Data/patch-A.MPQ", Kind::Changed),
|
||||
("Data/new.MPQ", Kind::Missing)
|
||||
]
|
||||
);
|
||||
assert_eq!(
|
||||
s2.requested.lock().unwrap().len(),
|
||||
2,
|
||||
"unchanged files were not downloaded again"
|
||||
);
|
||||
assert_eq!(
|
||||
fs::read(d.path().join("Data/patch-A.MPQ")).unwrap(),
|
||||
b"patch-a-2-longer"
|
||||
);
|
||||
assert!(
|
||||
!d.path().join(".coa-manager/replaced").exists(),
|
||||
"a file the Manager itself wrote needs no backup"
|
||||
);
|
||||
let again = sync(d.path(), &m2, &s2, false).unwrap();
|
||||
assert!(again.items.is_empty() && again.up_to_date_files == 5);
|
||||
assert_eq!(load_state(d.path()).unwrap().version.as_deref(), Some("v2"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_file_the_player_changed_is_asked_about_kept_when_told_to_and_saved_when_replaced() {
|
||||
let d = tempfile::tempdir().unwrap();
|
||||
sync(d.path(), &manifest("v1", &V1), &Server::new(&V1), false).unwrap();
|
||||
fs::write(d.path().join("Wow.exe"), b"my patched exe").unwrap();
|
||||
let mut v2 = V1.to_vec();
|
||||
v2[0] = ("Wow.exe", b"exe-2");
|
||||
let (m2, s2) = (manifest("v2", &v2), Server::new(&v2));
|
||||
|
||||
let p = sync(d.path(), &m2, &s2, true).unwrap();
|
||||
assert_eq!(p.modified().len(), 1);
|
||||
assert_eq!(
|
||||
fs::read(d.path().join("Wow.exe")).unwrap(),
|
||||
b"my patched exe",
|
||||
"kept"
|
||||
);
|
||||
assert!(
|
||||
s2.requested.lock().unwrap().is_empty(),
|
||||
"nothing needed downloading"
|
||||
);
|
||||
let quiet = sync(d.path(), &m2, &s2, true).unwrap();
|
||||
assert!(
|
||||
quiet.items.is_empty() && quiet.kept_files == 1,
|
||||
"the decision is remembered"
|
||||
);
|
||||
|
||||
let mut v3 = V1.to_vec();
|
||||
v3[0] = ("Wow.exe", b"exe-3");
|
||||
let (m3, s3) = (manifest("v3", &v3), Server::new(&v3));
|
||||
let again = sync(d.path(), &m3, &s3, false).unwrap();
|
||||
assert_eq!(again.modified().len(), 1, "a newer client asks again");
|
||||
assert_eq!(fs::read(d.path().join("Wow.exe")).unwrap(), b"exe-3");
|
||||
let saved = fs::read_dir(d.path().join(".coa-manager/replaced"))
|
||||
.unwrap()
|
||||
.next()
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.path();
|
||||
assert_eq!(
|
||||
fs::read(saved.join("Wow.exe")).unwrap(),
|
||||
b"my patched exe",
|
||||
"the player's version was moved aside, not lost"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn disabled_launcher_renderers_are_never_restored_even_with_a_stale_plan() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let files: Vec<(&str, &[u8])> = vec![("d3d9.dll", b"dxvk"), ("dxgi.dll", b"enhancements")];
|
||||
let manifest = manifest("v1", &files);
|
||||
let cancel = Cancel::default();
|
||||
let old_plan = plan(dir.path(), &manifest, &State::default(), &cancel, &|_| {}).unwrap();
|
||||
fs::write(dir.path().join("d3d9.dll.DISABLED"), b"custom disabled").unwrap();
|
||||
crate::client_graphics::set(dir.path(), "dxgi.dll", true).unwrap();
|
||||
let server = Server::new(&files);
|
||||
apply(
|
||||
&Apply {
|
||||
client: dir.path(),
|
||||
manifest: &manifest,
|
||||
plan: &old_plan,
|
||||
keep_modified: false,
|
||||
transport: &server,
|
||||
objects_url: "https://x.invalid/objects",
|
||||
cancel: &cancel,
|
||||
},
|
||||
&|_| {},
|
||||
)
|
||||
.unwrap();
|
||||
assert!(server.requested.lock().unwrap().is_empty());
|
||||
assert!(!dir.path().join("d3d9.dll").exists());
|
||||
assert!(!dir.path().join("dxgi.dll").exists());
|
||||
assert_eq!(
|
||||
fs::read(dir.path().join("d3d9.dll.DISABLED")).unwrap(),
|
||||
b"custom disabled"
|
||||
);
|
||||
let after = plan(
|
||||
dir.path(),
|
||||
&manifest,
|
||||
&load_state(dir.path()).unwrap(),
|
||||
&cancel,
|
||||
&|_| {},
|
||||
)
|
||||
.unwrap();
|
||||
assert!(after.items.is_empty());
|
||||
crate::client_graphics::set(dir.path(), "d3d9.dll", false).unwrap();
|
||||
assert_eq!(
|
||||
fs::read(dir.path().join("d3d9.dll")).unwrap(),
|
||||
b"custom disabled"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn renderer_files_configs_and_everything_not_in_the_manifest_survive_an_update_untouched() {
|
||||
let d = tempfile::tempdir().unwrap();
|
||||
let v1: Vec<(&str, &[u8])> = vec![
|
||||
("Wow.exe", b"exe-1"),
|
||||
("d3d9.dll", b"official d3d9"),
|
||||
("dxvk.conf", b"official conf"),
|
||||
("Data/common.MPQ", b"common-1"),
|
||||
];
|
||||
sync(d.path(), &manifest("v1", &v1), &Server::new(&v1), false).unwrap();
|
||||
// the player's own setup: custom renderer + configs, addons, WTF, realmlist, extra archives, backups
|
||||
let mine: Vec<(&str, &[u8])> = vec![
|
||||
("d3d9.dll", b"my renderer"),
|
||||
("dxvk.conf", b"my conf"),
|
||||
("ModernWoWRenderer.ini", b"cfg"),
|
||||
("GraphicsEffects.ini.bak", b"bak"),
|
||||
(
|
||||
"Data/enUS/realmlist.wtf",
|
||||
b"set realmlist 127.0.0.1
|
||||
",
|
||||
),
|
||||
("Data/patch-5.MPQ", b"extra archive"),
|
||||
("Interface/AddOns/ElvUI/ElvUI.toc", b"## Title: Elv"),
|
||||
("WTF/Account/x/SavedVariables.lua", b"vars"),
|
||||
("Cache/x.wdb", b"cache"),
|
||||
];
|
||||
for (p, b) in &mine {
|
||||
let path = d.path().join(p);
|
||||
fs::create_dir_all(path.parent().unwrap()).unwrap();
|
||||
fs::write(path, b).unwrap();
|
||||
}
|
||||
let before: BTreeMap<String, String> = mine
|
||||
.iter()
|
||||
.map(|(p, b)| (p.to_string(), fsx::sha256_bytes(b)))
|
||||
.collect();
|
||||
let v2: Vec<(&str, &[u8])> = vec![
|
||||
("Wow.exe", b"exe-2"),
|
||||
("d3d9.dll", b"official d3d9 v2"),
|
||||
("dxvk.conf", b"official conf v2"),
|
||||
("Data/common.MPQ", b"common-2"),
|
||||
];
|
||||
let (m2, s2) = (manifest("v2", &v2), Server::new(&v2));
|
||||
for keep in [false, true] {
|
||||
sync(d.path(), &m2, &s2, keep).unwrap();
|
||||
for (p, h) in &before {
|
||||
assert_eq!(
|
||||
&fsx::sha256_file(&d.path().join(p)).unwrap(),
|
||||
h,
|
||||
"{p} must not change (keep_modified={keep})"
|
||||
);
|
||||
}
|
||||
assert_eq!(fs::read(d.path().join("Wow.exe")).unwrap(), b"exe-2");
|
||||
assert_eq!(
|
||||
fs::read(d.path().join("Data/common.MPQ")).unwrap(),
|
||||
b"common-2"
|
||||
);
|
||||
}
|
||||
assert!(
|
||||
!d.path().join(".coa-manager/replaced").exists(),
|
||||
"nothing of the player's was displaced"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_existing_client_without_state_is_compared_by_content() {
|
||||
let d = tempfile::tempdir().unwrap();
|
||||
for (p, b) in V1 {
|
||||
let path = d.path().join(p);
|
||||
fs::create_dir_all(path.parent().unwrap()).unwrap();
|
||||
fs::write(path, b).unwrap();
|
||||
}
|
||||
fs::write(d.path().join("Data/patch-A.MPQ"), b"patch-a-X").unwrap(); // same size, different content
|
||||
fs::remove_file(d.path().join("Data/enUS/locale.MPQ")).unwrap();
|
||||
fs::create_dir_all(d.path().join("WTF")).unwrap();
|
||||
fs::write(d.path().join("WTF/Config.wtf"), b"mine").unwrap();
|
||||
let m = manifest("v1", &V1);
|
||||
let p = plan(d.path(), &m, &State::default(), &Cancel::default(), &|_| {}).unwrap();
|
||||
let kinds: Vec<_> = p.items.iter().map(|i| (i.path.as_str(), i.kind)).collect();
|
||||
assert_eq!(
|
||||
kinds,
|
||||
[
|
||||
("Data/patch-A.MPQ", Kind::Modified),
|
||||
("Data/enUS/locale.MPQ", Kind::Missing)
|
||||
]
|
||||
);
|
||||
assert_eq!(p.up_to_date_files, 2);
|
||||
assert_eq!(fs::read(d.path().join("WTF/Config.wtf")).unwrap(), b"mine");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cancel_keeps_finished_files_and_the_next_run_only_fetches_the_rest() {
|
||||
let d = tempfile::tempdir().unwrap();
|
||||
let m = manifest("v1", &V1);
|
||||
let mut s = Server::new(&V1);
|
||||
let cancel = Cancel::default();
|
||||
s.cancel_after = Some((AtomicUsize::new(3), cancel.clone()));
|
||||
let state = State::default();
|
||||
let p = plan(d.path(), &m, &state, &cancel, &|_| {}).unwrap();
|
||||
let r = apply(
|
||||
&Apply {
|
||||
client: d.path(),
|
||||
manifest: &m,
|
||||
plan: &p,
|
||||
keep_modified: false,
|
||||
transport: &s,
|
||||
objects_url: "https://x.invalid/o",
|
||||
cancel: &cancel,
|
||||
},
|
||||
&|_| {},
|
||||
);
|
||||
assert!(r.is_err());
|
||||
let st = load_state(d.path()).unwrap();
|
||||
assert!(
|
||||
st.version.is_none() && !st.files.is_empty() && st.files.len() < 4,
|
||||
"unfinished but remembered: {}",
|
||||
st.files.len()
|
||||
);
|
||||
assert!(local(d.path()).managed && local(d.path()).version.is_none());
|
||||
|
||||
let s2 = Server::new(&V1);
|
||||
sync(d.path(), &m, &s2, false).unwrap();
|
||||
assert_eq!(
|
||||
s2.requested.lock().unwrap().len(),
|
||||
4 - st.files.len(),
|
||||
"only the missing files were requested"
|
||||
);
|
||||
assert_eq!(load_state(d.path()).unwrap().version.as_deref(), Some("v1"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_wrong_object_never_reaches_the_client_folder() {
|
||||
let d = tempfile::tempdir().unwrap();
|
||||
let m = manifest("v1", &V1);
|
||||
let s = Server::new(&V1);
|
||||
// the server returns different bytes under the right hash
|
||||
let sha = fsx::sha256_bytes(b"exe-1");
|
||||
s.objects.lock().unwrap().insert(sha, b"EVIL!".to_vec());
|
||||
assert!(sync(d.path(), &m, &s, false).is_err());
|
||||
assert!(!d.path().join("Wow.exe").exists());
|
||||
assert!(load_state(d.path()).unwrap().version.is_none());
|
||||
}
|
||||
}
|
||||
@@ -583,6 +583,45 @@ pub fn cancel_pending_job(meta_dir: &Path, realm: &str) -> Result<Option<Compani
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
/// The most companions a startup fleet can hold (the limit the settings accept).
|
||||
pub const STARTUP_FLEET_MAX: u32 = 5000;
|
||||
|
||||
/// The most companions one creation job asks the server for (a single server command takes at most this many).
|
||||
pub const FLEET_JOB_MAX: u32 = 2000;
|
||||
|
||||
/// Companions still missing so that `limit` of them exist. The startup limit is a fleet size, not an addition: with
|
||||
/// 50 companions and a limit of 300 only 250 are missing, and with 300 or more nothing is.
|
||||
pub fn fleet_shortfall(limit: u32, existing: u32) -> u32 {
|
||||
limit.min(STARTUP_FLEET_MAX).saturating_sub(existing)
|
||||
}
|
||||
|
||||
/// Queue the durable job that creates the companions a realm's startup fleet is missing (at most `FLEET_JOB_MAX`
|
||||
/// at a time; the rest follows at the next start or save). Returns the new job, or `None` when the fleet is complete
|
||||
/// or an unfinished job already exists for the realm: that one is carried out instead, because a second job would
|
||||
/// create the same bots twice.
|
||||
pub fn queue_fleet_top_up(
|
||||
meta_dir: &Path,
|
||||
instance_id: &str,
|
||||
mode: crate::realms::Mode,
|
||||
limit: u32,
|
||||
existing: u32,
|
||||
) -> Result<Option<CompanionsPendingJob>> {
|
||||
let missing = fleet_shortfall(limit, existing).min(FLEET_JOB_MAX);
|
||||
if missing == 0 {
|
||||
return Ok(None);
|
||||
}
|
||||
let realm = mode.name();
|
||||
if let Some(job) = load_pending_job(meta_dir, realm)? {
|
||||
if !job.state.is_terminal() {
|
||||
return Ok(None);
|
||||
}
|
||||
}
|
||||
validate_spawn_request(mode, missing, None, None, None, None)?;
|
||||
let job = CompanionsPendingJob::new(instance_id, realm, missing, None, None, None, None);
|
||||
save_pending_job(meta_dir, realm, &job)?;
|
||||
Ok(Some(job))
|
||||
}
|
||||
|
||||
/// One-time idempotent migration of legacy `companions.pending.json` into `companions.pending.coa.json`.
|
||||
/// Never creates a duplicate job if `companions.pending.coa.json` already exists.
|
||||
pub fn migrate_legacy_pending_job(
|
||||
@@ -1630,3 +1669,65 @@ mod tests {
|
||||
assert!(validate_spawn_request(Mode::Reborn, 5, Some(60), Some(7), Some(4), None).is_ok());
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod fleet_tests {
|
||||
use super::*;
|
||||
use crate::realms::Mode;
|
||||
|
||||
#[test]
|
||||
fn the_limit_is_a_fleet_size_not_an_addition() {
|
||||
assert_eq!(fleet_shortfall(300, 50), 250);
|
||||
assert_eq!(fleet_shortfall(300, 300), 0);
|
||||
assert_eq!(fleet_shortfall(300, 450), 0);
|
||||
assert_eq!(fleet_shortfall(0, 0), 0);
|
||||
assert_eq!(fleet_shortfall(9000, 0), STARTUP_FLEET_MAX);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn only_the_missing_companions_are_queued() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let job = queue_fleet_top_up(dir.path(), "srv", Mode::Coa, 300, 50).unwrap().unwrap();
|
||||
assert_eq!(job.count, 250);
|
||||
assert_eq!(job.effective_requested_count(), 250);
|
||||
assert_eq!(job.realm, "coa");
|
||||
let saved = load_pending_job(dir.path(), "coa").unwrap().unwrap();
|
||||
assert_eq!(saved.job_id, job.job_id);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_complete_fleet_creates_nothing() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
assert!(queue_fleet_top_up(dir.path(), "srv", Mode::Coa, 300, 300).unwrap().is_none());
|
||||
assert!(queue_fleet_top_up(dir.path(), "srv", Mode::Coa, 300, 1000).unwrap().is_none());
|
||||
assert!(load_pending_job(dir.path(), "coa").unwrap().is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_unfinished_job_is_not_doubled_but_a_finished_one_is_replaced() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let first = queue_fleet_top_up(dir.path(), "srv", Mode::Coa, 300, 50).unwrap().unwrap();
|
||||
assert!(queue_fleet_top_up(dir.path(), "srv", Mode::Coa, 400, 50).unwrap().is_none());
|
||||
assert_eq!(load_pending_job(dir.path(), "coa").unwrap().unwrap().job_id, first.job_id);
|
||||
cancel_pending_job(dir.path(), "coa").unwrap();
|
||||
let second = queue_fleet_top_up(dir.path(), "srv", Mode::Coa, 400, 50).unwrap().unwrap();
|
||||
assert_ne!(second.job_id, first.job_id);
|
||||
assert_eq!(second.count, 350);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn one_job_never_asks_for_more_than_a_server_command_takes() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let job = queue_fleet_top_up(dir.path(), "srv", Mode::Coa, 5000, 0).unwrap().unwrap();
|
||||
assert_eq!(job.count, FLEET_JOB_MAX);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn realms_keep_separate_jobs() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
queue_fleet_top_up(dir.path(), "srv", Mode::Coa, 100, 0).unwrap().unwrap();
|
||||
let reborn = queue_fleet_top_up(dir.path(), "srv", Mode::Reborn, 40, 10).unwrap().unwrap();
|
||||
assert_eq!(reborn.count, 30);
|
||||
assert_eq!(load_pending_job(dir.path(), "coa").unwrap().unwrap().count, 100);
|
||||
}
|
||||
}
|
||||
@@ -14,24 +14,34 @@ use crate::download::Cancel;
|
||||
use crate::error::{Error, Result};
|
||||
use crate::fsx;
|
||||
|
||||
pub const CLIENT_VERSION: &str = "2.0";
|
||||
pub const CLIENT_VERSION: &str = "2.0.2";
|
||||
pub const MANIFEST_FILENAME: &str = "custom_races_patch_manifest.txt";
|
||||
/// Files earlier releases installed that the current release no longer ships (removed on update).
|
||||
#[cfg(test)]
|
||||
const RETIRED_FILES: &[&str] = &["Ascension.exe"];
|
||||
/// The client archives of the coa-custom-2.0 release. The server archive is read only for its client
|
||||
/// addons (files/addons: subclass interface, dev menu, teleports, spell activation overlay).
|
||||
/// The client archives of the coa-custom-2.0.2 release. Clients 1 to 9 are byte for byte the 2.0 archives and keep their
|
||||
/// 2.0 file names, so a verified copy in the cache or in Downloads is not fetched again. The server archive is read
|
||||
/// only for its client addons; the SkinCollection (Skinshifter) addon in Client 17 is not installed (see RACE_ADDONS).
|
||||
/// Order matters: a later archive replaces a file of an earlier one, and Client 17 carries the newer Ascension_Subclass.
|
||||
pub const ARCHIVES: &[(&str, &str)] = &[
|
||||
("CoA-Custom-V2-Client-1.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-1.zip"),
|
||||
("CoA-Custom-V2-Client-2.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-2.zip"),
|
||||
("CoA-Custom-V2-Client-3.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-3.zip"),
|
||||
("CoA-Custom-V2-Client-4.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-4.zip"),
|
||||
("CoA-Custom-V2-Client-5.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-5.zip"),
|
||||
("CoA-Custom-V2-Client-6.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-6.zip"),
|
||||
("CoA-Custom-V2-Client-7.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-7.zip"),
|
||||
("CoA-Custom-V2-Client-8.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-8.zip"),
|
||||
("CoA-Custom-V2-Client-9.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-9.zip"),
|
||||
("CoA-Custom-V2-Server.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Server.zip"),
|
||||
("CoA-Custom-V2-Client-1.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-1.zip"),
|
||||
("CoA-Custom-V2-Client-2.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-2.zip"),
|
||||
("CoA-Custom-V2-Client-3.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-3.zip"),
|
||||
("CoA-Custom-V2-Client-4.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-4.zip"),
|
||||
("CoA-Custom-V2-Client-5.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-5.zip"),
|
||||
("CoA-Custom-V2-Client-6.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-6.zip"),
|
||||
("CoA-Custom-V2-Client-7.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-7.zip"),
|
||||
("CoA-Custom-V2-Client-8.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-8.zip"),
|
||||
("CoA-Custom-V2-Client-9.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-9.zip"),
|
||||
("CoA-Custom-V2.0.2-Client-10.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-10.zip"),
|
||||
("CoA-Custom-V2.0.2-Client-11.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-11.zip"),
|
||||
("CoA-Custom-V2.0.2-Client-12.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-12.zip"),
|
||||
("CoA-Custom-V2.0.2-Client-13.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-13.zip"),
|
||||
("CoA-Custom-V2.0.2-Client-14.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-14.zip"),
|
||||
("CoA-Custom-V2.0.2-Client-15.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-15.zip"),
|
||||
("CoA-Custom-V2.0.2-Client-16.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-16.zip"),
|
||||
("CoA-Custom-V2.0.2-Server.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Server.zip"),
|
||||
("CoA-Custom-V2.0.2-Client-17.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-17.zip"),
|
||||
];
|
||||
|
||||
pub const RACE_MPQS: &[&str] = &[
|
||||
@@ -111,6 +121,24 @@ pub const RACE_MPQS: &[&str] = &[
|
||||
"patch-ZZZZZW.MPQ",
|
||||
"patch-ZZZZZX.MPQ",
|
||||
"patch-ZZZZZY.MPQ",
|
||||
"patch-ZZZZZY-SUBMA.MPQ",
|
||||
"patch-ZZZZZY-SUBVA.MPQ",
|
||||
"patch-ZZZZZY-SUBVB.MPQ",
|
||||
"patch-ZZZZZY-SUBVC.MPQ",
|
||||
"patch-ZZZZZY-SUBXA-HD.MPQ",
|
||||
"patch-ZZZZZY-SUBXB-HD.MPQ",
|
||||
"patch-ZZZZZY-SUBXC-HD.MPQ",
|
||||
"patch-ZZZZZZ.MPQ",
|
||||
"patch-ZZZZZZA.MPQ",
|
||||
"patch-ZZZZZZB.MPQ",
|
||||
"patch-ZZZZZZC.MPQ",
|
||||
"patch-ZZZZZZD.MPQ",
|
||||
"patch-ZZZZZZE.MPQ",
|
||||
"patch-retail-001.mpq",
|
||||
"patch-retail-002.mpq",
|
||||
"patch-retail-003.mpq",
|
||||
"patch-retail-004.mpq",
|
||||
"patch-retail-005.mpq",
|
||||
];
|
||||
|
||||
pub const RACE_ADDONS: &[&str] = &[
|
||||
@@ -118,13 +146,18 @@ pub const RACE_ADDONS: &[&str] = &[
|
||||
"Ascension_Subclass/Ascension_Subclass.toc",
|
||||
"Ascension_Subclass/Bindings.xml",
|
||||
"Ascension_Subclass/SubclassBar.lua",
|
||||
"Ascension_Subclass/SubclassBonk.lua",
|
||||
"Ascension_Subclass/SubclassCarry.lua",
|
||||
"Ascension_Subclass/SubclassCastBar.lua",
|
||||
"Ascension_Subclass/SubclassChoices.lua",
|
||||
"Ascension_Subclass/SubclassGlow.lua",
|
||||
"Ascension_Subclass/SubclassNodes.lua",
|
||||
"Ascension_Subclass/SubclassOrbs.lua",
|
||||
"Ascension_Subclass/SubclassPairs.lua",
|
||||
"Ascension_Subclass/SubclassPetBar.lua",
|
||||
"Ascension_Subclass/SubclassPowerBar.lua",
|
||||
"Ascension_Subclass/SubclassRaceBackground.lua",
|
||||
"Ascension_Subclass/Textures/IceFrame.tga",
|
||||
"CoAHideArmor/CoAHideArmor.lua",
|
||||
"CoAHideArmor/CoAHideArmor.toc",
|
||||
"CoAQuestSafe/CoAQuestSafe.lua",
|
||||
@@ -405,6 +438,8 @@ fn patch_files(client: &Path) -> Result<Vec<PatchFile>> {
|
||||
include_str!("custom_races_hashes_1_9_1.json")
|
||||
} else if manifest.lines().any(|line| line == "# CoA Custom 1.9.2") {
|
||||
include_str!("custom_races_hashes_1_9_2.json")
|
||||
} else if manifest.lines().any(|line| line == "# CoA Custom 2.0") {
|
||||
include_str!("custom_races_hashes_2_0.json")
|
||||
} else {
|
||||
include_str!("custom_races_hashes.json")
|
||||
};
|
||||
@@ -1100,9 +1135,41 @@ fn archive_job(filename: &str, url: &str, cache: &Path) -> Result<crate::downloa
|
||||
195_235_400,
|
||||
"0764893543084a12d15578fe734f66ba4519740794a6b3b3a38a08594c38c640",
|
||||
),
|
||||
"CoA-Custom-V2-Server.zip" => (
|
||||
63_983_587,
|
||||
"8970d61eea40f53cea4c27481edd85d2b2647cd32eb88932e0077da3b4a77d23",
|
||||
"CoA-Custom-V2.0.2-Client-10.zip" => (
|
||||
73_099_250,
|
||||
"035720776b66a18b965bbd7262154ea398f5425b8cd116fdfc5f663cd800316e",
|
||||
),
|
||||
"CoA-Custom-V2.0.2-Client-11.zip" => (
|
||||
178_667_276,
|
||||
"9a66f782be47f66ce4ec9f4f70cb1970218fe48950a031b39aa79c091008901b",
|
||||
),
|
||||
"CoA-Custom-V2.0.2-Client-12.zip" => (
|
||||
1_053_880_101,
|
||||
"f7a90890a0248967eb4572c641f5dee1bd0cafba12d1841360821b79cd5b1c3e",
|
||||
),
|
||||
"CoA-Custom-V2.0.2-Client-13.zip" => (
|
||||
950_360_503,
|
||||
"8ae00b9bebc4e21d6d6d32ddbf319c341f3c418349a3aeb3d840dffb0fa14d3f",
|
||||
),
|
||||
"CoA-Custom-V2.0.2-Client-14.zip" => (
|
||||
971_472_467,
|
||||
"511ec3fd1933b9342920262f6a5eae7e451671a49679e93612632b77c31ba57f",
|
||||
),
|
||||
"CoA-Custom-V2.0.2-Client-15.zip" => (
|
||||
1_106_537_793,
|
||||
"b65505a047508cbd15f4fec670d3953873014250efc484aa3bdb75cb3b3cbbf1",
|
||||
),
|
||||
"CoA-Custom-V2.0.2-Client-16.zip" => (
|
||||
11_874_081,
|
||||
"5442dc06147e60140c43eebfae14f6ad5f19e6fed974db471b65211497609a27",
|
||||
),
|
||||
"CoA-Custom-V2.0.2-Client-17.zip" => (
|
||||
947_478,
|
||||
"707e09c8b95926e2d83bdc16adab763901951566caf6bf4fcebfdf4d7ba0e62a",
|
||||
),
|
||||
"CoA-Custom-V2.0.2-Server.zip" => (
|
||||
96_857_277,
|
||||
"36d0cba993623064ce01f364116f99330423cec3cef22101e50cf941dfd85afe",
|
||||
),
|
||||
_ => return Err(Error::Invalid("Unknown custom races archive.".into())),
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"CoACustomRace.exe": "428e41f5cb349f66b9ac133c711c2ffb92bd2be28c595f67268924df8a5c89cc",
|
||||
"CoACustomRace.exe": "8c283dcd464418e6859217dd53ad522b6a61f064c6db349c77d3cb90412690d9",
|
||||
"CoAVolFog-regions.ini": "a21c2616c866ea29bdf2c75af2607e8cb982fdaaef1167375b23f1490325a0a5",
|
||||
"CoAVolFog.dll": "65c9abb6d44ce41bc943b25a83ab4292dd0697d6490a60385e75610fe66801ce",
|
||||
"CoAVolFog.ini": "921d99e3dd5a85db4d815c4baf94851639e85e74a5bb5b5f610548a0fbf94483",
|
||||
@@ -4798,7 +4798,7 @@
|
||||
"Data/patch-ZZZZX.MPQ": "d4b1352e62f3b47b2a8fe38cf751825f20f58e4feee0a1b04e935e2211554f30",
|
||||
"Data/patch-ZZZZY.MPQ": "f9d05e9e0b0c31264c5d5dfd3bb3d486acfd0f3380186a3dec73cd2fa92c4859",
|
||||
"Data/patch-ZZZZZ.MPQ": "9d94a39178f2e8b34e612321ed1ad484d60be395520a38818546b5a8e96c94f4",
|
||||
"Data/patch-ZZZZZA.MPQ": "23d62f92116106039afbe37e7ad8199a99ec8401e6c65728d6293c8155591e89",
|
||||
"Data/patch-ZZZZZA.MPQ": "dad9d283885b69d4f11daacfd667acec691220cfc22d3abbbad557739a38da51",
|
||||
"Data/patch-ZZZZZB.MPQ": "07146bfd6501d3022133bf661786f1061e57393993b79b6115b12ddc77e9946c",
|
||||
"Data/patch-ZZZZZC.MPQ": "94b21941edef2e81b4461716f8945d7b19e8f0fb09071f4b777c26d9dccd2670",
|
||||
"Data/patch-ZZZZZM.MPQ": "cebe58e8c25192593afeabab9e23ec2757de6811e944823350af709ba15b6ab8",
|
||||
@@ -4813,7 +4813,25 @@
|
||||
"Data/patch-ZZZZZV.MPQ": "f0a7c595575ae2bbb58b6c525fc61c613ae2960e9b76742c128a83247f6b240c",
|
||||
"Data/patch-ZZZZZW.MPQ": "80d9288310710cb6a438621f95dfa22798f335a347b4a62c7cabd22a656b431b",
|
||||
"Data/patch-ZZZZZX.MPQ": "775539db1818068f4d676cbcb7fb1f87f61f303f0952d9843e273fe105eba019",
|
||||
"Data/patch-ZZZZZY-SUBMA.MPQ": "389255c799b27a8c82d2f39911433cc3e91c4f4ad1f244cccc9661ccb1dc82a2",
|
||||
"Data/patch-ZZZZZY-SUBVA.MPQ": "93c6aad4289ade86eee6c49377d21f34b7b29fa92edb31bb1798df9cc66b1494",
|
||||
"Data/patch-ZZZZZY-SUBVB.MPQ": "ea1d10a77c84dae77f137ff7307bc00e27891ee873789a58ddf924681e0ada5b",
|
||||
"Data/patch-ZZZZZY-SUBVC.MPQ": "23b02a87cde6a443046de12ac13fc7b1ea3e1a74e7f5ce3723292da24ff3f099",
|
||||
"Data/patch-ZZZZZY-SUBXA-HD.MPQ": "19c88cd704511375ee98730d05e9aded49894c9497d9ee2ad7823028b0104668",
|
||||
"Data/patch-ZZZZZY-SUBXB-HD.MPQ": "7fb6172edd64f6fc27816964d0ed13ba351afc9c07b2920564a5d41694e5ae1b",
|
||||
"Data/patch-ZZZZZY-SUBXC-HD.MPQ": "765a0158bc501c435b828e64923f06f981a1408ea27b42a38b9ea2b467dcd54f",
|
||||
"Data/patch-ZZZZZY.MPQ": "05b8cbd7a45cc9933a84ee991ff3193063cb2d040296843b947e190e8c64e741",
|
||||
"Data/patch-ZZZZZZ.MPQ": "b3f95a34f2c5d2157f54191124e864db4d2cb559156d2b7fccb119d9ae247ec8",
|
||||
"Data/patch-ZZZZZZA.MPQ": "2c8f9caef8e3f3cf33b9b35bf5782123b4759a8fecb92a326be59d2f918608f7",
|
||||
"Data/patch-ZZZZZZB.MPQ": "cb3107c155b57e6b77e92d881be3f2113a5401c101be185175d06b0a7ffdf6ab",
|
||||
"Data/patch-ZZZZZZC.MPQ": "0fbd43a7208a11ee02a2ed31ed1da90bf4240074e7e508ed801f20de50e697d4",
|
||||
"Data/patch-ZZZZZZD.MPQ": "53f4dac665280030ac8764cd2b45fc8ff65c5e85981b3f3ddcff34d5bc8d3c7f",
|
||||
"Data/patch-ZZZZZZE.MPQ": "64fb42fc12367bc0b8b95489315c882d36c195c90732bd5a8ed449f7373653cf",
|
||||
"Data/patch-retail-001.mpq": "1b0fafbdc6d01b92b5f09566f05510361972879a0407a79c03d1146f3440b764",
|
||||
"Data/patch-retail-002.mpq": "6802c1c9530a9fb4107fd56bf18185484257cda69ead36a170ab557cea5b64d3",
|
||||
"Data/patch-retail-003.mpq": "ae3f030fdb0b340a420ee9a3f027c47798e2646ab73bcac62b6f6b6c8589ca9b",
|
||||
"Data/patch-retail-004.mpq": "ed857958adcf96266d25c2ab2da882359fc302d9d2f2da9032010061a0ca0a37",
|
||||
"Data/patch-retail-005.mpq": "4fb237c92ccfccb7de90ff3ef184d04edb08dfda0ed2b2f16de802dff0455a5e",
|
||||
"EsteriaAppearance.bin": "90d9cfaeaf6de10f014f1d1610ea10453ec9b240255759aea99513cac488a3ec",
|
||||
"EsteriaAppearance.dll": "88e268d3be9eca3b0644f543d823f4bdcc04a9700a6e8ed73fd2a1260ad191af",
|
||||
"EsteriaAppearanceGeometry.bin": "cacd2086eabf43391bca07b622e17444de91b30593827e9e1e54758fe4dcd8e7",
|
||||
@@ -4894,17 +4912,22 @@
|
||||
"EsteriaVulperaTextures.bin": "1ab844e74684aced2b069f1b91cd563aade45e05bd5e23f866a6c0c301cb098e",
|
||||
"EsteriaWretched.bin": "a407b49ef55e6d76411bee2f522a2087b3571e8ec5d12b630a859cdbcdbde890",
|
||||
"EsteriaWretchedTextures.bin": "837774377ca055e6a5c79c1a4cfd8151e7c1f7ce2c16990b00fd445281137433",
|
||||
"Interface/AddOns/Ascension_Subclass/Ascension_Subclass.lua": "30710edd3d3bbdf393c6665850bd022f5cabffa58ae66bd1476769799635c7a0",
|
||||
"Interface/AddOns/Ascension_Subclass/Ascension_Subclass.toc": "9498ac1dd7f810d3314b0bf4a2404c3f49df9825b73469952a72c28c2419ff7c",
|
||||
"Interface/AddOns/Ascension_Subclass/Ascension_Subclass.lua": "b769f6c64d93c5e1850456782cfaebca073e97ad23fbf5e6b0068a58399d64ad",
|
||||
"Interface/AddOns/Ascension_Subclass/Ascension_Subclass.toc": "c840e4396adb66534586f5d55ee58586d0f2343108383322e6de5bbbceee563c",
|
||||
"Interface/AddOns/Ascension_Subclass/Bindings.xml": "cd057da400c0d40277ca5b310f021b78ac2b4e95b6a9445460b8651fffa83b8e",
|
||||
"Interface/AddOns/Ascension_Subclass/SubclassBar.lua": "c3b809a024780ba7fac3689b329dc3b906aa046ede233fc5ef522a029d7ed2fe",
|
||||
"Interface/AddOns/Ascension_Subclass/SubclassBar.lua": "af91304e5628d6e0327dfa2472fcbf9ad317ee32ca7777b3c09cfe60062174fe",
|
||||
"Interface/AddOns/Ascension_Subclass/SubclassBonk.lua": "3cdc86792529c75d4186accaa1ed5b8a7541c17b0b9a022cf3ebdadf802b4c54",
|
||||
"Interface/AddOns/Ascension_Subclass/SubclassCarry.lua": "e915f4a2e52f0d417e46654d5e5d438cc258be429661018c0155c4cd007aacb9",
|
||||
"Interface/AddOns/Ascension_Subclass/SubclassCastBar.lua": "395ccda4bc0733cfa34dd506a2578ae73867305b5cd09dc988ff615a7d8a1e78",
|
||||
"Interface/AddOns/Ascension_Subclass/SubclassChoices.lua": "3e313f30eade45b32c7827d8e045ed74ff05ff5fb9263d8f28e4c6c98ad74288",
|
||||
"Interface/AddOns/Ascension_Subclass/SubclassGlow.lua": "c9a4c900c97a4f215f00ed3fd3c703058522c4f5180d8c4dd76e60b1611e0366",
|
||||
"Interface/AddOns/Ascension_Subclass/SubclassNodes.lua": "cdc91d73d066664133bc3f621c4994360474486bd6ffe1bc96964bfc35faf2c7",
|
||||
"Interface/AddOns/Ascension_Subclass/SubclassOrbs.lua": "cc29fbabe955cdd994d0f3281dff758ea4146dbe5fd6e65e0ad87b8b5fd2238e",
|
||||
"Interface/AddOns/Ascension_Subclass/SubclassOrbs.lua": "e4d337628d267f338846b5d0aefe5204de91e1dec6d933a4bca208eccfdf0052",
|
||||
"Interface/AddOns/Ascension_Subclass/SubclassPairs.lua": "670b67e6fc400ead68ef0324172467219e14342dce9b9015e674414d1a6efc5d",
|
||||
"Interface/AddOns/Ascension_Subclass/SubclassPetBar.lua": "ab487a1b2eabef221a2c23eb8e3f52dfb90194a75db46c88c006e3fad3ac5926",
|
||||
"Interface/AddOns/Ascension_Subclass/SubclassPowerBar.lua": "609819307864810cdc36bb52305ab0525094466e5e2be135d96c878081cf69f6",
|
||||
"Interface/AddOns/Ascension_Subclass/SubclassRaceBackground.lua": "b63fa918438386a0c1cd861b4655785cd63b1089e721c6e3bd9585e372950b68",
|
||||
"Interface/AddOns/Ascension_Subclass/SubclassRaceBackground.lua": "d38352928ee3e546eaa25c77e0e961ddfe1bd383020904f84907a4b3f5fce132",
|
||||
"Interface/AddOns/Ascension_Subclass/Textures/IceFrame.tga": "91cefa31a6f32a847c888651bc3f90a2a91fb07b7a33c74bf8090efc92d22705",
|
||||
"Interface/AddOns/CoAHideArmor/CoAHideArmor.lua": "8c1c7403524fc9bd56c0809b4101b141da700ba163701209bf1420f2ef106aa7",
|
||||
"Interface/AddOns/CoAHideArmor/CoAHideArmor.toc": "123580d92fd5ceee258e96296f42c359b7e83cdff151af49c50c6c4e2059677c",
|
||||
"Interface/AddOns/CoAQuestSafe/CoAQuestSafe.lua": "062de55c91228971553f482fd2c8753f4752993b4e8e49d4ded04fa18b98bde7",
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -5,7 +5,7 @@
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::time::Duration;
|
||||
|
||||
use chrono::{Local, NaiveDateTime, NaiveTime, Timelike};
|
||||
use chrono::{Datelike, Local, NaiveDateTime, NaiveTime, Timelike};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::error::{Error, Result};
|
||||
@@ -20,14 +20,53 @@ const LATE: Duration = Duration::from_secs(15 * 60);
|
||||
/// A world that has not come back within this time no longer counts as restarting.
|
||||
const UNDER_WAY_LIMIT: Duration = Duration::from_secs(45 * 60);
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum Weekday {
|
||||
Monday,
|
||||
Tuesday,
|
||||
Wednesday,
|
||||
Thursday,
|
||||
Friday,
|
||||
Saturday,
|
||||
#[default]
|
||||
Sunday,
|
||||
}
|
||||
|
||||
impl Weekday {
|
||||
fn to_chrono(self) -> chrono::Weekday {
|
||||
match self {
|
||||
Self::Monday => chrono::Weekday::Mon,
|
||||
Self::Tuesday => chrono::Weekday::Tue,
|
||||
Self::Wednesday => chrono::Weekday::Wed,
|
||||
Self::Thursday => chrono::Weekday::Thu,
|
||||
Self::Friday => chrono::Weekday::Fri,
|
||||
Self::Saturday => chrono::Weekday::Sat,
|
||||
Self::Sunday => chrono::Weekday::Sun,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct DueRestart {
|
||||
pub moment: NaiveDateTime,
|
||||
pub warning_minutes: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[serde(rename_all = "camelCase", default)]
|
||||
pub struct RestartSchedule {
|
||||
pub enabled: bool,
|
||||
/// Local time, `HH:MM`.
|
||||
pub time: String,
|
||||
/// The in-game countdown before the restart, in minutes (1-60).
|
||||
pub warning_minutes: u32,
|
||||
pub weekly_enabled: bool,
|
||||
pub weekly_day: Weekday,
|
||||
/// Local time for weekly restart, `HH:MM`.
|
||||
pub weekly_time: String,
|
||||
/// The in-game countdown before the weekly restart, in minutes (1-60).
|
||||
pub weekly_warning_minutes: u32,
|
||||
}
|
||||
|
||||
impl Default for RestartSchedule {
|
||||
@@ -36,35 +75,72 @@ impl Default for RestartSchedule {
|
||||
enabled: false,
|
||||
time: "05:00".into(),
|
||||
warning_minutes: 5,
|
||||
weekly_enabled: false,
|
||||
weekly_day: Weekday::Sunday,
|
||||
weekly_time: "05:00".into(),
|
||||
weekly_warning_minutes: 5,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl RestartSchedule {
|
||||
fn at(&self) -> Option<NaiveTime> {
|
||||
NaiveTime::parse_from_str(self.time.trim(), "%H:%M").ok()
|
||||
fn parse_time(text: &str) -> Option<NaiveTime> {
|
||||
NaiveTime::parse_from_str(text.trim(), "%H:%M").ok()
|
||||
}
|
||||
|
||||
fn validate(&self) -> Result<()> {
|
||||
if self.at().is_none() {
|
||||
fn validate_entry(time: &str, warning_minutes: u32) -> Result<()> {
|
||||
if Self::parse_time(time).is_none() {
|
||||
return Err(Error::Invalid("The restart time must be HH:MM, for example 05:00.".into()));
|
||||
}
|
||||
if !(1..=60).contains(&self.warning_minutes) {
|
||||
if !(1..=60).contains(&warning_minutes) {
|
||||
return Err(Error::Invalid("The restart warning must be 1 to 60 minutes.".into()));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// The scheduled moment of `now`'s day, when a restart is due at `now` for a world started at `started`:
|
||||
/// the moment has passed by less than [`LATE`] and the world was already running before it.
|
||||
pub fn due(&self, now: NaiveDateTime, started: NaiveDateTime) -> Option<NaiveDateTime> {
|
||||
if !self.enabled {
|
||||
return None;
|
||||
fn validate(&self) -> Result<()> {
|
||||
if self.enabled {
|
||||
Self::validate_entry(&self.time, self.warning_minutes)?;
|
||||
}
|
||||
let moment = now.date().and_time(self.at()?);
|
||||
if self.weekly_enabled {
|
||||
Self::validate_entry(&self.weekly_time, self.weekly_warning_minutes)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn due_at(time_str: &str, now: NaiveDateTime, started: NaiveDateTime) -> Option<NaiveDateTime> {
|
||||
let at = Self::parse_time(time_str)?;
|
||||
let moment = now.date().and_time(at);
|
||||
let late = now.signed_duration_since(moment).to_std().ok()?;
|
||||
(late <= LATE && started < moment).then_some(moment)
|
||||
}
|
||||
|
||||
/// The scheduled moment of `now`'s day, when a daily or weekly restart is due at `now` for a world started at `started`:
|
||||
/// the moment has passed by less than [`LATE`] and the world was already running before it.
|
||||
pub fn due_restart(&self, now: NaiveDateTime, started: NaiveDateTime) -> Option<DueRestart> {
|
||||
if self.weekly_enabled && now.weekday() == self.weekly_day.to_chrono() {
|
||||
if let Some(moment) = Self::due_at(&self.weekly_time, now, started) {
|
||||
return Some(DueRestart {
|
||||
moment,
|
||||
warning_minutes: self.weekly_warning_minutes,
|
||||
});
|
||||
}
|
||||
}
|
||||
if self.enabled {
|
||||
if let Some(moment) = Self::due_at(&self.time, now, started) {
|
||||
return Some(DueRestart {
|
||||
moment,
|
||||
warning_minutes: self.warning_minutes,
|
||||
});
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// The scheduled moment of `now`'s day, when a restart is due at `now` for a world started at `started`.
|
||||
pub fn due(&self, now: NaiveDateTime, started: NaiveDateTime) -> Option<NaiveDateTime> {
|
||||
self.due_restart(now, started).map(|d| d.moment)
|
||||
}
|
||||
}
|
||||
|
||||
/// The folder whose schedule a world follows: an extra world (`<server>/.realms/<name>`) follows its server's.
|
||||
@@ -84,11 +160,14 @@ pub fn load(root: &Path) -> RestartSchedule {
|
||||
pub fn save(root: &Path, schedule: &RestartSchedule) -> Result<RestartSchedule> {
|
||||
let mut schedule = schedule.clone();
|
||||
schedule.time = schedule.time.trim().to_string();
|
||||
if schedule.enabled {
|
||||
schedule.validate()?;
|
||||
} else if schedule.at().is_none() {
|
||||
schedule.weekly_time = schedule.weekly_time.trim().to_string();
|
||||
schedule.validate()?;
|
||||
if !schedule.enabled && RestartSchedule::parse_time(&schedule.time).is_none() {
|
||||
schedule.time = RestartSchedule::default().time;
|
||||
}
|
||||
if !schedule.weekly_enabled && RestartSchedule::parse_time(&schedule.weekly_time).is_none() {
|
||||
schedule.weekly_time = RestartSchedule::default().weekly_time;
|
||||
}
|
||||
crate::fsx::atomic_write_json(&owner(root).join(FILE), &schedule)?;
|
||||
Ok(schedule)
|
||||
}
|
||||
@@ -127,7 +206,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn a_restart_is_due_once_after_its_time_for_a_world_that_ran_before_it() {
|
||||
let s = RestartSchedule { enabled: true, time: "05:00".into(), warning_minutes: 5 };
|
||||
let s = RestartSchedule { enabled: true, time: "05:00".into(), warning_minutes: 5, ..RestartSchedule::default() };
|
||||
let started = at("2026-11-14 20:00");
|
||||
assert_eq!(s.due(at("2026-11-15 04:59"), started), None);
|
||||
assert_eq!(s.due(at("2026-11-15 05:00"), started), Some(at("2026-11-15 05:00")));
|
||||
@@ -140,19 +219,88 @@ mod tests {
|
||||
assert_eq!(off.due(at("2026-11-15 05:00"), started), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn weekly_restart_triggers_only_on_configured_weekday_and_independently_of_daily() {
|
||||
// 2026-11-15 is Sunday; 2026-11-16 is Monday.
|
||||
let s = RestartSchedule {
|
||||
enabled: false,
|
||||
weekly_enabled: true,
|
||||
weekly_day: Weekday::Sunday,
|
||||
weekly_time: "04:00".into(),
|
||||
weekly_warning_minutes: 15,
|
||||
..RestartSchedule::default()
|
||||
};
|
||||
let started = at("2026-11-14 20:00");
|
||||
assert_eq!(s.due_restart(at("2026-11-15 03:59"), started), None);
|
||||
assert_eq!(
|
||||
s.due_restart(at("2026-11-15 04:05"), started),
|
||||
Some(DueRestart { moment: at("2026-11-15 04:00"), warning_minutes: 15 })
|
||||
);
|
||||
// Monday does not trigger Sunday's weekly restart.
|
||||
assert_eq!(s.due_restart(at("2026-11-16 04:05"), started), None);
|
||||
|
||||
// Both daily and weekly enabled: each triggers on its own schedule.
|
||||
let both = RestartSchedule { enabled: true, time: "05:00".into(), warning_minutes: 5, ..s };
|
||||
assert_eq!(
|
||||
both.due_restart(at("2026-11-15 04:05"), started),
|
||||
Some(DueRestart { moment: at("2026-11-15 04:00"), warning_minutes: 15 })
|
||||
);
|
||||
assert_eq!(
|
||||
both.due_restart(at("2026-11-15 05:02"), at("2026-11-15 04:16")),
|
||||
Some(DueRestart { moment: at("2026-11-15 05:00"), warning_minutes: 5 })
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn schedules_are_validated_and_extra_worlds_follow_their_server() {
|
||||
let d = tempfile::tempdir().unwrap();
|
||||
assert_eq!(load(d.path()), RestartSchedule::default());
|
||||
let bad = RestartSchedule { enabled: true, time: "25:00".into(), warning_minutes: 5 };
|
||||
let bad = RestartSchedule { enabled: true, time: "25:00".into(), warning_minutes: 5, ..RestartSchedule::default() };
|
||||
assert!(save(d.path(), &bad).is_err());
|
||||
let quiet = RestartSchedule { enabled: true, time: "05:00".into(), warning_minutes: 0 };
|
||||
let quiet = RestartSchedule { enabled: true, time: "05:00".into(), warning_minutes: 0, ..RestartSchedule::default() };
|
||||
assert!(save(d.path(), &quiet).is_err());
|
||||
let good = RestartSchedule { enabled: true, time: " 04:30 ".into(), warning_minutes: 10 };
|
||||
assert_eq!(save(d.path(), &good).unwrap().time, "04:30");
|
||||
let bad_weekly = RestartSchedule {
|
||||
weekly_enabled: true,
|
||||
weekly_time: "99:00".into(),
|
||||
..RestartSchedule::default()
|
||||
};
|
||||
assert!(save(d.path(), &bad_weekly).is_err());
|
||||
let quiet_weekly = RestartSchedule {
|
||||
weekly_enabled: true,
|
||||
weekly_warning_minutes: 61,
|
||||
..RestartSchedule::default()
|
||||
};
|
||||
assert!(save(d.path(), &quiet_weekly).is_err());
|
||||
let good = RestartSchedule {
|
||||
enabled: true,
|
||||
time: " 04:30 ".into(),
|
||||
warning_minutes: 10,
|
||||
weekly_enabled: true,
|
||||
weekly_day: Weekday::Wednesday,
|
||||
weekly_time: " 03:15 ".into(),
|
||||
weekly_warning_minutes: 20,
|
||||
};
|
||||
let saved = save(d.path(), &good).unwrap();
|
||||
assert_eq!(saved.time, "04:30");
|
||||
assert_eq!(saved.weekly_time, "03:15");
|
||||
assert_eq!(saved.weekly_day, Weekday::Wednesday);
|
||||
let extra = d.path().join(".realms/secondary");
|
||||
std::fs::create_dir_all(&extra).unwrap();
|
||||
assert!(load(&extra).enabled);
|
||||
assert!(load(&extra).weekly_enabled);
|
||||
|
||||
// Legacy schedule JSON without weekly fields loads cleanly with defaults.
|
||||
std::fs::write(
|
||||
d.path().join(FILE),
|
||||
r#"{"enabled":true,"time":"06:00","warningMinutes":10}"#,
|
||||
)
|
||||
.unwrap();
|
||||
let legacy = load(d.path());
|
||||
assert!(legacy.enabled);
|
||||
assert_eq!(legacy.time, "06:00");
|
||||
assert!(!legacy.weekly_enabled);
|
||||
assert_eq!(legacy.weekly_day, Weekday::Sunday);
|
||||
|
||||
assert!(!under_way(d.path()));
|
||||
mark_under_way(d.path()).unwrap();
|
||||
assert!(under_way(d.path()));
|
||||
|
||||
@@ -174,7 +174,13 @@ fn spawn_relay(root: &Path, launcher: Option<&Path>) -> Result<Proc> {
|
||||
pub fn watch_world(root: &Path, launcher: Option<&Path>, offset: i32, log: Progress) -> Result<()> {
|
||||
squid::validate_bots(root)?;
|
||||
let mut relay: Option<Proc> = None;
|
||||
let mut last_log_clean = Instant::now();
|
||||
loop {
|
||||
if let Some(report) = crate::server_logging::auto_clean_if_needed(root) {
|
||||
if report.freed_bytes > 0 {
|
||||
log(&format!("Auto-cleaned server logs ({} MB freed).", report.freed_bytes / (1024 * 1024)));
|
||||
}
|
||||
}
|
||||
let world = spawn_child(root, "world", &root.join("Core/worldserver.exe"), &["-c", "configs/worldserver.conf"], &root.join("Core"), &root.join("Core/Logs/world-console.log"))?;
|
||||
let started = schedule::now();
|
||||
let mut requested = false;
|
||||
@@ -204,8 +210,8 @@ pub fn watch_world(root: &Path, launcher: Option<&Path>, offset: i32, log: Progr
|
||||
}
|
||||
if !requested {
|
||||
let plan = schedule::load(root);
|
||||
if plan.due(schedule::now(), started).is_some() {
|
||||
let seconds = plan.warning_minutes * 60;
|
||||
if let Some(due) = plan.due_restart(schedule::now(), started) {
|
||||
let seconds = due.warning_minutes * 60;
|
||||
let asked = Settings::load(root, offset).and_then(|cfg| {
|
||||
crate::ra::Ra::connect_to(cfg.ra_port, &cfg.ra_username, &cfg.ra_password)
|
||||
.and_then(|mut ra| ra.run(&format!("server restart {seconds}")))
|
||||
@@ -214,12 +220,20 @@ pub fn watch_world(root: &Path, launcher: Option<&Path>, offset: i32, log: Progr
|
||||
Ok(_) => {
|
||||
schedule::mark_under_way(root)?;
|
||||
requested = true;
|
||||
log(&format!("Scheduled restart: the world restarts in {} minutes.", plan.warning_minutes));
|
||||
log(&format!("Scheduled restart: the world restarts in {} minutes.", due.warning_minutes));
|
||||
}
|
||||
Err(e) => log(&format!("Scheduled restart could not be requested ({e}); retrying.")),
|
||||
}
|
||||
}
|
||||
}
|
||||
if last_log_clean.elapsed() >= Duration::from_secs(300) {
|
||||
last_log_clean = Instant::now();
|
||||
if let Some(report) = crate::server_logging::auto_clean_if_needed(root) {
|
||||
if report.freed_bytes > 0 {
|
||||
log(&format!("Auto-cleaned server logs ({} MB freed).", report.freed_bytes / (1024 * 1024)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
std::thread::sleep(Duration::from_secs(2));
|
||||
};
|
||||
|
||||
@@ -16,7 +16,6 @@ pub mod character_start_check;
|
||||
pub mod cleanbase;
|
||||
pub mod client;
|
||||
pub mod client_graphics;
|
||||
pub mod clientdl;
|
||||
pub mod companions;
|
||||
pub mod config;
|
||||
pub mod console;
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
use std::{fs, path::Path};
|
||||
use std::{
|
||||
fs,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
config::{parser::ConfFile, Scope},
|
||||
@@ -6,6 +11,213 @@ use crate::{
|
||||
fsx,
|
||||
};
|
||||
|
||||
const SETTINGS_FILE: &str = "Settings/log-settings.json";
|
||||
const DEFAULT_MAX_SIZE_MB: u64 = 500;
|
||||
const MIN_MAX_SIZE_MB: u64 = 10;
|
||||
const MAX_MAX_SIZE_MB: u64 = 100_000;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase", default)]
|
||||
pub struct LogSettings {
|
||||
pub auto_cleanup: bool,
|
||||
pub max_size_mb: u64,
|
||||
}
|
||||
|
||||
impl Default for LogSettings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
auto_cleanup: false,
|
||||
max_size_mb: DEFAULT_MAX_SIZE_MB,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CleanLogsReport {
|
||||
pub freed_bytes: u64,
|
||||
pub remaining_bytes: u64,
|
||||
pub deleted_files: u64,
|
||||
pub skipped_files: u64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ServerLoggingView {
|
||||
pub preset: Option<String>,
|
||||
pub log_bytes: u64,
|
||||
pub settings: LogSettings,
|
||||
}
|
||||
|
||||
fn owner(root: &Path) -> PathBuf {
|
||||
if crate::launcher::settings::is_extra_world(root) {
|
||||
if let Some(main) = root.parent().and_then(Path::parent) {
|
||||
return main.to_path_buf();
|
||||
}
|
||||
}
|
||||
root.to_path_buf()
|
||||
}
|
||||
|
||||
pub fn load_settings(root: &Path) -> LogSettings {
|
||||
let mut settings: LogSettings =
|
||||
fsx::read_json(&owner(root).join(SETTINGS_FILE)).unwrap_or_default();
|
||||
if settings.max_size_mb < MIN_MAX_SIZE_MB || settings.max_size_mb > MAX_MAX_SIZE_MB {
|
||||
settings.max_size_mb = DEFAULT_MAX_SIZE_MB;
|
||||
}
|
||||
settings
|
||||
}
|
||||
|
||||
pub fn save_settings(root: &Path, settings: &LogSettings) -> Result<LogSettings> {
|
||||
let mut settings = settings.clone();
|
||||
if settings.auto_cleanup {
|
||||
if !(MIN_MAX_SIZE_MB..=MAX_MAX_SIZE_MB).contains(&settings.max_size_mb) {
|
||||
return Err(Error::Invalid(format!(
|
||||
"Log auto-cleanup threshold must be between {MIN_MAX_SIZE_MB} and {MAX_MAX_SIZE_MB} MB."
|
||||
)));
|
||||
}
|
||||
} else if !(MIN_MAX_SIZE_MB..=MAX_MAX_SIZE_MB).contains(&settings.max_size_mb) {
|
||||
settings.max_size_mb = DEFAULT_MAX_SIZE_MB;
|
||||
}
|
||||
fsx::atomic_write_json(&owner(root).join(SETTINGS_FILE), &settings)?;
|
||||
Ok(settings)
|
||||
}
|
||||
|
||||
pub fn detect_preset(root: &Path) -> Option<String> {
|
||||
let candidates = [
|
||||
root.join("Core/configs/worldserver.conf"),
|
||||
root.join("Settings/worldserver.conf.template"),
|
||||
];
|
||||
for path in candidates {
|
||||
let Ok(bytes) = fs::read(&path) else {
|
||||
continue;
|
||||
};
|
||||
let Ok(conf) = ConfFile::parse_bytes(&bytes) else {
|
||||
continue;
|
||||
};
|
||||
let found = conf
|
||||
.entries()
|
||||
.find(|(k, _)| *k == "Logger.root")
|
||||
.and_then(|(_, value)| {
|
||||
value
|
||||
.split(',')
|
||||
.next()
|
||||
.map(str::trim)
|
||||
.and_then(|s| s.parse::<u32>().ok())
|
||||
});
|
||||
if let Some(level) = found {
|
||||
return match level {
|
||||
0 => Some("off".into()),
|
||||
2 => Some("errors".into()),
|
||||
4 => Some("normal".into()),
|
||||
_ => None,
|
||||
};
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
fn log_dirs(root: &Path) -> Vec<PathBuf> {
|
||||
let base = owner(root);
|
||||
let mut dirs = Vec::new();
|
||||
for prefix in ["", ".realms/secondary/", ".realms/reborn/"] {
|
||||
let candidate = base.join(format!("{prefix}Core/Logs"));
|
||||
if let Ok(checked) = fsx::ensure_within(&base, &candidate) {
|
||||
if checked.is_dir() {
|
||||
dirs.push(checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
dirs
|
||||
}
|
||||
|
||||
fn measure_dir(dir: &Path) -> u64 {
|
||||
let Ok(entries) = fs::read_dir(dir) else {
|
||||
return 0;
|
||||
};
|
||||
let mut total = 0u64;
|
||||
for entry in entries.flatten() {
|
||||
let path = entry.path();
|
||||
let Ok(meta) = entry.metadata() else {
|
||||
continue;
|
||||
};
|
||||
if meta.is_dir() {
|
||||
total = total.saturating_add(measure_dir(&path));
|
||||
} else if meta.is_file() {
|
||||
total = total.saturating_add(meta.len());
|
||||
}
|
||||
}
|
||||
total
|
||||
}
|
||||
|
||||
pub fn measure_logs(root: &Path) -> u64 {
|
||||
log_dirs(root)
|
||||
.into_iter()
|
||||
.fold(0u64, |acc, dir| acc.saturating_add(measure_dir(&dir)))
|
||||
}
|
||||
|
||||
fn clean_dir(dir: &Path, report: &mut CleanLogsReport, remove_empty_dir: bool) {
|
||||
let Ok(entries) = fs::read_dir(dir) else {
|
||||
return;
|
||||
};
|
||||
for entry in entries.flatten() {
|
||||
let path = entry.path();
|
||||
let Ok(meta) = entry.metadata() else {
|
||||
continue;
|
||||
};
|
||||
if meta.is_dir() {
|
||||
clean_dir(&path, report, true);
|
||||
} else if meta.is_file() {
|
||||
let size = meta.len();
|
||||
match fs::remove_file(&path) {
|
||||
Ok(()) => {
|
||||
report.freed_bytes = report.freed_bytes.saturating_add(size);
|
||||
report.deleted_files = report.deleted_files.saturating_add(1);
|
||||
}
|
||||
Err(_) => {
|
||||
report.remaining_bytes = report.remaining_bytes.saturating_add(size);
|
||||
report.skipped_files = report.skipped_files.saturating_add(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if remove_empty_dir {
|
||||
let _ = fs::remove_dir(dir);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn clean_logs(root: &Path) -> Result<CleanLogsReport> {
|
||||
let mut report = CleanLogsReport {
|
||||
freed_bytes: 0,
|
||||
remaining_bytes: 0,
|
||||
deleted_files: 0,
|
||||
skipped_files: 0,
|
||||
};
|
||||
for dir in log_dirs(root) {
|
||||
clean_dir(&dir, &mut report, false);
|
||||
}
|
||||
Ok(report)
|
||||
}
|
||||
|
||||
pub fn auto_clean_if_needed(root: &Path) -> Option<CleanLogsReport> {
|
||||
let settings = load_settings(root);
|
||||
if !settings.auto_cleanup {
|
||||
return None;
|
||||
}
|
||||
let limit = settings.max_size_mb.saturating_mul(1024 * 1024);
|
||||
if measure_logs(root) <= limit {
|
||||
return None;
|
||||
}
|
||||
clean_logs(root).ok()
|
||||
}
|
||||
|
||||
pub fn state(root: &Path) -> ServerLoggingView {
|
||||
ServerLoggingView {
|
||||
preset: detect_preset(root),
|
||||
log_bytes: measure_logs(root),
|
||||
settings: load_settings(root),
|
||||
}
|
||||
}
|
||||
|
||||
fn transform(bytes: &[u8], preset: &str) -> Result<String> {
|
||||
let level = match preset {
|
||||
"normal" => 4,
|
||||
@@ -162,4 +374,56 @@ mod tests {
|
||||
assert_eq!(transform(normal.as_bytes(), "normal").unwrap(), normal);
|
||||
assert!(transform(original, "unsupported").is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn detects_preset_measures_and_cleans_logs_across_realms() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let root = temp.path();
|
||||
fs::create_dir_all(root.join("Core/configs")).unwrap();
|
||||
fs::write(root.join("Core/configs/worldserver.conf"), "Logger.root=4,Console Server\n").unwrap();
|
||||
assert_eq!(detect_preset(root).as_deref(), Some("normal"));
|
||||
fs::write(root.join("Core/configs/worldserver.conf"), "Logger.root=0,Console Server\n").unwrap();
|
||||
assert_eq!(detect_preset(root).as_deref(), Some("off"));
|
||||
fs::write(root.join("Core/configs/worldserver.conf"), "Logger.root=2,Console Server\n").unwrap();
|
||||
assert_eq!(detect_preset(root).as_deref(), Some("errors"));
|
||||
|
||||
fs::create_dir_all(root.join("Core/Logs/archive")).unwrap();
|
||||
fs::create_dir_all(root.join(".realms/secondary/Core/Logs")).unwrap();
|
||||
fs::write(root.join("Core/Logs/Server.log"), vec![b'a'; 1000]).unwrap();
|
||||
fs::write(root.join("Core/Logs/archive/old.log"), vec![b'b'; 500]).unwrap();
|
||||
fs::write(root.join(".realms/secondary/Core/Logs/Server.log"), vec![b'c'; 250]).unwrap();
|
||||
assert_eq!(measure_logs(root), 1750);
|
||||
|
||||
let report = clean_logs(root).unwrap();
|
||||
assert_eq!(report.freed_bytes, 1750);
|
||||
assert_eq!(report.remaining_bytes, 0);
|
||||
assert_eq!(report.deleted_files, 3);
|
||||
assert_eq!(report.skipped_files, 0);
|
||||
assert_eq!(measure_logs(root), 0);
|
||||
assert!(!root.join("Core/Logs/archive").exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn log_settings_validate_and_auto_clean_only_above_threshold() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let root = temp.path();
|
||||
assert_eq!(load_settings(root), LogSettings::default());
|
||||
assert!(save_settings(root, &LogSettings { auto_cleanup: true, max_size_mb: 5 }).is_err());
|
||||
let saved = save_settings(root, &LogSettings { auto_cleanup: true, max_size_mb: 10 }).unwrap();
|
||||
assert!(saved.auto_cleanup);
|
||||
assert_eq!(saved.max_size_mb, 10);
|
||||
|
||||
fs::create_dir_all(root.join("Core/Logs")).unwrap();
|
||||
fs::write(root.join("Core/Logs/Server.log"), vec![b'x'; 1024]).unwrap();
|
||||
// 1 KB < 10 MB: does not clean.
|
||||
assert!(auto_clean_if_needed(root).is_none());
|
||||
assert_eq!(measure_logs(root), 1024);
|
||||
|
||||
// Threshold check helper: writing > 10 MB triggers cleanup.
|
||||
let over = vec![b'y'; 10 * 1024 * 1024 + 1];
|
||||
fs::write(root.join("Core/Logs/Big.log"), over).unwrap();
|
||||
let cleaned = auto_clean_if_needed(root).unwrap();
|
||||
assert!(cleaned.freed_bytes > 10 * 1024 * 1024);
|
||||
assert_eq!(measure_logs(root), 0);
|
||||
}
|
||||
}
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "coa-server-manager",
|
||||
"version": "0.9.14",
|
||||
"version": "0.9.16",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "coa-server-manager",
|
||||
"version": "0.9.14",
|
||||
"version": "0.9.16",
|
||||
"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.9.14",
|
||||
"version": "0.9.16",
|
||||
"license": "AGPL-3.0-only",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
+132
-229
@@ -2,7 +2,7 @@
|
||||
//! registry; the frontend can never ask the backend to touch an arbitrary path (scan is read-only).
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::path::PathBuf;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
mod browse_preferences;
|
||||
@@ -46,7 +46,7 @@ struct AppState {
|
||||
busy: Mutex<HashSet<String>>,
|
||||
/// Cancel handle of the installation currently running, if any.
|
||||
install_cancel: Mutex<Option<Cancel>>,
|
||||
/// Cancel handle of the game-client check or download currently running, if any.
|
||||
/// Cancel handle of the game-client operation currently running (the custom-race patch), if any.
|
||||
client_cancel: Mutex<Option<Cancel>>,
|
||||
/// The portable play runtime (the Host loop): started with the application, stopped with it.
|
||||
portable: Option<Arc<PortableRuntime>>,
|
||||
@@ -597,6 +597,91 @@ async fn run_verb(
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
/// Creates the companions a realm's startup fleet is missing (when its auto-login is on and its world runs) and
|
||||
/// carries out the realm's pending companion job. Returns how many companions were queued to top the fleet up.
|
||||
fn reconcile_realm_companions(
|
||||
root: &Path,
|
||||
meta: &Path,
|
||||
instance_id: &str,
|
||||
mode: coa_core::realms::Mode,
|
||||
top_up: bool,
|
||||
) -> Result<u32> {
|
||||
let target = coa_core::multiworld::resolve_bot_operation_target(root, mode)?;
|
||||
let mut queued = 0;
|
||||
if top_up && target.running {
|
||||
match queue_startup_fleet(root, meta, instance_id, mode, &target.world_root) {
|
||||
Ok(n) => queued = n,
|
||||
Err(e) => tracing::warn!("startup fleet of realm {} was not topped up: {e}", mode.name()),
|
||||
}
|
||||
}
|
||||
let r_snap = root.to_path_buf();
|
||||
let chars_db = target.chars_db;
|
||||
let r_ra = root.to_path_buf();
|
||||
coa_core::companions::process_pending_job_with(
|
||||
meta,
|
||||
mode,
|
||||
instance_id,
|
||||
target.running,
|
||||
|since_guid| {
|
||||
let admin_db = coa_core::db::Db::from_repack(&r_snap, coa_core::db::Account::Admin)?;
|
||||
let _ = coa_core::companions::ensure_templates_for_schema(&admin_db, chars_db);
|
||||
coa_core::companions::query_bot_db_snapshot(&r_snap, &admin_db, chars_db, since_guid)
|
||||
},
|
||||
|delta, job| {
|
||||
let mut ra = Ra::connect_target(&r_ra, Some(mode))?;
|
||||
if let Some(lvl) = job.level {
|
||||
ra.spawn_custom(delta, lvl, job.class_id, job.spec_id, job.build_id.as_deref())
|
||||
} else {
|
||||
ra.spawn_bots(delta)
|
||||
}
|
||||
},
|
||||
)?;
|
||||
Ok(queued)
|
||||
}
|
||||
|
||||
/// Queues the job that creates the companions missing from a realm's startup fleet. The realm's auto-login limit is
|
||||
/// the fleet size: companions that exist already count, so only the difference is created. Nothing is created when
|
||||
/// the number of existing companions cannot be read.
|
||||
fn queue_startup_fleet(
|
||||
root: &Path,
|
||||
meta: &Path,
|
||||
instance_id: &str,
|
||||
mode: coa_core::realms::Mode,
|
||||
world_root: &Path,
|
||||
) -> Result<u32> {
|
||||
let cfg = config::load(world_root, Scope::Bots)?;
|
||||
let value = |key: &str| cfg.settings.iter().find(|s| s.meta.key == key).map(|s| s.value.clone());
|
||||
let on = value("CoaBots.AutoLoginOnStartup").and_then(|v| v.as_bool()).unwrap_or(false);
|
||||
let limit = value("CoaBots.AutoLogin.MaxCount").and_then(|v| v.as_u64()).unwrap_or(0) as u32;
|
||||
if !on || limit == 0 {
|
||||
return Ok(0);
|
||||
}
|
||||
let existing = coa_core::population::query_for_realm(root, mode)?.bots_total;
|
||||
let job = coa_core::companions::queue_fleet_top_up(meta, instance_id, mode, limit, existing)?;
|
||||
Ok(job.map_or(0, |j| j.count))
|
||||
}
|
||||
|
||||
/// After the startup fleet settings are saved: create the companions the fleet is missing right away when the realm's
|
||||
/// world is running (otherwise it happens at the next start). Returns how many were queued.
|
||||
#[tauri::command]
|
||||
async fn top_up_startup_fleet(
|
||||
state: State<'_, AppState>,
|
||||
id: String,
|
||||
realm: Option<coa_core::realms::Mode>,
|
||||
) -> std::result::Result<u32, UiError> {
|
||||
let root = path_of(&state, &id)?;
|
||||
let _guard = BusyGuard::acquire(&state, &id)?;
|
||||
blocking(move || {
|
||||
if coa_core::realms::guard_module(&root, "companions").is_err() {
|
||||
return Ok(0);
|
||||
}
|
||||
let meta = meta_dir(&root)?;
|
||||
let mode = realm.unwrap_or_else(|| coa_core::realms::view(&root).map(|v| v.active).unwrap_or_default());
|
||||
reconcile_realm_companions(&root, &meta, &id, mode, true)
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn start_server(
|
||||
state: State<'_, AppState>,
|
||||
@@ -643,37 +728,8 @@ async fn start_server(
|
||||
coa_core::realms::Mode::Wildcard,
|
||||
coa_core::realms::Mode::Reborn,
|
||||
] {
|
||||
let target = match coa_core::multiworld::resolve_bot_operation_target(&r, mode) {
|
||||
Ok(t) => t,
|
||||
Err(e) => {
|
||||
tracing::warn!("cannot resolve target for realm {}: {e}", mode.name());
|
||||
continue;
|
||||
}
|
||||
};
|
||||
let r_snap = r.clone();
|
||||
let chars_db = target.chars_db;
|
||||
let r_ra = r.clone();
|
||||
let res = coa_core::companions::process_pending_job_with(
|
||||
&meta,
|
||||
mode,
|
||||
&instance_id,
|
||||
target.running,
|
||||
|since_guid| {
|
||||
let admin_db = coa_core::db::Db::from_repack(&r_snap, coa_core::db::Account::Admin)?;
|
||||
let _ = coa_core::companions::ensure_templates_for_schema(&admin_db, chars_db);
|
||||
coa_core::companions::query_bot_db_snapshot(&r_snap, &admin_db, chars_db, since_guid)
|
||||
},
|
||||
|delta, job| {
|
||||
let mut ra = Ra::connect_target(&r_ra, Some(mode))?;
|
||||
if let Some(lvl) = job.level {
|
||||
ra.spawn_custom(delta, lvl, job.class_id, job.spec_id, job.build_id.as_deref())
|
||||
} else {
|
||||
ra.spawn_bots(delta)
|
||||
}
|
||||
},
|
||||
);
|
||||
if let Err(e) = res {
|
||||
tracing::warn!("pending companions for realm {} failed during reconciliation: {e}", mode.name());
|
||||
if let Err(e) = reconcile_realm_companions(&r, &meta, &instance_id, mode, true) {
|
||||
tracing::warn!("companions for realm {} failed during start-up: {e}", mode.name());
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
@@ -758,6 +814,15 @@ async fn get_settings(
|
||||
blocking(move || config::load(&root, scope)).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn server_logging_state(
|
||||
state: State<'_, AppState>,
|
||||
id: String,
|
||||
) -> std::result::Result<coa_core::server_logging::ServerLoggingView, UiError> {
|
||||
let root = path_of(&state, &id)?;
|
||||
blocking(move || Ok(coa_core::server_logging::state(&root))).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn server_logging_preset(
|
||||
state: State<'_, AppState>,
|
||||
@@ -772,6 +837,30 @@ async fn server_logging_preset(
|
||||
}).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn server_logging_settings_save(
|
||||
state: State<'_, AppState>,
|
||||
id: String,
|
||||
settings: coa_core::server_logging::LogSettings,
|
||||
) -> std::result::Result<coa_core::server_logging::ServerLoggingView, UiError> {
|
||||
let root = path_of(&state, &id)?;
|
||||
let _guard = BusyGuard::acquire(&state, &id)?;
|
||||
blocking(move || {
|
||||
coa_core::server_logging::save_settings(&root, &settings)?;
|
||||
Ok(coa_core::server_logging::state(&root))
|
||||
}).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn server_logs_clean(
|
||||
state: State<'_, AppState>,
|
||||
id: String,
|
||||
) -> std::result::Result<coa_core::server_logging::CleanLogsReport, UiError> {
|
||||
let root = path_of(&state, &id)?;
|
||||
let _guard = BusyGuard::acquire(&state, &id)?;
|
||||
blocking(move || coa_core::server_logging::clean_logs(&root)).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn save_settings(
|
||||
state: State<'_, AppState>,
|
||||
@@ -2429,13 +2518,6 @@ fn client_install_addon(
|
||||
struct ClientStatus {
|
||||
/// A usable client folder is linked to this server.
|
||||
linked: bool,
|
||||
/// The Manager keeps this folder up to date (it downloaded it or was asked to adopt it).
|
||||
managed: bool,
|
||||
installed_version: Option<String>,
|
||||
latest_version: Option<String>,
|
||||
latest_bytes: Option<u64>,
|
||||
/// A managed client is older than the published one (or its download never finished).
|
||||
update_available: bool,
|
||||
}
|
||||
|
||||
fn linked_client(root: &std::path::Path) -> Result<Option<PathBuf>> {
|
||||
@@ -2446,192 +2528,16 @@ fn linked_client(root: &std::path::Path) -> Result<Option<PathBuf>> {
|
||||
.filter(|p| coa_core::client::detect(p, None).is_some()))
|
||||
}
|
||||
|
||||
/// Cheap: one small manifest request and the local state file; no game file is read.
|
||||
/// Whether a usable client folder is linked. Local only; the Manager no longer downloads or updates the client.
|
||||
#[tauri::command]
|
||||
async fn client_status(
|
||||
fn client_status(
|
||||
state: State<'_, AppState>,
|
||||
id: String,
|
||||
) -> std::result::Result<ClientStatus, UiError> {
|
||||
let ctx = client_context(&state, &id)?;
|
||||
blocking(move || {
|
||||
let client = ctx.linked();
|
||||
let latest = coa_core::clientdl::fetch_latest().ok();
|
||||
let local = client.as_deref().map(coa_core::clientdl::local);
|
||||
let managed = local.as_ref().map(|l| l.managed).unwrap_or(false);
|
||||
let installed = local.and_then(|l| l.version);
|
||||
let update_available = managed
|
||||
&& latest
|
||||
.as_ref()
|
||||
.map(|l| installed.as_deref() != Some(l.version.as_str()))
|
||||
.unwrap_or(false);
|
||||
Ok(ClientStatus {
|
||||
linked: client.is_some(),
|
||||
managed,
|
||||
installed_version: installed,
|
||||
latest_bytes: latest.as_ref().map(|l| l.total_bytes()),
|
||||
latest_version: latest.map(|l| l.version),
|
||||
update_available,
|
||||
})
|
||||
Ok(ClientStatus {
|
||||
linked: ctx.linked().is_some(),
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct ClientDownloadCheck {
|
||||
needed_bytes: u64,
|
||||
free_bytes: u64,
|
||||
version: String,
|
||||
/// Where the client would go.
|
||||
dest: String,
|
||||
}
|
||||
|
||||
const CLIENT_FOLDER: &str = "CoA Client";
|
||||
|
||||
#[tauri::command]
|
||||
async fn client_download_check(
|
||||
parent: String,
|
||||
) -> std::result::Result<ClientDownloadCheck, UiError> {
|
||||
blocking(move || {
|
||||
let latest = coa_core::clientdl::fetch_latest()?;
|
||||
let dest = PathBuf::from(&parent).join(CLIENT_FOLDER);
|
||||
Ok(ClientDownloadCheck {
|
||||
needed_bytes: latest.total_bytes(),
|
||||
free_bytes: coa_core::fsx::free_space(std::path::Path::new(&parent))?,
|
||||
version: latest.version,
|
||||
dest: dest.to_string_lossy().into_owned(),
|
||||
})
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
/// Compare the linked client with the published one. Hashes files only where the recorded state cannot vouch for them.
|
||||
#[tauri::command]
|
||||
async fn client_plan(
|
||||
app: AppHandle,
|
||||
state: State<'_, AppState>,
|
||||
id: String,
|
||||
) -> std::result::Result<coa_core::clientdl::Plan, UiError> {
|
||||
let ctx = client_context(&state, &id)?;
|
||||
let cancel = begin_client_job(&state)?;
|
||||
let result = blocking(move || {
|
||||
let client = ctx.require()?;
|
||||
let manifest = coa_core::clientdl::fetch_latest()?;
|
||||
let current = coa_core::clientdl::load_state(&client).unwrap_or_default();
|
||||
coa_core::clientdl::plan(&client, &manifest, ¤t, &cancel, &|s| {
|
||||
let _ = app.emit("client-progress", s);
|
||||
})
|
||||
})
|
||||
.await;
|
||||
end_client_job(&state);
|
||||
result
|
||||
}
|
||||
|
||||
/// Bring the linked client to the published version. `keep_modified` leaves files the player changed alone.
|
||||
#[tauri::command]
|
||||
async fn client_sync(
|
||||
app: AppHandle,
|
||||
state: State<'_, AppState>,
|
||||
id: String,
|
||||
keep_modified: bool,
|
||||
) -> std::result::Result<(), UiError> {
|
||||
let ctx = client_context(&state, &id)?;
|
||||
let cancel = begin_client_job(&state)?;
|
||||
let result = blocking(move || {
|
||||
let client = ctx.require()?;
|
||||
run_client_sync(&app, &client, keep_modified, &cancel)?;
|
||||
if ctx.root.is_none() && !ctx.host.is_empty() {
|
||||
coa_core::client::set_realmlist(&client, &ctx.dir, &ctx.host)?;
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
.await;
|
||||
end_client_job(&state);
|
||||
result
|
||||
}
|
||||
|
||||
fn run_client_sync(
|
||||
app: &AppHandle,
|
||||
client: &std::path::Path,
|
||||
keep_modified: bool,
|
||||
cancel: &Cancel,
|
||||
) -> Result<()> {
|
||||
let emit = |s: coa_core::clientdl::Step| {
|
||||
let _ = app.emit("client-progress", s);
|
||||
};
|
||||
let manifest = coa_core::clientdl::fetch_latest()?;
|
||||
let current = coa_core::clientdl::load_state(client).unwrap_or_default();
|
||||
let plan = coa_core::clientdl::plan(client, &manifest, ¤t, cancel, &emit)?;
|
||||
coa_core::download::check_url(coa_core::clientdl::OBJECTS_URL)?;
|
||||
let transport = coa_core::download::HttpTransport::new()?;
|
||||
coa_core::clientdl::apply(
|
||||
&coa_core::clientdl::Apply {
|
||||
client,
|
||||
manifest: &manifest,
|
||||
plan: &plan,
|
||||
keep_modified,
|
||||
transport: &transport,
|
||||
objects_url: coa_core::clientdl::OBJECTS_URL,
|
||||
cancel,
|
||||
},
|
||||
&emit,
|
||||
)?;
|
||||
tracing::info!(version = %manifest.version, downloaded = plan.items.len(), "client brought up to date");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Download the client into `<parent>/CoA Client`, then link it to a host or player profile.
|
||||
#[tauri::command]
|
||||
async fn client_download(
|
||||
app: AppHandle,
|
||||
state: State<'_, AppState>,
|
||||
id: String,
|
||||
parent: String,
|
||||
) -> std::result::Result<coa_core::client::ClientInfo, UiError> {
|
||||
let ctx = client_context(&state, &id)?;
|
||||
let cancel = begin_client_job(&state)?;
|
||||
let result = blocking(move || {
|
||||
let parent = PathBuf::from(&parent);
|
||||
if !parent.is_dir() {
|
||||
return Err(Error::Invalid(
|
||||
"Choose an existing folder to put the game client in.".into(),
|
||||
));
|
||||
}
|
||||
let dest = parent.join(CLIENT_FOLDER);
|
||||
let resuming = coa_core::clientdl::load_state(&dest).is_some();
|
||||
let non_empty = std::fs::read_dir(&dest)
|
||||
.map(|mut r| r.next().is_some())
|
||||
.unwrap_or(false);
|
||||
if non_empty && !resuming {
|
||||
return Err(Error::Invalid(format!(
|
||||
"{} already exists and is not an unfinished download. Choose another folder.",
|
||||
dest.display()
|
||||
)));
|
||||
}
|
||||
std::fs::create_dir_all(&dest)?;
|
||||
run_client_sync(&app, &dest, false, &cancel)?;
|
||||
let info = coa_core::client::detect(&dest, ctx.source.as_deref())
|
||||
.ok_or_else(|| Error::Invalid("The downloaded client looks incomplete.".into()))?;
|
||||
ctx.link(&info.path)?;
|
||||
if !ctx.host.is_empty() {
|
||||
coa_core::client::set_realmlist(&dest, &ctx.dir, &ctx.host)?;
|
||||
}
|
||||
if let Some(src) = &ctx.source {
|
||||
coa_core::client::install_addon(&dest, &ctx.dir, src)?;
|
||||
}
|
||||
Ok(coa_core::client::detect(&dest, ctx.source.as_deref()).unwrap_or(info))
|
||||
})
|
||||
.await;
|
||||
end_client_job(&state);
|
||||
result
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn client_cancel(state: State<'_, AppState>) {
|
||||
if let Ok(c) = state.client_cancel.lock() {
|
||||
if let Some(c) = c.as_ref() {
|
||||
c.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn begin_client_job(state: &AppState) -> std::result::Result<Cancel, UiError> {
|
||||
@@ -2640,10 +2546,7 @@ fn begin_client_job(state: &AppState) -> std::result::Result<Cancel, UiError> {
|
||||
.lock()
|
||||
.map_err(|_| Error::Invalid("state poisoned".into()))?;
|
||||
if slot.is_some() {
|
||||
return Err(Error::Invalid(
|
||||
"The game client is already being checked or downloaded.".into(),
|
||||
)
|
||||
.into());
|
||||
return Err(Error::Invalid("A game client operation is already running.".into()).into());
|
||||
}
|
||||
let cancel = Cancel::default();
|
||||
*slot = Some(cancel.clone());
|
||||
@@ -2777,6 +2680,7 @@ fn open_link(url: String) -> std::result::Result<(), UiError> {
|
||||
"https://login.tailscale.com/",
|
||||
"https://portforward.com/",
|
||||
"https://github.com/Corfirean/",
|
||||
"https://coa-development.org/",
|
||||
];
|
||||
// A prefilled "new issue" page of one of the places a report can go (the Manager, Companions, SQUID Playerbots): the
|
||||
// address must be exactly that page, and its query may carry `&` between the (percent-encoded) title and text.
|
||||
@@ -3247,7 +3151,10 @@ pub fn run() {
|
||||
.plugin(tauri_plugin_updater::Builder::new().build())
|
||||
.plugin(tauri_plugin_process::init())
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
server_logging_state,
|
||||
server_logging_preset,
|
||||
server_logging_settings_save,
|
||||
server_logs_clean,
|
||||
release_history,
|
||||
default_install_dir,
|
||||
game_data_folder,
|
||||
@@ -3337,6 +3244,7 @@ pub fn run() {
|
||||
report_targets,
|
||||
companion_sizes,
|
||||
add_companions,
|
||||
top_up_startup_fleet,
|
||||
get_wildcard_archetypes,
|
||||
remote_connection,
|
||||
remote_connect,
|
||||
@@ -3347,11 +3255,6 @@ pub fn run() {
|
||||
client_realmlist,
|
||||
client_install_addon,
|
||||
client_status,
|
||||
client_download_check,
|
||||
client_plan,
|
||||
client_sync,
|
||||
client_download,
|
||||
client_cancel,
|
||||
play,
|
||||
friends_status,
|
||||
friends_check_internet,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "CoA Server Manager",
|
||||
"version": "0.9.14",
|
||||
"version": "0.9.16",
|
||||
"identifier": "com.coa.servermanager",
|
||||
"build": {
|
||||
"beforeDevCommand": "npm run dev",
|
||||
|
||||
@@ -52,7 +52,13 @@
|
||||
"Restart the world every day at a chosen time": "Ежедневный перезапуск мира в выбранное время",
|
||||
"Switches for the Custom Races V2 subclasses, Hero Races and the /dev menu": "Переключатели подклассов, героических рас и меню /dev из Custom Races V2",
|
||||
"Companion bots on Wildcard and Warcraft Reborn": "Боты-компаньоны на Wildcard и Warcraft Reborn",
|
||||
"The Custom Races card tells which characters stay out while races are off": "Карточка Custom Races показывает, какие персонажи не войдут в мир, пока расы выключены"
|
||||
"The Custom Races card tells which characters stay out while races are off": "Карточка Custom Races показывает, какие персонажи не войдут в мир, пока расы выключены",
|
||||
"The Custom Races client update brings version 2.0.2": "Обновление клиента Custom Races приносит версию 2.0.2",
|
||||
"The game client now comes from the community launcher, not from the Manager": "Игровой клиент теперь берётся из лаунчера сообщества, а не из Менеджера",
|
||||
"Client setup says where to switch HD graphics; Custom Races patch card is translated": "Установка клиента подсказывает, где переключить HD-графику; карточка патча Custom Races переведена",
|
||||
"Clean server logs by hand or automatically when they grow too big": "Очищайте логи сервера вручную или автоматически, когда они становятся слишком большими",
|
||||
"The startup limit for companions now creates the ones that are missing": "Лимит запуска компаньонов теперь создаёт недостающих",
|
||||
"Restart the world every week on a chosen day and time": "Перезапускайте мир каждую неделю в выбранный день и время"
|
||||
},
|
||||
"de": {
|
||||
"Choose Parallel or Global level scaling in module settings": "Parallele oder globale Levelskalierung in den Moduleinstellungen wählen",
|
||||
@@ -106,7 +112,13 @@
|
||||
"Restart the world every day at a chosen time": "Die Welt täglich zu einer gewählten Uhrzeit neu starten",
|
||||
"Switches for the Custom Races V2 subclasses, Hero Races and the /dev menu": "Schalter für die Unterklassen, Heldenvölker und das /dev-Menü von Custom Races V2",
|
||||
"Companion bots on Wildcard and Warcraft Reborn": "Begleiter-Bots auf Wildcard und Warcraft Reborn",
|
||||
"The Custom Races card tells which characters stay out while races are off": "Die Custom-Races-Karte zeigt, welche Figuren draußen bleiben, solange die Völker aus sind"
|
||||
"The Custom Races card tells which characters stay out while races are off": "Die Custom-Races-Karte zeigt, welche Figuren draußen bleiben, solange die Völker aus sind",
|
||||
"The Custom Races client update brings version 2.0.2": "Das Update des Custom-Races-Clients bringt Version 2.0.2",
|
||||
"The game client now comes from the community launcher, not from the Manager": "Der Spielclient kommt jetzt vom Community-Launcher und nicht mehr vom Manager",
|
||||
"Client setup says where to switch HD graphics; Custom Races patch card is translated": "Die Client-Einrichtung sagt, wo man die HD-Grafik umschaltet; die Karte des Custom-Races-Patches ist übersetzt",
|
||||
"Clean server logs by hand or automatically when they grow too big": "Serverlogs von Hand oder automatisch bereinigen, wenn sie zu groß werden",
|
||||
"The startup limit for companions now creates the ones that are missing": "Das Startlimit für Begleiter erstellt jetzt die fehlenden",
|
||||
"Restart the world every week on a chosen day and time": "Die Welt jede Woche an einem gewählten Tag und zu einer gewählten Zeit neu starten"
|
||||
},
|
||||
"fr": {
|
||||
"Choose Parallel or Global level scaling in module settings": "Choisissez une progression parallèle ou globale des niveaux dans les paramètres du module",
|
||||
@@ -160,7 +172,13 @@
|
||||
"Restart the world every day at a chosen time": "Redémarrez le monde chaque jour à l'heure choisie",
|
||||
"Switches for the Custom Races V2 subclasses, Hero Races and the /dev menu": "Interrupteurs pour les sous-classes, races héroïques et le menu /dev de Custom Races V2",
|
||||
"Companion bots on Wildcard and Warcraft Reborn": "Bots compagnons sur Wildcard et Warcraft Reborn",
|
||||
"The Custom Races card tells which characters stay out while races are off": "La carte Custom Races indique quels personnages restent hors du monde quand les races sont désactivées"
|
||||
"The Custom Races card tells which characters stay out while races are off": "La carte Custom Races indique quels personnages restent hors du monde quand les races sont désactivées",
|
||||
"The Custom Races client update brings version 2.0.2": "La mise à jour du client Custom Races apporte la version 2.0.2",
|
||||
"The game client now comes from the community launcher, not from the Manager": "Le client du jeu vient désormais du lanceur de la communauté, plus du Manager",
|
||||
"Client setup says where to switch HD graphics; Custom Races patch card is translated": "La configuration du client indique où changer les graphismes HD ; la carte du patch Custom Races est traduite",
|
||||
"Clean server logs by hand or automatically when they grow too big": "Nettoyez les journaux du serveur à la main ou automatiquement quand ils deviennent trop gros",
|
||||
"The startup limit for companions now creates the ones that are missing": "La limite de démarrage des compagnons crée maintenant ceux qui manquent",
|
||||
"Restart the world every week on a chosen day and time": "Redémarrez le monde chaque semaine au jour et à l’heure choisis"
|
||||
},
|
||||
"es": {
|
||||
"Choose Parallel or Global level scaling in module settings": "Elige escalado de nivel paralelo o global en los ajustes del módulo",
|
||||
@@ -214,7 +232,13 @@
|
||||
"Restart the world every day at a chosen time": "Reinicia el mundo cada día a la hora elegida",
|
||||
"Switches for the Custom Races V2 subclasses, Hero Races and the /dev menu": "Interruptores para las subclases, razas heroicas y el menú /dev de Custom Races V2",
|
||||
"Companion bots on Wildcard and Warcraft Reborn": "Bots acompañantes en Wildcard y Warcraft Reborn",
|
||||
"The Custom Races card tells which characters stay out while races are off": "La tarjeta Custom Races indica qué personajes quedan fuera mientras las razas están desactivadas"
|
||||
"The Custom Races card tells which characters stay out while races are off": "La tarjeta Custom Races indica qué personajes quedan fuera mientras las razas están desactivadas",
|
||||
"The Custom Races client update brings version 2.0.2": "La actualización del cliente de Custom Races trae la versión 2.0.2",
|
||||
"The game client now comes from the community launcher, not from the Manager": "El cliente del juego ahora viene del launcher de la comunidad, no del Manager",
|
||||
"Client setup says where to switch HD graphics; Custom Races patch card is translated": "La configuración del cliente indica dónde cambiar los gráficos HD; la tarjeta del parche de Custom Races está traducida",
|
||||
"Clean server logs by hand or automatically when they grow too big": "Limpia los registros del servidor a mano o automáticamente cuando crecen demasiado",
|
||||
"The startup limit for companions now creates the ones that are missing": "El límite de inicio de los compañeros ahora crea los que faltan",
|
||||
"Restart the world every week on a chosen day and time": "Reinicia el mundo cada semana en el día y la hora elegidos"
|
||||
},
|
||||
"zh": {
|
||||
"Choose Parallel or Global level scaling in module settings": "在模块设置中选择并行或全局等级缩放",
|
||||
@@ -268,7 +292,13 @@
|
||||
"Restart the world every day at a chosen time": "每天在选定时间重启世界",
|
||||
"Switches for the Custom Races V2 subclasses, Hero Races and the /dev menu": "Custom Races V2 副职业、英雄种族和 /dev 菜单的开关",
|
||||
"Companion bots on Wildcard and Warcraft Reborn": "Wildcard 和 Warcraft Reborn 上的伙伴机器人",
|
||||
"The Custom Races card tells which characters stay out while races are off": "Custom Races 卡片会显示种族关闭时哪些角色无法进入世界"
|
||||
"The Custom Races card tells which characters stay out while races are off": "Custom Races 卡片会显示种族关闭时哪些角色无法进入世界",
|
||||
"The Custom Races client update brings version 2.0.2": "Custom Races 客户端更新带来 2.0.2 版本",
|
||||
"The game client now comes from the community launcher, not from the Manager": "游戏客户端现在来自社区启动器,而不是 Manager",
|
||||
"Client setup says where to switch HD graphics; Custom Races patch card is translated": "客户端设置会说明在哪里切换 HD 画质;Custom Races 补丁卡片已翻译",
|
||||
"Clean server logs by hand or automatically when they grow too big": "手动清理服务器日志,或在日志过大时自动清理",
|
||||
"The startup limit for companions now creates the ones that are missing": "同伴的启动上限现在会创建缺少的同伴",
|
||||
"Restart the world every week on a chosen day and time": "每周在选定的日期和时间重启世界"
|
||||
}
|
||||
},
|
||||
"server": {
|
||||
|
||||
+4
-14
@@ -45,7 +45,8 @@ export {};
|
||||
if(cmd==="addons_list"||cmd==="addons_install"||cmd==="addons_remove"){const w=window as any;w.__addons=w.__addons??{dragonui:"old"};if(cmd==="addons_install"){await new Promise(r=>setTimeout(r,700));w.__addons[args.addon]="new";}if(cmd==="addons_remove")delete w.__addons[args.addon];return addonCatalog.addons.map((a:any)=>({id:a.id,name:a.name,description:a.description,author:a.author,license:a.license,needs:a.needs??null,repo:a.repo,size:a.files.reduce((s:number,f:any)=>s+f.size,0),installed:a.id in w.__addons,updateAvailable:w.__addons[a.id]==="old",foreignFolders:a.id==="coacombat"&&!(a.id in w.__addons)?["CoACombat"]:[],bundled:null as string|null})).concat([{id:"coa-dev-menu",name:"CoA Dev Menu",description:{en:"The in-game /dev editor for game masters.",ru:"Внутриигровой редактор /dev для гейм-мастеров. Ставится вместе с клиентским патчем Custom Races V2 и включается вместе с ним."},author:"ilusixn",license:"see repository",needs:null,repo:"https://github.com/ilusixn/ilusixn-dev-menu",size:0,installed:true,updateAvailable:false,foreignFolders:[],bundled:"custom-races"}]);}
|
||||
if(cmd==="custom_race_characters") return {players:2,companionBots:14,squidBots:0};
|
||||
if(cmd==="purge_custom_race_bots"){await new Promise(r=>setTimeout(r,500));return 14;}
|
||||
if(cmd==="restart_schedule"||cmd==="restart_schedule_save"){const w=window as any;w.__sched=w.__sched??{enabled:false,time:"05:00",warningMinutes:5};if(cmd==="restart_schedule_save"){const s=args.schedule;if(s.enabled&&!/^([01]\d|2[0-3]):[0-5]\d$/.test(s.time))throw new Error("The restart time must be HH:MM, for example 05:00.");w.__sched={...s};}return {schedule:w.__sched,supported:true};}
|
||||
if(cmd==="restart_schedule"||cmd==="restart_schedule_save"){const w=window as any;w.__sched=w.__sched??{enabled:false,time:"05:00",warningMinutes:5,weeklyEnabled:false,weeklyDay:"sunday",weeklyTime:"05:00",weeklyWarningMinutes:5};if(cmd==="restart_schedule_save"){const s=args.schedule;if(s.enabled&&!/^([01]\d|2[0-3]):[0-5]\d$/.test(s.time))throw new Error("The restart time must be HH:MM, for example 05:00.");if(s.weeklyEnabled&&!/^([01]\d|2[0-3]):[0-5]\d$/.test(s.weeklyTime))throw new Error("The restart time must be HH:MM, for example 05:00.");w.__sched={...s};}return {schedule:w.__sched,supported:true};}
|
||||
if(cmd==="server_logging_state"||cmd==="server_logging_preset"||cmd==="server_logging_settings_save"||cmd==="server_logs_clean"){const w=window as any;w.__logs=w.__logs??{preset:"normal",logBytes:148*1024*1024,settings:{autoCleanup:false,maxSizeMb:500}};if(cmd==="server_logging_preset"){w.__logs.preset=args.preset;return;}if(cmd==="server_logging_settings_save"){w.__logs.settings={...args.settings};}if(cmd==="server_logs_clean"){const freed=w.__logs.logBytes;w.__logs.logBytes=0;return {freedBytes:freed,remainingBytes:0,deletedFiles:freed>0?3:0,skippedFiles:0};}return w.__logs;}
|
||||
if(cmd==="mysql_custom"||cmd==="mysql_custom_save"){const w=window as any;if(cmd==="mysql_custom_save")w.__my=args.text;const text:string=w.__my??"";const applied=text.split("\n").map((l:string)=>l.trim()).filter((l:string)=>l&&!l.startsWith("#")&&!/^(port|datadir|basedir|bind[-_]address)\b/i.test(l)).map((l:string)=>l+"\n").join("");return {text,applied};}
|
||||
if(cmd==="realm_names"||cmd==="realm_rename"){const w=window as any;w.__rn=w.__rn??{};const defs:[number,string][]=[[1,"Conquest of Azeroth"],[2,"Wildcard"]];if(cmd==="realm_rename"){await new Promise(r=>setTimeout(r,300));const n=(args.name??"").trim();if(n.length>32||n.includes('"'))throw new Error("The realm name can have at most 32 characters.");if(n)w.__rn[args.realmId]=n;else delete w.__rn[args.realmId];}return defs.map(([id,d])=>({id,name:w.__rn[id]??d,defaultName:d,custom:id in w.__rn}));}
|
||||
if(cmd==="realm_profiles") return {active:realm,wildcard_created:wildcardCreated,reborn_created:rebornCreated,reborn_supported:true,supported:true,recovery_pending:false,simultaneous,secondary_world_port:simultaneous?8086:null,secondary_running:simultaneous&&running,with_reborn:withReborn,reborn_world_port:withReborn?8087:null,reborn_running:withReborn&&running};
|
||||
@@ -69,25 +70,14 @@ export {};
|
||||
if(cmd==="list_presets"){const pr=args?.scope==="server"?serverPresets:botsPresets;return (pr.presets as any[]).map(p=>({id:p.id,title:p.title,description:p.description}));}
|
||||
if(cmd==="preview_preset"){const a=args;const sc=a.scope==="server"?serverSchema:botsSchema;const pr=(a.scope==="server"?serverPresets:botsPresets).presets as any[];const p=pr.find(x=>x.id===a.preset)??{id:a.preset??"defaults",title:"Recommended defaults",description:"Every setting returns to its default value."};const st=(sc.settings as any[]).filter(x=>x.type==="int"||x.type==="float"||x.type==="enum").slice(0,3);return {id:p.id,title:p.title,description:p.description,changes:st.map(x=>({key:x.key,title:x.title,from:x.default,to:x.type==="enum"?(x.options?.[1]?.value??x.default):(Number(x.default)||1)*2,dangerous:false}))};}
|
||||
if(cmd==="companion_sizes") return {hardware:{cores:16,ram_gb:31,free_ram_gb:12},sizes:[{id:"small",title:"Small",bots:50,warning:null},{id:"medium",title:"Medium",bots:250,warning:null},{id:"large",title:"Large",bots:500,warning:"500 companions may need more CPU and memory than this computer has (8 cores, 16 GB)."}]};
|
||||
if(cmd==="top_up_startup_fleet") return 0;
|
||||
if(cmd==="add_companions"){const base=(window as any).__bots??85;(window as any).__target=base+args.count;return {spawned:"queued",created:null,baseline:base};}
|
||||
if(cmd==="check_update") return {from_version:(window as any).__updated?"0.261028.83":"0.261026.81",to_version:"0.261028.83",items:[],conflicts:[],migrations:5,pending_migrations:(window as any).__updated?0:5,download_bytes:6000000};
|
||||
if(cmd==="apply_update"){const w=window as any;for(let i=1;i<=8;i++){await new Promise((r: any)=>setTimeout(r,700));(w.__handlers?.["update-progress"]??[]).forEach((h: any)=>h({event:"update-progress",id:1,payload:{step:i<4?"Downloading the update":i<7?"Applying the update":"Finishing",percent:i*12}}));}(window as any).__updated=true;return {txn:{state:"committed",to_version:"0.261028.83"},migrations:null};}
|
||||
if(cmd==="get_population"){if(!running) return null;let b=(window as any).__bots??85;const t=(window as any).__target??0;if(t>b){b=Math.min(t,b+25);(window as any).__bots=b;}return {online_total:b,bots_online:Math.max(0,b-7),players_online:0,bots_total:b};}
|
||||
if(cmd==="get_performance") return running?{mean_ms:14,median_ms:15,p95_ms:24,p99_ms:30,max_ms:61,ticks_per_sec:71.4}:null;
|
||||
if(cmd==="run_diagnostics") return {problems:2,checks:[{id:"files",title:"Server files",level:"ok",detail:"All expected server parts were found."},{id:"world",title:"World server",level:"warn",detail:"Not running."},{id:"disk",title:"Free disk space",level:"warn",detail:"Only 3 GB free; backups and updates need room."},{id:"exposure",title:"Private services",level:"ok",detail:"Database and server console are not reachable from the network."}]};
|
||||
if(cmd.startsWith("client_")){
|
||||
const w=window as any;
|
||||
const emit=(payload: any)=>(w.__handlers?.["client-progress"]??[]).forEach((h: any)=>h({event:"client-progress",id:1,payload}));
|
||||
const sleep=(ms: number)=>new Promise((r: any)=>setTimeout(r,ms));
|
||||
const total=46404000000;
|
||||
const run=async(phase: string,n: number,speed: number)=>{for(let i=1;i<=n;i++){if(w.__stop){w.__stop=false;throw {human:{code:"unknown",title:"",message:"",actions:[]},technical:"Download cancelled."};}emit({phase,done:Math.round(total*i/n),total,bytes_per_sec:speed,file:phase==="scan"?"Data/patch-"+i+".MPQ":"Data/patch-O.MPQ"});await sleep(120);}};
|
||||
if(cmd==="client_status"){const c=w.__client??"none";return {linked:c!=="none",managed:c==="old"||c==="new",installed_version:c==="old"?"2026-09-20-01":c==="new"?"2026-09-29-01":null,latest_version:"2026-09-29-01",latest_bytes:total,update_available:c==="old"};}
|
||||
if(cmd==="client_download_check") return {needed_bytes:total,free_bytes:args.parent.startsWith("C")?210e9:20e9,version:"2026-09-29-01",dest:args.parent+"\\CoA Client"};
|
||||
if(cmd==="client_plan"){await run("scan",12,0);return {version:"2026-09-29-01",items:[{path:"Data/patch-O.MPQ",size:2814983707,kind:"changed"},{path:"Data/patch-WB1.MPQ",size:2001890268,kind:"missing"},...(w.__modified?[{path:"d3d9.dll",size:4284430,kind:"modified"},{path:"Ascension.exe",size:7694848,kind:"modified"}]:[])],download_bytes:4829000000,total_files:200,up_to_date_files:196,kept_files:0};}
|
||||
if(cmd==="client_sync"){await run("download",25,41e6);w.__client="new";return null;}
|
||||
if(cmd==="client_download"){await run("scan",4,0);await run("download",40,41e6);w.__client="new";return {path:args.parent+"\\CoA Client",executable:"Ascension.exe",realmlists:[{path:"x",host:"127.0.0.1"}],addon:{installed:true,version:"1",up_to_date:true},other_addons:0};}
|
||||
if(cmd==="client_cancel"){w.__stop=true;return null;}
|
||||
}
|
||||
if(cmd==="client_status") return {linked:((window as any).__client??"none")!=="none"};
|
||||
if(cmd==="realmlist_profiles"){const w=window as any;w.__rl=w.__rl??{profiles:[{id:"solo",name:"Solo",data:"set realmlist 127.0.0.1\r\n"},{id:"ptr",name:"PTR",data:"set realmlist ptr.example.org\r\n"}],active:"solo"};return w.__rl;}
|
||||
if(cmd==="realmlist_activate"){(window as any).__rl.active=args.profileId;return [];}
|
||||
if(cmd==="realmlist_save"){const w=window as any;const rl=w.__rl;if(args.profileId){const p=rl.profiles.find((x: any)=>x.id===args.profileId);p.name=args.name;p.data=args.data;return p;}if(rl.profiles.some((x: any)=>x.name.toLowerCase()===String(args.name).toLowerCase()))throw {human:{code:"unknown",title:"",message:"",actions:[]},technical:"A realmlist with that name already exists."};const p={id:String(args.name).toLowerCase().replace(/[^a-z0-9]+/g,"-"),name:args.name,data:(/\s/.test(args.data.trim())?args.data.trim():"set realmlist "+args.data.trim())+"\r\n"};rl.profiles.push(p);return p;}
|
||||
|
||||
+35
-45
@@ -46,7 +46,7 @@ const de: Partial<Record<keyof typeof en, string>> = {
|
||||
"mod.switching": "Änderungen werden angewendet… Bitte warten.",
|
||||
"portable.experimental": "Experimentelle Funktion: Portable Charaktere befinden sich noch in aktiver Entwicklung. Fehler können auftreten.",
|
||||
"remote.clientReady": "Dein Client ist bereit. Speichere die Hostadresse und klicke auf Spielen.",
|
||||
"remote.clientIntro": "Wähle einen vorhandenen Spielclient oder lade ihn hier herunter. Ein lokaler Server ist nicht nötig.",
|
||||
"remote.clientIntro": "Wähle einen vorhandenen Spielclient oder hole dir einen über den Launcher der Community. Ein lokaler Server ist nicht nötig.",
|
||||
"welcome.host.title": "Einen Server hosten",
|
||||
"welcome.host.text": "Einen neuen Server installieren oder einen vorhandenen verwalten.",
|
||||
"welcome.connect.title": "Mit anderem Server verbinden",
|
||||
@@ -117,7 +117,6 @@ const de: Partial<Record<keyof typeof en, string>> = {
|
||||
"btn.stopSmall": "Stoppen",
|
||||
"btn.restart": "Neustart",
|
||||
"btn.startWithoutUpdate": "Ohne Update starten",
|
||||
"btn.playWithoutUpdate": "Ohne Update spielen",
|
||||
"import.squidRepackWarning": "Dieses SquidBots-Repack prüft den Worldserver-Hash. Ein Austausch kann Start_All_Bots und coa_update deaktivieren. Updates fragen vorher nach.",
|
||||
"btn.play": "SPIELEN",
|
||||
"btn.startPlay": "STARTEN & SPIELEN",
|
||||
@@ -260,6 +259,7 @@ const de: Partial<Record<keyof typeof en, string>> = {
|
||||
"client.updateAddon": "Begleiter-Addon aktualisieren",
|
||||
"client.addonNote": "Begleiter-Addon installiert. Andere Addons wurden nicht angetastet.",
|
||||
"client.changeFolder": "Ordner ändern …",
|
||||
"client.getFromSite": "Launcher holen…",
|
||||
|
||||
// Diagnostics
|
||||
"diag.title": "Diagnose",
|
||||
@@ -597,6 +597,8 @@ const de: Partial<Record<keyof typeof en, string>> = {
|
||||
"comp.startCount": "Wie viele sich anmelden",
|
||||
"comp.startSave": "Speichern",
|
||||
"comp.startSaved": "Gespeichert. Gilt ab dem nächsten Serverstart.",
|
||||
"comp.startTopUp": "Gespeichert. {n} weitere Begleiter werden erstellt, damit {max} existieren; die übrigen gibt es schon.",
|
||||
"comp.startTopUpConfirm": "{n} weitere Begleiter erstellen, damit {max} existieren? Vorhandene werden nicht erneut erstellt.",
|
||||
"comp.startHint": "Bots, die sich nicht anmelden, bleiben gespeichert und können später online gebracht werden.",
|
||||
"comp.startInvalid": "Gib eine ganze Zahl von 0 bis 5000 ein.",
|
||||
|
||||
@@ -645,51 +647,26 @@ const de: Partial<Record<keyof typeof en, string>> = {
|
||||
// Game client download and update
|
||||
"btn.close": "Schließen",
|
||||
"btn.setupClient": "Spielclient einrichten",
|
||||
"btn.updateClient": "CLIENT AKTUALISIEREN",
|
||||
"client.setup.title": "Spielclient einrichten",
|
||||
"client.setup.intro": "Zum Spielen brauchst du den Spielclient. Nutze einen vorhandenen oder lass ihn vom Manager herunterladen.",
|
||||
"client.setup.intro": "Zum Spielen brauchst du den Spielclient. Die Community gibt ihn über ihren offiziellen Launcher heraus.",
|
||||
"client.setup.have": "Ich habe bereits einen Client",
|
||||
"client.setup.download": "Client herunterladen",
|
||||
"client.setup.downloadHint": "Etwa 43 GB",
|
||||
"client.dl.pickParent": "Wähle, wohin der Spielclient soll",
|
||||
"client.dl.confirmText": "Version {v}, {size}. Er wird in diesem Ordner gespeichert:",
|
||||
"client.dl.free": "Freier Platz auf diesem Laufwerk: {free}.",
|
||||
"client.dl.notEnough": "Nicht genug freier Platz: {need} nötig, {free} verfügbar. Wähle ein anderes Laufwerk.",
|
||||
"client.dl.otherFolder": "Anderer Ordner …",
|
||||
"client.dl.start": "Herunterladen",
|
||||
"client.setup.getLauncher": "Launcher holen (coa-development.org)",
|
||||
"client.setup.getLauncherHint": "Öffnet die Website der Community im Browser. Lade dort den Launcher herunter, installiere ihn, melde dich mit deinem Konto an und lass ihn das Spiel laden (etwa 43 GB).",
|
||||
"client.setup.haveHint": "Wähle den Ordner, in den der Launcher das Spiel installiert hat, oder eine andere Kopie des Clients.",
|
||||
"client.setup.hdHint": "Standard- oder HD-Grafik wählst du im Launcher: Öffne dort die Einstellungen und schalte „HD graphics“ um. Der Manager kann das nicht ändern.",
|
||||
"races.patch.active": "Client-Patch: Aktiv",
|
||||
"races.patch.disabled": "Client-Patch: Deaktiviert (.disabled)",
|
||||
"races.patch.notInstalled": "Client-Patch: Nicht installiert",
|
||||
"races.patch.partial": "Client-Patch: {a}/{b} MPQ",
|
||||
"races.patch.partialHint": "Dateien fehlen oder wurden geändert. Repariere den Client-Patch.",
|
||||
"races.patch.install": "Client-Patch installieren",
|
||||
"races.patch.repair": "Client-Patch reparieren",
|
||||
"races.patch.uninstall": "Client-Patch entfernen",
|
||||
"races.patch.willEnable": "Der Patch ist nach der Installation aktiv.",
|
||||
"races.patch.willStayOff": "Der Patch bleibt nach der Installation deaktiviert: Das Servermodul ist aus oder fehlt.",
|
||||
"client.dl.back": "Zurück",
|
||||
"client.dl.retry": "Erneut versuchen",
|
||||
"client.dl.resume": "Fortsetzen",
|
||||
"client.dl.cancel": "Anhalten",
|
||||
"client.dl.cancelled": "Angehalten. Alles bereits Heruntergeladene bleibt erhalten; du kannst jederzeit fortsetzen.",
|
||||
"client.dl.scanning": "Dateien werden verglichen …",
|
||||
"client.dl.downloading": "Wird heruntergeladen",
|
||||
"client.dl.progress": "{done} von {total}",
|
||||
"client.dl.speed": "{speed}/s",
|
||||
"client.dl.done": "Der Spielclient ist bereit",
|
||||
"client.dl.doneText": "Er ist mit diesem Server verknüpft. Du kannst auf PLAY drücken.",
|
||||
"client.upd.title": "Client-Update",
|
||||
"client.upd.available": "Ein neuerer Spielclient ist verfügbar: {v}.",
|
||||
"client.upd.summary": "{n} Datei(en) zum Herunterladen, insgesamt {size}.",
|
||||
"client.upd.upToDate": "Dein Client entspricht bereits Version {v}.",
|
||||
"client.upd.modifiedTitle": "{n} Datei(en) hast du geändert",
|
||||
"client.upd.modifiedText": "Zum Beispiel eine gepatchte Programmdatei. Behalte sie oder ersetze sie durch die offiziellen Versionen; deine werden dann im Ordner .coa-manager des Clients gesichert. Grafik-Wrapper (d3d9.dll und ähnliche) und Konfigurationsdateien bleiben immer unverändert.",
|
||||
"client.upd.keep": "Von mir geänderte Dateien behalten",
|
||||
"client.upd.more": "… und {n} weitere",
|
||||
"client.upd.start": "Client aktualisieren",
|
||||
"client.upd.later": "Jetzt nicht",
|
||||
"client.upd.playAnyway": "Ohne Update spielen",
|
||||
"client.upd.done": "Der Spielclient ist aktuell",
|
||||
"client.upd.doneText": "Der Manager sagt dir Bescheid, wenn eine neuere Version erscheint.",
|
||||
"client.track.title": "Client aktuell halten",
|
||||
"client.track.text": "Der Manager vergleicht deinen Client einmal mit dem offiziellen und prüft danach auf neue Versionen, wie beim Server. Von dir geänderte Dateien werden nur ersetzt, wenn du es willst.",
|
||||
"client.track.start": "Aktuell halten",
|
||||
"client.track.startUpdate": "Aktualisieren und aktuell halten",
|
||||
"client.track.button": "Diesen Client aktuell halten …",
|
||||
"client.version": "Client-Version",
|
||||
"client.versionUntracked": "vom Manager nicht verfolgt",
|
||||
"client.versionUnfinished": "Download nicht abgeschlossen",
|
||||
"client.downloadInstead": "Client herunterladen …",
|
||||
|
||||
// Accounts panel, password toggle, install size, addon explanation
|
||||
"pw.show": "Passwort anzeigen",
|
||||
@@ -780,6 +757,15 @@ const de: Partial<Record<keyof typeof en, string>> = {
|
||||
"mysql.applied": "Angewandte Optionen: {count}",
|
||||
"sched.title": "Geplanter Neustart",
|
||||
"sched.enable": "Die Welt jeden Tag neu starten",
|
||||
"sched.weeklyEnable": "Die Welt jede Woche neu starten",
|
||||
"sched.day": "Tag",
|
||||
"sched.days.monday": "Montag",
|
||||
"sched.days.tuesday": "Dienstag",
|
||||
"sched.days.wednesday": "Mittwoch",
|
||||
"sched.days.thursday": "Donnerstag",
|
||||
"sched.days.friday": "Freitag",
|
||||
"sched.days.saturday": "Samstag",
|
||||
"sched.days.sunday": "Sonntag",
|
||||
"sched.time": "Uhrzeit",
|
||||
"sched.warning": "Vorwarnung (Minuten)",
|
||||
"sched.hint": "Die Welt startet zu dieser Uhrzeit dieses Computers neu, mit einem Countdown im Spielchat; die Datenbank läuft weiter, Spieler melden sich danach wieder an. Ein laufender Server übernimmt die neue Zeit innerhalb einer Minute.",
|
||||
@@ -931,7 +917,6 @@ const de: Partial<Record<keyof typeof en, string>> = {
|
||||
"dash.openBrowser": "Im Browser öffnen",
|
||||
"dash.update": "Dashboard aktualisieren",
|
||||
"upd.startAfter": "Server nach dem Update starten (sonst bleibt ein angehaltener Server angehalten)",
|
||||
"client.startAfter": "Spiel nach dem Client-Update starten",
|
||||
"bk.folder": "Sicherungsordner",
|
||||
"bk.folderDefault": "Standard",
|
||||
"bk.folderNote": "Neue Sicherungen werden hier gespeichert, zum Beispiel auf einem anderen Laufwerk. Frühere Sicherungen bleiben, wo sie sind, und werden weiter aufgelistet. Der Ordner muss außerhalb des Serverordners liegen.",
|
||||
@@ -944,8 +929,6 @@ const de: Partial<Record<keyof typeof en, string>> = {
|
||||
"remove.stopFirst": "Halte zuerst den Server an.",
|
||||
"remove.confirm": "Diesen Server aus dem Manager entfernen?\n\n{path}\n\nEs werden keine Dateien gelöscht.",
|
||||
"upd.dbUnchecked": "Die Datenbank konnte nicht geprüft werden, daher sind offene Datenbankänderungen unbekannt: {why}",
|
||||
"client.job.checking": "Client wird geprüft…",
|
||||
"client.job.updating": "Client wird aktualisiert",
|
||||
"fr.lan.address": "Netzwerkadresse",
|
||||
"fr.lan.automatic": "Automatisch",
|
||||
"fr.lan.default": "Standard",
|
||||
@@ -1127,6 +1110,13 @@ const de: Partial<Record<keyof typeof en, string>> = {
|
||||
"serverLogs.errors": "Nur Fehler",
|
||||
"serverLogs.off": "Aus",
|
||||
"serverLogs.saved": "Gespeichert. Zum Anwenden den Server neu starten.",
|
||||
"serverLogs.autoClean": "Serverlogs nach Größe automatisch bereinigen",
|
||||
"serverLogs.maxSize": "Max. Größe",
|
||||
"serverLogs.autoCleanHint": "Löscht alte Logdateien, wenn Core/Logs diese Größe überschreitet (geprüft beim Start der Welt und regelmäßig während des Betriebs).",
|
||||
"serverLogs.currentSize": "Aktuelle Loggröße: {size}",
|
||||
"serverLogs.cleanNow": "Logs bereinigen ({size})",
|
||||
"serverLogs.cleaned": "{freed} an Logs bereinigt.",
|
||||
"serverLogs.skippedInUse": "{remaining} werden vom laufenden Server verwendet und konnten nicht entfernt werden.",
|
||||
"mod.requiresSquid": "Aktivieren Sie SQUID-Bots, um Dungeon Clear zu verwenden.",
|
||||
};
|
||||
|
||||
|
||||
+36
-46
@@ -43,7 +43,7 @@ const en = {
|
||||
"races.existing": "Existing characters keep their race and data.",
|
||||
"mod.switching": "Applying changes… Please wait.",
|
||||
"remote.clientReady": "Your client is ready. Save the host’s address, then press Play.",
|
||||
"remote.clientIntro": "Choose an existing game client or download one here. No local server is needed.",
|
||||
"remote.clientIntro": "Choose an existing game client, or get one through the community’s launcher. No local server is needed.",
|
||||
"welcome.host.title": "Host a server",
|
||||
"welcome.host.text": "Install a new server or manage one you already have.",
|
||||
"welcome.connect.title": "Connect to another server",
|
||||
@@ -64,6 +64,15 @@ const en = {
|
||||
"mysql.applied": "Options applied: {count}",
|
||||
"sched.title": "Scheduled restart",
|
||||
"sched.enable": "Restart the world every day",
|
||||
"sched.weeklyEnable": "Restart the world every week",
|
||||
"sched.day": "Day",
|
||||
"sched.days.monday": "Monday",
|
||||
"sched.days.tuesday": "Tuesday",
|
||||
"sched.days.wednesday": "Wednesday",
|
||||
"sched.days.thursday": "Thursday",
|
||||
"sched.days.friday": "Friday",
|
||||
"sched.days.saturday": "Saturday",
|
||||
"sched.days.sunday": "Sunday",
|
||||
"sched.time": "Time",
|
||||
"sched.warning": "Warning (minutes)",
|
||||
"sched.hint": "The world restarts at this time of this computer with a countdown in the game chat; the database keeps running and players log in again after it. A minute after saving, the running server follows the new time.",
|
||||
@@ -198,7 +207,6 @@ const en = {
|
||||
"btn.stopSmall": "Stop",
|
||||
"btn.restart": "Restart",
|
||||
"btn.startWithoutUpdate": "Start without updating",
|
||||
"btn.playWithoutUpdate": "Play without updating",
|
||||
"import.squidRepackWarning": "This SquidBots repack checks its worldserver hash. Replacing the binary can stop Start_All_Bots and coa_update from working. Updates will ask before replacing it.",
|
||||
"btn.play": "PLAY",
|
||||
"btn.startPlay": "START & PLAY",
|
||||
@@ -358,6 +366,7 @@ const en = {
|
||||
"client.updateAddon": "Update companion addon",
|
||||
"client.addonNote": "Companion addon installed. Other addons were not touched.",
|
||||
"client.changeFolder": "Change folder…",
|
||||
"client.getFromSite": "Get the launcher…",
|
||||
|
||||
// Diagnostics
|
||||
"diag.title": "Diagnostics",
|
||||
@@ -696,6 +705,8 @@ const en = {
|
||||
"comp.startCount": "How many log in",
|
||||
"comp.startSave": "Save",
|
||||
"comp.startSaved": "Saved. It applies the next time the server starts.",
|
||||
"comp.startTopUp": "Saved. Creating {n} more companions so that {max} exist; the others already exist.",
|
||||
"comp.startTopUpConfirm": "Create {n} more companions so that {max} exist? Companions that already exist are not created again.",
|
||||
"comp.startHint": "Bots that do not log in stay saved and can be brought online later.",
|
||||
"comp.startInvalid": "Enter a whole number from 0 to 5000.",
|
||||
|
||||
@@ -741,54 +752,29 @@ const en = {
|
||||
"overview.updatingNote": "Updating: the server is stopped, backed up, updated and started again to check that it works.",
|
||||
"nav.updateDot": "Update available",
|
||||
|
||||
// Game client download and update
|
||||
// Game client: link a folder or get the community launcher
|
||||
"btn.close": "Close",
|
||||
"btn.setupClient": "Set up game client",
|
||||
"btn.updateClient": "UPDATE CLIENT",
|
||||
"client.setup.title": "Set up the game client",
|
||||
"client.setup.intro": "To play you need the game client. Use one you already have, or let the Manager download it.",
|
||||
"client.setup.intro": "To play you need the game client. The community hands it out through its official launcher.",
|
||||
"client.setup.have": "I already have a client",
|
||||
"client.setup.download": "Download the client",
|
||||
"client.setup.downloadHint": "About 43 GB",
|
||||
"client.dl.pickParent": "Choose where to put the game client",
|
||||
"client.dl.confirmText": "Version {v}, {size}. It will be saved in this folder:",
|
||||
"client.dl.free": "Free space on that drive: {free}.",
|
||||
"client.dl.notEnough": "Not enough free space: {need} needed, {free} available. Choose another drive.",
|
||||
"client.dl.otherFolder": "Other folder…",
|
||||
"client.dl.start": "Download",
|
||||
"client.setup.getLauncher": "Get the launcher (coa-development.org)",
|
||||
"client.setup.getLauncherHint": "Opens the community website in your browser. Download and install the launcher there, sign in with your account and let it download the game (about 43 GB).",
|
||||
"client.setup.haveHint": "Pick the folder the launcher installed the game to, or any other copy of the client.",
|
||||
"client.setup.hdHint": "Standard or HD graphics is chosen in the launcher: open its Settings and switch \"HD graphics\". The Manager cannot change it.",
|
||||
"races.patch.active": "Client Patch: Active",
|
||||
"races.patch.disabled": "Client Patch: Disabled (.disabled)",
|
||||
"races.patch.notInstalled": "Client Patch: Not Installed",
|
||||
"races.patch.partial": "Client Patch: {a}/{b} MPQ",
|
||||
"races.patch.partialHint": "Files are missing or changed. Repair the client patch.",
|
||||
"races.patch.install": "Install Client Patch",
|
||||
"races.patch.repair": "Repair Client Patch",
|
||||
"races.patch.uninstall": "Uninstall Client Patch",
|
||||
"races.patch.willEnable": "The patch will be enabled after installation.",
|
||||
"races.patch.willStayOff": "The patch will stay disabled after installation: the server module is off or missing.",
|
||||
"client.dl.back": "Back",
|
||||
"client.dl.retry": "Try again",
|
||||
"client.dl.resume": "Continue",
|
||||
"client.dl.cancel": "Stop",
|
||||
"client.dl.cancelled": "Stopped. Everything already downloaded is kept; continue whenever you like.",
|
||||
"client.dl.scanning": "Comparing files…",
|
||||
"client.dl.downloading": "Downloading",
|
||||
"client.dl.progress": "{done} of {total}",
|
||||
"client.dl.speed": "{speed}/s",
|
||||
"client.dl.done": "The game client is ready",
|
||||
"client.dl.doneText": "It is linked to this server. You can press PLAY.",
|
||||
"client.upd.title": "Client update",
|
||||
"client.upd.available": "A newer game client is available: {v}.",
|
||||
"client.upd.summary": "{n} file(s) to download, {size} in total.",
|
||||
"client.upd.upToDate": "Your client already matches version {v}.",
|
||||
"client.upd.modifiedTitle": "{n} file(s) were changed by you",
|
||||
"client.upd.modifiedText": "For example a patched executable. Keep them, or replace them with the official versions; yours are then saved in the client’s .coa-manager folder. Graphics wrappers (d3d9.dll and the like) and config files are always left as they are.",
|
||||
"client.upd.keep": "Keep the files I changed",
|
||||
"client.upd.more": "… and {n} more",
|
||||
"client.upd.start": "Update client",
|
||||
"client.upd.later": "Not now",
|
||||
"client.upd.playAnyway": "Play without updating",
|
||||
"client.upd.done": "The game client is up to date",
|
||||
"client.upd.doneText": "The Manager will tell you when a newer one is published.",
|
||||
"client.track.title": "Keep the client up to date",
|
||||
"client.track.text": "The Manager compares your client with the official one once, then checks for new versions like it does for the server. Files you changed are never replaced unless you say so.",
|
||||
"client.track.start": "Keep up to date",
|
||||
"client.track.startUpdate": "Update and keep up to date",
|
||||
"client.track.button": "Keep this client up to date…",
|
||||
"client.version": "Client version",
|
||||
"client.versionUntracked": "not tracked by the Manager",
|
||||
"client.versionUnfinished": "download not finished",
|
||||
"client.downloadInstead": "Download a client…",
|
||||
|
||||
// Accounts panel, password toggle, install size, addon explanation
|
||||
"pw.show": "Show password",
|
||||
@@ -977,7 +963,6 @@ const en = {
|
||||
"dash.openBrowser": "Open in the browser",
|
||||
"dash.update": "Update the dashboard",
|
||||
"upd.startAfter": "Start the server after updating it (otherwise a stopped server stays stopped)",
|
||||
"client.startAfter": "Start the game after the client has been updated",
|
||||
"bk.folder": "Backup folder",
|
||||
"bk.folderDefault": "default",
|
||||
"bk.folderNote": "New backups are saved here, for example on another drive. Backups made earlier stay where they are and are still listed. The folder must be outside the server folder.",
|
||||
@@ -990,8 +975,6 @@ const en = {
|
||||
"remove.stopFirst": "Stop the server first.",
|
||||
"remove.confirm": "Remove this server from the Manager?\n\n{path}\n\nNo files are deleted.",
|
||||
"upd.dbUnchecked": "The database could not be checked, so pending database changes are unknown: {why}",
|
||||
"client.job.checking": "Checking the client…",
|
||||
"client.job.updating": "Updating the client",
|
||||
"nav.characters": "Characters",
|
||||
"q.characters": "Which of my characters can play where?",
|
||||
"portable.experimental": "Experimental feature: portable characters are still in active development. Bugs may occur.",
|
||||
@@ -1337,6 +1320,13 @@ const en = {
|
||||
"serverLogs.errors": "Errors only",
|
||||
"serverLogs.off": "Off",
|
||||
"serverLogs.saved": "Saved. Restart the server to apply.",
|
||||
"serverLogs.autoClean": "Auto-clean server logs by size",
|
||||
"serverLogs.maxSize": "Max size",
|
||||
"serverLogs.autoCleanHint": "Clears old log files when Core/Logs exceeds this size (checked on world start and periodically while running).",
|
||||
"serverLogs.currentSize": "Current log size: {size}",
|
||||
"serverLogs.cleanNow": "Clean logs ({size})",
|
||||
"serverLogs.cleaned": "Cleaned {freed} of logs.",
|
||||
"serverLogs.skippedInUse": "{remaining} in use by the running server could not be removed.",
|
||||
"mod.requiresSquid": "Enable SQUID bots to use Dungeon Clear.",
|
||||
} as const;
|
||||
|
||||
|
||||
+35
-45
@@ -46,7 +46,7 @@ const es: Partial<Record<keyof typeof en, string>> = {
|
||||
"mod.switching": "Aplicando cambios… Espera un momento.",
|
||||
"portable.experimental": "Función experimental: los personajes portátiles siguen en desarrollo activo. Pueden producirse errores.",
|
||||
"remote.clientReady": "Tu cliente está listo. Guarda la dirección del anfitrión y pulsa Jugar.",
|
||||
"remote.clientIntro": "Elige un cliente existente o descárgalo aquí. No necesitas un servidor local.",
|
||||
"remote.clientIntro": "Elige un cliente del juego existente u obtén uno con el launcher de la comunidad. No hace falta un servidor local.",
|
||||
"welcome.host.title": "Alojar un servidor",
|
||||
"welcome.host.text": "Instalar un servidor nuevo o gestionar uno existente.",
|
||||
"welcome.connect.title": "Conectarse a otro servidor",
|
||||
@@ -117,7 +117,6 @@ const es: Partial<Record<keyof typeof en, string>> = {
|
||||
"btn.stopSmall": "Detener",
|
||||
"btn.restart": "Reiniciar",
|
||||
"btn.startWithoutUpdate": "Iniciar sin actualizar",
|
||||
"btn.playWithoutUpdate": "Jugar sin actualizar",
|
||||
"import.squidRepackWarning": "Este repack SquidBots verifica el hash del servidor. Sustituirlo puede impedir el funcionamiento de Start_All_Bots y coa_update. Se solicitará confirmación.",
|
||||
"btn.play": "JUGAR",
|
||||
"btn.startPlay": "INICIAR Y JUGAR",
|
||||
@@ -260,6 +259,7 @@ const es: Partial<Record<keyof typeof en, string>> = {
|
||||
"client.updateAddon": "Actualizar addon de compañeros",
|
||||
"client.addonNote": "Addon de compañeros instalado. Los demás addons no se tocaron.",
|
||||
"client.changeFolder": "Cambiar carpeta…",
|
||||
"client.getFromSite": "Obtener el launcher…",
|
||||
|
||||
// Diagnostics
|
||||
"diag.title": "Diagnóstico",
|
||||
@@ -597,6 +597,8 @@ const es: Partial<Record<keyof typeof en, string>> = {
|
||||
"comp.startCount": "Cuántos inician sesión",
|
||||
"comp.startSave": "Guardar",
|
||||
"comp.startSaved": "Guardado. Se aplica la próxima vez que se inicie el servidor.",
|
||||
"comp.startTopUp": "Guardado. Se crean {n} compañeros más para que existan {max}; los demás ya existen.",
|
||||
"comp.startTopUpConfirm": "¿Crear {n} compañeros más para que existan {max}? Los que ya existen no se crean de nuevo.",
|
||||
"comp.startHint": "Los bots que no inician sesión quedan guardados y se pueden conectar más tarde.",
|
||||
"comp.startInvalid": "Introduce un número entero de 0 a 5000.",
|
||||
|
||||
@@ -645,51 +647,26 @@ const es: Partial<Record<keyof typeof en, string>> = {
|
||||
// Game client download and update
|
||||
"btn.close": "Cerrar",
|
||||
"btn.setupClient": "Configurar el cliente del juego",
|
||||
"btn.updateClient": "ACTUALIZAR CLIENTE",
|
||||
"client.setup.title": "Configurar el cliente del juego",
|
||||
"client.setup.intro": "Para jugar necesitas el cliente del juego. Usa uno que ya tengas o deja que el Manager lo descargue.",
|
||||
"client.setup.intro": "Para jugar necesitas el cliente del juego. La comunidad lo entrega a través de su launcher oficial.",
|
||||
"client.setup.have": "Ya tengo un cliente",
|
||||
"client.setup.download": "Descargar el cliente",
|
||||
"client.setup.downloadHint": "Unos 43 GB",
|
||||
"client.dl.pickParent": "Elige dónde guardar el cliente del juego",
|
||||
"client.dl.confirmText": "Versión {v}, {size}. Se guardará en esta carpeta:",
|
||||
"client.dl.free": "Espacio libre en esa unidad: {free}.",
|
||||
"client.dl.notEnough": "No hay espacio suficiente: se necesitan {need} y hay {free}. Elige otra unidad.",
|
||||
"client.dl.otherFolder": "Otra carpeta…",
|
||||
"client.dl.start": "Descargar",
|
||||
"client.setup.getLauncher": "Obtener el launcher (coa-development.org)",
|
||||
"client.setup.getLauncherHint": "Abre la web de la comunidad en tu navegador. Descarga e instala allí el launcher, inicia sesión con tu cuenta y deja que descargue el juego (unos 43 GB).",
|
||||
"client.setup.haveHint": "Elige la carpeta donde el launcher instaló el juego, o cualquier otra copia del cliente.",
|
||||
"client.setup.hdHint": "Los gráficos estándar o HD se eligen en el launcher: abre sus Ajustes y cambia «HD graphics». El Manager no puede cambiarlo.",
|
||||
"races.patch.active": "Parche del cliente: Activo",
|
||||
"races.patch.disabled": "Parche del cliente: Desactivado (.disabled)",
|
||||
"races.patch.notInstalled": "Parche del cliente: No instalado",
|
||||
"races.patch.partial": "Parche del cliente: {a}/{b} MPQ",
|
||||
"races.patch.partialHint": "Faltan archivos o han cambiado. Repara el parche del cliente.",
|
||||
"races.patch.install": "Instalar parche del cliente",
|
||||
"races.patch.repair": "Reparar parche del cliente",
|
||||
"races.patch.uninstall": "Desinstalar parche del cliente",
|
||||
"races.patch.willEnable": "El parche estará activo después de la instalación.",
|
||||
"races.patch.willStayOff": "El parche seguirá desactivado después de la instalación: el módulo del servidor está apagado o falta.",
|
||||
"client.dl.back": "Atrás",
|
||||
"client.dl.retry": "Reintentar",
|
||||
"client.dl.resume": "Continuar",
|
||||
"client.dl.cancel": "Detener",
|
||||
"client.dl.cancelled": "Detenido. Todo lo ya descargado se conserva; puedes continuar cuando quieras.",
|
||||
"client.dl.scanning": "Comparando archivos…",
|
||||
"client.dl.downloading": "Descargando",
|
||||
"client.dl.progress": "{done} de {total}",
|
||||
"client.dl.speed": "{speed}/s",
|
||||
"client.dl.done": "El cliente del juego está listo",
|
||||
"client.dl.doneText": "Está vinculado a este servidor. Puedes pulsar PLAY.",
|
||||
"client.upd.title": "Actualización del cliente",
|
||||
"client.upd.available": "Hay un cliente del juego más reciente: {v}.",
|
||||
"client.upd.summary": "{n} archivo(s) por descargar, {size} en total.",
|
||||
"client.upd.upToDate": "Tu cliente ya coincide con la versión {v}.",
|
||||
"client.upd.modifiedTitle": "{n} archivo(s) cambiado(s) por ti",
|
||||
"client.upd.modifiedText": "Por ejemplo un ejecutable modificado. Consérvalos o reemplázalos por las versiones oficiales; los tuyos se guardan entonces en la carpeta .coa-manager del cliente. Los wrappers gráficos (d3d9.dll y similares) y los archivos de configuración se dejan siempre como están.",
|
||||
"client.upd.keep": "Conservar los archivos que cambié",
|
||||
"client.upd.more": "… y {n} más",
|
||||
"client.upd.start": "Actualizar cliente",
|
||||
"client.upd.later": "Ahora no",
|
||||
"client.upd.playAnyway": "Jugar sin actualizar",
|
||||
"client.upd.done": "El cliente del juego está actualizado",
|
||||
"client.upd.doneText": "El Manager te avisará cuando se publique una más reciente.",
|
||||
"client.track.title": "Mantener el cliente actualizado",
|
||||
"client.track.text": "El Manager compara una vez tu cliente con el oficial y luego busca versiones nuevas como hace con el servidor. Los archivos que cambiaste solo se reemplazan si tú lo decides.",
|
||||
"client.track.start": "Mantener actualizado",
|
||||
"client.track.startUpdate": "Actualizar y mantener actualizado",
|
||||
"client.track.button": "Mantener este cliente actualizado…",
|
||||
"client.version": "Versión del cliente",
|
||||
"client.versionUntracked": "el Manager no la sigue",
|
||||
"client.versionUnfinished": "descarga sin terminar",
|
||||
"client.downloadInstead": "Descargar un cliente…",
|
||||
|
||||
// Accounts panel, password toggle, install size, addon explanation
|
||||
"pw.show": "Mostrar contraseña",
|
||||
@@ -780,6 +757,15 @@ const es: Partial<Record<keyof typeof en, string>> = {
|
||||
"mysql.applied": "Opciones aplicadas: {count}",
|
||||
"sched.title": "Reinicio programado",
|
||||
"sched.enable": "Reiniciar el mundo cada día",
|
||||
"sched.weeklyEnable": "Reiniciar el mundo cada semana",
|
||||
"sched.day": "Día",
|
||||
"sched.days.monday": "Lunes",
|
||||
"sched.days.tuesday": "Martes",
|
||||
"sched.days.wednesday": "Miércoles",
|
||||
"sched.days.thursday": "Jueves",
|
||||
"sched.days.friday": "Viernes",
|
||||
"sched.days.saturday": "Sábado",
|
||||
"sched.days.sunday": "Domingo",
|
||||
"sched.time": "Hora",
|
||||
"sched.warning": "Aviso (minutos)",
|
||||
"sched.hint": "El mundo se reinicia a esta hora de este ordenador con una cuenta atrás en el chat del juego; la base de datos sigue en marcha y los jugadores vuelven a entrar después. Un servidor en marcha sigue la nueva hora en menos de un minuto.",
|
||||
@@ -931,7 +917,6 @@ const es: Partial<Record<keyof typeof en, string>> = {
|
||||
"dash.openBrowser": "Abrir en el navegador",
|
||||
"dash.update": "Actualizar el panel",
|
||||
"upd.startAfter": "Iniciar el servidor tras actualizarlo (si no, un servidor detenido sigue detenido)",
|
||||
"client.startAfter": "Iniciar el juego tras actualizar el cliente",
|
||||
"bk.folder": "Carpeta de copias de seguridad",
|
||||
"bk.folderDefault": "predeterminada",
|
||||
"bk.folderNote": "Las copias nuevas se guardan aquí, por ejemplo en otra unidad. Las anteriores se quedan donde están y siguen en la lista. La carpeta debe estar fuera de la carpeta del servidor.",
|
||||
@@ -944,8 +929,6 @@ const es: Partial<Record<keyof typeof en, string>> = {
|
||||
"remove.stopFirst": "Detén primero el servidor.",
|
||||
"remove.confirm": "¿Quitar este servidor del Manager?\n\n{path}\n\nNo se borra ningún archivo.",
|
||||
"upd.dbUnchecked": "No se pudo comprobar la base de datos, así que se desconocen los cambios pendientes: {why}",
|
||||
"client.job.checking": "Comprobando el cliente…",
|
||||
"client.job.updating": "Actualizando el cliente",
|
||||
"fr.lan.address": "Dirección de red",
|
||||
"fr.lan.automatic": "Automática",
|
||||
"fr.lan.default": "Predeterminada",
|
||||
@@ -1127,6 +1110,13 @@ const es: Partial<Record<keyof typeof en, string>> = {
|
||||
"serverLogs.errors": "Solo errores",
|
||||
"serverLogs.off": "Desactivados",
|
||||
"serverLogs.saved": "Guardado. Reinicia el servidor para aplicar los cambios.",
|
||||
"serverLogs.autoClean": "Limpiar automáticamente los registros del servidor por tamaño",
|
||||
"serverLogs.maxSize": "Tamaño máx.",
|
||||
"serverLogs.autoCleanHint": "Borra los archivos de registro antiguos cuando Core/Logs supera este tamaño (se comprueba al iniciar el mundo y periódicamente mientras funciona).",
|
||||
"serverLogs.currentSize": "Tamaño actual de los registros: {size}",
|
||||
"serverLogs.cleanNow": "Limpiar registros ({size})",
|
||||
"serverLogs.cleaned": "Se limpiaron {freed} de registros.",
|
||||
"serverLogs.skippedInUse": "{remaining} están en uso por el servidor en marcha y no se pudieron eliminar.",
|
||||
"mod.requiresSquid": "Activa los bots SQUID para usar Dungeon Clear.",
|
||||
};
|
||||
|
||||
|
||||
+35
-45
@@ -46,7 +46,7 @@ const fr: Partial<Record<keyof typeof en, string>> = {
|
||||
"mod.switching": "Application des modifications… Veuillez patienter.",
|
||||
"portable.experimental": "Fonction expérimentale : les personnages portables sont encore en développement actif. Des bugs peuvent survenir.",
|
||||
"remote.clientReady": "Votre client est prêt. Enregistrez l’adresse de l’hôte, puis cliquez sur Jouer.",
|
||||
"remote.clientIntro": "Choisissez un client existant ou téléchargez-le ici. Aucun serveur local n’est nécessaire.",
|
||||
"remote.clientIntro": "Choisissez un client de jeu existant ou obtenez-en un via le lanceur de la communauté. Aucun serveur local n’est nécessaire.",
|
||||
"welcome.host.title": "Héberger un serveur",
|
||||
"welcome.host.text": "Installer un serveur ou gérer un serveur existant.",
|
||||
"welcome.connect.title": "Rejoindre un autre serveur",
|
||||
@@ -117,7 +117,6 @@ const fr: Partial<Record<keyof typeof en, string>> = {
|
||||
"btn.stopSmall": "Arrêter",
|
||||
"btn.restart": "Redémarrer",
|
||||
"btn.startWithoutUpdate": "Démarrer sans mise à jour",
|
||||
"btn.playWithoutUpdate": "Jouer sans mise à jour",
|
||||
"import.squidRepackWarning": "Ce repack SquidBots vérifie le hash du serveur. Le remplacer peut empêcher Start_All_Bots et coa_update de fonctionner. Une confirmation sera demandée.",
|
||||
"btn.play": "JOUER",
|
||||
"btn.startPlay": "DÉMARRER ET JOUER",
|
||||
@@ -260,6 +259,7 @@ const fr: Partial<Record<keyof typeof en, string>> = {
|
||||
"client.updateAddon": "Mettre à jour l’addon des compagnons",
|
||||
"client.addonNote": "Addon des compagnons installé. Les autres addons n’ont pas été touchés.",
|
||||
"client.changeFolder": "Changer de dossier…",
|
||||
"client.getFromSite": "Obtenir le lanceur…",
|
||||
|
||||
// Diagnostics
|
||||
"diag.title": "Diagnostic",
|
||||
@@ -597,6 +597,8 @@ const fr: Partial<Record<keyof typeof en, string>> = {
|
||||
"comp.startCount": "Combien se connectent",
|
||||
"comp.startSave": "Enregistrer",
|
||||
"comp.startSaved": "Enregistré. S’applique au prochain démarrage du serveur.",
|
||||
"comp.startTopUp": "Enregistré. {n} compagnons de plus sont créés pour qu’il y en ait {max} ; les autres existent déjà.",
|
||||
"comp.startTopUpConfirm": "Créer {n} compagnons de plus pour qu’il y en ait {max} ? Ceux qui existent déjà ne sont pas recréés.",
|
||||
"comp.startHint": "Les bots qui ne se connectent pas restent enregistrés et peuvent être mis en ligne plus tard.",
|
||||
"comp.startInvalid": "Saisissez un nombre entier de 0 à 5000.",
|
||||
|
||||
@@ -645,51 +647,26 @@ const fr: Partial<Record<keyof typeof en, string>> = {
|
||||
// Game client download and update
|
||||
"btn.close": "Fermer",
|
||||
"btn.setupClient": "Configurer le client du jeu",
|
||||
"btn.updateClient": "METTRE À JOUR LE CLIENT",
|
||||
"client.setup.title": "Configurer le client du jeu",
|
||||
"client.setup.intro": "Pour jouer, il faut le client du jeu. Utilisez-en un existant ou laissez le Manager le télécharger.",
|
||||
"client.setup.intro": "Pour jouer, il faut le client du jeu. La communauté le distribue via son lanceur officiel.",
|
||||
"client.setup.have": "J’ai déjà un client",
|
||||
"client.setup.download": "Télécharger le client",
|
||||
"client.setup.downloadHint": "Environ 43 Go",
|
||||
"client.dl.pickParent": "Choisissez où placer le client du jeu",
|
||||
"client.dl.confirmText": "Version {v}, {size}. Il sera enregistré dans ce dossier :",
|
||||
"client.dl.free": "Espace libre sur ce disque : {free}.",
|
||||
"client.dl.notEnough": "Espace libre insuffisant : {need} nécessaires, {free} disponibles. Choisissez un autre disque.",
|
||||
"client.dl.otherFolder": "Autre dossier…",
|
||||
"client.dl.start": "Télécharger",
|
||||
"client.setup.getLauncher": "Obtenir le lanceur (coa-development.org)",
|
||||
"client.setup.getLauncherHint": "Ouvre le site de la communauté dans votre navigateur. Téléchargez et installez-y le lanceur, connectez-vous avec votre compte et laissez-le télécharger le jeu (environ 43 Go).",
|
||||
"client.setup.haveHint": "Choisissez le dossier où le lanceur a installé le jeu, ou toute autre copie du client.",
|
||||
"client.setup.hdHint": "Les graphismes standard ou HD se choisissent dans le lanceur : ouvrez ses Paramètres et basculez « HD graphics ». Le Manager ne peut pas le modifier.",
|
||||
"races.patch.active": "Patch client : actif",
|
||||
"races.patch.disabled": "Patch client : désactivé (.disabled)",
|
||||
"races.patch.notInstalled": "Patch client : non installé",
|
||||
"races.patch.partial": "Patch client : {a}/{b} MPQ",
|
||||
"races.patch.partialHint": "Des fichiers manquent ou ont changé. Réparez le patch client.",
|
||||
"races.patch.install": "Installer le patch client",
|
||||
"races.patch.repair": "Réparer le patch client",
|
||||
"races.patch.uninstall": "Désinstaller le patch client",
|
||||
"races.patch.willEnable": "Le patch sera activé après l'installation.",
|
||||
"races.patch.willStayOff": "Le patch restera désactivé après l'installation : le module du serveur est désactivé ou absent.",
|
||||
"client.dl.back": "Retour",
|
||||
"client.dl.retry": "Réessayer",
|
||||
"client.dl.resume": "Continuer",
|
||||
"client.dl.cancel": "Arrêter",
|
||||
"client.dl.cancelled": "Arrêté. Tout ce qui est déjà téléchargé est conservé ; vous pouvez reprendre à tout moment.",
|
||||
"client.dl.scanning": "Comparaison des fichiers…",
|
||||
"client.dl.downloading": "Téléchargement",
|
||||
"client.dl.progress": "{done} sur {total}",
|
||||
"client.dl.speed": "{speed}/s",
|
||||
"client.dl.done": "Le client du jeu est prêt",
|
||||
"client.dl.doneText": "Il est lié à ce serveur. Vous pouvez appuyer sur PLAY.",
|
||||
"client.upd.title": "Mise à jour du client",
|
||||
"client.upd.available": "Un client de jeu plus récent est disponible : {v}.",
|
||||
"client.upd.summary": "{n} fichier(s) à télécharger, {size} au total.",
|
||||
"client.upd.upToDate": "Votre client correspond déjà à la version {v}.",
|
||||
"client.upd.modifiedTitle": "{n} fichier(s) modifié(s) par vous",
|
||||
"client.upd.modifiedText": "Par exemple un exécutable modifié. Conservez-les ou remplacez-les par les versions officielles ; les vôtres sont alors sauvegardées dans le dossier .coa-manager du client. Les wrappers graphiques (d3d9.dll et similaires) et les fichiers de configuration restent toujours tels quels.",
|
||||
"client.upd.keep": "Conserver les fichiers que j’ai modifiés",
|
||||
"client.upd.more": "… et {n} de plus",
|
||||
"client.upd.start": "Mettre à jour le client",
|
||||
"client.upd.later": "Pas maintenant",
|
||||
"client.upd.playAnyway": "Jouer sans mettre à jour",
|
||||
"client.upd.done": "Le client du jeu est à jour",
|
||||
"client.upd.doneText": "Le Manager vous préviendra quand une version plus récente sera publiée.",
|
||||
"client.track.title": "Garder le client à jour",
|
||||
"client.track.text": "Le Manager compare une fois votre client avec l’officiel, puis cherche les nouvelles versions comme pour le serveur. Les fichiers que vous avez modifiés ne sont remplacés que si vous le décidez.",
|
||||
"client.track.start": "Garder à jour",
|
||||
"client.track.startUpdate": "Mettre à jour et garder à jour",
|
||||
"client.track.button": "Garder ce client à jour…",
|
||||
"client.version": "Version du client",
|
||||
"client.versionUntracked": "non suivi par le Manager",
|
||||
"client.versionUnfinished": "téléchargement inachevé",
|
||||
"client.downloadInstead": "Télécharger un client…",
|
||||
|
||||
// Accounts panel, password toggle, install size, addon explanation
|
||||
"pw.show": "Afficher le mot de passe",
|
||||
@@ -780,6 +757,15 @@ const fr: Partial<Record<keyof typeof en, string>> = {
|
||||
"mysql.applied": "Options appliquées : {count}",
|
||||
"sched.title": "Redémarrage planifié",
|
||||
"sched.enable": "Redémarrer le monde chaque jour",
|
||||
"sched.weeklyEnable": "Redémarrer le monde chaque semaine",
|
||||
"sched.day": "Jour",
|
||||
"sched.days.monday": "Lundi",
|
||||
"sched.days.tuesday": "Mardi",
|
||||
"sched.days.wednesday": "Mercredi",
|
||||
"sched.days.thursday": "Jeudi",
|
||||
"sched.days.friday": "Vendredi",
|
||||
"sched.days.saturday": "Samedi",
|
||||
"sched.days.sunday": "Dimanche",
|
||||
"sched.time": "Heure",
|
||||
"sched.warning": "Avertissement (minutes)",
|
||||
"sched.hint": "Le monde redémarre à cette heure de cet ordinateur avec un compte à rebours dans le chat du jeu ; la base de données continue de tourner et les joueurs se reconnectent ensuite. Un serveur en marche suit la nouvelle heure en moins d'une minute.",
|
||||
@@ -931,7 +917,6 @@ const fr: Partial<Record<keyof typeof en, string>> = {
|
||||
"dash.openBrowser": "Ouvrir dans le navigateur",
|
||||
"dash.update": "Mettre à jour le tableau de bord",
|
||||
"upd.startAfter": "Démarrer le serveur après la mise à jour (sinon un serveur arrêté reste arrêté)",
|
||||
"client.startAfter": "Lancer le jeu après la mise à jour du client",
|
||||
"bk.folder": "Dossier des sauvegardes",
|
||||
"bk.folderDefault": "par défaut",
|
||||
"bk.folderNote": "Les nouvelles sauvegardes sont enregistrées ici, par exemple sur un autre disque. Les précédentes restent où elles sont et figurent toujours dans la liste. Le dossier doit se trouver hors du dossier du serveur.",
|
||||
@@ -944,8 +929,6 @@ const fr: Partial<Record<keyof typeof en, string>> = {
|
||||
"remove.stopFirst": "Arrêtez d’abord le serveur.",
|
||||
"remove.confirm": "Retirer ce serveur du Manager ?\n\n{path}\n\nAucun fichier n’est supprimé.",
|
||||
"upd.dbUnchecked": "La base de données n'a pas pu être vérifiée ; les modifications en attente sont donc inconnues : {why}",
|
||||
"client.job.checking": "Vérification du client…",
|
||||
"client.job.updating": "Mise à jour du client",
|
||||
"fr.lan.address": "Adresse réseau",
|
||||
"fr.lan.automatic": "Automatique",
|
||||
"fr.lan.default": "Par défaut",
|
||||
@@ -1127,6 +1110,13 @@ const fr: Partial<Record<keyof typeof en, string>> = {
|
||||
"serverLogs.errors": "Erreurs uniquement",
|
||||
"serverLogs.off": "Désactivés",
|
||||
"serverLogs.saved": "Enregistré. Redémarrez le serveur pour appliquer.",
|
||||
"serverLogs.autoClean": "Nettoyer automatiquement les journaux du serveur selon leur taille",
|
||||
"serverLogs.maxSize": "Taille max.",
|
||||
"serverLogs.autoCleanHint": "Supprime les anciens fichiers journaux quand Core/Logs dépasse cette taille (vérifié au démarrage du monde et périodiquement pendant son fonctionnement).",
|
||||
"serverLogs.currentSize": "Taille actuelle des journaux : {size}",
|
||||
"serverLogs.cleanNow": "Nettoyer les journaux ({size})",
|
||||
"serverLogs.cleaned": "{freed} de journaux nettoyés.",
|
||||
"serverLogs.skippedInUse": "{remaining} sont utilisés par le serveur en cours et n’ont pas pu être supprimés.",
|
||||
"mod.requiresSquid": "Activez les bots SQUID pour utiliser Dungeon Clear.",
|
||||
};
|
||||
|
||||
|
||||
+35
-45
@@ -46,7 +46,7 @@ const ru: Partial<Record<keyof typeof en, string>> = {
|
||||
"mod.switching": "Применяем изменения… Подождите.",
|
||||
"portable.experimental": "Экспериментальная функция: портативные персонажи ещё в активной разработке. Возможны ошибки.",
|
||||
"remote.clientReady": "Клиент готов. Сохраните адрес хоста и нажмите «Играть».",
|
||||
"remote.clientIntro": "Выберите существующий клиент игры или скачайте его здесь. Локальный сервер не требуется.",
|
||||
"remote.clientIntro": "Выберите готовый клиент игры или получите его через лаунчер сообщества. Локальный сервер не нужен.",
|
||||
"welcome.host.title": "Хочу быть хостом",
|
||||
"welcome.host.text": "Установить новый сервер или управлять существующим.",
|
||||
"welcome.connect.title": "Подключиться к другому серверу",
|
||||
@@ -67,6 +67,15 @@ const ru: Partial<Record<keyof typeof en, string>> = {
|
||||
"mysql.applied": "Применяется параметров: {count}",
|
||||
"sched.title": "Перезапуск по расписанию",
|
||||
"sched.enable": "Перезапускать мир каждый день",
|
||||
"sched.weeklyEnable": "Перезапускать мир каждую неделю",
|
||||
"sched.day": "День",
|
||||
"sched.days.monday": "Понедельник",
|
||||
"sched.days.tuesday": "Вторник",
|
||||
"sched.days.wednesday": "Среда",
|
||||
"sched.days.thursday": "Четверг",
|
||||
"sched.days.friday": "Пятница",
|
||||
"sched.days.saturday": "Суббота",
|
||||
"sched.days.sunday": "Воскресенье",
|
||||
"sched.time": "Время",
|
||||
"sched.warning": "Предупреждение (минуты)",
|
||||
"sched.hint": "Мир перезапускается в это время этого компьютера, с обратным отсчётом в игровом чате; база данных продолжает работать, игроки заходят снова после перезапуска. Работающий сервер подхватывает новое время в течение минуты.",
|
||||
@@ -198,7 +207,6 @@ const ru: Partial<Record<keyof typeof en, string>> = {
|
||||
"btn.stopSmall": "Остановить",
|
||||
"btn.restart": "Перезапустить",
|
||||
"btn.startWithoutUpdate": "Запустить без обновления",
|
||||
"btn.playWithoutUpdate": "Играть без обновления",
|
||||
"import.squidRepackWarning": "Этот репак SquidBots проверяет хеш worldserver. Замена файла может нарушить работу Start_All_Bots и coa_update. Перед заменой менеджер запросит ваше решение.",
|
||||
"btn.play": "ИГРАТЬ",
|
||||
"btn.startPlay": "ЗАПУСТИТЬ И ИГРАТЬ",
|
||||
@@ -341,6 +349,7 @@ const ru: Partial<Record<keyof typeof en, string>> = {
|
||||
"client.updateAddon": "Обновить аддон компаньонов",
|
||||
"client.addonNote": "Аддон компаньонов установлен. Другие аддоны не затронуты.",
|
||||
"client.changeFolder": "Сменить папку…",
|
||||
"client.getFromSite": "Скачать лаунчер…",
|
||||
|
||||
// Diagnostics
|
||||
"diag.title": "Диагностика",
|
||||
@@ -679,6 +688,8 @@ const ru: Partial<Record<keyof typeof en, string>> = {
|
||||
"comp.startCount": "Сколько входит",
|
||||
"comp.startSave": "Сохранить",
|
||||
"comp.startSaved": "Сохранено. Вступит в силу при следующем запуске сервера.",
|
||||
"comp.startTopUp": "Сохранено. Создаётся ещё {n} компаньонов, чтобы их стало {max}; остальные уже есть.",
|
||||
"comp.startTopUpConfirm": "Создать ещё {n} компаньонов, чтобы их стало {max}? Уже существующие заново не создаются.",
|
||||
"comp.startHint": "Боты, которые не входят, остаются сохранёнными, их можно вывести в сеть позже.",
|
||||
"comp.startInvalid": "Введите целое число от 0 до 5000.",
|
||||
|
||||
@@ -727,51 +738,26 @@ const ru: Partial<Record<keyof typeof en, string>> = {
|
||||
// Game client download and update
|
||||
"btn.close": "Закрыть",
|
||||
"btn.setupClient": "Настроить клиент игры",
|
||||
"btn.updateClient": "ОБНОВИТЬ КЛИЕНТ",
|
||||
"client.setup.title": "Настройка клиента игры",
|
||||
"client.setup.intro": "Чтобы играть, нужен клиент игры. Выберите уже имеющийся или позвольте менеджеру скачать его.",
|
||||
"client.setup.intro": "Чтобы играть, нужен клиент игры. Сообщество выдаёт его через свой официальный лаунчер.",
|
||||
"client.setup.have": "У меня уже есть клиент",
|
||||
"client.setup.download": "Скачать клиент",
|
||||
"client.setup.downloadHint": "Примерно 43 ГБ",
|
||||
"client.dl.pickParent": "Выберите, куда поместить клиент игры",
|
||||
"client.dl.confirmText": "Версия {v}, {size}. Клиент будет сохранён в эту папку:",
|
||||
"client.dl.free": "Свободно на этом диске: {free}.",
|
||||
"client.dl.notEnough": "Недостаточно места: нужно {need}, доступно {free}. Выберите другой диск.",
|
||||
"client.dl.otherFolder": "Другая папка…",
|
||||
"client.dl.start": "Скачать",
|
||||
"client.setup.getLauncher": "Скачать лаунчер (coa-development.org)",
|
||||
"client.setup.getLauncherHint": "Откроет сайт сообщества в браузере. Скачайте и установите лаунчер, войдите в свой аккаунт и дайте ему скачать игру (около 43 ГБ).",
|
||||
"client.setup.haveHint": "Укажите папку, куда лаунчер установил игру, или любую другую копию клиента.",
|
||||
"client.setup.hdHint": "Стандартная или HD-графика выбирается в лаунчере: откройте его «Настройки» и переключите «HD graphics». Менеджер этого изменить не может.",
|
||||
"races.patch.active": "Патч клиента: Включен",
|
||||
"races.patch.disabled": "Патч клиента: Отключен (.disabled)",
|
||||
"races.patch.notInstalled": "Патч клиента: Не установлен",
|
||||
"races.patch.partial": "Патч клиента: {a}/{b} MPQ",
|
||||
"races.patch.partialHint": "Файлы отсутствуют или изменены. Восстановите патч клиента.",
|
||||
"races.patch.install": "Установить патч клиента",
|
||||
"races.patch.repair": "Восстановить патч клиента",
|
||||
"races.patch.uninstall": "Удалить патч клиента",
|
||||
"races.patch.willEnable": "После установки патч будет включён.",
|
||||
"races.patch.willStayOff": "После установки патч останется отключённым: модуль сервера выключен или отсутствует.",
|
||||
"client.dl.back": "Назад",
|
||||
"client.dl.retry": "Повторить",
|
||||
"client.dl.resume": "Продолжить",
|
||||
"client.dl.cancel": "Остановить",
|
||||
"client.dl.cancelled": "Остановлено. Всё уже скачанное сохранено, можно продолжить в любой момент.",
|
||||
"client.dl.scanning": "Сравниваю файлы…",
|
||||
"client.dl.downloading": "Загрузка",
|
||||
"client.dl.progress": "{done} из {total}",
|
||||
"client.dl.speed": "{speed}/с",
|
||||
"client.dl.done": "Клиент игры готов",
|
||||
"client.dl.doneText": "Он привязан к этому серверу. Можно нажимать PLAY.",
|
||||
"client.upd.title": "Обновление клиента",
|
||||
"client.upd.available": "Доступна новая версия клиента игры: {v}.",
|
||||
"client.upd.summary": "Файлов к загрузке: {n}, всего {size}.",
|
||||
"client.upd.upToDate": "Ваш клиент уже соответствует версии {v}.",
|
||||
"client.upd.modifiedTitle": "Файлов, изменённых вами: {n}",
|
||||
"client.upd.modifiedText": "Например, изменённый exe. Оставьте их или замените официальными версиями; ваши тогда сохранятся в папке .coa-manager внутри клиента. Графические обёртки (d3d9.dll и подобные) и конфиги всегда остаются как есть.",
|
||||
"client.upd.keep": "Оставить файлы, которые я менял",
|
||||
"client.upd.more": "… и ещё {n}",
|
||||
"client.upd.start": "Обновить клиент",
|
||||
"client.upd.later": "Не сейчас",
|
||||
"client.upd.playAnyway": "Играть без обновления",
|
||||
"client.upd.done": "Клиент игры обновлён",
|
||||
"client.upd.doneText": "Менеджер сообщит, когда выйдет новая версия.",
|
||||
"client.track.title": "Обновление клиента через менеджер",
|
||||
"client.track.text": "Менеджер один раз сравнит ваш клиент с официальным, а потом будет проверять новые версии, как для сервера. Файлы, которые вы меняли, не заменяются без вашего согласия.",
|
||||
"client.track.start": "Следить за обновлениями",
|
||||
"client.track.startUpdate": "Обновить и следить за обновлениями",
|
||||
"client.track.button": "Обновлять этот клиент через менеджер…",
|
||||
"client.version": "Версия клиента",
|
||||
"client.versionUntracked": "менеджер не отслеживает",
|
||||
"client.versionUnfinished": "загрузка не завершена",
|
||||
"client.downloadInstead": "Скачать клиент…",
|
||||
|
||||
// Accounts panel, password toggle, install size, addon explanation
|
||||
"pw.show": "Показать пароль",
|
||||
@@ -960,7 +946,6 @@ const ru: Partial<Record<keyof typeof en, string>> = {
|
||||
"dash.openBrowser": "Открыть в браузере",
|
||||
"dash.update": "Обновить панель",
|
||||
"upd.startAfter": "Запускать сервер после обновления (иначе выключенный сервер останется выключенным)",
|
||||
"client.startAfter": "Запускать игру после обновления клиента",
|
||||
"bk.folder": "Папка резервных копий",
|
||||
"bk.folderDefault": "по умолчанию",
|
||||
"bk.folderNote": "Новые копии сохраняются сюда, например на другой диск. Прежние копии остаются на месте и по-прежнему в списке. Папка должна быть вне папки сервера.",
|
||||
@@ -973,8 +958,6 @@ const ru: Partial<Record<keyof typeof en, string>> = {
|
||||
"remove.stopFirst": "Сначала остановите сервер.",
|
||||
"remove.confirm": "Убрать этот сервер из Manager?\n\n{path}\n\nФайлы не удаляются.",
|
||||
"upd.dbUnchecked": "Не удалось проверить базу данных, поэтому неизвестно, нужны ли ей изменения: {why}",
|
||||
"client.job.checking": "Проверка клиента…",
|
||||
"client.job.updating": "Обновление клиента",
|
||||
"nav.characters": "Персонажи",
|
||||
"q.characters": "Какие мои персонажи где могут играть?",
|
||||
"portable.title": "Персонажи",
|
||||
@@ -1320,6 +1303,13 @@ const ru: Partial<Record<keyof typeof en, string>> = {
|
||||
"serverLogs.errors": "Только ошибки",
|
||||
"serverLogs.off": "Выключены",
|
||||
"serverLogs.saved": "Сохранено. Перезапустите сервер для применения.",
|
||||
"serverLogs.autoClean": "Автоочистка логов сервера по размеру",
|
||||
"serverLogs.maxSize": "Макс. размер",
|
||||
"serverLogs.autoCleanHint": "Очищает старые файлы логов при превышении порога в Core/Logs (проверяется при запуске мира и периодически во время работы).",
|
||||
"serverLogs.currentSize": "Текущий размер логов: {size}",
|
||||
"serverLogs.cleanNow": "Очистить логи ({size})",
|
||||
"serverLogs.cleaned": "Очищено логов: {freed}.",
|
||||
"serverLogs.skippedInUse": "{remaining} заняты работающим сервером и не были удалены.",
|
||||
"mod.requiresSquid": "Для Dungeon Clear сначала включите SQUID bots.",
|
||||
};
|
||||
|
||||
|
||||
+35
-45
@@ -44,7 +44,7 @@ const zh = {
|
||||
"mod.switching": "正在应用更改…请稍候。",
|
||||
"portable.experimental": "实验性功能:便携角色仍在积极开发中,可能存在错误。",
|
||||
"remote.clientReady": "客户端已就绪。保存服主地址,然后点击开始游戏。",
|
||||
"remote.clientIntro": "选择已有游戏客户端,或在此下载。无需安装本地服务器。",
|
||||
"remote.clientIntro": "选择已有的游戏客户端,或通过社区的启动器获取。无需本地服务器。",
|
||||
"welcome.host.title": "我要搭建服务器",
|
||||
"welcome.host.text": "安装新服务器或管理已有服务器。",
|
||||
"welcome.connect.title": "连接其他服务器",
|
||||
@@ -65,6 +65,15 @@ const zh = {
|
||||
"mysql.applied": "生效的选项:{count}",
|
||||
"sched.title": "定时重启",
|
||||
"sched.enable": "每天重启世界",
|
||||
"sched.weeklyEnable": "每周重启世界",
|
||||
"sched.day": "星期",
|
||||
"sched.days.monday": "星期一",
|
||||
"sched.days.tuesday": "星期二",
|
||||
"sched.days.wednesday": "星期三",
|
||||
"sched.days.thursday": "星期四",
|
||||
"sched.days.friday": "星期五",
|
||||
"sched.days.saturday": "星期六",
|
||||
"sched.days.sunday": "星期日",
|
||||
"sched.time": "时间",
|
||||
"sched.warning": "提前警告(分钟)",
|
||||
"sched.hint": "世界会在本机的这个时间重启,并在游戏聊天中倒计时;数据库保持运行,玩家在重启后重新登录。正在运行的服务器会在一分钟内采用新时间。",
|
||||
@@ -170,7 +179,6 @@ const zh = {
|
||||
"btn.stopSmall": "停止",
|
||||
"btn.restart": "重启",
|
||||
"btn.startWithoutUpdate": "不更新启动服务器",
|
||||
"btn.playWithoutUpdate": "不更新开始游戏",
|
||||
"import.squidRepackWarning": "此 SquidBots 整合包会检查 worldserver 哈希。替换程序可能导致 Start_All_Bots 和 coa_update 无法运行。更新前会要求您选择。",
|
||||
"btn.play": "开始游戏",
|
||||
"btn.startPlay": "启动并开始游戏",
|
||||
@@ -313,6 +321,7 @@ const zh = {
|
||||
"client.updateAddon": "更新随从插件",
|
||||
"client.addonNote": "随从插件已安装。其他插件未受任何影响。",
|
||||
"client.changeFolder": "更换文件夹…",
|
||||
"client.getFromSite": "获取启动器…",
|
||||
|
||||
// Diagnostics
|
||||
"diag.title": "诊断",
|
||||
@@ -650,6 +659,8 @@ const zh = {
|
||||
"comp.startCount": "自动登录随从数量",
|
||||
"comp.startSave": "保存",
|
||||
"comp.startSaved": "已保存。将在下次服务器启动时生效。",
|
||||
"comp.startTopUp": "已保存。正在再创建 {n} 个同伴,使总数达到 {max};其余已存在。",
|
||||
"comp.startTopUpConfirm": "再创建 {n} 个同伴,使总数达到 {max}?已存在的不会重复创建。",
|
||||
"comp.startHint": "未登录的随从仍保留在数据库中,随时可在需要时手动调出上线。",
|
||||
"comp.startInvalid": "请输入 0 到 5000 之间的整数。",
|
||||
|
||||
@@ -698,51 +709,26 @@ const zh = {
|
||||
// Game client download and update
|
||||
"btn.close": "关闭",
|
||||
"btn.setupClient": "配置游戏客户端",
|
||||
"btn.updateClient": "更新客户端",
|
||||
"client.setup.title": "配置游戏客户端",
|
||||
"client.setup.intro": "进行游戏需要安装匹配的客户端。你可以关联已有的游戏客户端,也可以让管理器为你自动下载。",
|
||||
"client.setup.intro": "进行游戏需要安装客户端。社区通过其官方启动器提供客户端。",
|
||||
"client.setup.have": "已有游戏客户端",
|
||||
"client.setup.download": "下载全新客户端",
|
||||
"client.setup.downloadHint": "约 43 GB",
|
||||
"client.dl.pickParent": "选择游戏客户端存放位置",
|
||||
"client.dl.confirmText": "版本 {v},体积 {size}。将被保存在以下文件夹中:",
|
||||
"client.dl.free": "该驱动器剩余空间:{free}。",
|
||||
"client.dl.notEnough": "磁盘剩余空间不足:需要 {need},可用 {free}。请选择其他驱动器。",
|
||||
"client.dl.otherFolder": "选择其他文件夹…",
|
||||
"client.dl.start": "开始下载",
|
||||
"client.setup.getLauncher": "获取启动器(coa-development.org)",
|
||||
"client.setup.getLauncherHint": "在浏览器中打开社区网站。在那里下载并安装启动器,用你的账号登录,让它下载游戏(约 43 GB)。",
|
||||
"client.setup.haveHint": "选择启动器安装游戏的文件夹,或任何其他客户端副本。",
|
||||
"client.setup.hdHint": "标准或高清画质在启动器中选择:打开启动器的“设置”,切换“HD graphics”。Manager 无法更改。",
|
||||
"races.patch.active": "客户端补丁:已启用",
|
||||
"races.patch.disabled": "客户端补丁:已停用 (.disabled)",
|
||||
"races.patch.notInstalled": "客户端补丁:未安装",
|
||||
"races.patch.partial": "客户端补丁:{a}/{b} MPQ",
|
||||
"races.patch.partialHint": "文件缺失或已被修改。请修复客户端补丁。",
|
||||
"races.patch.install": "安装客户端补丁",
|
||||
"races.patch.repair": "修复客户端补丁",
|
||||
"races.patch.uninstall": "卸载客户端补丁",
|
||||
"races.patch.willEnable": "安装后补丁将被启用。",
|
||||
"races.patch.willStayOff": "安装后补丁仍将保持停用:服务器模块已关闭或不存在。",
|
||||
"client.dl.back": "返回",
|
||||
"client.dl.retry": "重试",
|
||||
"client.dl.resume": "继续下载",
|
||||
"client.dl.cancel": "停止",
|
||||
"client.dl.cancelled": "下载已暂停。已下载的文件将被保留;随时可继续断点续传。",
|
||||
"client.dl.scanning": "正在比对文件…",
|
||||
"client.dl.downloading": "正在下载",
|
||||
"client.dl.progress": "{done} / {total}",
|
||||
"client.dl.speed": "{speed}/秒",
|
||||
"client.dl.done": "游戏客户端已就绪",
|
||||
"client.dl.doneText": "已成功关联至此服务器。你可以点击“开始游戏”了。",
|
||||
"client.upd.title": "客户端更新",
|
||||
"client.upd.available": "检测到更新的游戏客户端版本:{v}。",
|
||||
"client.upd.summary": "需下载 {n} 个文件,共计 {size}。",
|
||||
"client.upd.upToDate": "你的客户端已与版本 {v} 完全一致。",
|
||||
"client.upd.modifiedTitle": "检测到 {n} 个文件曾被你修改",
|
||||
"client.upd.modifiedText": "例如打过补丁的可执行程序。你可以选择保留它们,或替换为官方版本;被替换的文件将保存在客户端的 .coa-manager 文件夹中以作备份。图形渲染增强补丁(如 d3d9.dll 等)及配置文件始终会保留原样。",
|
||||
"client.upd.keep": "保留我修改过的文件",
|
||||
"client.upd.more": "… 以及另外 {n} 个",
|
||||
"client.upd.start": "更新客户端",
|
||||
"client.upd.later": "暂不更新",
|
||||
"client.upd.playAnyway": "跳过更新直接进入游戏",
|
||||
"client.upd.done": "游戏客户端已是最新版本",
|
||||
"client.upd.doneText": "当发布更高版本时,管理器会及时提醒你。",
|
||||
"client.track.title": "保持客户端为最新版本",
|
||||
"client.track.text": "管理器会先比对你的客户端与官方版本,并在后续像检查服务器更新一样检测新版本。除非你明确选择,否则你修改过的文件绝不会被自动替换。",
|
||||
"client.track.start": "保持更新",
|
||||
"client.track.startUpdate": "更新并保持同步",
|
||||
"client.track.button": "为该客户端开启自动检查更新…",
|
||||
"client.version": "客户端版本",
|
||||
"client.versionUntracked": "未由管理器追踪",
|
||||
"client.versionUnfinished": "下载尚未完成",
|
||||
"client.downloadInstead": "下载全新客户端…",
|
||||
|
||||
// Accounts panel, password toggle, install size, addon explanation
|
||||
"pw.show": "显示密码",
|
||||
@@ -931,7 +917,6 @@ const zh = {
|
||||
"dash.openBrowser": "在浏览器中打开",
|
||||
"dash.update": "更新仪表盘",
|
||||
"upd.startAfter": "更新后启动服务器(否则已停止的服务器保持停止)",
|
||||
"client.startAfter": "更新客户端后启动游戏",
|
||||
"bk.folder": "备份文件夹",
|
||||
"bk.folderDefault": "默认",
|
||||
"bk.folderNote": "新备份将保存在这里,例如另一个驱动器上。之前的备份保留在原处,仍会列出。该文件夹必须位于服务器文件夹之外。",
|
||||
@@ -944,8 +929,6 @@ const zh = {
|
||||
"remove.stopFirst": "请先停止服务器。",
|
||||
"remove.confirm": "要从 Manager 中移除此服务器吗?\n\n{path}\n\n不会删除任何文件。",
|
||||
"upd.dbUnchecked": "无法检查数据库,因此不清楚是否有待应用的数据库更改:{why}",
|
||||
"client.job.checking": "正在检查游戏客户端…",
|
||||
"client.job.updating": "正在更新游戏客户端",
|
||||
"err.docker_unavailable.title": "Docker 不可用",
|
||||
"err.docker_unavailable.message": "此服务器通过 Docker 运行。请安装并启动 Docker,确保当前用户有权使用它,然后重试。",
|
||||
"fr.lan.address": "网络地址",
|
||||
@@ -1129,6 +1112,13 @@ const zh = {
|
||||
"serverLogs.errors": "仅错误",
|
||||
"serverLogs.off": "关闭",
|
||||
"serverLogs.saved": "已保存。重启服务器后生效。",
|
||||
"serverLogs.autoClean": "按大小自动清理服务器日志",
|
||||
"serverLogs.maxSize": "最大大小",
|
||||
"serverLogs.autoCleanHint": "当 Core/Logs 超过此大小时清理旧日志文件(在世界启动时和运行期间定期检查)。",
|
||||
"serverLogs.currentSize": "当前日志大小:{size}",
|
||||
"serverLogs.cleanNow": "清理日志({size})",
|
||||
"serverLogs.cleaned": "已清理 {freed} 日志。",
|
||||
"serverLogs.skippedInUse": "{remaining} 正被运行中的服务器占用,无法删除。",
|
||||
"mod.requiresSquid": "请先启用 SQUID 机器人,再使用 Dungeon Clear。",
|
||||
} as const;
|
||||
|
||||
|
||||
+19
-35
@@ -60,8 +60,20 @@ export interface StatusView {
|
||||
export type RealmMode = "coa" | "wildcard" | "reborn";
|
||||
export interface CustomRaceCharacters { players: number; companionBots: number; squidBots: number }
|
||||
export interface AddonView { id: string; name: string; description: Record<string, string>; author: string; license: string; needs: string | null; repo: string; size: number; installed: boolean; updateAvailable: boolean; foreignFolders: string[]; bundled?: string | null }
|
||||
export interface RestartSchedule { enabled: boolean; time: string; warningMinutes: number }
|
||||
export type Weekday = "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday";
|
||||
export interface RestartSchedule {
|
||||
enabled: boolean;
|
||||
time: string;
|
||||
warningMinutes: number;
|
||||
weeklyEnabled: boolean;
|
||||
weeklyDay: Weekday;
|
||||
weeklyTime: string;
|
||||
weeklyWarningMinutes: number;
|
||||
}
|
||||
export interface RestartScheduleView { schedule: RestartSchedule; supported: boolean }
|
||||
export interface LogSettings { autoCleanup: boolean; maxSizeMb: number }
|
||||
export interface CleanLogsReport { freedBytes: number; remainingBytes: number; deletedFiles: number; skippedFiles: number }
|
||||
export interface ServerLoggingView { preset: "normal" | "errors" | "off" | null; logBytes: number; settings: LogSettings }
|
||||
export interface CustomMysql { text: string; applied: string }
|
||||
export interface RealmName { id: number; name: string; defaultName: string; custom: boolean }
|
||||
export interface RealmProfiles { active: RealmMode; wildcard_created: boolean; reborn_created: boolean; reborn_supported: boolean; supported: boolean; recovery_pending: boolean; simultaneous: boolean; secondary_world_port: number | null; secondary_running: boolean; with_reborn: boolean; reborn_world_port: number | null; reborn_running: boolean }
|
||||
@@ -380,36 +392,8 @@ export interface ClientInfo {
|
||||
}
|
||||
|
||||
export interface ClientStatus {
|
||||
/** A usable client folder is linked. */
|
||||
linked: boolean;
|
||||
managed: boolean;
|
||||
installed_version: string | null;
|
||||
latest_version: string | null;
|
||||
latest_bytes: number | null;
|
||||
update_available: boolean;
|
||||
}
|
||||
|
||||
export interface ClientPlan {
|
||||
version: string;
|
||||
items: { path: string; size: number; kind: "missing" | "changed" | "modified" }[];
|
||||
download_bytes: number;
|
||||
total_files: number;
|
||||
up_to_date_files: number;
|
||||
kept_files: number;
|
||||
}
|
||||
|
||||
export interface ClientStep {
|
||||
phase: "scan" | "download" | "finish";
|
||||
done: number;
|
||||
total: number;
|
||||
bytes_per_sec: number;
|
||||
file: string | null;
|
||||
}
|
||||
|
||||
export interface ClientDownloadCheck {
|
||||
needed_bytes: number;
|
||||
free_bytes: number;
|
||||
version: string;
|
||||
dest: string;
|
||||
}
|
||||
|
||||
export type ClientPatchState = "not-installed" | "enabled" | "disabled" | "partially-installed";
|
||||
@@ -530,7 +514,10 @@ export const api = {
|
||||
forceStop: (id: string) => invoke<DriverOutcome>("force_stop_server", { id }),
|
||||
stop: (id: string) => invoke<DriverOutcome>("stop_server", { id }),
|
||||
settings: (id: string, scope: Scope) => invoke<SettingsView>("get_settings", { id, scope }),
|
||||
serverLoggingState: (id: string) => invoke<ServerLoggingView>("server_logging_state", { id }),
|
||||
serverLoggingPreset: (id: string, preset: "normal" | "errors" | "off") => invoke<void>("server_logging_preset", { id, preset }),
|
||||
serverLoggingSettingsSave: (id: string, settings: LogSettings) => invoke<ServerLoggingView>("server_logging_settings_save", { id, settings }),
|
||||
serverLogsClean: (id: string) => invoke<CleanLogsReport>("server_logs_clean", { id }),
|
||||
save: (id: string, scope: Scope, changes: Record<string, JsonValue>) => invoke<SaveReport>("save_settings", { id, scope, changes }),
|
||||
presets: (scope: Scope) => invoke<PresetInfo[]>("list_presets", { scope }),
|
||||
backups: (id: string) => invoke<RecoveryPoint[]>("list_backups", { id }),
|
||||
@@ -584,6 +571,8 @@ export const api = {
|
||||
invoke<{ txn: UpdateTxn; preexisting_character_count?: number }>("apply_update", { id, source: source ?? null, resolutions }),
|
||||
rollbackUpdate: (id: string, txn: string) => invoke<UpdateTxn>("rollback_update", { id, txn }),
|
||||
retryUpdateValidation: (id: string, txn: string) => invoke<UpdateTxn>("retry_update_validation", { id, txn }),
|
||||
/** Creates the companions the startup fleet is missing (the limit is a fleet size). Returns how many were queued. */
|
||||
topUpStartupFleet: (id: string, realm?: RealmMode) => invoke<number>("top_up_startup_fleet", { id, realm: realm ?? null }),
|
||||
population: (id: string, realm?: RealmMode) => invoke<Population | null>("get_population", { id, realm: realm ?? null }),
|
||||
stopSpawning: (id: string, realm?: RealmMode) => invoke<{ count: number }>("companions_stop_spawning", { id, realm: realm ?? null }),
|
||||
takeOffline: (id: string, realm?: RealmMode) => invoke<{ count: number }>("companions_take_offline", { id, realm: realm ?? null }),
|
||||
@@ -620,11 +609,6 @@ export const api = {
|
||||
setRealmlist: (id: string, host: string) => invoke<string[]>("client_realmlist", { id, host }),
|
||||
installAddon: (id: string) => invoke<void>("client_install_addon", { id }),
|
||||
clientStatus: (id: string) => invoke<ClientStatus>("client_status", { id }),
|
||||
clientDownloadCheck: (parent: string) => invoke<ClientDownloadCheck>("client_download_check", { parent }),
|
||||
clientPlan: (id: string) => invoke<ClientPlan>("client_plan", { id }),
|
||||
clientSync: (id: string, keepModified: boolean) => invoke<void>("client_sync", { id, keepModified }),
|
||||
clientDownload: (id: string, parent: string) => invoke<ClientInfo>("client_download", { id, parent }),
|
||||
clientCancel: () => invoke<void>("client_cancel"),
|
||||
customRacesStatus: (id: string) => invoke<CustomRacesClientStatus | null>("custom_races_status", { id }),
|
||||
raceAvailability: (id: string) => invoke<RaceAvailability>("race_availability", { id }),
|
||||
raceAvailabilitySave: (id: string, catalogSha256: string, realm: RealmMode, disabledRaceIds: number[]) =>
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
import { startAfterUpdate } from "./updatePrefs";
|
||||
import { useSyncExternalStore } from "react";
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
import { api, asUiError, type ClientPlan, type ClientStep, type UiError } from "@/lib/api";
|
||||
import { checkClient } from "@/lib/clientUpdate";
|
||||
|
||||
/**
|
||||
* Updating the game client from the main screen, without a window over everything: the "Update client" button turns into
|
||||
* a progress bar (as in a game launcher). Only a choice that needs the owner's word (files they changed) is shown, in
|
||||
* place, below the buttons. The first-time linking of a client keeps its dialog (ClientDialog).
|
||||
*/
|
||||
export type ClientJobPhase = "idle" | "scanning" | "choose" | "working" | "done" | "current" | "stopped" | "failed";
|
||||
|
||||
export interface ClientJob {
|
||||
phase: ClientJobPhase;
|
||||
step: ClientStep | null;
|
||||
plan: ClientPlan | null;
|
||||
error: UiError | null;
|
||||
}
|
||||
|
||||
const IDLE: ClientJob = { phase: "idle", step: null, plan: null, error: null };
|
||||
const jobs = new Map<string, ClientJob>();
|
||||
const listeners = new Set<() => void>();
|
||||
const cancelled = new Set<string>();
|
||||
|
||||
const get = (id: string) => jobs.get(id) ?? IDLE;
|
||||
function set(id: string, next: Partial<ClientJob>) {
|
||||
jobs.set(id, { ...get(id), ...next });
|
||||
listeners.forEach((l) => l());
|
||||
}
|
||||
|
||||
let unlisten: (() => void) | null = null;
|
||||
async function followProgress(id: string) {
|
||||
if (unlisten) return;
|
||||
try {
|
||||
unlisten = await listen<ClientStep>("client-progress", (e) => {
|
||||
const phase = get(id).phase;
|
||||
if (phase === "scanning" || phase === "working") set(id, { step: e.payload });
|
||||
});
|
||||
} catch {
|
||||
/* no event bridge (a plain browser): the bar just stays at zero */
|
||||
}
|
||||
}
|
||||
|
||||
function fail(id: string, e: unknown) {
|
||||
if (cancelled.has(id)) set(id, { phase: "stopped", step: null });
|
||||
else set(id, { phase: "failed", step: null, error: asUiError(e) });
|
||||
}
|
||||
|
||||
async function refresh(id: string) {
|
||||
await checkClient(id);
|
||||
}
|
||||
|
||||
/** Look at what differs from the published client; update at once when nothing needs a decision. */
|
||||
export async function startClientUpdate(id: string): Promise<void> {
|
||||
const now = get(id).phase;
|
||||
if (now === "scanning" || now === "working") return;
|
||||
cancelled.delete(id);
|
||||
set(id, { phase: "scanning", step: null, plan: null, error: null });
|
||||
void followProgress(id);
|
||||
try {
|
||||
const plan = await api.clientPlan(id);
|
||||
if (plan.items.length === 0) {
|
||||
set(id, { phase: "current", plan, step: null });
|
||||
void refresh(id);
|
||||
setTimeout(() => {
|
||||
if (get(id).phase === "current") set(id, { phase: "idle" });
|
||||
}, 5000);
|
||||
return;
|
||||
}
|
||||
if (plan.items.some((i) => i.kind === "modified")) {
|
||||
set(id, { phase: "choose", plan, step: null });
|
||||
return;
|
||||
}
|
||||
await syncClient(id, true);
|
||||
} catch (e) {
|
||||
fail(id, e);
|
||||
}
|
||||
}
|
||||
|
||||
/** Download what is missing or changed; `keepModified` keeps the files the owner changed. */
|
||||
export async function syncClient(id: string, keepModified: boolean): Promise<void> {
|
||||
cancelled.delete(id);
|
||||
set(id, { phase: "working", step: null, error: null });
|
||||
void followProgress(id);
|
||||
try {
|
||||
await api.clientSync(id, keepModified);
|
||||
set(id, { phase: "done", step: null });
|
||||
if (startAfterUpdate("client", id)) void api.play(id).catch(() => undefined);
|
||||
void refresh(id);
|
||||
setTimeout(() => {
|
||||
if (get(id).phase === "done") set(id, { phase: "idle" });
|
||||
}, 6000);
|
||||
} catch (e) {
|
||||
fail(id, e);
|
||||
}
|
||||
}
|
||||
|
||||
export function stopClientJob(id: string) {
|
||||
cancelled.add(id);
|
||||
void api.clientCancel().catch(() => undefined);
|
||||
}
|
||||
|
||||
export function dismissClientJob(id: string) {
|
||||
set(id, { phase: "idle", error: null, plan: null, step: null });
|
||||
}
|
||||
|
||||
export function useClientJob(id: string): ClientJob {
|
||||
return useSyncExternalStore(
|
||||
(l) => {
|
||||
listeners.add(l);
|
||||
return () => listeners.delete(l);
|
||||
},
|
||||
() => get(id),
|
||||
);
|
||||
}
|
||||
+3
-11
@@ -2,8 +2,8 @@ import { useSyncExternalStore } from "react";
|
||||
import { api, type ClientStatus } from "@/lib/api";
|
||||
|
||||
/**
|
||||
* Game client status for the main screen: which client is linked and, for a client the Manager keeps up to date,
|
||||
* whether a newer one has been published. Checked at start and every five minutes (one small request; no game file is read).
|
||||
* Whether a game client is linked, for the main screen. The Manager does not download or update the client (the
|
||||
* community's official launcher does), so this is a local check only.
|
||||
*/
|
||||
interface State {
|
||||
status: ClientStatus | null;
|
||||
@@ -13,7 +13,6 @@ interface State {
|
||||
const EMPTY: State = { status: null, checking: false };
|
||||
const states = new Map<string, State>();
|
||||
const listeners = new Set<() => void>();
|
||||
const CHECK_EVERY_MS = 5 * 60 * 1000;
|
||||
|
||||
const get = (id: string) => states.get(id) ?? EMPTY;
|
||||
function set(id: string, next: Partial<State>) {
|
||||
@@ -27,19 +26,12 @@ export async function checkClient(id: string): Promise<void> {
|
||||
try {
|
||||
set(id, { status: await api.clientStatus(id) });
|
||||
} catch {
|
||||
// offline: keep what we knew
|
||||
// keep what we knew
|
||||
} finally {
|
||||
set(id, { checking: false });
|
||||
}
|
||||
}
|
||||
|
||||
/** Check now and then every five minutes. Returns the function that stops it. */
|
||||
export function startClientPolling(id: string): () => void {
|
||||
void checkClient(id);
|
||||
const t = setInterval(() => void checkClient(id), CHECK_EVERY_MS);
|
||||
return () => clearInterval(t);
|
||||
}
|
||||
|
||||
export function useClientStatus(id: string): State {
|
||||
return useSyncExternalStore(
|
||||
(l) => {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { useState } from "react";
|
||||
|
||||
/**
|
||||
* Whether a finished update starts things. Off by default for both: updating a stopped server leaves it stopped (a
|
||||
* server that was running is started again, as the update had to stop it) and a client update does not open the game.
|
||||
* Whether a finished server update starts the server. Off by default: updating a stopped server leaves it stopped (a
|
||||
* server that was running is started again, as the update had to stop it).
|
||||
*/
|
||||
export type AfterUpdate = "server" | "client";
|
||||
export type AfterUpdate = "server";
|
||||
|
||||
const key = (kind: AfterUpdate, id: string) => `coa-start-after-${kind}-update:${id}`;
|
||||
const fallback = (_kind: AfterUpdate) => false;
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
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 { api, asUiError, type ClientInfo, type UiError } from "@/lib/api";
|
||||
import { checkClient } from "@/lib/clientUpdate";
|
||||
import { ClientGraphics } from "./ClientGraphics";
|
||||
import { AddonCatalog } from "./AddonCatalog";
|
||||
import { ClientDialog, type ClientDialogMode } from "@/screens/ClientDialog";
|
||||
import { CLIENT_SITE, ClientDialog } from "@/screens/ClientDialog";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card } from "@/components/ui/card";
|
||||
import { useHuman, useT } from "@/i18n";
|
||||
import { useStartAfterUpdate } from "@/lib/updatePrefs";
|
||||
|
||||
export function ClientCard({ serverId, remote = false }: { serverId: string; remote?: boolean }) {
|
||||
const t = useT();
|
||||
@@ -18,13 +17,10 @@ export function ClientCard({ serverId, remote = false }: { serverId: string; rem
|
||||
const [error, setError] = useState<UiError | null>(null);
|
||||
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);
|
||||
const [dialog, setDialog] = useState(false);
|
||||
|
||||
const refresh = () => {
|
||||
void api.clientStatus(serverId).then(setStatus).catch(() => setStatus(null));
|
||||
return api.clientInfo(serverId).then(setInfo).catch((e) => setError(asUiError(e)));
|
||||
};
|
||||
useEffect(() => {
|
||||
@@ -67,7 +63,7 @@ export function ClientCard({ serverId, remote = false }: { serverId: string; rem
|
||||
{info === null && (
|
||||
<>
|
||||
<p className="mt-1 text-sm text-muted">{t(remote ? "remote.clientIntro" : "client.intro")}</p>
|
||||
<Button className="mt-4" onClick={() => setDialog("setup")} disabled={busy}>{t("btn.setupClient")}</Button>
|
||||
<Button className="mt-4" onClick={() => setDialog(true)} disabled={busy}>{t("btn.setupClient")}</Button>
|
||||
</>
|
||||
)}
|
||||
{info && (
|
||||
@@ -79,24 +75,11 @@ export function ClientCard({ serverId, remote = false }: { serverId: string; rem
|
||||
{hosts.length ? hosts.filter(Boolean).join(", ") : "—"}
|
||||
{!remote && (pointsLocal ? <span className="ml-2 text-ok">{t("client.thisComputer")}</span> : <span className="ml-2 text-warn">{t("client.notThisServer")}</span>)}
|
||||
</dd>
|
||||
<dt className="text-muted">{t("client.version")}</dt>
|
||||
<dd>
|
||||
{status?.managed
|
||||
? status.installed_version ?? t("client.versionUnfinished")
|
||||
: t("client.versionUntracked")}
|
||||
{status?.update_available && <span className="ml-2 text-warn">{t("client.updateAvailable")}</span>}
|
||||
</dd>
|
||||
<dt className="text-muted">{t("client.otherAddons")}</dt>
|
||||
<dd>{t("client.leftAsIs", { n: info.other_addons })}</dd>
|
||||
</dl>
|
||||
<ClientGraphics key={info.path} serverId={serverId} />
|
||||
<AddonCatalog key={"addons-" + info.path} serverId={serverId} companions={remote ? null : info.addon} onCompanionsInstalled={() => void refresh()} />
|
||||
{!remote && (
|
||||
<label className="mt-4 flex cursor-pointer items-center gap-2 text-sm">
|
||||
<input type="checkbox" checked={playAfter} onChange={(e) => setPlayAfter(e.target.checked)} className="h-4 w-4 accent-[#c9a24a]" />
|
||||
<span>{t("client.startAfter")}</span>
|
||||
</label>
|
||||
)}
|
||||
<div className="mt-4 flex flex-wrap gap-2">
|
||||
{!remote && !pointsLocal && (
|
||||
<Button size="sm" disabled={busy} onClick={() => void run(async () => { await api.setRealmlist(serverId, "127.0.0.1"); return t("client.pointedNote"); })}>
|
||||
@@ -108,15 +91,9 @@ export function ClientCard({ serverId, remote = false }: { serverId: string; rem
|
||||
{info.addon.installed ? t("client.updateAddon") : t("client.installAddon")}
|
||||
</Button>
|
||||
)}
|
||||
{(status?.update_available || (remote && status?.managed)) && (
|
||||
<Button size="sm" variant="primary" disabled={busy} onClick={() => setDialog("update")}>{t("client.upd.start")}</Button>
|
||||
)}
|
||||
{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>
|
||||
<Button size="sm" variant="ghost" disabled={busy} onClick={() => void api.openLink(CLIENT_SITE).catch((e) => setError(asUiError(e)))}>{t("client.getFromSite")}</Button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
@@ -126,8 +103,7 @@ export function ClientCard({ serverId, remote = false }: { serverId: string; rem
|
||||
{dialog && (
|
||||
<ClientDialog
|
||||
serverId={serverId}
|
||||
mode={dialog}
|
||||
onClose={() => setDialog(null)}
|
||||
onClose={() => setDialog(false)}
|
||||
onChanged={() => {
|
||||
void refresh();
|
||||
void checkClient(serverId);
|
||||
|
||||
+30
-207
@@ -1,62 +1,35 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { open } from "@tauri-apps/plugin-dialog";
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
import { Check, Loader2 } from "lucide-react";
|
||||
import { api, asUiError, REMOTE_CLIENT_ID, type ClientDownloadCheck, type ClientPlan, type ClientStep, type UiError } from "@/lib/api";
|
||||
import { formatBytes } from "@/lib/utils";
|
||||
import { Check, ExternalLink } from "lucide-react";
|
||||
import { api, asUiError, REMOTE_CLIENT_ID, type UiError } from "@/lib/api";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card } from "@/components/ui/card";
|
||||
import { useHuman, useT } from "@/i18n";
|
||||
|
||||
/**
|
||||
* - setup: no client linked yet: pick an existing folder or download the client.
|
||||
* - update: a client the Manager keeps up to date has a newer version.
|
||||
* - track: an existing client the Manager has not looked at yet: compare it once, then keep it up to date.
|
||||
*/
|
||||
export type ClientDialogMode = "setup" | "update" | "track";
|
||||
type Phase = "choose" | "confirm" | "scanning" | "preview" | "working" | "done" | "stopped" | "failed";
|
||||
/** Where the community hands out its launcher, which downloads the game client. The Manager does not download it. */
|
||||
export const CLIENT_SITE = "https://coa-development.org/";
|
||||
|
||||
type Phase = "choose" | "done" | "failed";
|
||||
|
||||
/**
|
||||
* Linking the game client: pick a folder that already has the game, or go to the community site for the official
|
||||
* launcher (it downloads the client after signing in) and come back to pick the folder it installed to.
|
||||
*/
|
||||
export function ClientDialog(props: {
|
||||
serverId: string;
|
||||
mode: ClientDialogMode;
|
||||
onClose: () => void;
|
||||
/** The linked client or its version changed; the caller refreshes what it shows. */
|
||||
/** The linked client changed; the caller refreshes what it shows. */
|
||||
onChanged: () => void;
|
||||
/** Update mode only: start the game without updating. */
|
||||
onPlayAnyway?: () => void;
|
||||
}) {
|
||||
const t = useT();
|
||||
const human = useHuman();
|
||||
const { serverId, mode } = props;
|
||||
const [phase, setPhase] = useState<Phase>(mode === "setup" ? "choose" : "scanning");
|
||||
const [step, setStep] = useState<ClientStep | null>(null);
|
||||
const [parent, setParent] = useState<string | null>(null);
|
||||
const [check, setCheck] = useState<ClientDownloadCheck | null>(null);
|
||||
const [plan, setPlan] = useState<ClientPlan | null>(null);
|
||||
const [keep, setKeep] = useState(true);
|
||||
const { serverId } = props;
|
||||
const [phase, setPhase] = useState<Phase>("choose");
|
||||
const [error, setError] = useState<UiError | null>(null);
|
||||
const cancelled = useRef(false);
|
||||
const working = phase === "scanning" || phase === "working";
|
||||
|
||||
useEffect(() => {
|
||||
let un: (() => void) | undefined;
|
||||
let gone = false;
|
||||
listen<ClientStep>("client-progress", (e) => setStep(e.payload))
|
||||
.then((u) => (gone ? u() : (un = u)))
|
||||
.catch(() => undefined);
|
||||
return () => {
|
||||
gone = true;
|
||||
un?.();
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (mode !== "setup") void startPlan();
|
||||
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
useEffect(() => {
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key === "Escape" && !working) close();
|
||||
if (e.key === "Escape") close();
|
||||
};
|
||||
window.addEventListener("keydown", onKey);
|
||||
return () => window.removeEventListener("keydown", onKey);
|
||||
@@ -67,15 +40,6 @@ export function ClientDialog(props: {
|
||||
props.onClose();
|
||||
}
|
||||
|
||||
function fail(e: unknown) {
|
||||
if (cancelled.current) {
|
||||
setPhase("stopped");
|
||||
} else {
|
||||
setError(asUiError(e));
|
||||
setPhase("failed");
|
||||
}
|
||||
}
|
||||
|
||||
async function useExisting() {
|
||||
const picked = await open({ directory: true, multiple: false, title: t("client.dialogTitle") });
|
||||
if (typeof picked !== "string") return;
|
||||
@@ -89,68 +53,16 @@ export function ClientDialog(props: {
|
||||
}
|
||||
}
|
||||
|
||||
async function pickParent() {
|
||||
const picked = await open({ directory: true, multiple: false, title: t("client.dl.pickParent") });
|
||||
if (typeof picked !== "string") return;
|
||||
setError(null);
|
||||
async function openSite() {
|
||||
try {
|
||||
setCheck(await api.clientDownloadCheck(picked));
|
||||
setParent(picked);
|
||||
setPhase("confirm");
|
||||
await api.openLink(CLIENT_SITE);
|
||||
} catch (e) {
|
||||
setError(asUiError(e));
|
||||
setPhase("failed");
|
||||
}
|
||||
}
|
||||
|
||||
async function startDownload() {
|
||||
if (!parent) return;
|
||||
cancelled.current = false;
|
||||
setStep(null);
|
||||
setPhase("working");
|
||||
try {
|
||||
await api.clientDownload(serverId, parent);
|
||||
setPhase("done");
|
||||
} catch (e) {
|
||||
fail(e);
|
||||
}
|
||||
}
|
||||
|
||||
async function startPlan() {
|
||||
cancelled.current = false;
|
||||
setStep(null);
|
||||
setError(null);
|
||||
setPhase("scanning");
|
||||
try {
|
||||
const p = await api.clientPlan(serverId);
|
||||
setPlan(p);
|
||||
setKeep(p.items.some((i) => i.kind === "modified"));
|
||||
setPhase("preview");
|
||||
} catch (e) {
|
||||
fail(e);
|
||||
}
|
||||
}
|
||||
|
||||
async function startSync() {
|
||||
cancelled.current = false;
|
||||
setStep(null);
|
||||
setPhase("working");
|
||||
try {
|
||||
await api.clientSync(serverId, keep);
|
||||
setPhase("done");
|
||||
} catch (e) {
|
||||
fail(e);
|
||||
}
|
||||
}
|
||||
|
||||
function stop() {
|
||||
cancelled.current = true;
|
||||
void api.clientCancel();
|
||||
}
|
||||
|
||||
const modified = plan?.items.filter((i) => i.kind === "modified") ?? [];
|
||||
const pct = step && step.total > 0 ? Math.min(100, Math.floor((step.done / step.total) * 100)) : 0;
|
||||
const title = mode === "setup" ? t("client.setup.title") : mode === "update" ? t("client.upd.title") : t("client.track.title");
|
||||
const title = t("client.setup.title");
|
||||
|
||||
return (
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-6" role="presentation">
|
||||
@@ -161,107 +73,32 @@ export function ClientDialog(props: {
|
||||
<>
|
||||
<p className="mt-1 text-sm text-muted">{t("client.setup.intro")}</p>
|
||||
<div className="mt-4 grid gap-3">
|
||||
<button type="button" onClick={() => void openSite()} className="cursor-pointer rounded-md border border-line bg-card-2 p-4 text-left transition-colors hover:border-gold/50">
|
||||
<span className="flex items-center gap-2 font-medium">
|
||||
{t("client.setup.getLauncher")}
|
||||
<ExternalLink className="h-4 w-4 text-muted" aria-hidden />
|
||||
</span>
|
||||
<span className="mt-1 block text-sm text-muted">{t("client.setup.getLauncherHint")}</span>
|
||||
</button>
|
||||
<button type="button" onClick={() => void useExisting()} className="cursor-pointer rounded-md border border-line bg-card-2 p-4 text-left transition-colors hover:border-gold/50">
|
||||
<span className="block font-medium">{t("client.setup.have")}</span>
|
||||
</button>
|
||||
<button type="button" onClick={() => void pickParent()} className="cursor-pointer rounded-md border border-line bg-card-2 p-4 text-left transition-colors hover:border-gold/50">
|
||||
<span className="block font-medium">{t("client.setup.download")}</span>
|
||||
<span className="mt-1 block text-sm text-muted">{t("client.setup.downloadHint")}</span>
|
||||
<span className="mt-1 block text-sm text-muted">{t("client.setup.haveHint")}</span>
|
||||
</button>
|
||||
</div>
|
||||
<p className="mt-3 text-xs text-muted">{t("client.setup.hdHint")}</p>
|
||||
<div className="mt-5 flex justify-end">
|
||||
<Button variant="ghost" onClick={close}>{t("btn.close")}</Button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{phase === "confirm" && check && (
|
||||
<>
|
||||
<p className="mt-1 text-sm text-muted">{t("client.dl.confirmText", { v: check.version, size: formatBytes(check.needed_bytes) })}</p>
|
||||
<p className="selectable mt-3 break-all rounded-md bg-black/30 px-3 py-2 text-sm">{check.dest}</p>
|
||||
<p className={check.free_bytes < check.needed_bytes + 512 * 1024 * 1024 ? "mt-3 text-sm text-bad" : "mt-3 text-sm text-muted"}>
|
||||
{check.free_bytes < check.needed_bytes + 512 * 1024 * 1024
|
||||
? t("client.dl.notEnough", { need: formatBytes(check.needed_bytes), free: formatBytes(check.free_bytes) })
|
||||
: t("client.dl.free", { free: formatBytes(check.free_bytes) })}
|
||||
</p>
|
||||
<div className="mt-5 flex justify-end gap-2">
|
||||
<Button variant="ghost" onClick={() => void pickParent()}>{t("client.dl.otherFolder")}</Button>
|
||||
<Button variant="primary" disabled={check.free_bytes < check.needed_bytes + 512 * 1024 * 1024} onClick={() => void startDownload()}>
|
||||
{t("client.dl.start")}
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{(phase === "scanning" || phase === "working") && (
|
||||
<div className="mt-4" role="status">
|
||||
<div className="flex items-center gap-2 text-sm">
|
||||
<Loader2 className="h-4 w-4 animate-spin text-gold" aria-hidden />
|
||||
<span>{phase === "scanning" || step?.phase === "scan" ? t("client.dl.scanning") : t("client.dl.downloading")}</span>
|
||||
<span className="ml-auto text-muted">{pct}%</span>
|
||||
</div>
|
||||
<div className="mt-2 h-2 overflow-hidden rounded-full bg-white/10" role="progressbar" aria-valuenow={pct} aria-valuemin={0} aria-valuemax={100}>
|
||||
<div className="h-full rounded-full bg-gold transition-[width] duration-300" style={{ width: `${pct}%` }} />
|
||||
</div>
|
||||
<div className="mt-2 flex justify-between gap-4 text-xs text-muted">
|
||||
<span className="min-w-0 truncate">{step?.file ?? ""}</span>
|
||||
<span className="shrink-0">
|
||||
{step ? t("client.dl.progress", { done: formatBytes(step.done), total: formatBytes(step.total) }) : ""}
|
||||
{step && step.phase === "download" && step.bytes_per_sec > 0 ? ` · ${t("client.dl.speed", { speed: formatBytes(step.bytes_per_sec) })}` : ""}
|
||||
</span>
|
||||
</div>
|
||||
<div className="mt-5 flex justify-end">
|
||||
<Button variant="ghost" onClick={stop}>{t("client.dl.cancel")}</Button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{phase === "preview" && plan && (
|
||||
<>
|
||||
{plan.items.length === 0 ? (
|
||||
<p className="mt-2 text-sm">{t("client.upd.upToDate", { v: plan.version })}</p>
|
||||
) : (
|
||||
<>
|
||||
{mode === "update" && <p className="mt-2 text-sm">{t("client.upd.available", { v: plan.version })}</p>}
|
||||
<p className="mt-1 text-sm text-muted">{t("client.upd.summary", { n: plan.items.length, size: formatBytes(plan.download_bytes) })}</p>
|
||||
</>
|
||||
)}
|
||||
{mode === "track" && <p className="mt-3 text-sm text-muted">{t("client.track.text")}</p>}
|
||||
{modified.length > 0 && (
|
||||
<div className="mt-4 rounded-md border border-warn/40 bg-warn/5 p-3 text-sm">
|
||||
<p className="font-medium">{t("client.upd.modifiedTitle", { n: modified.length })}</p>
|
||||
<p className="mt-1 text-muted">{t("client.upd.modifiedText")}</p>
|
||||
<ul className="selectable mt-2 space-y-0.5 text-xs text-muted">
|
||||
{modified.slice(0, 8).map((i) => (
|
||||
<li key={i.path} className="truncate">{i.path}</li>
|
||||
))}
|
||||
{modified.length > 8 && <li>{t("client.upd.more", { n: modified.length - 8 })}</li>}
|
||||
</ul>
|
||||
<label className="mt-3 flex cursor-pointer items-center gap-2">
|
||||
<input type="checkbox" checked={keep} onChange={(e) => setKeep(e.target.checked)} className="h-4 w-4 accent-[#c9a24a]" />
|
||||
<span>{t("client.upd.keep")}</span>
|
||||
</label>
|
||||
</div>
|
||||
)}
|
||||
<div className="mt-5 flex flex-wrap justify-end gap-2">
|
||||
{mode === "update" && props.onPlayAnyway && (
|
||||
<Button variant="ghost" onClick={() => { close(); props.onPlayAnyway?.(); }}>{t("client.upd.playAnyway")}</Button>
|
||||
)}
|
||||
<Button variant="ghost" onClick={close}>{t("client.upd.later")}</Button>
|
||||
<Button variant="primary" onClick={() => void startSync()}>
|
||||
{mode === "track" ? (plan.items.length === 0 ? t("client.track.start") : t("client.track.startUpdate")) : t("client.upd.start")}
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{phase === "done" && (
|
||||
<>
|
||||
<div className="mt-4 flex items-center gap-3">
|
||||
<span className="flex h-9 w-9 items-center justify-center rounded-full bg-ok/15 text-ok"><Check className="h-5 w-5" aria-hidden /></span>
|
||||
<div>
|
||||
<p className="font-medium">{mode === "setup" ? t("client.dl.done") : t("client.upd.done")}</p>
|
||||
<p className="text-sm text-muted">{mode === "setup" ? t(serverId === REMOTE_CLIENT_ID ? "remote.clientReady" : "client.dl.doneText") : t("client.upd.doneText")}</p>
|
||||
<p className="font-medium">{t("client.dl.done")}</p>
|
||||
<p className="text-sm text-muted">{t(serverId === REMOTE_CLIENT_ID ? "remote.clientReady" : "client.dl.doneText")}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-5 flex justify-end">
|
||||
@@ -270,26 +107,12 @@ export function ClientDialog(props: {
|
||||
</>
|
||||
)}
|
||||
|
||||
{phase === "stopped" && (
|
||||
<>
|
||||
<p className="mt-3 text-sm text-muted">{t("client.dl.cancelled")}</p>
|
||||
<div className="mt-5 flex justify-end gap-2">
|
||||
<Button variant="ghost" onClick={close}>{t("btn.close")}</Button>
|
||||
{mode === "setup" ? (
|
||||
parent && <Button variant="primary" onClick={() => void startDownload()}>{t("client.dl.resume")}</Button>
|
||||
) : (
|
||||
<Button variant="primary" onClick={() => void startPlan()}>{t("client.dl.resume")}</Button>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{phase === "failed" && error && (
|
||||
<>
|
||||
<p className="mt-3 text-sm text-bad" role="alert">{error.human.code === "unknown" ? error.technical : human(error.human).message}</p>
|
||||
<div className="mt-5 flex justify-end gap-2">
|
||||
<Button variant="ghost" onClick={close}>{t("btn.close")}</Button>
|
||||
{mode === "setup" ? <Button onClick={() => { setError(null); setPhase("choose"); }}>{t("client.dl.back")}</Button> : <Button onClick={() => void startPlan()}>{t("client.dl.retry")}</Button>}
|
||||
<Button onClick={() => { setError(null); setPhase("choose"); }}>{t("client.dl.back")}</Button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -305,11 +305,18 @@ export function CompanionsCard({ serverId }: { serverId: string }) {
|
||||
setError(null);
|
||||
setStartNote(null);
|
||||
try {
|
||||
// The limit is a fleet size: companions that exist count, only the missing ones are created.
|
||||
const missing = autoOn && running && isViewingActiveRealm && pop ? Math.max(0, maxNum - pop.bots_total) : 0;
|
||||
if (missing > 200 && !window.confirm(t("comp.startTopUpConfirm", { n: Math.min(missing, 2000), max: maxNum }))) {
|
||||
setStartBusy(false);
|
||||
return;
|
||||
}
|
||||
await api.save(serverId, "bots", {
|
||||
"CoaBots.AutoLoginOnStartup": autoOn,
|
||||
"CoaBots.AutoLogin.MaxCount": maxNum,
|
||||
});
|
||||
setStartNote(t("comp.startSaved"));
|
||||
const queued = autoOn && running ? await api.topUpStartupFleet(serverId, activeServerRealm) : 0;
|
||||
setStartNote(queued > 0 ? t("comp.startTopUp", { n: queued, max: maxNum }) : t("comp.startSaved"));
|
||||
} catch (e) {
|
||||
setError(asUiError(e));
|
||||
} finally {
|
||||
@@ -781,7 +788,7 @@ export function CompanionsCard({ serverId }: { serverId: string }) {
|
||||
Persistent Startup Fleet
|
||||
</h3>
|
||||
<p className="text-xs text-muted">
|
||||
Configure how many bots automatically log into the world whenever the server launches.
|
||||
The server keeps this many companions. At every start the ones that exist log in, and only the missing ones are created.
|
||||
</p>
|
||||
|
||||
<div className="flex flex-wrap items-center gap-4 text-sm">
|
||||
|
||||
@@ -5,7 +5,7 @@ import { cn } from "@/lib/utils";
|
||||
import { useI18n, type Key } from "@/i18n";
|
||||
import { asControlError, control, type AccountView, type Credentials, type JoinOutcome, type RemoteCharacter } from "@/lib/control";
|
||||
import { REMOTE_CLIENT_ID } from "@/lib/api";
|
||||
import { ClientDialog, type ClientDialogMode } from "@/screens/ClientDialog";
|
||||
import { ClientDialog } from "@/screens/ClientDialog";
|
||||
import { Notes } from "@/screens/PortablePage";
|
||||
|
||||
const STATUS_TEXT: Record<string, Key> = {
|
||||
@@ -129,7 +129,7 @@ export function JoinPanel({ realm, character, automatic, onClaimed }: { realm: s
|
||||
const [err, setErr] = useState<{ code: string; message: string } | null>(null);
|
||||
const [linking, setLinking] = useState(false);
|
||||
const [bring, setBring] = useState(false);
|
||||
const [clientDialog, setClientDialog] = useState<ClientDialogMode | null>(null);
|
||||
const [clientDialog, setClientDialog] = useState(false);
|
||||
const refresh = () => control.account(realm).then(setAccount).catch(() => setAccount(null));
|
||||
useEffect(() => { setOutcome(null); setErr(null); setLinking(false); void refresh(); }, [realm]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
@@ -139,7 +139,7 @@ export function JoinPanel({ realm, character, automatic, onClaimed }: { realm: s
|
||||
const o = await control.join(realm, bring && character ? character : null, true);
|
||||
setOutcome(o);
|
||||
if (o.status === "needs_link") setLinking(true);
|
||||
if (o.status === "needs_client") setClientDialog("setup");
|
||||
if (o.status === "needs_client") setClientDialog(true);
|
||||
await refresh();
|
||||
} catch (e) { setErr(asControlError(e)); } finally { setBusy(false); }
|
||||
}
|
||||
@@ -156,7 +156,7 @@ export function JoinPanel({ realm, character, automatic, onClaimed }: { realm: s
|
||||
{outcome && text && <div className={cn("mt-3 rounded-md border p-3 text-sm", bad ? "border-warn/50 bg-warn/10" : "border-ok/40 bg-ok/10")} role="status" data-status={outcome.status}>
|
||||
<p>{t(text)}</p>
|
||||
{outcome.status === "needs_client" && (
|
||||
<Button size="sm" className="mt-2" onClick={() => setClientDialog("setup")}>
|
||||
<Button size="sm" className="mt-2" onClick={() => setClientDialog(true)}>
|
||||
{t("btn.setupClient")}
|
||||
</Button>
|
||||
)}
|
||||
@@ -170,10 +170,9 @@ export function JoinPanel({ realm, character, automatic, onClaimed }: { realm: s
|
||||
{clientDialog && (
|
||||
<ClientDialog
|
||||
serverId={REMOTE_CLIENT_ID}
|
||||
mode={clientDialog}
|
||||
onClose={() => setClientDialog(null)}
|
||||
onClose={() => setClientDialog(false)}
|
||||
onChanged={() => {
|
||||
setClientDialog(null);
|
||||
setClientDialog(false);
|
||||
void join();
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -282,29 +282,29 @@ export function ModulesPage({ serverId, onChanged, onRegisterGuard }: { serverId
|
||||
{racesPatchStatus?.state === "enabled" && (
|
||||
<span className="inline-flex items-center gap-1.5 rounded-full bg-ok/10 px-2.5 py-1 text-xs text-ok border border-ok/30">
|
||||
<span className="h-1.5 w-1.5 rounded-full bg-ok" />
|
||||
{locale === "ru" ? "Патч клиента: Включен" : "Client Patch: Active"}
|
||||
{t("races.patch.active")}
|
||||
</span>
|
||||
)}
|
||||
{racesPatchStatus?.state === "disabled" && (
|
||||
<span className="inline-flex items-center gap-1.5 rounded-full bg-white/5 px-2.5 py-1 text-xs text-muted border border-white/15" title="MPQ files disabled with .disabled suffix">
|
||||
<span className="h-1.5 w-1.5 rounded-full bg-muted" />
|
||||
{locale === "ru" ? "Патч клиента: Отключен (.disabled)" : "Client Patch: Disabled (.disabled)"}
|
||||
{t("races.patch.disabled")}
|
||||
</span>
|
||||
)}
|
||||
{racesPatchStatus?.state === "not-installed" && (
|
||||
<span className="inline-flex items-center gap-1.5 rounded-full bg-warn/10 px-2.5 py-1 text-xs text-warn border border-warn/30">
|
||||
<span className="h-1.5 w-1.5 rounded-full bg-warn" />
|
||||
{locale === "ru" ? "Патч клиента: Не установлен" : "Client Patch: Not Installed"}
|
||||
{t("races.patch.notInstalled")}
|
||||
</span>
|
||||
)}
|
||||
{racesPatchStatus?.state === "partially-installed" && (
|
||||
<span className="inline-flex items-center gap-1.5 rounded-full bg-warn/10 px-2.5 py-1 text-xs text-warn border border-warn/30">
|
||||
<span className="h-1.5 w-1.5 rounded-full bg-warn" />
|
||||
{locale === "ru" ? `Патч клиента: ${racesPatchStatus.installedMpqs}/${racesPatchStatus.totalMpqs} MPQ` : `Client Patch: ${racesPatchStatus.installedMpqs}/${racesPatchStatus.totalMpqs} MPQ`}
|
||||
{t("races.patch.partial", { a: racesPatchStatus.installedMpqs, b: racesPatchStatus.totalMpqs })}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{racesPatchStatus?.state === "partially-installed" && <p className="text-xs text-warn">{locale === "ru" ? "Файлы отсутствуют или изменены. Восстановите патч клиента." : "Files are missing or changed. Repair the client patch."}</p>}
|
||||
{racesPatchStatus?.state === "partially-installed" && <p className="text-xs text-warn">{t("races.patch.partialHint")}</p>}
|
||||
{(
|
||||
<Button
|
||||
size="sm"
|
||||
@@ -314,11 +314,11 @@ export function ModulesPage({ serverId, onChanged, onRegisterGuard }: { serverId
|
||||
onClick={() => void installClientPatch()}
|
||||
>
|
||||
{racesInstalling && <Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" />}
|
||||
{racesPatchStatus?.state === "not-installed" ? (locale === "ru" ? "Установить патч клиента" : "Install Client Patch") : (locale === "ru" ? "Восстановить патч клиента" : "Repair Client Patch")}
|
||||
{racesPatchStatus?.state === "not-installed" ? t("races.patch.install") : t("races.patch.repair")}
|
||||
</Button>
|
||||
)}
|
||||
{racesPatchStatus && racesPatchStatus.state !== "not-installed" && <Button size="sm" variant="ghost" disabled={toggling !== null || racesInstalling} onClick={() => void uninstallClientPatch()}>{locale === "ru" ? "Удалить патч клиента" : "Uninstall Client Patch"}</Button>}
|
||||
<p className="text-xs text-muted">{locale === "ru" ? (m.enabled ? "После установки патч будет включён." : "После установки патч останется отключённым: модуль сервера выключен или отсутствует.") : (m.enabled ? "The patch will be enabled after installation." : "The patch will stay disabled after installation: the server module is off or missing.")}</p>
|
||||
{racesPatchStatus && racesPatchStatus.state !== "not-installed" && <Button size="sm" variant="ghost" disabled={toggling !== null || racesInstalling} onClick={() => void uninstallClientPatch()}>{t("races.patch.uninstall")}</Button>}
|
||||
<p className="text-xs text-muted">{t(m.enabled ? "races.patch.willEnable" : "races.patch.willStayOff")}</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import { ForceStopDialog } from "./ForceStopDialog";
|
||||
import { serverLifecycle } from "@/lib/serverLifecycle";
|
||||
import { serverUpdateBlocksRestart } from "@/lib/serverUpdate";
|
||||
import { dismissClientJob, startClientUpdate, stopClientJob, syncClient, useClientJob } from "@/lib/clientJob";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { AlertTriangle, Loader2, X } from "lucide-react";
|
||||
import { api, asUiError, type ClientInfo, type Human, type Performance, type Population, type ServerSummary, type ServiceStatus, type StatusView } from "@/lib/api";
|
||||
import { cn, formatBytes, formatUptime } from "@/lib/utils";
|
||||
import { cn, formatUptime } from "@/lib/utils";
|
||||
import { useHuman, useT } from "@/i18n";
|
||||
import { applyServerUpdate, useServerUpdate } from "@/lib/serverUpdate";
|
||||
import { checkClient, useClientStatus } from "@/lib/clientUpdate";
|
||||
import { ClientDialog, type ClientDialogMode } from "@/screens/ClientDialog";
|
||||
import { checkClient } from "@/lib/clientUpdate";
|
||||
import { ClientDialog } from "@/screens/ClientDialog";
|
||||
import { RealmlistMenu } from "@/screens/RealmlistMenu";
|
||||
import { RealmPicker } from "@/screens/RealmPicker";
|
||||
import { CrashHistoryModal } from "@/screens/CrashHistoryModal";
|
||||
@@ -100,13 +99,8 @@ export function Overview({ server, companions = true, onForget, onOpenUpdates, o
|
||||
const [showDetails, setShowDetails] = useState(false);
|
||||
const [pop, setPop] = useState<Population | null>(null);
|
||||
const [client, setClient] = useState<ClientInfo | null | undefined>(undefined);
|
||||
const [dialog, setDialog] = useState<ClientDialogMode | null>(null);
|
||||
const clientStatus = useClientStatus(server.id).status;
|
||||
const [dialog, setDialog] = useState(false);
|
||||
const [playing, setPlaying] = useState(false);
|
||||
const job = useClientJob(server.id);
|
||||
const jobBusy = job.phase === "scanning" || job.phase === "working";
|
||||
const jobPct = job.step && job.step.total > 0 ? Math.min(100, Math.floor((job.step.done / job.step.total) * 100)) : 0;
|
||||
const [keepMine, setKeepMine] = useState(true);
|
||||
const [perf, setPerf] = useState<Performance | null>(null);
|
||||
const upd = useServerUpdate(server.id);
|
||||
const visibleFailure = failure ?? upd.stateError ?? upd.uiError;
|
||||
@@ -166,10 +160,6 @@ export function Overview({ server, companions = true, onForget, onOpenUpdates, o
|
||||
}, [server.id]);
|
||||
const alive = useRef(true);
|
||||
|
||||
useEffect(() => {
|
||||
if (job.phase === "done" || job.phase === "current") void api.clientInfo(server.id).then(setClient).catch(() => undefined);
|
||||
}, [job.phase, server.id]);
|
||||
|
||||
const run = useCallback(
|
||||
async (kind: Exclude<Action, null>) => {
|
||||
setStopFailed(false);
|
||||
@@ -454,45 +444,13 @@ export function Overview({ server, companions = true, onForget, onOpenUpdates, o
|
||||
)}
|
||||
<div className="ml-auto flex max-w-full flex-wrap items-center justify-end gap-3">
|
||||
{client && <RealmlistMenu serverId={server.id} />}
|
||||
{client && jobBusy ? (
|
||||
<div
|
||||
className="relative flex h-12 min-w-64 items-center overflow-hidden rounded-md border border-gold/50 bg-card-2"
|
||||
role="progressbar"
|
||||
aria-valuenow={jobPct}
|
||||
aria-valuemin={0}
|
||||
aria-valuemax={100}
|
||||
aria-label={job.phase === "scanning" ? t("client.job.checking") : t("client.job.updating")}
|
||||
>
|
||||
<div className="absolute inset-y-0 left-0 bg-gold/35 transition-[width] duration-300" style={{ width: `${jobPct}%` }} />
|
||||
<div className="relative z-10 flex min-w-0 flex-1 flex-col px-5 leading-tight">
|
||||
<span className="text-sm font-semibold uppercase tracking-wide">{job.phase === "scanning" ? t("client.job.checking") : t("client.job.updating")}</span>
|
||||
<span className="truncate text-xs text-muted">
|
||||
{jobPct}%
|
||||
{job.step && job.step.phase === "download" && job.step.bytes_per_sec > 0 ? ` · ${t("client.dl.speed", { speed: formatBytes(job.step.bytes_per_sec) })}` : ""}
|
||||
</span>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => stopClientJob(server.id)}
|
||||
title={t("client.dl.cancel")}
|
||||
aria-label={t("client.dl.cancel")}
|
||||
className="relative z-10 flex h-full w-12 cursor-pointer items-center justify-center text-muted hover:text-ink"
|
||||
>
|
||||
<X className="h-4 w-4" aria-hidden />
|
||||
</button>
|
||||
</div>
|
||||
) : client && (clientStatus?.update_available || job.phase === "choose") ? (
|
||||
<SplitButton label={t("btn.play")}
|
||||
primary={{ disabled: playing || job.phase === "choose", onClick: () => void startClientUpdate(server.id), children: t("btn.updateClient") }}
|
||||
secondary={{ disabled: realmBusy || playing || upd.applying, onClick: () => void play(), children: <>{playing && <Loader2 className="h-4 w-4 animate-spin" aria-hidden />}{t("btn.playWithoutUpdate")}</> }}
|
||||
/>
|
||||
) : client ? (
|
||||
{client ? (
|
||||
<Button variant="primary" size="xl" disabled={realmBusy || playing} onClick={() => void play()} className="min-w-40">
|
||||
{playing && <Loader2 className="h-5 w-5 animate-spin" aria-hidden />}
|
||||
{t("btn.play")}
|
||||
</Button>
|
||||
) : client === null ? (
|
||||
<Button variant="secondary" size="xl" onClick={() => setDialog("setup")} className="min-w-40">
|
||||
<Button variant="secondary" size="xl" onClick={() => setDialog(true)} className="min-w-40">
|
||||
{t("btn.setupClient")}
|
||||
</Button>
|
||||
) : null}
|
||||
@@ -522,35 +480,6 @@ export function Overview({ server, companions = true, onForget, onOpenUpdates, o
|
||||
{anyUp && !running && !transitioning && (
|
||||
<p className="mt-3 text-sm text-muted">{t("overview.partial")}</p>
|
||||
)}
|
||||
{job.phase === "choose" && job.plan && (
|
||||
<div className="mt-4 rounded-md border border-warn/40 bg-warn/5 p-3 text-sm">
|
||||
<p className="font-medium">{t("client.upd.modifiedTitle", { n: job.plan.items.filter((i) => i.kind === "modified").length })}</p>
|
||||
<p className="mt-1 text-muted">{t("client.upd.modifiedText")}</p>
|
||||
<label className="mt-3 flex cursor-pointer items-center gap-2">
|
||||
<input type="checkbox" checked={keepMine} onChange={(e) => setKeepMine(e.target.checked)} className="h-4 w-4 accent-[#c9a24a]" />
|
||||
<span>{t("client.upd.keep")}</span>
|
||||
</label>
|
||||
<div className="mt-3 flex gap-2">
|
||||
<Button size="sm" variant="primary" onClick={() => void syncClient(server.id, keepMine)}>{t("client.upd.start")}</Button>
|
||||
<Button size="sm" variant="ghost" onClick={() => dismissClientJob(server.id)}>{t("client.upd.later")}</Button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{job.phase === "done" && <p className="mt-3 text-sm text-ok" role="status">{t("client.upd.done")}</p>}
|
||||
{job.phase === "current" && <p className="mt-3 text-sm text-ok" role="status">{t("client.upd.upToDate", { v: job.plan?.version ?? "" })}</p>}
|
||||
{job.phase === "stopped" && (
|
||||
<p className="mt-3 flex items-center gap-3 text-sm text-muted" role="status">
|
||||
{t("client.dl.cancelled")}
|
||||
<Button size="sm" variant="ghost" onClick={() => void startClientUpdate(server.id)}>{t("client.dl.resume")}</Button>
|
||||
</p>
|
||||
)}
|
||||
{job.phase === "failed" && job.error && (
|
||||
<p className="mt-3 flex flex-wrap items-center gap-3 text-sm text-bad" role="alert">
|
||||
{job.error.human.code === "unknown" ? job.error.technical : human(job.error.human).message}
|
||||
<Button size="sm" variant="ghost" onClick={() => void startClientUpdate(server.id)}>{t("client.dl.retry")}</Button>
|
||||
</p>
|
||||
)}
|
||||
{upd.result && "committed" in upd.result && !!upd.result.preexistingCharacters && <p className="mt-3 text-sm text-warn" role="status">{t("upd.preexistingCharacters", { n: upd.result.preexistingCharacters })}</p>}
|
||||
{upd.available && upd.preview && (
|
||||
<div className="mt-4 rounded-md border border-gold/40 bg-gold/5 p-3 text-sm">
|
||||
<p>{t("overview.updateAvail", { to: upd.preview.to_version, from: upd.preview.from_version ?? "?" })}</p>
|
||||
@@ -650,13 +579,11 @@ export function Overview({ server, companions = true, onForget, onOpenUpdates, o
|
||||
{dialog && (
|
||||
<ClientDialog
|
||||
serverId={server.id}
|
||||
mode={dialog}
|
||||
onClose={() => setDialog(null)}
|
||||
onClose={() => setDialog(false)}
|
||||
onChanged={() => {
|
||||
void api.clientInfo(server.id).then(setClient).catch(() => setClient(null));
|
||||
void checkClient(server.id);
|
||||
}}
|
||||
onPlayAnyway={() => void play()}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { Gauge, Globe, Settings, Swords } from "lucide-react";
|
||||
import { api, asUiError, REMOTE_CLIENT_ID } from "@/lib/api";
|
||||
import { checkClient, startClientPolling, useClientStatus } from "@/lib/clientUpdate";
|
||||
import { checkClient, useClientStatus } from "@/lib/clientUpdate";
|
||||
import { ClientCard } from "@/screens/ClientCard";
|
||||
import { ClientDialog, type ClientDialogMode } from "@/screens/ClientDialog";
|
||||
import { ClientDialog } from "@/screens/ClientDialog";
|
||||
import { AboutCard } from "@/screens/AboutCard";
|
||||
import { PortablePage } from "@/screens/PortablePage";
|
||||
import { BrowsePage } from "@/screens/BrowsePage";
|
||||
@@ -27,7 +27,7 @@ export function RemoteClient({ onHost }: { onHost: () => void }) {
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [note, setNote] = useState<string | null>(null);
|
||||
const [revision, setRevision] = useState(0);
|
||||
const [dialog, setDialog] = useState<ClientDialogMode | null>(null);
|
||||
const [dialog, setDialog] = useState(false);
|
||||
const { status } = useClientStatus(REMOTE_CLIENT_ID);
|
||||
function fail(e: unknown) {
|
||||
const err = asUiError(e);
|
||||
@@ -35,7 +35,6 @@ export function RemoteClient({ onHost }: { onHost: () => void }) {
|
||||
}
|
||||
useEffect(() => {
|
||||
void api.remoteConnection().then(p => { setHost(p.host); setSavedHost(p.host); }).catch(fail).finally(() => setLoading(false));
|
||||
return startClientPolling(REMOTE_CLIENT_ID);
|
||||
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
useEffect(() => { void checkClient(REMOTE_CLIENT_ID); }, [revision]);
|
||||
|
||||
@@ -52,8 +51,7 @@ export function RemoteClient({ onHost }: { onHost: () => void }) {
|
||||
try { await api.play(REMOTE_CLIENT_ID); } catch (e) { fail(e); } finally { setBusy(false); }
|
||||
}
|
||||
function play() {
|
||||
if (!status?.linked) setDialog("setup");
|
||||
else if (status.update_available) setDialog("update");
|
||||
if (!status?.linked) setDialog(true);
|
||||
else void launch();
|
||||
}
|
||||
return <div className="flex h-full">
|
||||
@@ -78,13 +76,12 @@ export function RemoteClient({ onHost }: { onHost: () => void }) {
|
||||
</form>
|
||||
<p className="mt-3 text-sm text-muted">{t("remote.accountHint")}</p>
|
||||
<Button variant="primary" className="mt-4" disabled={loading || busy || !savedHost || host.trim() !== savedHost || status === null} onClick={play}>{t("btn.play")}</Button>
|
||||
{status?.linked && status.update_available && <Button variant="secondary" className="mt-4 ml-3" disabled={loading || busy || !savedHost || host.trim() !== savedHost} onClick={() => void launch()}>{t("btn.playWithoutUpdate")}</Button>}
|
||||
{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}</p>}
|
||||
</Card>
|
||||
<ClientCard key={revision} serverId={REMOTE_CLIENT_ID} remote />
|
||||
</>}
|
||||
</main>
|
||||
{dialog && <ClientDialog serverId={REMOTE_CLIENT_ID} mode={dialog} onClose={() => setDialog(null)} onChanged={() => setRevision(n => n + 1)} onPlayAnyway={() => void launch()} />}
|
||||
{dialog && <ClientDialog serverId={REMOTE_CLIENT_ID} onClose={() => setDialog(false)} onChanged={() => setRevision(n => n + 1)} />}
|
||||
</div>;
|
||||
}
|
||||
@@ -1,14 +1,25 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { api, asUiError, type RestartSchedule } from "@/lib/api";
|
||||
import { api, asUiError, type RestartSchedule, type Weekday } from "@/lib/api";
|
||||
import { Card } from "@/components/ui/card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useT } from "@/i18n";
|
||||
|
||||
/** A daily world restart at a chosen local time, with an in-game countdown (#202). */
|
||||
const WEEKDAYS: Weekday[] = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"];
|
||||
const DEFAULT_SCHEDULE: RestartSchedule = {
|
||||
enabled: false,
|
||||
time: "05:00",
|
||||
warningMinutes: 5,
|
||||
weeklyEnabled: false,
|
||||
weeklyDay: "sunday",
|
||||
weeklyTime: "05:00",
|
||||
weeklyWarningMinutes: 5,
|
||||
};
|
||||
|
||||
/** Daily and weekly world restarts at chosen local times, with an in-game countdown (#202). */
|
||||
export function RestartScheduleSettings({ serverId }: { serverId: string }) {
|
||||
const t = useT();
|
||||
const [saved, setSaved] = useState<RestartSchedule | null>(null);
|
||||
const [draft, setDraft] = useState<RestartSchedule>({ enabled: false, time: "05:00", warningMinutes: 5 });
|
||||
const [draft, setDraft] = useState<RestartSchedule>(DEFAULT_SCHEDULE);
|
||||
const [supported, setSupported] = useState(true);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [done, setDone] = useState(false);
|
||||
@@ -29,6 +40,8 @@ export function RestartScheduleSettings({ serverId }: { serverId: string }) {
|
||||
|
||||
const changed = !!saved && JSON.stringify(saved) !== JSON.stringify(draft);
|
||||
const minutesOk = Number.isInteger(draft.warningMinutes) && draft.warningMinutes >= 1 && draft.warningMinutes <= 60;
|
||||
const weeklyMinutesOk = Number.isInteger(draft.weeklyWarningMinutes) && draft.weeklyWarningMinutes >= 1 && draft.weeklyWarningMinutes <= 60;
|
||||
const valid = (!draft.enabled || minutesOk) && (!draft.weeklyEnabled || weeklyMinutesOk);
|
||||
const input = "rounded border border-line bg-bg px-2 py-1 text-sm text-ink outline-none focus:border-gold";
|
||||
return <Card className="mt-6 p-6" aria-busy={busy}>
|
||||
<h2 className="font-semibold">{t("sched.title")}</h2>
|
||||
@@ -46,10 +59,34 @@ export function RestartScheduleSettings({ serverId }: { serverId: string }) {
|
||||
<input type="number" min={1} max={60} step={1} className={`${input} w-20`} value={draft.warningMinutes} disabled={busy || !draft.enabled} onChange={e => { setDraft(d => ({ ...d, warningMinutes: Number(e.target.value) })); setDone(false); }} />
|
||||
</label>
|
||||
</div>
|
||||
<p className="mt-2 text-sm text-muted">{t("sched.hint")}</p>
|
||||
|
||||
<div className="mt-4 border-t border-line pt-4">
|
||||
<label className="flex cursor-pointer items-center gap-3">
|
||||
<input type="checkbox" className="h-4 w-4 accent-[#c9a24a]" checked={draft.weeklyEnabled} disabled={busy || !saved} onChange={e => { setDraft(d => ({ ...d, weeklyEnabled: e.target.checked })); setDone(false); }} />
|
||||
<span className="text-sm font-medium">{t("sched.weeklyEnable")}</span>
|
||||
</label>
|
||||
<div className="mt-3 flex flex-wrap items-center gap-4 text-sm">
|
||||
<label className="flex items-center gap-2">
|
||||
<span>{t("sched.day")}</span>
|
||||
<select className={input} value={draft.weeklyDay} disabled={busy || !draft.weeklyEnabled} onChange={e => { setDraft(d => ({ ...d, weeklyDay: e.target.value as Weekday })); setDone(false); }}>
|
||||
{WEEKDAYS.map(day => <option key={day} value={day}>{t(`sched.days.${day}`)}</option>)}
|
||||
</select>
|
||||
</label>
|
||||
<label className="flex items-center gap-2">
|
||||
<span>{t("sched.time")}</span>
|
||||
<input type="time" className={input} value={draft.weeklyTime} disabled={busy || !draft.weeklyEnabled} onChange={e => { setDraft(d => ({ ...d, weeklyTime: e.target.value })); setDone(false); }} />
|
||||
</label>
|
||||
<label className="flex items-center gap-2">
|
||||
<span>{t("sched.warning")}</span>
|
||||
<input type="number" min={1} max={60} step={1} className={`${input} w-20`} value={draft.weeklyWarningMinutes} disabled={busy || !draft.weeklyEnabled} onChange={e => { setDraft(d => ({ ...d, weeklyWarningMinutes: Number(e.target.value) })); setDone(false); }} />
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p className="mt-3 text-sm text-muted">{t("sched.hint")}</p>
|
||||
{!supported && <p className="mt-2 text-sm text-warn">{t("sched.unsupported")}</p>}
|
||||
<div className="mt-3 flex items-center gap-3">
|
||||
<Button size="sm" disabled={busy || !changed || (draft.enabled && !minutesOk)} onClick={() => void save()}>{t("sched.save")}</Button>
|
||||
<Button size="sm" disabled={busy || !changed || !valid} onClick={() => void save()}>{t("sched.save")}</Button>
|
||||
{done && <span className="text-xs text-muted">{t("sched.saved")}</span>}
|
||||
</div>
|
||||
{error && <p className="mt-3 text-sm text-bad" role="alert">{error}</p>}
|
||||
|
||||
@@ -1,26 +1,155 @@
|
||||
import { useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Card } from "@/components/ui/card";
|
||||
import { api, asUiError } from "@/lib/api";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { api, asUiError, type CleanLogsReport, type LogSettings, type ServerLoggingView } from "@/lib/api";
|
||||
import { formatBytes } from "@/lib/utils";
|
||||
import { useT } from "@/i18n";
|
||||
|
||||
const DEFAULT_LOG_SETTINGS: LogSettings = { autoCleanup: false, maxSizeMb: 500 };
|
||||
|
||||
export function ServerLoggingSettings({ serverId }: { serverId: string }) {
|
||||
const t = useT();
|
||||
const [view, setView] = useState<ServerLoggingView | null>(null);
|
||||
const [draft, setDraft] = useState<LogSettings>(DEFAULT_LOG_SETTINGS);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [saved, setSaved] = useState(false);
|
||||
const [autoSaved, setAutoSaved] = useState(false);
|
||||
const [cleanReport, setCleanReport] = useState<CleanLogsReport | null>(null);
|
||||
const [error, setError] = useState("");
|
||||
async function apply(preset: "normal" | "errors" | "off") {
|
||||
setBusy(true); setSaved(false); setError("");
|
||||
try { await api.serverLoggingPreset(serverId, preset); setSaved(true); }
|
||||
catch (error) { setError(asUiError(error).technical); }
|
||||
finally { setBusy(false); }
|
||||
|
||||
useEffect(() => {
|
||||
let alive = true;
|
||||
void api.serverLoggingState(serverId)
|
||||
.then(v => {
|
||||
if (!alive) return;
|
||||
setView(v);
|
||||
setDraft(v.settings);
|
||||
})
|
||||
.catch(err => {
|
||||
if (alive) setError(asUiError(err).technical);
|
||||
});
|
||||
return () => { alive = false; };
|
||||
}, [serverId]);
|
||||
|
||||
async function refreshState() {
|
||||
const v = await api.serverLoggingState(serverId);
|
||||
setView(v);
|
||||
setDraft(v.settings);
|
||||
}
|
||||
return <Card className="mt-6 p-6">
|
||||
|
||||
async function apply(preset: "normal" | "errors" | "off") {
|
||||
setBusy(true); setSaved(false); setAutoSaved(false); setCleanReport(null); setError("");
|
||||
try {
|
||||
await api.serverLoggingPreset(serverId, preset);
|
||||
await refreshState();
|
||||
setSaved(true);
|
||||
} catch (err) {
|
||||
setError(asUiError(err).technical);
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function saveAutoCleanup() {
|
||||
setBusy(true); setSaved(false); setAutoSaved(false); setCleanReport(null); setError("");
|
||||
try {
|
||||
const v = await api.serverLoggingSettingsSave(serverId, draft);
|
||||
setView(v);
|
||||
setDraft(v.settings);
|
||||
setAutoSaved(true);
|
||||
} catch (err) {
|
||||
setError(asUiError(err).technical);
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function cleanNow() {
|
||||
setBusy(true); setSaved(false); setAutoSaved(false); setCleanReport(null); setError("");
|
||||
try {
|
||||
const report = await api.serverLogsClean(serverId);
|
||||
setCleanReport(report);
|
||||
await refreshState();
|
||||
} catch (err) {
|
||||
setError(asUiError(err).technical);
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
const changed = !!view && JSON.stringify(view.settings) !== JSON.stringify(draft);
|
||||
const sizeOk = Number.isInteger(draft.maxSizeMb) && draft.maxSizeMb >= 10 && draft.maxSizeMb <= 100000;
|
||||
const logBytes = view?.logBytes ?? 0;
|
||||
const input = "rounded border border-line bg-bg px-2 py-1 text-sm text-ink outline-none focus:border-gold";
|
||||
|
||||
return <Card className="mt-6 p-6" aria-busy={busy}>
|
||||
<h2 className="font-semibold">{t("serverLogs.title")}</h2>
|
||||
<p className="mt-2 text-sm text-muted">{t("serverLogs.description")}</p>
|
||||
<div className="mt-4 flex flex-wrap gap-2">
|
||||
{(["normal", "errors", "off"] as const).map(preset => <button key={preset} disabled={busy} onClick={() => apply(preset)} className="rounded-md border border-line px-3 py-2 text-sm hover:bg-white/5 disabled:opacity-50">{t(`serverLogs.${preset}`)}</button>)}
|
||||
{(["normal", "errors", "off"] as const).map(preset => {
|
||||
const active = view?.preset === preset;
|
||||
return <button
|
||||
key={preset}
|
||||
disabled={busy}
|
||||
aria-pressed={active}
|
||||
onClick={() => void apply(preset)}
|
||||
className={`rounded-md border px-3 py-2 text-sm disabled:opacity-50 ${active ? "border-gold bg-gold/10 text-gold" : "border-line hover:bg-white/5"}`}
|
||||
>
|
||||
{t(`serverLogs.${preset}`)}
|
||||
</button>;
|
||||
})}
|
||||
</div>
|
||||
{saved && <p role="status" className="mt-3 text-sm text-ok">{t("serverLogs.saved")}</p>}
|
||||
|
||||
<div className="mt-5 border-t border-line pt-4">
|
||||
<label className="flex cursor-pointer items-center gap-3">
|
||||
<input
|
||||
type="checkbox"
|
||||
className="h-4 w-4 accent-[#c9a24a]"
|
||||
checked={draft.autoCleanup}
|
||||
disabled={busy || !view}
|
||||
onChange={e => { setDraft(d => ({ ...d, autoCleanup: e.target.checked })); setAutoSaved(false); }}
|
||||
/>
|
||||
<span className="text-sm font-medium">{t("serverLogs.autoClean")}</span>
|
||||
</label>
|
||||
<div className="mt-3 flex flex-wrap items-center gap-3 text-sm">
|
||||
<label className="flex items-center gap-2">
|
||||
<span>{t("serverLogs.maxSize")}</span>
|
||||
<input
|
||||
type="number"
|
||||
min={10}
|
||||
max={100000}
|
||||
step={10}
|
||||
className={`${input} w-24`}
|
||||
value={draft.maxSizeMb}
|
||||
disabled={busy || !draft.autoCleanup}
|
||||
onChange={e => { setDraft(d => ({ ...d, maxSizeMb: Number(e.target.value) })); setAutoSaved(false); }}
|
||||
/>
|
||||
<span className="text-muted">MB</span>
|
||||
</label>
|
||||
<Button size="sm" disabled={busy || !changed || (draft.autoCleanup && !sizeOk)} onClick={() => void saveAutoCleanup()}>
|
||||
{t("sched.save")}
|
||||
</Button>
|
||||
{autoSaved && <span role="status" className="text-xs text-ok">{t("sched.saved")}</span>}
|
||||
</div>
|
||||
<p className="mt-2 text-xs text-muted">{t("serverLogs.autoCleanHint")}</p>
|
||||
</div>
|
||||
|
||||
<div className="mt-5 flex flex-wrap items-center justify-between gap-3 border-t border-line pt-4">
|
||||
<span className="text-sm text-muted">
|
||||
{t("serverLogs.currentSize", { size: formatBytes(logBytes) })}
|
||||
</span>
|
||||
<Button size="sm" disabled={busy || !view || logBytes === 0} onClick={() => void cleanNow()}>
|
||||
{t("serverLogs.cleanNow", { size: formatBytes(logBytes) })}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{cleanReport && (
|
||||
<p role="status" className="mt-3 text-sm text-ok">
|
||||
{t("serverLogs.cleaned", { freed: formatBytes(cleanReport.freedBytes) })}
|
||||
{cleanReport.skippedFiles > 0 && ` ${t("serverLogs.skippedInUse", { remaining: formatBytes(cleanReport.remainingBytes) })}`}
|
||||
</p>
|
||||
)}
|
||||
{error && <p role="alert" className="mt-3 text-sm text-bad">{error}</p>}
|
||||
</Card>;
|
||||
}
|
||||
@@ -19,7 +19,7 @@ import { DashboardPage } from "@/screens/DashboardPage";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card } from "@/components/ui/card";
|
||||
import { startServerUpdatePolling, useServerUpdate } from "@/lib/serverUpdate";
|
||||
import { startClientPolling } from "@/lib/clientUpdate";
|
||||
import { checkClient } from "@/lib/clientUpdate";
|
||||
import type { UnsavedChangesGuard } from "@/lib/unsavedGuard";
|
||||
|
||||
type Page = "overview" | "bots" | "dashboard" | "server" | "modules" | "players" | "characters" | "friends" | "backups" | "console" | "report" | "settings";
|
||||
@@ -88,14 +88,10 @@ export function Shell(props: {
|
||||
if (hiddenPages.includes(page)) setPage("overview");
|
||||
}, [hiddenPages, page]);
|
||||
|
||||
// Look for a server and a game client update when the app starts and then every five minutes.
|
||||
// Look for a server update when the app starts and then every five minutes; note whether a game client is linked.
|
||||
useEffect(() => {
|
||||
const stopServer = startServerUpdatePolling(props.activeId);
|
||||
const stopClient = startClientPolling(props.activeId);
|
||||
return () => {
|
||||
stopServer();
|
||||
stopClient();
|
||||
};
|
||||
void checkClient(props.activeId);
|
||||
return startServerUpdatePolling(props.activeId);
|
||||
}, [props.activeId]);
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
{
|
||||
"version": "0.9.14",
|
||||
"version": "0.9.16",
|
||||
"notes": [
|
||||
"Install community addons from the Manager",
|
||||
"Old item and creature data is cleared before every Play",
|
||||
"Turning the custom races client patch on or off takes seconds again",
|
||||
"The database moves to a free port when Windows reserves or another program takes 3307",
|
||||
"Your own MySQL settings survive restarts and updates",
|
||||
"Disabled custom races stay disabled after a server update that adds races",
|
||||
"Rename your realms in the Manager",
|
||||
"The account for a friend's server is in the login box at every Play",
|
||||
"Restart the world every day at a chosen time",
|
||||
"Switches for the Custom Races V2 subclasses, Hero Races and the /dev menu",
|
||||
"Companion bots on Wildcard and Warcraft Reborn",
|
||||
"The Custom Races card tells which characters stay out while races are off"
|
||||
"The game client now comes from the community launcher, not from the Manager",
|
||||
"Client setup says where to switch HD graphics; Custom Races patch card is translated",
|
||||
"Clean server logs by hand or automatically when they grow too big",
|
||||
"The startup limit for companions now creates the ones that are missing",
|
||||
"Restart the world every week on a chosen day and time"
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user