From 7cdf854eb0e48598f4cd99ff9f3c46e63f6a03eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Tue, 17 Nov 2026 10:03:13 +0500 Subject: [PATCH] feat(client): drop built-in client download, point players to the community launcher The community moved the game client behind its official launcher (account sign-in, signed manifest, its own CDN), so the public manifest now answers 404 and the Manager must not pose as the launcher. Remove the client download and update path (clientdl, plan/sync/download/cancel commands, update job and progress UI, version tracking) and reduce "Set up the game client" to: open coa-development.org for the launcher, or pick a folder that already has the game. Linking a folder, realmlist switch, companion addon and the custom-race patch are unchanged. Co-Authored-By: Claude Sonnet 5.5 --- ...20261117-client-download-needs-launcher.md | 7 + crates/coa-core/examples/client_probe.rs | 75 -- crates/coa-core/src/clientdl.rs | 921 ------------------ crates/coa-core/src/lib.rs | 1 - src-tauri/src/lib.rs | 204 +--- src/dev/mock.ts | 14 +- src/i18n/locales/de.ts | 51 +- src/i18n/locales/en.ts | 53 +- src/i18n/locales/es.ts | 51 +- src/i18n/locales/fr.ts | 51 +- src/i18n/locales/ru.ts | 51 +- src/i18n/locales/zh.ts | 51 +- src/lib/api.ts | 35 +- src/lib/clientJob.ts | 116 --- src/lib/clientUpdate.ts | 14 +- src/lib/updatePrefs.ts | 6 +- src/screens/ClientCard.tsx | 36 +- src/screens/ClientDialog.tsx | 236 +---- src/screens/JoinPanel.tsx | 13 +- src/screens/Overview.tsx | 90 +- src/screens/RemoteClient.tsx | 13 +- src/screens/Shell.tsx | 12 +- 22 files changed, 116 insertions(+), 1985 deletions(-) create mode 100644 changelog.d/20261117-client-download-needs-launcher.md delete mode 100644 crates/coa-core/examples/client_probe.rs delete mode 100644 crates/coa-core/src/clientdl.rs delete mode 100644 src/lib/clientJob.ts diff --git a/changelog.d/20261117-client-download-needs-launcher.md b/changelog.d/20261117-client-download-needs-launcher.md new file mode 100644 index 0000000..6935ba1 --- /dev/null +++ b/changelog.d/20261117-client-download-needs-launcher.md @@ -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 community moved the game client behind its official launcher (account sign-in), so the Manager can no longer download or update it. The built-in client download and update are removed. "Set up the game client" now sends you to coa-development.org to get the launcher; once the launcher has installed the game, choose "I already have a client" and pick its folder. Linking a folder, the server address switch and the companion addon work as before. diff --git a/crates/coa-core/examples/client_probe.rs b/crates/coa-core/examples/client_probe.rs deleted file mode 100644 index bd19056..0000000 --- a/crates/coa-core/examples/client_probe.rs +++ /dev/null @@ -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(); -} diff --git a/crates/coa-core/src/clientdl.rs b/crates/coa-core/src/clientdl.rs deleted file mode 100644 index e605f73..0000000 --- a/crates/coa-core/src/clientdl.rs +++ /dev/null @@ -1,921 +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, - pub files: Vec, -} - -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, - files: Vec, -} - -/// 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 { - 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 { - 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 { - 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, -} - -#[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, - pub files: BTreeMap, -} - -fn state_path(client: &Path) -> PathBuf { - client.join(STATE_DIR).join("client-state.json") -} - -pub fn load_state(client: &Path) -> Option { - 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, -} - -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, - pub download_bytes: u64, - pub total_files: usize, - pub up_to_date_files: usize, - pub kept_files: usize, - #[serde(skip)] - confirmed: BTreeMap, -} - -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, -} - -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 { - 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 { - 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()), - }); - 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 = 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 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>>, - requested: Mutex>, - 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 { - 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 { - 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::>(), - ["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 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 = 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()); - } -} diff --git a/crates/coa-core/src/lib.rs b/crates/coa-core/src/lib.rs index 818915a..538701a 100644 --- a/crates/coa-core/src/lib.rs +++ b/crates/coa-core/src/lib.rs @@ -14,7 +14,6 @@ pub mod backup; pub mod channels; pub mod cleanbase; pub mod client; -pub mod clientdl; pub mod companions; pub mod config; pub mod console; diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index b4ec47f..dfa244d 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -34,7 +34,7 @@ struct AppState { busy: Mutex>, /// Cancel handle of the installation currently running, if any. install_cancel: Mutex>, - /// 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>, /// The portable play runtime (the Host loop): started with the application, stopped with it. portable: Option>, @@ -2026,13 +2026,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, - latest_version: Option, - latest_bytes: Option, - /// 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> { @@ -2043,192 +2036,16 @@ fn linked_client(root: &std::path::Path) -> Result> { .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 { 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 { - 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 { - 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 `/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 { - 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 { @@ -2237,10 +2054,7 @@ fn begin_client_job(state: &AppState) -> std::result::Result { .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()); @@ -2355,6 +2169,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. @@ -2888,11 +2703,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, diff --git a/src/dev/mock.ts b/src/dev/mock.ts index 2d138c1..f54a965 100644 --- a/src/dev/mock.ts +++ b/src/dev/mock.ts @@ -53,19 +53,7 @@ export {}; 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;} diff --git a/src/i18n/locales/de.ts b/src/i18n/locales/de.ts index d2b72ea..4714320 100644 --- a/src/i18n/locales/de.ts +++ b/src/i18n/locales/de.ts @@ -5,7 +5,7 @@ const de: Partial> = { "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", @@ -76,7 +76,6 @@ const de: Partial> = { "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", @@ -219,6 +218,7 @@ const de: Partial> = { "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", @@ -604,51 +604,15 @@ const de: Partial> = { // 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.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", @@ -850,7 +814,6 @@ const de: Partial> = { "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.", @@ -863,8 +826,6 @@ const de: Partial> = { "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", diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index 538a9ef..0734fa8 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -2,7 +2,7 @@ const en = { "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", @@ -119,7 +119,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", @@ -279,6 +278,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", @@ -662,54 +662,18 @@ 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.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", @@ -896,7 +860,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.", @@ -909,8 +872,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.", diff --git a/src/i18n/locales/es.ts b/src/i18n/locales/es.ts index 16d31b0..98ded15 100644 --- a/src/i18n/locales/es.ts +++ b/src/i18n/locales/es.ts @@ -5,7 +5,7 @@ const es: Partial> = { "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", @@ -76,7 +76,6 @@ const es: Partial> = { "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", @@ -219,6 +218,7 @@ const es: Partial> = { "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", @@ -604,51 +604,15 @@ const es: Partial> = { // 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.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", @@ -850,7 +814,6 @@ const es: Partial> = { "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.", @@ -863,8 +826,6 @@ const es: Partial> = { "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", diff --git a/src/i18n/locales/fr.ts b/src/i18n/locales/fr.ts index 06334bb..c59514a 100644 --- a/src/i18n/locales/fr.ts +++ b/src/i18n/locales/fr.ts @@ -5,7 +5,7 @@ const fr: Partial> = { "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", @@ -76,7 +76,6 @@ const fr: Partial> = { "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", @@ -219,6 +218,7 @@ const fr: Partial> = { "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", @@ -604,51 +604,15 @@ const fr: Partial> = { // 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.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", @@ -850,7 +814,6 @@ const fr: Partial> = { "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.", @@ -863,8 +826,6 @@ const fr: Partial> = { "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", diff --git a/src/i18n/locales/ru.ts b/src/i18n/locales/ru.ts index 09f8c92..9b68864 100644 --- a/src/i18n/locales/ru.ts +++ b/src/i18n/locales/ru.ts @@ -5,7 +5,7 @@ const ru: Partial> = { "mod.switching": "Применяем изменения… Подождите.", "portable.experimental": "Экспериментальная функция: портативные персонажи ещё в активной разработке. Возможны ошибки.", "remote.clientReady": "Клиент готов. Сохраните адрес хоста и нажмите «Играть».", - "remote.clientIntro": "Выберите существующий клиент игры или скачайте его здесь. Локальный сервер не требуется.", + "remote.clientIntro": "Выберите готовый клиент игры или получите его через лаунчер сообщества. Локальный сервер не нужен.", "welcome.host.title": "Хочу быть хостом", "welcome.host.text": "Установить новый сервер или управлять существующим.", "welcome.connect.title": "Подключиться к другому серверу", @@ -119,7 +119,6 @@ const ru: Partial> = { "btn.stopSmall": "Остановить", "btn.restart": "Перезапустить", "btn.startWithoutUpdate": "Запустить без обновления", - "btn.playWithoutUpdate": "Играть без обновления", "import.squidRepackWarning": "Этот репак SquidBots проверяет хеш worldserver. Замена файла может нарушить работу Start_All_Bots и coa_update. Перед заменой менеджер запросит ваше решение.", "btn.play": "ИГРАТЬ", "btn.startPlay": "ЗАПУСТИТЬ И ИГРАТЬ", @@ -262,6 +261,7 @@ const ru: Partial> = { "client.updateAddon": "Обновить аддон компаньонов", "client.addonNote": "Аддон компаньонов установлен. Другие аддоны не затронуты.", "client.changeFolder": "Сменить папку…", + "client.getFromSite": "Скачать лаунчер…", // Diagnostics "diag.title": "Диагностика", @@ -648,51 +648,15 @@ const ru: Partial> = { // 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.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": "Показать пароль", @@ -879,7 +843,6 @@ const ru: Partial> = { "dash.openBrowser": "Открыть в браузере", "dash.update": "Обновить панель", "upd.startAfter": "Запускать сервер после обновления (иначе выключенный сервер останется выключенным)", - "client.startAfter": "Запускать игру после обновления клиента", "bk.folder": "Папка резервных копий", "bk.folderDefault": "по умолчанию", "bk.folderNote": "Новые копии сохраняются сюда, например на другой диск. Прежние копии остаются на месте и по-прежнему в списке. Папка должна быть вне папки сервера.", @@ -892,8 +855,6 @@ const ru: Partial> = { "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": "Персонажи", diff --git a/src/i18n/locales/zh.ts b/src/i18n/locales/zh.ts index 93b8710..b2be463 100644 --- a/src/i18n/locales/zh.ts +++ b/src/i18n/locales/zh.ts @@ -3,7 +3,7 @@ const zh = { "mod.switching": "正在应用更改…请稍候。", "portable.experimental": "实验性功能:便携角色仍在积极开发中,可能存在错误。", "remote.clientReady": "客户端已就绪。保存服主地址,然后点击开始游戏。", - "remote.clientIntro": "选择已有游戏客户端,或在此下载。无需安装本地服务器。", + "remote.clientIntro": "选择已有的游戏客户端,或通过社区的启动器获取。无需本地服务器。", "welcome.host.title": "我要搭建服务器", "welcome.host.text": "安装新服务器或管理已有服务器。", "welcome.connect.title": "连接其他服务器", @@ -91,7 +91,6 @@ const zh = { "btn.stopSmall": "停止", "btn.restart": "重启", "btn.startWithoutUpdate": "不更新启动服务器", - "btn.playWithoutUpdate": "不更新开始游戏", "import.squidRepackWarning": "此 SquidBots 整合包会检查 worldserver 哈希。替换程序可能导致 Start_All_Bots 和 coa_update 无法运行。更新前会要求您选择。", "btn.play": "开始游戏", "btn.startPlay": "启动并开始游戏", @@ -234,6 +233,7 @@ const zh = { "client.updateAddon": "更新随从插件", "client.addonNote": "随从插件已安装。其他插件未受任何影响。", "client.changeFolder": "更换文件夹…", + "client.getFromSite": "获取启动器…", // Diagnostics "diag.title": "诊断", @@ -619,51 +619,15 @@ 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.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": "显示密码", @@ -850,7 +814,6 @@ const zh = { "dash.openBrowser": "在浏览器中打开", "dash.update": "更新仪表盘", "upd.startAfter": "更新后启动服务器(否则已停止的服务器保持停止)", - "client.startAfter": "更新客户端后启动游戏", "bk.folder": "备份文件夹", "bk.folderDefault": "默认", "bk.folderNote": "新备份将保存在这里,例如另一个驱动器上。之前的备份保留在原处,仍会列出。该文件夹必须位于服务器文件夹之外。", @@ -863,8 +826,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": "网络地址", diff --git a/src/lib/api.ts b/src/lib/api.ts index a42ab35..73b0b94 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -421,36 +421,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"; @@ -614,11 +586,6 @@ export const api = { setRealmlist: (id: string, host: string) => invoke("client_realmlist", { id, host }), installAddon: (id: string) => invoke("client_install_addon", { id }), clientStatus: (id: string) => invoke("client_status", { id }), - clientDownloadCheck: (parent: string) => invoke("client_download_check", { parent }), - clientPlan: (id: string) => invoke("client_plan", { id }), - clientSync: (id: string, keepModified: boolean) => invoke("client_sync", { id, keepModified }), - clientDownload: (id: string, parent: string) => invoke("client_download", { id, parent }), - clientCancel: () => invoke("client_cancel"), customRacesStatus: (id: string) => invoke("custom_races_status", { id }), customRacesUninstall: (id: string) => invoke("custom_races_uninstall", { id }), customRacesInstall: (id: string) => invoke("custom_races_install", { id }), diff --git a/src/lib/clientJob.ts b/src/lib/clientJob.ts deleted file mode 100644 index 3c8393e..0000000 --- a/src/lib/clientJob.ts +++ /dev/null @@ -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(); -const listeners = new Set<() => void>(); -const cancelled = new Set(); - -const get = (id: string) => jobs.get(id) ?? IDLE; -function set(id: string, next: Partial) { - 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("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 { - 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 { - 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), - ); -} diff --git a/src/lib/clientUpdate.ts b/src/lib/clientUpdate.ts index df8aea3..0a15906 100644 --- a/src/lib/clientUpdate.ts +++ b/src/lib/clientUpdate.ts @@ -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(); 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) { @@ -27,19 +26,12 @@ export async function checkClient(id: string): Promise { 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) => { diff --git a/src/lib/updatePrefs.ts b/src/lib/updatePrefs.ts index ba2caa3..7bbff13 100644 --- a/src/lib/updatePrefs.ts +++ b/src/lib/updatePrefs.ts @@ -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; diff --git a/src/screens/ClientCard.tsx b/src/screens/ClientCard.tsx index 7d5baaa..58cea2f 100644 --- a/src/screens/ClientCard.tsx +++ b/src/screens/ClientCard.tsx @@ -1,13 +1,12 @@ 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 { 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(); @@ -16,13 +15,10 @@ export function ClientCard({ serverId, remote = false }: { serverId: string; rem const [error, setError] = useState(null); const [note, setNote] = useState(null); const [busy, setBusy] = useState(false); - const [status, setStatus] = useState(null); const [patchProgress, setPatchProgress] = useState(null); - const [dialog, setDialog] = useState(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(() => { @@ -65,7 +61,7 @@ export function ClientCard({ serverId, remote = false }: { serverId: string; rem {info === null && ( <>

