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 <noreply@anthropic.com>
This commit is contained in:
ДмитрийandClaude Sonnet 5.5 committed 2026-11-17 10:03:13 +05:00
1 parent 0f0f9e6fe2
commit 7cdf854eb0
22 files changed
+116 -1985

No files matched your search

+7 -197
View File
@@ -34,7 +34,7 @@ struct AppState {
busy: Mutex<HashSet<String>>,
/// Cancel handle of the installation currently running, if any.
install_cancel: Mutex<Option<Cancel>>,
/// Cancel handle of the game-client check or download currently running, if any.
/// Cancel handle of the game-client operation currently running (the custom-race patch), if any.
client_cancel: Mutex<Option<Cancel>>,
/// The portable play runtime (the Host loop): started with the application, stopped with it.
portable: Option<Arc<PortableRuntime>>,
@@ -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<String>,
latest_version: Option<String>,
latest_bytes: Option<u64>,
/// A managed client is older than the published one (or its download never finished).
update_available: bool,
}
fn linked_client(root: &std::path::Path) -> Result<Option<PathBuf>> {
@@ -2043,192 +2036,16 @@ fn linked_client(root: &std::path::Path) -> Result<Option<PathBuf>> {
.filter(|p| coa_core::client::detect(p, None).is_some()))
}
/// Cheap: one small manifest request and the local state file; no game file is read.
/// Whether a usable client folder is linked. Local only; the Manager no longer downloads or updates the client.
#[tauri::command]
async fn client_status(
fn client_status(
state: State<'_, AppState>,
id: String,
) -> std::result::Result<ClientStatus, UiError> {
let ctx = client_context(&state, &id)?;
blocking(move || {
let client = ctx.linked();
let latest = coa_core::clientdl::fetch_latest().ok();
let local = client.as_deref().map(coa_core::clientdl::local);
let managed = local.as_ref().map(|l| l.managed).unwrap_or(false);
let installed = local.and_then(|l| l.version);
let update_available = managed
&& latest
.as_ref()
.map(|l| installed.as_deref() != Some(l.version.as_str()))
.unwrap_or(false);
Ok(ClientStatus {
linked: client.is_some(),
managed,
installed_version: installed,
latest_bytes: latest.as_ref().map(|l| l.total_bytes()),
latest_version: latest.map(|l| l.version),
update_available,
})
Ok(ClientStatus {
linked: ctx.linked().is_some(),
})
.await
}
#[derive(Serialize)]
struct ClientDownloadCheck {
needed_bytes: u64,
free_bytes: u64,
version: String,
/// Where the client would go.
dest: String,
}
const CLIENT_FOLDER: &str = "CoA Client";
#[tauri::command]
async fn client_download_check(
parent: String,
) -> std::result::Result<ClientDownloadCheck, UiError> {
blocking(move || {
let latest = coa_core::clientdl::fetch_latest()?;
let dest = PathBuf::from(&parent).join(CLIENT_FOLDER);
Ok(ClientDownloadCheck {
needed_bytes: latest.total_bytes(),
free_bytes: coa_core::fsx::free_space(std::path::Path::new(&parent))?,
version: latest.version,
dest: dest.to_string_lossy().into_owned(),
})
})
.await
}
/// Compare the linked client with the published one. Hashes files only where the recorded state cannot vouch for them.
#[tauri::command]
async fn client_plan(
app: AppHandle,
state: State<'_, AppState>,
id: String,
) -> std::result::Result<coa_core::clientdl::Plan, UiError> {
let ctx = client_context(&state, &id)?;
let cancel = begin_client_job(&state)?;
let result = blocking(move || {
let client = ctx.require()?;
let manifest = coa_core::clientdl::fetch_latest()?;
let current = coa_core::clientdl::load_state(&client).unwrap_or_default();
coa_core::clientdl::plan(&client, &manifest, &current, &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, &current, cancel, &emit)?;
coa_core::download::check_url(coa_core::clientdl::OBJECTS_URL)?;
let transport = coa_core::download::HttpTransport::new()?;
coa_core::clientdl::apply(
&coa_core::clientdl::Apply {
client,
manifest: &manifest,
plan: &plan,
keep_modified,
transport: &transport,
objects_url: coa_core::clientdl::OBJECTS_URL,
cancel,
},
&emit,
)?;
tracing::info!(version = %manifest.version, downloaded = plan.items.len(), "client brought up to date");
Ok(())
}
/// Download the client into `<parent>/CoA Client`, then link it to a host or player profile.
#[tauri::command]
async fn client_download(
app: AppHandle,
state: State<'_, AppState>,
id: String,
parent: String,
) -> std::result::Result<coa_core::client::ClientInfo, UiError> {
let ctx = client_context(&state, &id)?;
let cancel = begin_client_job(&state)?;
let result = blocking(move || {
let parent = PathBuf::from(&parent);
if !parent.is_dir() {
return Err(Error::Invalid(
"Choose an existing folder to put the game client in.".into(),
));
}
let dest = parent.join(CLIENT_FOLDER);
let resuming = coa_core::clientdl::load_state(&dest).is_some();
let non_empty = std::fs::read_dir(&dest)
.map(|mut r| r.next().is_some())
.unwrap_or(false);
if non_empty && !resuming {
return Err(Error::Invalid(format!(
"{} already exists and is not an unfinished download. Choose another folder.",
dest.display()
)));
}
std::fs::create_dir_all(&dest)?;
run_client_sync(&app, &dest, false, &cancel)?;
let info = coa_core::client::detect(&dest, ctx.source.as_deref())
.ok_or_else(|| Error::Invalid("The downloaded client looks incomplete.".into()))?;
ctx.link(&info.path)?;
if !ctx.host.is_empty() {
coa_core::client::set_realmlist(&dest, &ctx.dir, &ctx.host)?;
}
if let Some(src) = &ctx.source {
coa_core::client::install_addon(&dest, &ctx.dir, src)?;
}
Ok(coa_core::client::detect(&dest, ctx.source.as_deref()).unwrap_or(info))
})
.await;
end_client_job(&state);
result
}
#[tauri::command]
fn client_cancel(state: State<'_, AppState>) {
if let Ok(c) = state.client_cancel.lock() {
if let Some(c) = c.as_ref() {
c.cancel();
}
}
}
fn begin_client_job(state: &AppState) -> std::result::Result<Cancel, UiError> {
@@ -2237,10 +2054,7 @@ fn begin_client_job(state: &AppState) -> std::result::Result<Cancel, UiError> {
.lock()
.map_err(|_| Error::Invalid("state poisoned".into()))?;
if slot.is_some() {
return Err(Error::Invalid(
"The game client is already being checked or downloaded.".into(),
)
.into());
return Err(Error::Invalid("A game client operation is already running.".into()).into());
}
let cancel = Cancel::default();
*slot = Some(cancel.clone());
@@ -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,