Migrate club rename and numeric squad reads

This commit is contained in:
funman300
2026-08-18 17:29:24 +00:00
parent fc55de19fa
commit bf6db98f0d
8 changed files with 645 additions and 136 deletions
+20
View File
@@ -39,6 +39,11 @@ pub struct HostConfig {
/// identity store's parent directory + `clientdata.json`. The blobs are
/// non-authoritative client UI state, so a default path is safe.
pub clientdata_path: String,
/// Shared FIFA17 account JSON (`fut_account.py` shape), used for club-name
/// reads and the Rust-owned rename mutation. Defaults to
/// `OPENFUT_ACCOUNT_PATH`, then existing `FUT_ACCOUNT_PATH`, then the
/// identity store's parent directory + `active_account.json`.
pub account_path: String,
}
#[derive(Debug)]
@@ -78,6 +83,11 @@ impl HostConfig {
.ok()
.filter(|v| !v.is_empty())
.unwrap_or_else(|| default_clientdata_path(&identity_store_path));
let account_path = env::var("OPENFUT_ACCOUNT_PATH")
.ok()
.filter(|v| !v.is_empty())
.or_else(|| env::var("FUT_ACCOUNT_PATH").ok().filter(|v| !v.is_empty()))
.unwrap_or_else(|| default_account_path(&identity_store_path));
Ok(HostConfig {
listen_addr: required("OPENFUT_UTAS_HOST_ADDR")?,
python_upstream: required("OPENFUT_UTAS_PYTHON_URL")?,
@@ -91,6 +101,7 @@ impl HostConfig {
pile_db_path: required("OPENFUT_PILE_DB")?,
identity_store_path,
clientdata_path,
account_path,
})
}
}
@@ -105,3 +116,12 @@ fn default_clientdata_path(identity_store_path: &str) -> String {
.to_string_lossy()
.into_owned()
}
fn default_account_path(identity_store_path: &str) -> String {
std::path::Path::new(identity_store_path)
.parent()
.map(|p| p.join("active_account.json"))
.unwrap_or_else(|| std::path::PathBuf::from("active_account.json"))
.to_string_lossy()
.into_owned()
}