{t(remote ? "remote.clientIntro" : "client.intro")}

- + )} {info && ( @@ -77,13 +73,6 @@ export function ClientCard({ serverId, remote = false }: { serverId: string; rem {hosts.length ? hosts.filter(Boolean).join(", ") : "—"} {!remote && (pointsLocal ? {t("client.thisComputer")} : {t("client.notThisServer")})} -
{t("client.version")}
-
- {status?.managed - ? status.installed_version ?? t("client.versionUnfinished") - : t("client.versionUntracked")} - {status?.update_available && {t("client.updateAvailable")}} -
{!remote && <>
{t("client.addon")}
@@ -95,12 +84,6 @@ export function ClientCard({ serverId, remote = false }: { serverId: string; rem
{t("client.otherAddons")}
{t("client.leftAsIs", { n: info.other_addons })}
- {!remote && ( - - )}
{!remote && !pointsLocal && ( )} - {(status?.update_available || (remote && status?.managed)) && ( - - )} - {status && !status.managed && ( - - )} {remote && } - +
)} @@ -130,8 +107,7 @@ export function ClientCard({ serverId, remote = false }: { serverId: string; rem {dialog && ( setDialog(null)} + onClose={() => setDialog(false)} onChanged={() => { void refresh(); void checkClient(serverId); diff --git a/src/screens/ClientDialog.tsx b/src/screens/ClientDialog.tsx index a77e8d2..396cb4a 100644 --- a/src/screens/ClientDialog.tsx +++ b/src/screens/ClientDialog.tsx @@ -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(mode === "setup" ? "choose" : "scanning"); - const [step, setStep] = useState(null); - const [parent, setParent] = useState(null); - const [check, setCheck] = useState(null); - const [plan, setPlan] = useState(null); - const [keep, setKeep] = useState(true); + const { serverId } = props; + const [phase, setPhase] = useState("choose"); const [error, setError] = useState(null); - const cancelled = useRef(false); - const working = phase === "scanning" || phase === "working"; - - useEffect(() => { - let un: (() => void) | undefined; - let gone = false; - listen("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 (
@@ -161,12 +73,16 @@ export function ClientDialog(props: { <>

{t("client.setup.intro")}

+ -
@@ -175,93 +91,13 @@ export function ClientDialog(props: { )} - {phase === "confirm" && check && ( - <> -

{t("client.dl.confirmText", { v: check.version, size: formatBytes(check.needed_bytes) })}

-

{check.dest}

-

- {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) })} -

-
- - -
- - )} - - {(phase === "scanning" || phase === "working") && ( -
-
- - {phase === "scanning" || step?.phase === "scan" ? t("client.dl.scanning") : t("client.dl.downloading")} - {pct}% -
-
-
-
-
- {step?.file ?? ""} - - {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) })}` : ""} - -
-
- -
-
- )} - - {phase === "preview" && plan && ( - <> - {plan.items.length === 0 ? ( -

{t("client.upd.upToDate", { v: plan.version })}

- ) : ( - <> - {mode === "update" &&

{t("client.upd.available", { v: plan.version })}

} -

{t("client.upd.summary", { n: plan.items.length, size: formatBytes(plan.download_bytes) })}

- - )} - {mode === "track" &&

{t("client.track.text")}

} - {modified.length > 0 && ( -
-

{t("client.upd.modifiedTitle", { n: modified.length })}

-

{t("client.upd.modifiedText")}

-
    - {modified.slice(0, 8).map((i) => ( -
  • {i.path}
  • - ))} - {modified.length > 8 &&
  • {t("client.upd.more", { n: modified.length - 8 })}
  • } -
- -
- )} -
- {mode === "update" && props.onPlayAnyway && ( - - )} - - -
- - )} - {phase === "done" && ( <>
-

{mode === "setup" ? t("client.dl.done") : t("client.upd.done")}

-

{mode === "setup" ? t(serverId === REMOTE_CLIENT_ID ? "remote.clientReady" : "client.dl.doneText") : t("client.upd.doneText")}

+

{t("client.dl.done")}

+

{t(serverId === REMOTE_CLIENT_ID ? "remote.clientReady" : "client.dl.doneText")}

@@ -270,26 +106,12 @@ export function ClientDialog(props: { )} - {phase === "stopped" && ( - <> -

{t("client.dl.cancelled")}

-
- - {mode === "setup" ? ( - parent && - ) : ( - - )} -
- - )} - {phase === "failed" && error && ( <>

{error.human.code === "unknown" ? error.technical : human(error.human).message}

- {mode === "setup" ? : } +
)} diff --git a/src/screens/JoinPanel.tsx b/src/screens/JoinPanel.tsx index 8bf7f14..505f64e 100644 --- a/src/screens/JoinPanel.tsx +++ b/src/screens/JoinPanel.tsx @@ -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 = { @@ -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(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 &&

{t(text)}

{outcome.status === "needs_client" && ( - )} @@ -170,10 +170,9 @@ export function JoinPanel({ realm, character, automatic, onClaimed }: { realm: s {clientDialog && ( setClientDialog(null)} + onClose={() => setClientDialog(false)} onChanged={() => { - setClientDialog(null); + setClientDialog(false); void join(); }} /> diff --git a/src/screens/Overview.tsx b/src/screens/Overview.tsx index 4d1f029..d930053 100644 --- a/src/screens/Overview.tsx +++ b/src/screens/Overview.tsx @@ -1,12 +1,11 @@ -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"; @@ -90,13 +89,8 @@ export function Overview({ server, companions = true, onForget, onOpenUpdates, o const [showDetails, setShowDetails] = useState(false); const [pop, setPop] = useState(null); const [client, setClient] = useState(undefined); - const [dialog, setDialog] = useState(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(null); const upd = useServerUpdate(server.id); const visibleFailure = failure ?? upd.stateError ?? upd.uiError; @@ -149,10 +143,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) => { if (kind === "stopping") { @@ -442,52 +432,16 @@ export function Overview({ server, companions = true, onForget, onOpenUpdates, o )}
{client && } - {client && jobBusy ? ( -
-
-
- {job.phase === "scanning" ? t("client.job.checking") : t("client.job.updating")} - - {jobPct}% - {job.step && job.step.phase === "download" && job.step.bytes_per_sec > 0 ? ` · ${t("client.dl.speed", { speed: formatBytes(job.step.bytes_per_sec) })}` : ""} - -
- -
- ) : client && (clientStatus?.update_available || job.phase === "choose") ? ( - - ) : client ? ( + {client ? ( ) : client === null ? ( - ) : null} - {client && !jobBusy && (clientStatus?.update_available || job.phase === "choose") && ( - - )}
@@ -514,34 +468,6 @@ export function Overview({ server, companions = true, onForget, onOpenUpdates, o {anyUp && !running && !transitioning && (

{t("overview.partial")}

)} - {job.phase === "choose" && job.plan && ( -
-

{t("client.upd.modifiedTitle", { n: job.plan.items.filter((i) => i.kind === "modified").length })}

-

{t("client.upd.modifiedText")}

- -
- - -
-
- )} - {job.phase === "done" &&

{t("client.upd.done")}

} - {job.phase === "current" &&

{t("client.upd.upToDate", { v: job.plan?.version ?? "" })}

} - {job.phase === "stopped" && ( -

- {t("client.dl.cancelled")} - -

- )} - {job.phase === "failed" && job.error && ( -

- {job.error.human.code === "unknown" ? job.error.technical : human(job.error.human).message} - -

- )} {upd.available && upd.preview && (

{t("overview.updateAvail", { to: upd.preview.to_version, from: upd.preview.from_version ?? "?" })}

@@ -639,13 +565,11 @@ export function Overview({ server, companions = true, onForget, onOpenUpdates, o {dialog && ( setDialog(null)} + onClose={() => setDialog(false)} onChanged={() => { void api.clientInfo(server.id).then(setClient).catch(() => setClient(null)); void checkClient(server.id); }} - onPlayAnyway={() => void play()} /> )} diff --git a/src/screens/RemoteClient.tsx b/src/screens/RemoteClient.tsx index f0f9160..08ad369 100644 --- a/src/screens/RemoteClient.tsx +++ b/src/screens/RemoteClient.tsx @@ -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"; @@ -25,7 +25,7 @@ export function RemoteClient({ onHost }: { onHost: () => void }) { const [error, setError] = useState(null); const [note, setNote] = useState(null); const [revision, setRevision] = useState(0); - const [dialog, setDialog] = useState(null); + const [dialog, setDialog] = useState(false); const { status } = useClientStatus(REMOTE_CLIENT_ID); function fail(e: unknown) { const err = asUiError(e); @@ -33,7 +33,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]); @@ -50,8 +49,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
@@ -76,13 +74,12 @@ export function RemoteClient({ onHost }: { onHost: () => void }) {

{t("remote.accountHint")}

- {status?.linked && status.update_available && } {note &&

{note}

} {error &&

{error}

} } - {dialog && setDialog(null)} onChanged={() => setRevision(n => n + 1)} onPlayAnyway={() => void launch()} />} + {dialog && setDialog(false)} onChanged={() => setRevision(n => n + 1)} />}
; } diff --git a/src/screens/Shell.tsx b/src/screens/Shell.tsx index 4ee61ed..ef49cc2 100644 --- a/src/screens/Shell.tsx +++ b/src/screens/Shell.tsx @@ -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 (