mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-18 19:25:56 +00:00
Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df102f16fa | ||
|
|
5963e97c59 | ||
|
|
e3fbb2e4b6 | ||
|
|
a7b56d6aed | ||
|
|
cda7875a9a | ||
|
|
f53c7cb221 | ||
|
|
ca6bcf0052 | ||
|
|
d6a6384f9c | ||
|
|
21ddc1e7d8 | ||
|
|
16396407ad | ||
|
|
093dbfcadc |
No files matched your search
Generated
+3
-3
@@ -491,7 +491,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "coa-core"
|
||||
version = "0.6.17"
|
||||
version = "0.6.21"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"chrono",
|
||||
@@ -520,7 +520,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "coa-release"
|
||||
version = "0.6.17"
|
||||
version = "0.6.21"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"coa-core",
|
||||
@@ -529,7 +529,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "coa-server-manager"
|
||||
version = "0.6.17"
|
||||
version = "0.6.21"
|
||||
dependencies = [
|
||||
"coa-core",
|
||||
"serde",
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ resolver = "2"
|
||||
members = ["crates/coa-core", "crates/coa-release", "src-tauri"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.6.17"
|
||||
version = "0.6.21"
|
||||
edition = "2021"
|
||||
license = "AGPL-3.0-only"
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: manager
|
||||
type: changed
|
||||
audience: admins
|
||||
title: Server updates apply migrations once after saving a recovery point
|
||||
---
|
||||
Updates no longer build and start a second full server copy. The Manager checks both realms, saves recovery, applies pending SQL once and verifies startup. Failed SQL or startup restores the recovery point. Full-copy upgrade testing remains a release task.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: manager
|
||||
type: changed
|
||||
audience: admins
|
||||
title: Older server versions update directly without installing intermediate packages
|
||||
---
|
||||
The Manager checks database history and applies missing SQL from the latest signed package. A version missing from the release test list no longer blocks the update. Unknown versions, interrupted migrations and downgrades remain blocked.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: manager
|
||||
type: fixed
|
||||
audience: admins
|
||||
title: Update validation recognizes an already stopped server
|
||||
---
|
||||
Validation uses the same complete-server stop check as recovery instead of issuing redundant unconditional shutdown commands.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: manager
|
||||
type: fixed
|
||||
audience: admins
|
||||
title: Older servers find a tested intermediate update instead of being blocked
|
||||
---
|
||||
When the latest release cannot update an older server directly, Manager offers a signed intermediate release from its compatibility matrix and explains how to continue to the latest version.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: manager
|
||||
type: fixed
|
||||
audience: admins
|
||||
title: Update checks no longer download a server archive to compare its launcher
|
||||
---
|
||||
Manager recognizes its supported launcher edits against the signed file hash locally. Overlapping checks wait briefly for one another, and the private update copy checks combined program and database space before copying.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: manager
|
||||
type: fixed
|
||||
audience: admins
|
||||
title: Recorded core SQL stays applied after old history tables are cleaned up
|
||||
---
|
||||
Existing core migration records are preserved in Manager history. Unknown legacy checksums remain explicitly unknown, and interrupted or changed migrations are still rejected.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: manager
|
||||
type: fixed
|
||||
audience: admins
|
||||
title: Switching realms no longer repeats shared account database updates
|
||||
---
|
||||
Solo and Wildcard use one migration history for their shared account database. Previously applied records from either realm are recognized without running their SQL again.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: manager
|
||||
type: fixed
|
||||
audience: admins
|
||||
title: Update offers distinguish version support from database validation
|
||||
---
|
||||
An available version sequence no longer claims that every database state has been tested. Database compatibility is checked during the update.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: manager
|
||||
type: added
|
||||
audience: admins
|
||||
title: Advanced settings cover creature melee damage, spell damage and health by rank
|
||||
---
|
||||
Configure normal, elite, rare, rare elite and world boss creatures separately. Existing normal-creature settings now identify their scope clearly. Changes persist in the server template and require a world server restart.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: manager
|
||||
type: fixed
|
||||
audience: admins
|
||||
title: Internet sharing accepts existing port forwards to the same server
|
||||
---
|
||||
When a router rejects an already configured port forward, the Manager checks its destination. Matching enabled rules are accepted; conflicting rules report the affected TCP port and remain untouched.
|
||||
@@ -0,0 +1,57 @@
|
||||
//! Read-only audit, or explicit SQL checks on a disposable database fixture.
|
||||
use coa_core::{db::{Account, Db}, migrations::{self, Store}, manifest::Manifest, realms::Mode};
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let args: Vec<_> = std::env::args().collect();
|
||||
if args.len() < 3 { return Err("usage: migration_plan <root> <signed-manifest> [--apply|--sql-only <migration-directory>]".into()); }
|
||||
let root = std::path::Path::new(&args[1]);
|
||||
let bytes = std::fs::read(&args[2])?;
|
||||
let signature = std::fs::read_to_string(format!("{}.sig",args[2]))?;
|
||||
coa_core::signing::verify(&bytes, &signature, coa_core::signing::EMBEDDED_PUBLIC_KEY)?;
|
||||
let manifest = Manifest::parse(&bytes)?;
|
||||
for (index,mode) in [Mode::Coa, Mode::Wildcard].into_iter().enumerate() {
|
||||
let db = Db::from_repack(root, Account::Admin)?.for_realm(mode);
|
||||
let rows = db.load_readonly()?;
|
||||
let relevant: Vec<_> = rows.iter().filter(|r| r.id == "rev_20260903_01_live_class_baseline").map(|r| format!("{} {:?} {}",r.db,r.status,r.baseline)).collect();
|
||||
println!("{} baseline history: {:?}",mode.name(),relevant);
|
||||
let list: Vec<_> = manifest.migrations.iter().filter(|m|index==0 || m.db!="auth").cloned().collect();
|
||||
let plan = migrations::status(&db,&list)?;
|
||||
println!("{} pending: {:?}",mode.name(),plan.iter().filter(|m|m.status!=migrations::Status::Applied).map(|m|(&m.db,&m.id,m.status)).collect::<Vec<_>>());
|
||||
}
|
||||
if args.get(3).is_some_and(|s| s == "--apply" || s == "--sql-only") {
|
||||
assert!(root.file_name().unwrap().to_string_lossy().starts_with("update-database-diagnosis-") && root.join(".coa-update-fixture").is_file(), "Only disposable fixture roots may be changed");
|
||||
if args[3] == "--sql-only" {
|
||||
let db = Db::from_repack(root, Account::Admin)?.for_realm(Mode::Coa);
|
||||
let identity = || -> coa_core::Result<String> {
|
||||
let mut rows = String::new();
|
||||
for (schema,table,columns) in [("acore_auth","account","id,HEX(username)"),("acore_characters","characters","guid,account,HEX(name)"),("acore_characters_wildcard","characters","guid,account,HEX(name)")] {
|
||||
rows.push_str(schema);
|
||||
rows.push_str(&db.query(&format!("SELECT {columns} FROM {schema}.{table} ORDER BY 1;"))?);
|
||||
}
|
||||
Ok(coa_core::fsx::sha256_bytes(rows.as_bytes()))
|
||||
};
|
||||
let before = identity()?;
|
||||
migrations::verify_files(&manifest.migrations,std::path::Path::new(&args[4]))?;
|
||||
for (index,mode) in [Mode::Coa,Mode::Wildcard].into_iter().enumerate() {
|
||||
let realm_db = db.clone().for_realm(mode);
|
||||
let list: Vec<_> = manifest.migrations.iter().filter(|m|index==0 || m.db!="auth").cloned().collect();
|
||||
let result = migrations::apply_pending(&realm_db,&list,std::path::Path::new(&args[4]),&||Ok("disposable fixture".into()))?;
|
||||
println!("{} SQL result: {}",mode.name(),serde_json::to_string(&result)?);
|
||||
if result.failed.is_some() {return Err("SQL failed; fixture preserved".into());}
|
||||
}
|
||||
assert_eq!(before,identity()?,"Account or character identity changed");
|
||||
println!("Account and character identities preserved: {}",before);
|
||||
let capture = root.join("captured-schema");
|
||||
coa_core::schema_check::capture(&db,&capture)?;
|
||||
println!("Captured schema SHA256: {}",coa_core::fsx::sha256_file(&capture.join(coa_core::schema_check::CONTRACT))?);
|
||||
return Ok(());
|
||||
}
|
||||
if args.len() != 5 { return Err("Migration directory required".into()); }
|
||||
use coa_core::update::{Env, RepackEnv};
|
||||
let meta = coa_core::registry::metadata_dir_for(root)?;
|
||||
let env = RepackEnv { root, meta_dir: &meta };
|
||||
let result = env.migrate(&manifest, std::path::Path::new(&args[4]));
|
||||
let _ = coa_core::driver::run(root, coa_core::driver::Verb::StopAll);
|
||||
println!("Application result: {}",serde_json::to_string(&result?)?);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
//! Exercise the production updater only on a disposable copy of an installed server.
|
||||
use coa_core::{registry::MetaDir, update::{self, Env, RepackEnv}};
|
||||
fn main() -> Result<(),Box<dyn std::error::Error>> {
|
||||
let args:Vec<_>=std::env::args().collect();
|
||||
if args.len()!=3 && args.len()!=4 {return Err("usage: upgrade_fixture <disposable-root> <signed-package-directory>".into());}
|
||||
let root=std::path::Path::new(&args[1]);
|
||||
assert!(root.file_name().unwrap().to_string_lossy().starts_with("coa-schema-fixture-real") && root.join(".coa-update-fixture").is_file(),"Disposable fixture required");
|
||||
let meta=coa_core::registry::metadata_dir_for(root)?;
|
||||
let (_,installed)=MetaDir::open(&meta)?;
|
||||
assert_eq!(coa_core::fsx::canonicalize_lenient(std::path::Path::new(&installed.server_path))?,coa_core::fsx::canonicalize_lenient(root)?,"Fixture metadata must point to the copy");
|
||||
assert!(installed.client_path.is_none(),"Detach the real client from fixture metadata");
|
||||
let env=RepackEnv{root,meta_dir:&meta};
|
||||
if args.get(3).is_some_and(|flag|flag=="--validate-only") {
|
||||
let result=env.validate();
|
||||
let _=coa_core::driver::run(root,coa_core::driver::Verb::StopAll);
|
||||
result?;
|
||||
println!("Startup and identity validation passed");
|
||||
return Ok(());
|
||||
}
|
||||
let outcome=update::apply(&update::Params{root,meta_dir:&meta,source:coa_core::pkgsource::Source::Dir(args[2].clone().into()),trusted_key:coa_core::signing::EMBEDDED_PUBLIC_KEY,cancel:Default::default(),resolutions:Default::default(),env:&env,fail_after_ops:None},&|phase,percent|println!("{percent}% {phase}"));
|
||||
let stopped=coa_core::driver::run(root,coa_core::driver::Verb::StopAll);
|
||||
println!("Shutdown after test: {:?}",stopped.map(|r|r.ok));
|
||||
let outcome=outcome?;
|
||||
println!("Final transaction: {:?}",outcome.txn.state);
|
||||
env.ensure_stopped()?;
|
||||
assert_eq!(outcome.txn.state,update::State::Committed);
|
||||
Ok(())
|
||||
}
|
||||
@@ -718,6 +718,28 @@ Spellbook.New = 5
|
||||
assert!(v.drift_keys.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn creature_rates_save_independently_in_template_and_active_config() {
|
||||
let (_d, root, meta) = fixture();
|
||||
let mut changes = BTreeMap::new();
|
||||
for (i, group) in ["Normal", "Elite.Elite", "Elite.RARE", "Elite.RAREELITE", "Elite.WORLDBOSS"].iter().enumerate() {
|
||||
for (j, stat) in ["Damage", "SpellDamage", "HP"].iter().enumerate() {
|
||||
changes.insert(format!("Rate.Creature.{group}.{stat}"), json!(0.25 + (i * 3 + j) as f64 * 0.25));
|
||||
}
|
||||
}
|
||||
let report = save(&root, &meta, Scope::Server, &changes).unwrap();
|
||||
assert_eq!(report.changed.len(), 15);
|
||||
assert_eq!(report.restart, Some(Restart::World));
|
||||
for path in ["Settings/worldserver.conf.template", "Core/configs/worldserver.conf"] {
|
||||
let conf = load_conf(&root.join(path)).unwrap();
|
||||
for (key, value) in &changes {
|
||||
assert_eq!(conf.get(key).unwrap().parse::<f64>().unwrap(), value.as_f64().unwrap(), "{path}: {key}");
|
||||
}
|
||||
assert_eq!(conf.get("Unknown.Custom"), Some("\"keep me\""));
|
||||
}
|
||||
assert!(save(&root, &meta, Scope::Server, &changes).unwrap().changed.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn save_changes_only_that_key_in_template_and_generated_conf() {
|
||||
let (_d, root, meta) = fixture();
|
||||
|
||||
@@ -44,6 +44,7 @@ pub mod release;
|
||||
pub mod report;
|
||||
pub mod release_schema;
|
||||
pub mod update;
|
||||
pub mod update_route;
|
||||
mod update_isolation;
|
||||
mod mysql_snapshot;
|
||||
pub mod wine;
|
||||
|
||||
@@ -93,6 +93,7 @@ pub struct Compatibility {
|
||||
pub core_commit: String,
|
||||
pub module_commits: std::collections::BTreeMap<String, String>,
|
||||
pub client_patch_version: String,
|
||||
/// Sources exercised during release qualification, not an exclusive updater allowlist.
|
||||
pub source_versions: Vec<String>,
|
||||
#[serde(default, skip_serializing_if = "std::collections::BTreeMap::is_empty")]
|
||||
pub source_databases: std::collections::BTreeMap<String, SourceDatabase>,
|
||||
|
||||
@@ -11,6 +11,7 @@ use crate::fsx;
|
||||
use crate::manifest::Migration;
|
||||
|
||||
const LEDGER_SCHEMA: &str = "acore_world";
|
||||
const AUTH_LEDGER_SCHEMA: &str = "acore_auth";
|
||||
const LEDGER_TABLE: &str = "coa_manager_migrations";
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
|
||||
@@ -37,6 +38,10 @@ pub trait Store {
|
||||
fn load(&self) -> Result<Vec<LedgerRow>>;
|
||||
fn load_readonly(&self) -> Result<Vec<LedgerRow>> { self.load() }
|
||||
fn put(&self, row: &LedgerRow) -> Result<()>;
|
||||
fn put_batch(&self, rows: &[LedgerRow]) -> Result<()> {
|
||||
for row in rows { self.put(row)?; }
|
||||
Ok(())
|
||||
}
|
||||
fn run_file(&self, schema: &str, file: &Path) -> Result<()>;
|
||||
}
|
||||
|
||||
@@ -48,59 +53,101 @@ fn ident_ok(s: &str) -> bool {
|
||||
!s.is_empty() && s.len() <= 150 && s.chars().all(|c| c.is_ascii_alphanumeric() || matches!(c, '_' | '.' | '-'))
|
||||
}
|
||||
|
||||
pub(crate) fn shared_auth(kind: &str) -> bool {
|
||||
matches!(db::schema_of(kind), Ok("acore_auth"))
|
||||
}
|
||||
|
||||
fn create_ledger(db: &Db, schema: &str) -> Result<()> {
|
||||
db.query(&format!("CREATE TABLE IF NOT EXISTS `{schema}`.`{LEDGER_TABLE}` (`db` VARCHAR(32) NOT NULL, `id` VARCHAR(190) NOT NULL, `sha256` CHAR(64) NOT NULL, `status` VARCHAR(16) NOT NULL, `applied_at` DATETIME NOT NULL, `error` TEXT NULL, `baseline` TINYINT NOT NULL DEFAULT 0, PRIMARY KEY (`db`,`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
impl Store for Db {
|
||||
fn load(&self) -> Result<Vec<LedgerRow>> {
|
||||
self.query(&format!(
|
||||
"CREATE TABLE IF NOT EXISTS `{LEDGER_SCHEMA}`.`{LEDGER_TABLE}` (`db` VARCHAR(32) NOT NULL, `id` VARCHAR(190) NOT NULL, `sha256` CHAR(64) NOT NULL, `status` VARCHAR(16) NOT NULL, `applied_at` DATETIME NOT NULL, `error` TEXT NULL, `baseline` TINYINT NOT NULL DEFAULT 0, PRIMARY KEY (`db`,`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
|
||||
))?;
|
||||
self.load_readonly()
|
||||
create_ledger(self, LEDGER_SCHEMA)?;
|
||||
create_ledger(self, AUTH_LEDGER_SCHEMA)?;
|
||||
let rows = self.load_readonly()?;
|
||||
// Preserve already-recorded core history even if a module later replaces its updates table.
|
||||
// A zero checksum remains unknown; importing it does not invent a checksum for old SQL.
|
||||
let selected: std::collections::BTreeMap<_, _> = rows.iter().map(|row| ((row.db.clone(), row.id.to_ascii_lowercase()), row)).collect();
|
||||
let core: Vec<_> = selected.values().filter(|r| r.status == Status::Applied && r.baseline && r.sha256 == "0".repeat(64)
|
||||
&& matches!(r.db.as_str(), "world" | "characters") && ident_ok(&r.id)).map(|r| (*r).clone()).collect();
|
||||
self.put_batch(&core)?;
|
||||
Ok(rows)
|
||||
}
|
||||
|
||||
fn load_readonly(&self) -> Result<Vec<LedgerRow>> {
|
||||
let out = if self.tables(LEDGER_SCHEMA)?.iter().any(|name| name == LEDGER_TABLE) {
|
||||
self.query(&format!("SELECT `db`,`id`,`sha256`,`status`,`baseline`,COALESCE(HEX(`error`),'') FROM `{LEDGER_SCHEMA}`.`{LEDGER_TABLE}` ORDER BY `db`,`id`;"))?
|
||||
} else { String::new() };
|
||||
let mut rows = Vec::new();
|
||||
// Files the core's own updater (or whoever prepared this database) already recorded count as applied.
|
||||
for (kind, schema) in db::SCHEMAS {
|
||||
if self.tables(schema)?.iter().any(|name| name == "updates") {
|
||||
let names = self.query(&format!("SELECT name FROM `{schema}`.`updates`;"))?;
|
||||
for name in names.lines().filter(|n| n.ends_with(".sql")) {
|
||||
rows.push(LedgerRow { db: kind.into(), id: name.trim_end_matches(".sql").into(), sha256: "0".repeat(64), status: Status::Applied, error: None, baseline: true });
|
||||
}
|
||||
// Resolve physical schemas once, then read all history in two client calls.
|
||||
// Using a neutral connection prevents a Wildcard query from rerouting the other realm.
|
||||
let connection = self.clone().for_realm(crate::realms::Mode::Coa);
|
||||
let world = self.realm_schema("acore_world");
|
||||
let characters = self.realm_schema("acore_characters");
|
||||
let other = if self.realm() == crate::realms::Mode::Coa { "acore_world_wildcard" } else { "acore_world" };
|
||||
let schemas: std::collections::BTreeSet<_> = [world, characters, other, AUTH_LEDGER_SCHEMA].into_iter().collect();
|
||||
let catalog = connection.query(&format!("SELECT table_schema,table_name FROM information_schema.tables WHERE table_schema IN ('{}') AND table_name IN ('updates','{LEDGER_TABLE}') AND table_type='BASE TABLE';", schemas.into_iter().collect::<Vec<_>>().join("','")))?;
|
||||
let available: std::collections::BTreeSet<_> = catalog.lines().filter_map(|line| line.split_once('\t')).collect();
|
||||
let text = |expression: &str| format!("CONVERT({expression} USING utf8mb4) COLLATE utf8mb4_bin");
|
||||
let mut queries = Vec::new();
|
||||
for (kind, schema) in [("characters", characters), ("auth", AUTH_LEDGER_SCHEMA), ("world", world)] {
|
||||
if available.contains(&(schema, "updates")) {
|
||||
queries.push(format!("SELECT 'core','{kind}',{},REPEAT('0',64),'applied',1,'' FROM `{schema}`.`updates` WHERE BINARY RIGHT(name,4)='.sql'",text("LEFT(name,CHAR_LENGTH(name)-4)")));
|
||||
}
|
||||
}
|
||||
for line in out.lines().filter(|l| !l.is_empty()) {
|
||||
let f: Vec<&str> = line.split('\t').collect();
|
||||
if f.len() < 5 {
|
||||
return Err(Error::Invalid("The database migration history is malformed; no SQL was replayed.".into()));
|
||||
for (origin, schema, filter) in [("local",world,""), ("other",other," WHERE `db` IN ('auth','coa-auth','wildcard-auth')"), ("shared",AUTH_LEDGER_SCHEMA,"")] {
|
||||
if available.contains(&(schema, LEDGER_TABLE)) {
|
||||
queries.push(format!("SELECT '{origin}',{},{},{},{},`baseline`,{} FROM `{schema}`.`{LEDGER_TABLE}`{filter}",text("`db`"),text("`id`"),text("`sha256`"),text("`status`"),text("COALESCE(HEX(`error`),'')")));
|
||||
}
|
||||
if !matches!(f[3], "applied" | "failed" | "running") || !ident_ok(f[1]) || f[2].len() != 64 || !f[2].chars().all(|c| c.is_ascii_hexdigit()) {
|
||||
}
|
||||
if queries.is_empty() { return Ok(vec![]); }
|
||||
let out = connection.query(&queries.join(" UNION ALL "))?;
|
||||
let (mut rows, mut local, mut auth, mut shared) = (Vec::new(), Vec::new(), Vec::new(), Vec::new());
|
||||
for line in out.lines().filter(|l| !l.is_empty()) {
|
||||
let f: Vec<_> = line.split('\t').collect();
|
||||
if f.len() < 6 { return Err(Error::Invalid("The database migration history is malformed; no SQL was replayed.".into())); }
|
||||
// Unrelated legacy filenames cannot match a valid manifest migration ID.
|
||||
if f[0] == "core" && !ident_ok(f[2]) { continue; }
|
||||
if !matches!(f[4], "applied" | "failed" | "running") || !ident_ok(f[2]) || f[3].len() != 64 || !f[3].chars().all(|c| c.is_ascii_hexdigit()) {
|
||||
return Err(Error::Invalid("The database migration history is invalid; no SQL was replayed.".into()));
|
||||
}
|
||||
let err = f.get(5).filter(|h| !h.is_empty()).and_then(|h| hex::decode(h).ok()).map(|b| String::from_utf8_lossy(&b).into_owned());
|
||||
rows.push(LedgerRow {
|
||||
db: f[0].into(),
|
||||
id: f[1].into(),
|
||||
sha256: f[2].into(),
|
||||
status: match f[3] { "applied" => Status::Applied, "running" => Status::Running, _ => Status::Failed },
|
||||
baseline: f[4] == "1",
|
||||
error: err,
|
||||
});
|
||||
let error = f.get(6).filter(|h| !h.is_empty()).and_then(|h| hex::decode(h).ok()).map(|b| String::from_utf8_lossy(&b).into_owned());
|
||||
let row = LedgerRow { db:f[1].into(), id:f[2].into(), sha256:f[3].into(), status:match f[4] { "applied"=>Status::Applied,"running"=>Status::Running,_=>Status::Failed }, baseline:f[5]=="1", error };
|
||||
match f[0] {
|
||||
"core" => rows.push(row),
|
||||
"local" if !shared_auth(&row.db) => local.push(row),
|
||||
"local" | "other" => auth.push(row),
|
||||
"shared" => shared.push(row),
|
||||
_ => return Err(Error::Invalid("Unknown migration history source.".into())),
|
||||
}
|
||||
}
|
||||
rows.extend(local);
|
||||
// An interrupted legacy auth execution must not be hidden by another realm's applied row.
|
||||
auth.sort_by_key(|r| (match r.status { Status::Applied=>0,Status::Running=>1,Status::Failed=>2,Status::Pending=>3 },r.sha256!="0".repeat(64)));
|
||||
for mut row in auth { row.db="auth".into(); rows.push(row); }
|
||||
// New auth records live with the shared account database and are authoritative.
|
||||
for mut row in shared {
|
||||
if !shared_auth(&row.db) { return Err(Error::Invalid("The shared authentication migration history is invalid.".into())); }
|
||||
rows.retain(|r| !(shared_auth(&r.db) && r.id.eq_ignore_ascii_case(&row.id)));
|
||||
row.db="auth".into(); rows.push(row);
|
||||
}
|
||||
Ok(rows)
|
||||
}
|
||||
|
||||
fn put(&self, r: &LedgerRow) -> Result<()> {
|
||||
if !ident_ok(&r.id) || !ident_ok(&r.db) || r.sha256.len() != 64 || !r.sha256.chars().all(|c| c.is_ascii_hexdigit()) {
|
||||
return Err(Error::Invalid("migration record has an invalid identifier".into()));
|
||||
fn put(&self, row: &LedgerRow) -> Result<()> { self.put_batch(std::slice::from_ref(row)) }
|
||||
|
||||
fn put_batch(&self, rows: &[LedgerRow]) -> Result<()> {
|
||||
let mut groups = std::collections::BTreeMap::<&str, Vec<String>>::new();
|
||||
for r in rows {
|
||||
if !ident_ok(&r.id) || !ident_ok(&r.db) || r.sha256.len() != 64 || !r.sha256.chars().all(|c| c.is_ascii_hexdigit()) {
|
||||
return Err(Error::Invalid("migration record has an invalid identifier".into()));
|
||||
}
|
||||
let status = match r.status { Status::Applied => "applied", Status::Running => "running", _ => "failed" };
|
||||
let error = r.error.as_deref().map(|e| format!("UNHEX('{}')", hex_of(e))).unwrap_or_else(|| "NULL".into());
|
||||
let (schema, kind) = if shared_auth(&r.db) { (AUTH_LEDGER_SCHEMA, "auth") } else { (LEDGER_SCHEMA, r.db.as_str()) };
|
||||
groups.entry(schema).or_default().push(format!("('{}','{}','{}','{status}',NOW(),{error},{})",kind,r.id,r.sha256,r.baseline as u8));
|
||||
}
|
||||
for (schema, values) in groups {
|
||||
self.query(&format!("REPLACE INTO `{schema}`.`{LEDGER_TABLE}` (`db`,`id`,`sha256`,`status`,`applied_at`,`error`,`baseline`) VALUES {};",values.join(",")))?;
|
||||
}
|
||||
let status = match r.status { Status::Applied => "applied", Status::Running => "running", _ => "failed" };
|
||||
let err = r.error.as_deref().map(|e| format!("UNHEX('{}')", hex_of(e))).unwrap_or_else(|| "NULL".into());
|
||||
self.query(&format!(
|
||||
"REPLACE INTO `{LEDGER_SCHEMA}`.`{LEDGER_TABLE}` (`db`,`id`,`sha256`,`status`,`applied_at`,`error`,`baseline`) VALUES ('{}','{}','{}','{status}',NOW(),{err},{});",
|
||||
r.db, r.id, r.sha256, r.baseline as u8
|
||||
))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -137,21 +184,34 @@ pub fn status(store: &dyn Store, list: &[Migration]) -> Result<Vec<Item>> {
|
||||
.map(|m| {
|
||||
// Manager records are appended after the core's updates table and are authoritative.
|
||||
let row = recorded(&rows, m);
|
||||
let changed = row.is_some_and(|r| hash_changed(r, m));
|
||||
let history = effective_history(&rows, m);
|
||||
let changed = history.iter().any(|r| hash_changed(r,m));
|
||||
let interrupted = history.iter().find(|r| matches!(r.status, Status::Running | Status::Failed));
|
||||
Item {
|
||||
id: m.id.clone(),
|
||||
db: m.db.clone(),
|
||||
status: if changed || row.is_some_and(|r| r.status == Status::Running) { Status::Failed } else { row.map(|r| r.status).unwrap_or(Status::Pending) },
|
||||
status: if changed || interrupted.is_some() { Status::Failed } else { row.map(|r| r.status).unwrap_or(Status::Pending) },
|
||||
destructive: m.destructive,
|
||||
baseline: row.map(|r| r.baseline).unwrap_or(false),
|
||||
error: if changed { Some("An already applied SQL file changed. Publish a new migration instead of replaying it.".into()) } else { row.and_then(|r| r.error.clone()) },
|
||||
error: if changed { Some("An already applied SQL file changed. Publish a new migration instead of replaying it.".into()) } else { interrupted.and_then(|r| r.error.clone()).or_else(|| row.and_then(|r| r.error.clone())) },
|
||||
}
|
||||
})
|
||||
.collect())
|
||||
}
|
||||
|
||||
fn recorded<'a>(rows: &'a [LedgerRow], m: &Migration) -> Option<&'a LedgerRow> {
|
||||
rows.iter().rev().find(|r| r.db == m.db && r.id == m.id)
|
||||
rows.iter().rev().find(|r| (r.db == m.db || shared_auth(&r.db) && shared_auth(&m.db)) && r.id.eq_ignore_ascii_case(&m.id))
|
||||
}
|
||||
|
||||
fn effective_history<'a>(rows: &'a [LedgerRow], m: &Migration) -> Vec<&'a LedgerRow> {
|
||||
if shared_auth(&m.db) { rows.iter().filter(|r| shared_auth(&r.db) && r.id.eq_ignore_ascii_case(&m.id)).collect() }
|
||||
else { recorded(rows, m).into_iter().collect() }
|
||||
}
|
||||
|
||||
fn preserve_auth_history(store: &dyn Store, rows: &[LedgerRow], list: &[Migration]) -> Result<()> {
|
||||
let applied: Vec<_> = list.iter().filter(|m| shared_auth(&m.db)).filter_map(|m| recorded(rows,m))
|
||||
.filter(|r| r.status == Status::Applied).cloned().collect();
|
||||
store.put_batch(&applied)
|
||||
}
|
||||
|
||||
/// Migrations that were published with different bytes but have the same effect, so a server that applied either
|
||||
@@ -166,7 +226,7 @@ const SAME_EFFECT: &[(&str, &[&str])] = &[(
|
||||
)];
|
||||
|
||||
fn same_effect(id: &str, a: &str, b: &str) -> bool {
|
||||
SAME_EFFECT.iter().any(|(known, hashes)| *known == id
|
||||
SAME_EFFECT.iter().any(|(known, hashes)| known.eq_ignore_ascii_case(id)
|
||||
&& hashes.iter().any(|h| h.eq_ignore_ascii_case(a)) && hashes.iter().any(|h| h.eq_ignore_ascii_case(b)))
|
||||
}
|
||||
|
||||
@@ -183,8 +243,7 @@ pub fn preflight(store: &dyn Store, list: &[Migration]) -> Result<()> {
|
||||
|
||||
pub fn pending_count(store: &dyn Store, list: &[Migration]) -> Result<usize> {
|
||||
let rows = store.load_readonly()?;
|
||||
check_history(&rows, list)?;
|
||||
Ok(list.iter().filter(|m| recorded(&rows, m).is_none_or(|r| r.status != Status::Applied)).count())
|
||||
Ok(pending_migrations(&rows, list)?.len())
|
||||
}
|
||||
|
||||
fn verified_file(m: &Migration, dir: &Path) -> Result<(&'static str, std::path::PathBuf, bool)> {
|
||||
@@ -199,22 +258,39 @@ fn verified_file(m: &Migration, dir: &Path) -> Result<(&'static str, std::path::
|
||||
|
||||
/// Check every migration artifact, including applied history, before replacing server files.
|
||||
pub fn verify_files(list: &[Migration], dir: &Path) -> Result<()> {
|
||||
validate_list(list)?;
|
||||
for m in list { verified_file(m, dir)?; }
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn validate_list(list: &[Migration]) -> Result<()> {
|
||||
let mut seen = std::collections::BTreeSet::new();
|
||||
for m in list {
|
||||
if !seen.insert((&m.db, &m.id)) { return Err(Error::InvalidManifest(format!("duplicate migration {} ({})", m.id, m.db))); }
|
||||
verified_file(m, dir)?;
|
||||
if !ident_ok(&m.id) { return Err(Error::InvalidManifest(format!("migration id {:?} is not allowed", m.id))); }
|
||||
let schema = db::schema_of(&m.db)?;
|
||||
if !seen.insert((schema, m.id.to_ascii_lowercase())) {
|
||||
return Err(Error::InvalidManifest(format!("duplicate migration {} ({})", m.id, m.db)));
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn pending_migrations<'a>(rows: &[LedgerRow], list: &'a [Migration]) -> Result<Vec<&'a Migration>> {
|
||||
check_history(rows, list)?;
|
||||
Ok(list.iter().filter(|m| recorded(rows, m).is_none_or(|r| r.status != Status::Applied)).collect())
|
||||
}
|
||||
|
||||
fn check_history(rows: &[LedgerRow], list: &[Migration]) -> Result<()> {
|
||||
validate_list(list)?;
|
||||
for m in list {
|
||||
if recorded(rows, m).is_some_and(|r| matches!(r.status, Status::Running | Status::Failed)) {
|
||||
for row in effective_history(rows,m) {
|
||||
if matches!(row.status, Status::Running | Status::Failed) {
|
||||
return Err(Error::Invalid(format!("Database update {} ({}) failed or was interrupted and may be partially applied. Restore its recovery point before retrying.", m.id, m.db)));
|
||||
}
|
||||
if recorded(rows, m).is_some_and(|r| hash_changed(r, m)) {
|
||||
if hash_changed(row,m) {
|
||||
return Err(Error::Invalid(format!("Applied database update {} ({}) has a different checksum. A new migration is required; it was not replayed.", m.id, m.db)));
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -223,9 +299,11 @@ fn check_history(rows: &[LedgerRow], list: &[Migration]) -> Result<()> {
|
||||
/// was brought up to date by hand).
|
||||
pub fn baseline(store: &dyn Store, list: &[Migration]) -> Result<usize> {
|
||||
let rows = store.load()?;
|
||||
check_history(&rows,list)?;
|
||||
preserve_auth_history(store,&rows,list)?;
|
||||
let mut n = 0;
|
||||
for m in list {
|
||||
if rows.iter().any(|r| r.db == m.db && r.id == m.id && r.status == Status::Applied) {
|
||||
if recorded(&rows,m).is_some_and(|r| r.status == Status::Applied) {
|
||||
continue;
|
||||
}
|
||||
store.put(&LedgerRow { db: m.db.clone(), id: m.id.clone(), sha256: m.sha256.clone(), status: Status::Applied, error: None, baseline: true })?;
|
||||
@@ -246,8 +324,7 @@ pub struct ApplyReport {
|
||||
pub fn apply_pending(store: &dyn Store, list: &[Migration], dir: &Path, snapshot: &dyn Fn() -> Result<String>) -> Result<ApplyReport> {
|
||||
let rows = store.load()?;
|
||||
// The list order is the release's order of application (released updates, then pending, then modules).
|
||||
check_history(&rows, list)?;
|
||||
let todo: Vec<&Migration> = list.iter().filter(|m| recorded(&rows, m).is_none_or(|r| r.status != Status::Applied)).collect();
|
||||
let todo = pending_migrations(&rows, list)?;
|
||||
tracing::info!(total = list.len(), pending = todo.len(), skipped = list.len() - todo.len(), "database migration plan");
|
||||
|
||||
// Resolve and verify every file before running anything.
|
||||
@@ -261,11 +338,13 @@ pub fn apply_pending(store: &dyn Store, list: &[Migration], dir: &Path, snapshot
|
||||
|
||||
let mut report = ApplyReport { applied: Vec::new(), failed: None, snapshot: None };
|
||||
if files.is_empty() {
|
||||
preserve_auth_history(store,&rows,list)?;
|
||||
return Ok(report);
|
||||
}
|
||||
if any_destructive {
|
||||
report.snapshot = Some(snapshot().map_err(|e| Error::Invalid(format!("No database update was applied because the safety backup failed: {e}")))?);
|
||||
}
|
||||
preserve_auth_history(store,&rows,list)?;
|
||||
for (m, schema, path) in files {
|
||||
tracing::info!(migration = %m.id, database = %m.db, "database migration starting");
|
||||
store.put(&LedgerRow { db: m.db.clone(), id: m.id.clone(), sha256: m.sha256.clone(), status: Status::Running, error: Some("Interrupted SQL must be recovered before replay.".into()), baseline: false })?;
|
||||
@@ -368,6 +447,23 @@ mod tests {
|
||||
assert!(store.ran.borrow().is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_entry_point_rejects_duplicate_sql_before_execution() {
|
||||
let (dir, original) = setup(&[("world", "once", "SELECT 1;\n")]);
|
||||
for alias in ["world", "coa-world"] {
|
||||
let mut list = original.clone();
|
||||
let mut duplicate = original[0].clone();
|
||||
duplicate.db = alias.into();
|
||||
list.push(duplicate);
|
||||
let store = Mem::default();
|
||||
assert!(preflight(&store, &list).is_err());
|
||||
assert!(pending_count(&store, &list).is_err());
|
||||
assert!(apply_pending(&store, &list, dir.path(), &no_snapshot).is_err());
|
||||
assert!(store.ran.borrow().is_empty());
|
||||
assert!(store.rows.borrow().is_empty());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn staged_files_reject_missing_corrupt_duplicate_and_invalid_migrations() {
|
||||
let (dir, list) = setup(&[("characters", "repair", "SELECT 1;\n")]);
|
||||
|
||||
@@ -129,10 +129,6 @@ pub(crate) fn inventory(root: &Path) -> Result<BTreeMap<String, String>> {
|
||||
}
|
||||
|
||||
pub(crate) fn copy_verified(source: &Path, target: &Path, files: &BTreeMap<String, String>) -> Result<()> {
|
||||
copy_verified_with_progress(source, target, files, &|_| {})
|
||||
}
|
||||
|
||||
fn copy_verified_with_progress(source: &Path, target: &Path, files: &BTreeMap<String, String>, report: &dyn Fn(&str)) -> Result<()> {
|
||||
if target.exists() { return Err(Error::Invalid("Database snapshot destination already exists.".into())); }
|
||||
let bytes = files.keys().try_fold(0u64, |total, name| -> Result<u64> {
|
||||
let path = fsx::ensure_within(source, &fsx::safe_join(source, name)?)?;
|
||||
@@ -142,15 +138,13 @@ fn copy_verified_with_progress(source: &Path, target: &Path, files: &BTreeMap<St
|
||||
fs::create_dir_all(parent)?;
|
||||
fsx::require_space(parent, bytes)?;
|
||||
fs::create_dir(target)?;
|
||||
for (index, (relative, expected)) in files.iter().enumerate() {
|
||||
if index % 250 == 0 { report(&format!("Copying private server files: {} of {}", index, files.len())); }
|
||||
for (relative, expected) in files {
|
||||
let source_file = fsx::ensure_within(source, &fsx::safe_join(source, relative)?)?;
|
||||
let target_file = fsx::ensure_within(target, &fsx::safe_join(target, relative)?)?;
|
||||
fs::create_dir_all(target_file.parent().unwrap())?;
|
||||
fs::copy(&source_file, &target_file)?;
|
||||
if fsx::sha256_file(&target_file)? != *expected { return Err(Error::Invalid(format!("Database snapshot file {relative} failed verification."))); }
|
||||
}
|
||||
report("Verifying the complete private file copy");
|
||||
if inventory(target)? != *files { return Err(Error::Invalid("Database snapshot inventory differs.".into())); }
|
||||
Ok(())
|
||||
}
|
||||
@@ -250,99 +244,6 @@ pub(crate) fn verify(point: &Path, snapshot: &Snapshot) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn rehearsal_copy_with_progress(root: &Path, meta: &Path, point: &Path, snapshot: &Snapshot, report: &dyn Fn(&str)) -> Result<PathBuf> {
|
||||
report("Verifying the database recovery copy before rehearsal");
|
||||
verify(point, snapshot)?;
|
||||
let canonical = fsx::canonicalize_lenient(root)?;
|
||||
let root = canonical.as_path();
|
||||
let destination = meta.join("rehearsals").join(uuid::Uuid::new_v4().simple().to_string()).join("server");
|
||||
let mut files = BTreeMap::new();
|
||||
let mut directories = vec![root.to_path_buf()];
|
||||
while let Some(directory) = directories.pop() {
|
||||
for entry in fs::read_dir(directory)? {
|
||||
let entry = entry?;
|
||||
let raw = entry.path();
|
||||
let relative = raw.strip_prefix(root).map_err(|e| Error::Invalid(e.to_string()))?.to_string_lossy().replace('\\', "/");
|
||||
let lower = relative.to_ascii_lowercase();
|
||||
let first = lower.split('/').next().unwrap();
|
||||
if entry.file_type()?.is_dir() && !relative.contains('/')
|
||||
&& !["core", "data", "scripts", "settings", "runtime", "mysql", ".realms", "bugreport", "extras", "licenses"].contains(&first) { continue; }
|
||||
if lower == "mysql/data" || lower.starts_with("mysql/data-")
|
||||
|| lower.split('/').any(|part| part == ".state")
|
||||
|| lower == "bugreport/reports" || lower == "core/logs" || lower == "mysql/logs" { continue; }
|
||||
let metadata = fs::symlink_metadata(&raw)?;
|
||||
reject_link(&metadata)?;
|
||||
let path = fsx::ensure_within(root, &raw)?;
|
||||
if metadata.is_dir() { directories.push(path); }
|
||||
else if metadata.is_file() {
|
||||
files.insert(relative, fsx::sha256_file(&path)?);
|
||||
if files.len() % 250 == 0 { report(&format!("Preparing the private copy: {} files checked", files.len())); }
|
||||
}
|
||||
else { return Err(Error::Invalid("Unsupported rehearsal file.".into())); }
|
||||
}
|
||||
}
|
||||
copy_verified_with_progress(root, &destination, &files, report)?;
|
||||
report("Restoring MySQL into the private server copy");
|
||||
copy_snapshot(point, snapshot, &destination.join("mysql/data"))?;
|
||||
let (_, mut installed) = crate::registry::MetaDir::open(meta)?;
|
||||
installed.id = uuid::Uuid::new_v4().to_string();
|
||||
installed.server_path = destination.to_string_lossy().into_owned();
|
||||
installed.client_path = None;
|
||||
crate::registry::MetaDir::create(&destination, &installed)?;
|
||||
Ok(destination)
|
||||
}
|
||||
|
||||
pub(crate) fn isolate_connections(root: &Path) -> Result<()> {
|
||||
for relative in ["Settings/worldserver.conf.template", "Settings/authserver.conf.template", "Core/configs/worldserver.conf", "Core/configs/authserver.conf"] {
|
||||
let path = fsx::ensure_within(root, &root.join(relative))?;
|
||||
if !path.is_file() {
|
||||
if relative.ends_with(".template") { return Err(Error::Invalid("The private update copy lacks connection templates.".into())); }
|
||||
continue;
|
||||
}
|
||||
let mut config = crate::config::parser::ConfFile::parse_bytes(&fs::read(&path)?)?;
|
||||
for key in ["LoginDatabaseInfo", "WorldDatabaseInfo", "CharacterDatabaseInfo"] {
|
||||
if relative.contains("worldserver") || key == "LoginDatabaseInfo" {
|
||||
config.set(key, &format!("\"@{key}@\""), &[]);
|
||||
}
|
||||
}
|
||||
config.set("BindIP", "\"127.0.0.1\"", &[]);
|
||||
if relative.contains("worldserver") {
|
||||
config.set("Ra.IP", "\"127.0.0.1\"", &[]);
|
||||
config.set("DataDir", "\"@DATA@\"", &[]);
|
||||
}
|
||||
fsx::atomic_write(&path, config.to_text().as_bytes())?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn unchanged(root: &Path, snapshot: &Snapshot) -> Result<()> {
|
||||
let data = fsx::ensure_within(root, &root.join("mysql/data"))?;
|
||||
if inventory(&data)? != snapshot.files || directories(&data)? != snapshot.directories {
|
||||
return Err(Error::Invalid("The installed database changed during the private rehearsal. Retry after stopping other database access.".into()));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn validate_connections(templates: &Path, installation: &Path) -> Result<()> {
|
||||
let port = crate::layout::read_ports(installation).mysql.to_string();
|
||||
let (_, password) = crate::db::credentials(installation)?;
|
||||
let realm = crate::realms::state(installation)?.active;
|
||||
for relative in ["Settings/worldserver.conf.template", "Settings/authserver.conf.template"] {
|
||||
let path = fsx::ensure_within(templates, &templates.join(relative))?;
|
||||
let config = crate::config::parser::ConfFile::parse_bytes(&fs::read(path)?)?;
|
||||
for (key, kind) in [("LoginDatabaseInfo", "auth"), ("WorldDatabaseInfo", "world"), ("CharacterDatabaseInfo", "characters")] {
|
||||
if relative.contains("authserver") && kind != "auth" { continue; }
|
||||
let value = config.get(key).ok_or_else(|| Error::Invalid(format!("The update cannot isolate the missing {key} connection.")))?.trim().trim_matches('"');
|
||||
if value == format!("@{key}@") { continue; }
|
||||
let fields: Vec<_> = value.split(';').collect();
|
||||
if fields.len() != 5 || !matches!(fields[0], "127.0.0.1" | "localhost") || fields[1] != port || fields[2] != "acore" || fields[3] != password || fields[4] != realm.schema(kind)? {
|
||||
return Err(Error::Invalid(format!("The {key} connection does not use this repack's bundled database. A private update cannot safely qualify an external database.")));
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Keep the replaced data directory. If interrupted between renames, a retry can install a new verified copy.
|
||||
pub(crate) fn swap(root: &Path, meta: &Path, point: &Path, snapshot: &Snapshot, fail_after_move: bool) -> Result<PathBuf> {
|
||||
verify(point, snapshot)?;
|
||||
@@ -570,6 +471,46 @@ mod tests {
|
||||
};
|
||||
let mut server = start();
|
||||
db.query("CREATE DATABASE acore_characters; CREATE DATABASE acore_world; CREATE DATABASE acore_auth; CREATE TABLE acore_characters.probe(id INT PRIMARY KEY, note VARCHAR(40)); CREATE TABLE acore_world.probe(id INT NOT NULL DEFAULT 0); INSERT INTO acore_world.probe VALUES(43); CREATE TABLE acore_auth.probe(id INT); INSERT INTO acore_auth.probe VALUES(44); CREATE USER 'fixture_user'@'localhost' IDENTIFIED BY 'fixture'; CREATE TRIGGER acore_characters.probe_insert BEFORE INSERT ON acore_characters.probe FOR EACH ROW SET NEW.note='triggered'; INSERT INTO acore_characters.probe VALUES(42,'original'); CREATE VIEW acore_characters.probe_view AS SELECT c.id,w.id AS world_id FROM acore_characters.probe c CROSS JOIN acore_world.probe w; CREATE PROCEDURE acore_characters.probe_proc() SELECT id FROM acore_characters.probe; CREATE FUNCTION acore_characters.probe_func() RETURNS INT DETERMINISTIC RETURN 73;").unwrap();
|
||||
// Shared auth must not run again when the active realm changes.
|
||||
use crate::migrations::Store;
|
||||
db.query("CREATE DATABASE acore_world_wildcard;").unwrap();
|
||||
let migration_dir = root.join("migration-fixture");
|
||||
fs::create_dir_all(migration_dir.join("auth")).unwrap();
|
||||
fs::create_dir_all(migration_dir.join("world")).unwrap();
|
||||
let auth_sql = b"INSERT INTO acore_auth.probe VALUES(45);";
|
||||
fs::write(migration_dir.join("auth/shared_once.sql"), auth_sql).unwrap();
|
||||
let auth_list = vec![crate::manifest::Migration { id:"shared_once".into(), db:"auth".into(), sha256:fsx::sha256_bytes(auth_sql), destructive:false, compatible_sha256:vec![] }];
|
||||
assert_eq!(crate::migrations::apply_pending(&db, &auth_list, &migration_dir, &|| Ok("fixture".into())).unwrap().applied.len(), 1);
|
||||
let wildcard = db.clone().for_realm(crate::realms::Mode::Wildcard);
|
||||
assert_eq!(crate::migrations::pending_count(&wildcard, &auth_list).unwrap(), 0, "auth is shared by both realms");
|
||||
assert!(crate::migrations::apply_pending(&wildcard, &auth_list, &migration_dir, &|| Ok("fixture".into())).unwrap().applied.is_empty());
|
||||
assert_eq!(db.query("SELECT COUNT(*) FROM acore_auth.probe WHERE id=45;").unwrap(), "1");
|
||||
let mut failed = crate::migrations::LedgerRow { db:"auth".into(), id:"shared_once".into(), sha256:auth_list[0].sha256.clone(), status:crate::migrations::Status::Failed, error:Some("interrupted fixture".into()), baseline:false };
|
||||
db.put(&failed).unwrap();
|
||||
assert!(crate::migrations::pending_count(&wildcard, &auth_list).is_err());
|
||||
failed.status = crate::migrations::Status::Applied; failed.error = None; db.put(&failed).unwrap();
|
||||
|
||||
|
||||
// Legacy per-world auth records are adopted without replaying their SQL.
|
||||
let legacy_sql = b"INSERT INTO acore_auth.probe VALUES(46);";
|
||||
fs::write(migration_dir.join("auth/legacy_auth.sql"), legacy_sql).unwrap();
|
||||
db.query(&format!("INSERT INTO acore_auth.probe VALUES(46); REPLACE INTO acore_world.coa_manager_migrations VALUES('auth','legacy_auth','{}','applied',NOW(),NULL,0);", fsx::sha256_bytes(legacy_sql))).unwrap();
|
||||
let legacy_auth = vec![crate::manifest::Migration { id:"legacy_auth".into(), db:"auth".into(), sha256:fsx::sha256_bytes(legacy_sql), destructive:false, compatible_sha256:vec![] }];
|
||||
assert_eq!(crate::migrations::pending_count(&wildcard, &legacy_auth).unwrap(), 0);
|
||||
assert!(crate::migrations::apply_pending(&wildcard, &legacy_auth, &migration_dir, &|| Ok("fixture".into())).unwrap().applied.is_empty());
|
||||
assert_eq!(db.query("SELECT COUNT(*) FROM acore_auth.probe WHERE id=46;").unwrap(), "1");
|
||||
|
||||
// A core history cleanup cannot make previously recorded SQL pending again.
|
||||
db.query("CREATE TABLE acore_world.updates(name VARCHAR(150) PRIMARY KEY) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; INSERT INTO acore_world.updates VALUES('LEGACY_WORLD.sql'); INSERT INTO acore_world.probe VALUES(99);").unwrap();
|
||||
db.load().unwrap();
|
||||
db.query("DROP TABLE acore_world.updates;").unwrap();
|
||||
let legacy_world_sql = b"INSERT INTO acore_world.probe VALUES(99);";
|
||||
fs::write(migration_dir.join("world/legacy_world.sql"), legacy_world_sql).unwrap();
|
||||
let legacy_world = vec![crate::manifest::Migration { id:"legacy_world".into(), db:"world".into(), sha256:fsx::sha256_bytes(legacy_world_sql), destructive:false, compatible_sha256:vec![] }];
|
||||
assert_eq!(crate::migrations::pending_count(&db, &legacy_world).unwrap(), 0);
|
||||
assert!(crate::migrations::apply_pending(&db, &legacy_world, &migration_dir, &|| Ok("fixture".into())).unwrap().applied.is_empty());
|
||||
assert_eq!(db.query("SELECT COUNT(*) FROM acore_world.probe WHERE id=99;").unwrap(), "1");
|
||||
db.query("DELETE FROM acore_world.probe WHERE id=99;").unwrap();
|
||||
assert_eq!(db.recovery_objects("acore_characters").unwrap().len(), 4);
|
||||
db.query("CREATE TABLE acore_characters.coa_squid_pending(path VARCHAR(255), sha256 CHAR(64)); INSERT INTO acore_characters.coa_squid_pending VALUES('playerbots/base/ai_playerbot_texts.sql', REPEAT('a',64));").unwrap();
|
||||
let squid_problems = crate::squid::database_problems(&root, crate::realms::Mode::Coa, &|sql| {
|
||||
@@ -660,45 +601,10 @@ mod tests {
|
||||
fsx::atomic_write(&archive_path, b"damaged").unwrap();
|
||||
assert!(verify(&point, &snapshot).is_err());
|
||||
}
|
||||
#[test]
|
||||
fn private_rehearsals_reject_external_database_connections() {
|
||||
let (_temp, root, _meta, _point, _snapshot) = fixture();
|
||||
fsx::atomic_write_json(&root.join("Settings/repack.json"), &serde_json::json!({"mysqlPort":3307})).unwrap();
|
||||
fsx::atomic_write_json(&root.join("Settings/database.json"), &serde_json::json!({"rootPassword":"test-root","appPassword":"test-app"})).unwrap();
|
||||
fsx::atomic_write(&root.join("Settings/worldserver.conf.template"), b"LoginDatabaseInfo = \"@LoginDatabaseInfo@\"\nWorldDatabaseInfo = \"@WorldDatabaseInfo@\"\nCharacterDatabaseInfo = \"@CharacterDatabaseInfo@\"\n").unwrap();
|
||||
fsx::atomic_write(&root.join("Settings/authserver.conf.template"), b"LoginDatabaseInfo = \"127.0.0.1;3307;acore;test-app;acore_auth\"\n").unwrap();
|
||||
validate_connections(&root, &root).unwrap();
|
||||
fsx::atomic_write(&root.join("Settings/authserver.conf.template"), b"LoginDatabaseInfo = \"192.0.2.1;3307;acore;test-app;acore_auth\"\n").unwrap();
|
||||
let error = validate_connections(&root, &root).unwrap_err().to_string();
|
||||
assert!(error.contains("external database"));
|
||||
assert!(!error.contains("test-app"));
|
||||
}
|
||||
#[test]
|
||||
fn a_changed_live_database_invalidates_the_rehearsal() {
|
||||
let (_temp, root, _meta, _point, snapshot) = fixture();
|
||||
assert!(unchanged(&root, &snapshot).is_err());
|
||||
fsx::atomic_write(&root.join("mysql/data/characters.ibd"), b"saved").unwrap();
|
||||
fs::create_dir_all(root.join("mysql/data/empty_schema")).unwrap();
|
||||
unchanged(&root, &snapshot).unwrap();
|
||||
fsx::atomic_write(&root.join("mysql/data/extra.ibd"), b"new data").unwrap();
|
||||
assert!(unchanged(&root, &snapshot).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rehearsal_copy_succeeds_with_nested_directories_and_unnormalized_root() {
|
||||
let (_temp, root, meta, point, snapshot) = fixture();
|
||||
let meta_obj = crate::registry::InstallMeta::new(crate::registry::InstallKind::New, &root);
|
||||
fsx::atomic_write_json(&meta.join("install.json"), &meta_obj).unwrap();
|
||||
fsx::atomic_write(&root.join("Core/worldserver.exe"), b"exe").unwrap();
|
||||
fsx::atomic_write(&root.join("Core/configs/worldserver.conf"), b"conf").unwrap();
|
||||
fsx::atomic_write(&root.join("Settings/repack.json"), b"{}").unwrap();
|
||||
let phases = std::cell::RefCell::new(Vec::new());
|
||||
let dest = rehearsal_copy_with_progress(&root, &meta, &point, &snapshot, &|phase| phases.borrow_mut().push(phase.to_string())).unwrap();
|
||||
assert_eq!(fs::read(dest.join("Core/configs/worldserver.conf")).unwrap(), b"conf");
|
||||
assert_eq!(fs::read(dest.join("mysql/data/characters.ibd")).unwrap(), b"saved");
|
||||
let phases = phases.into_inner();
|
||||
assert!(phases[0].contains("Verifying the database"));
|
||||
assert!(phases.iter().any(|phase| phase.contains("Copying private server files")));
|
||||
assert!(phases.last().unwrap().contains("Restoring MySQL"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -348,7 +348,8 @@ AC>";
|
||||
let (port, _h) = fake_ra("Account not found.");
|
||||
let mut ra = Ra::connect_to(port, "u", "p").unwrap();
|
||||
assert!(ra.set_account_password("x", "newpass9").is_err(), "the name is validated before anything is sent");
|
||||
assert!(ra.set_account_password("Nobody", "newpass9").unwrap_err().to_string().contains("not found"));
|
||||
let error = ra.set_account_password("Nobody", "newpass9").unwrap_err().to_string();
|
||||
assert!(error.contains("not found"), "Unexpected console error: {error}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -14,8 +14,6 @@ impl crate::update::Env for QualificationEnv<'_> {
|
||||
fn preflight(&self, manifest: &crate::manifest::Manifest) -> Result<()> { self.0.preflight(manifest) }
|
||||
fn snapshot(&self) -> Result<String> { self.0.snapshot() }
|
||||
fn verify_snapshot(&self, id: &str) -> Result<()> { self.0.verify_snapshot(id) }
|
||||
fn rehearse(&self, manifest: &crate::manifest::Manifest, tree: &Path, items: &[crate::update::PlanItem], point: &str) -> Result<()> { self.0.rehearse(manifest, tree, items, point) }
|
||||
fn rehearse_with_progress(&self, manifest: &crate::manifest::Manifest, tree: &Path, items: &[crate::update::PlanItem], point: &str, report: &dyn Fn(&str, u8)) -> Result<()> { self.0.rehearse_with_progress(manifest, tree, items, point, report) }
|
||||
fn restore_snapshot(&self, id: &str) -> Result<()> { self.0.restore_snapshot(id) }
|
||||
fn migrate(&self, manifest: &crate::manifest::Manifest, staged: &Path) -> Result<crate::migrations::ApplyReport> { self.0.migrate(manifest, staged) }
|
||||
fn validate(&self) -> Result<()> { self.0.validate() }
|
||||
@@ -87,7 +85,7 @@ pub fn qualify_upgrade(base: &Path, source: &Path, candidate: &Path, fixture: &P
|
||||
"schema": 1, "result": "passed", "fromVersion": source_manifest.version,
|
||||
"toVersion": candidate_manifest.version, "fromManifestSha256": fsx::sha256_bytes(&source_bytes),
|
||||
"fromSchemaSha256": source_manifest.files.iter().find(|file| file.path == schema_check::CONTRACT).map(|file| &file.sha256),
|
||||
"checks": ["manager-transaction", "private-user-database-rehearsal", "database-schema", "private-auth-world-startup", "existing-identities", "user-file-preservation"],
|
||||
"checks": ["manager-transaction", "recovery-backed-database-update", "database-schema", "private-auth-world-startup", "existing-identities", "user-file-preservation"],
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
+87
-188
@@ -92,9 +92,6 @@ pub trait Env {
|
||||
fn ensure_stopped(&self) -> Result<()>;
|
||||
fn preflight(&self, _manifest: &Manifest) -> Result<()> { Ok(()) }
|
||||
fn verify_snapshot(&self, _id: &str) -> Result<()> { Ok(()) }
|
||||
fn rehearse(&self, _manifest: &Manifest, _tree: &Path, _items: &[PlanItem], _point: &str) -> Result<()> { Ok(()) }
|
||||
fn rehearse_with_progress(&self, manifest: &Manifest, tree: &Path, items: &[PlanItem], point: &str, _report: &dyn Fn(&str, u8)) -> Result<()> { self.rehearse(manifest, tree, items, point) }
|
||||
/// Create a recovery point for the databases and configuration; returns its id.
|
||||
fn snapshot(&self) -> Result<String>;
|
||||
fn restore_snapshot(&self, id: &str) -> Result<()>;
|
||||
fn migrate(&self, manifest: &Manifest, staged_migrations: &Path) -> Result<ApplyReport>;
|
||||
@@ -296,6 +293,8 @@ pub fn plan(root: &Path, meta: &InstallMeta, manifest: &Manifest, resolutions: &
|
||||
pub struct Preview {
|
||||
pub from_version: Option<String>,
|
||||
pub to_version: String,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub latest_version: Option<String>,
|
||||
pub items: Vec<PlanItem>,
|
||||
pub conflicts: Vec<String>,
|
||||
pub migrations: usize,
|
||||
@@ -337,7 +336,7 @@ pub fn preview_with(root: &Path, meta: &InstallMeta, source: &Source, trusted_ke
|
||||
let meta_dir = crate::registry::metadata_dir_for(root)?;
|
||||
let observed_version = MetaDir::open(&meta_dir)?.1.core.version;
|
||||
let (m, _) = fetch_manifest(source, trusted_key)?;
|
||||
let _lock = operation_lock_for(&meta_dir, "checking updates", false)?;
|
||||
let _lock = operation_lock_for(&meta_dir, "checking updates", true)?;
|
||||
ensure_recovered(&meta_dir)?;
|
||||
let (_, current_meta) = MetaDir::open(&meta_dir)?;
|
||||
let meta = if current_meta.core.version != observed_version { ¤t_meta } else { meta };
|
||||
@@ -345,7 +344,7 @@ pub fn preview_with(root: &Path, meta: &InstallMeta, source: &Source, trusted_ke
|
||||
reject_downgrade(meta, &m)?;
|
||||
let mut items = plan(root, meta, &m, resolutions, None)?;
|
||||
if items.iter().any(|item| item.path == "Scripts/manage.py" && item.action != Action::Skip)
|
||||
&& launcher_already_integrated(root, &meta_dir, meta, &m, source)? {
|
||||
&& launcher_already_integrated(root, meta, &m)? {
|
||||
if let Some(item) = items.iter_mut().find(|item| item.path == "Scripts/manage.py") {
|
||||
item.action = Action::Skip;
|
||||
item.reason = Some("already up to date with Manager integration".into());
|
||||
@@ -364,6 +363,7 @@ pub fn preview_with(root: &Path, meta: &InstallMeta, source: &Source, trusted_ke
|
||||
Ok(Preview {
|
||||
from_version: meta.core.version.clone(),
|
||||
to_version: m.version.clone(),
|
||||
latest_version: None,
|
||||
conflicts: items.iter().filter(|i| i.action == Action::Conflict).map(|i| i.path.clone()).collect(),
|
||||
items,
|
||||
migrations: m.migrations.len(),
|
||||
@@ -374,27 +374,11 @@ pub fn preview_with(root: &Path, meta: &InstallMeta, source: &Source, trusted_ke
|
||||
})
|
||||
}
|
||||
|
||||
fn launcher_already_integrated(root: &Path, meta_dir: &Path, meta: &InstallMeta, manifest: &Manifest, source: &Source) -> Result<bool> {
|
||||
fn launcher_already_integrated(root: &Path, meta: &InstallMeta, manifest: &Manifest) -> Result<bool> {
|
||||
let Some(file) = manifest.files.iter().find(|file| file.path == "Scripts/manage.py") else { return Ok(false); };
|
||||
let actual = sha_if_exists(&root.join(&file.path));
|
||||
if actual.as_ref() != meta.original_hashes.get(&file.path) || actual.is_none() { return Ok(false); }
|
||||
let cache = meta_dir.join("manifests").join(format!("launcher-{}.py", file.sha256));
|
||||
let signed = match fs::read(&cache) {
|
||||
Ok(bytes) if fsx::sha256_bytes(&bytes) == file.sha256 => bytes,
|
||||
_ => {
|
||||
let temp = tempfile::tempdir()?;
|
||||
let parts = fetch_parts(source, manifest, &temp.path().join("download"), &Cancel::default(), &|_, _| {})?;
|
||||
package::extract(&parts, manifest, &temp.path().join("tree"), &|_, _| {})?;
|
||||
let bytes = fs::read(temp.path().join("tree").join(&file.path))?;
|
||||
if fsx::sha256_bytes(&bytes) != file.sha256 { return Err(Error::Invalid("The signed launcher failed verification.".into())); }
|
||||
// This derived cache is optional; failure to save it does not change the server.
|
||||
let _ = fsx::atomic_write(&cache, &bytes);
|
||||
bytes
|
||||
}
|
||||
};
|
||||
Ok(std::str::from_utf8(&signed).ok().is_some_and(|signed| {
|
||||
fs::read(root.join(&file.path)).ok().is_some_and(|actual| crate::driver::launcher_matches(signed, &actual))
|
||||
}))
|
||||
let Ok(actual) = fs::read(root.join(&file.path)) else { return Ok(false); };
|
||||
if meta.original_hashes.get(&file.path) != Some(&fsx::sha256_bytes(&actual)) { return Ok(false); }
|
||||
Ok(crate::driver::launcher_matches_recorded(&file.sha256, &actual))
|
||||
}
|
||||
|
||||
fn reject_downgrade(meta: &InstallMeta, manifest: &Manifest) -> Result<()> {
|
||||
@@ -403,8 +387,10 @@ fn reject_downgrade(meta: &InstallMeta, manifest: &Manifest) -> Result<()> {
|
||||
if c.platform != platform {
|
||||
return Err(Error::Invalid(format!("This package targets {} rather than {platform}.", c.platform)));
|
||||
}
|
||||
if meta.core.version.as_ref().is_none_or(|version| version != &manifest.version && !c.source_versions.contains(version)) {
|
||||
return Err(Error::Invalid("This server version is outside the release's tested compatibility matrix.".into()));
|
||||
// The source list records release qualification, not an exclusive upgrade route.
|
||||
// Database history and target validation decide whether the update can complete.
|
||||
if meta.core.version.as_deref().and_then(crate::manifest::parse_version).is_none() {
|
||||
return Err(Error::Invalid("The installed server version is unknown. An imported repack needs a verified starting state before updating.".into()));
|
||||
}
|
||||
}
|
||||
if let Some(installed) = meta.core.version.as_deref() {
|
||||
@@ -525,14 +511,6 @@ pub fn apply(p: &Params, report: &dyn Fn(&str, u8)) -> Result<Outcome> {
|
||||
let point_meta = crate::backup::point_json(meta_dir, txn.recovery_point.as_deref().unwrap())?;
|
||||
if point_meta.is_file() { txn.recovery_hashes.insert("@point".into(), fsx::sha256_file(&point_meta)?); }
|
||||
save(meta_dir, &txn)?;
|
||||
step(report, "Testing the update on a private copy of your server", 54);
|
||||
if let Err(error) = p.env.rehearse_with_progress(&m, &tree, &items, txn.recovery_point.as_deref().unwrap(), report) {
|
||||
txn.state = State::Failed;
|
||||
txn.message = Some(format!("The private update rehearsal failed: {error}. The installed server was not updated."));
|
||||
save(meta_dir, &txn)?;
|
||||
return Err(Error::Invalid(txn.message.unwrap()));
|
||||
}
|
||||
|
||||
txn.ops = items
|
||||
.iter()
|
||||
.filter(|i| i.action != Action::Skip)
|
||||
@@ -920,7 +898,7 @@ impl RepackEnv<'_> {
|
||||
if realms.wildcard_created { modes.push(if realms.active == crate::realms::Mode::Coa { crate::realms::Mode::Wildcard } else { crate::realms::Mode::Coa }); }
|
||||
let mut count = 0;
|
||||
for (index, mode) in modes.into_iter().enumerate() {
|
||||
let list: Vec<_> = manifest.migrations.iter().filter(|m| index == 0 || m.db != "auth").cloned().collect();
|
||||
let list: Vec<_> = manifest.migrations.iter().filter(|m| index == 0 || !crate::migrations::shared_auth(&m.db)).cloned().collect();
|
||||
count += crate::migrations::pending_count(&db.clone().for_realm(mode), &list)?;
|
||||
}
|
||||
Ok(count)
|
||||
@@ -986,85 +964,6 @@ impl Env for RepackEnv<'_> {
|
||||
}
|
||||
|
||||
fn automatic_rollback(&self) -> bool { true }
|
||||
fn rehearse(&self, manifest: &Manifest, tree: &Path, items: &[PlanItem], id: &str) -> Result<()> {
|
||||
self.rehearse_with_progress(manifest, tree, items, id, &|_, _| {})
|
||||
}
|
||||
|
||||
fn rehearse_with_progress(&self, manifest: &Manifest, tree: &Path, items: &[PlanItem], id: &str, report: &dyn Fn(&str, u8)) -> Result<()> {
|
||||
if items.iter().any(|item| item.action != Action::Skip && item.path.to_ascii_lowercase().starts_with("mysql/")) {
|
||||
return Err(Error::Invalid("A server update cannot replace MySQL while using a cold recovery copy; a separate database engine upgrade is required.".into()));
|
||||
}
|
||||
let point = crate::backup::get(self.meta_dir, id)?;
|
||||
let Some(snapshot) = &point.mysql_snapshot else {
|
||||
// Docker uses its separate experimental release channel until its clone runner is qualified.
|
||||
if crate::docker::is_docker(self.root) { return Ok(()); }
|
||||
return Err(Error::Invalid("This installation has no complete MySQL recovery copy for an update rehearsal.".into()));
|
||||
};
|
||||
crate::mysql_snapshot::validate_connections(self.root, self.root)?;
|
||||
crate::mysql_snapshot::stop(self.root)?;
|
||||
let point_dir = crate::backup::point_json(self.meta_dir, id)?.parent().unwrap().to_path_buf();
|
||||
let fixture = crate::mysql_snapshot::rehearsal_copy_with_progress(self.root, self.meta_dir, &point_dir, snapshot, &|phase| step(report, phase, 54))?;
|
||||
let metadata = crate::registry::metadata_dir_for(&fixture)?;
|
||||
let env = RepackEnv { root: &fixture, meta_dir: &metadata };
|
||||
let result = crate::install::with_scratch_ports(&fixture, || {
|
||||
let mut txn = Txn { id: "rehearsal".into(), state: State::Applying, from_version: None,
|
||||
to_version: manifest.version.clone(), recovery_point: None, databases_started: false,
|
||||
ops: items.iter().filter(|item| item.action != Action::Skip).map(|item| Op {
|
||||
path: item.path.clone(), action: item.action, reason: item.reason.clone(),
|
||||
new_sha256: manifest.files.iter().find(|file| file.path == item.path).unwrap().sha256.clone(),
|
||||
had_previous: fsx::safe_join(&fixture, &item.path).is_ok_and(|path| path.is_file()), started:false, done:false,
|
||||
}).collect(), message:None, recovery_hashes:BTreeMap::new() };
|
||||
let before = txn_dir(&metadata, &txn.id)?.join("before");
|
||||
fs::create_dir_all(&before)?;
|
||||
step(report, "Applying update files to the private server copy", 55);
|
||||
apply_ops(&fixture, tree, &before, &manifest.files, &mut txn, &metadata, None)?;
|
||||
crate::mysql_snapshot::validate_connections(&fixture, self.root)?;
|
||||
crate::mysql_snapshot::isolate_connections(&fixture)?;
|
||||
step(report, "Testing database updates on the private server copy", 56);
|
||||
let identities = crate::backup::with_database(&fixture, |db| {
|
||||
let identities = database_identities(db)?;
|
||||
let realms = crate::realms::state(&fixture)?;
|
||||
let mut modes = vec![realms.active];
|
||||
if realms.wildcard_created { modes.push(if realms.active == crate::realms::Mode::Coa { crate::realms::Mode::Wildcard } else { crate::realms::Mode::Coa }); }
|
||||
for (index, mode) in modes.into_iter().enumerate() {
|
||||
let db = db.clone().for_realm(mode);
|
||||
crate::schema_check::repair_missing_defaults(&db, &fixture, manifest.files.iter().find(|file| file.path == crate::schema_check::CONTRACT).map(|file| file.sha256.as_str()))?;
|
||||
let list: Vec<_> = manifest.migrations.iter().filter(|migration| index == 0 || migration.db != "auth").cloned().collect();
|
||||
let report = crate::migrations::apply_pending(&db, &list, &tree.join("_migrations"), &|| Ok("private rehearsal".into()))?;
|
||||
if let Some((migration, error)) = report.failed { return Err(Error::Invalid(format!("Rehearsal migration {migration} failed: {error}"))); }
|
||||
crate::schema_check::repair_missing_defaults(&db, &fixture, manifest.files.iter().find(|file| file.path == crate::schema_check::CONTRACT).map(|file| file.sha256.as_str()))?;
|
||||
}
|
||||
verify_database_identities(db, &identities)?;
|
||||
Ok(identities)
|
||||
})?;
|
||||
step(report, "Testing startup of the private server copy", 57);
|
||||
env.validate()?;
|
||||
crate::backup::with_database(&fixture, |db| verify_database_identities(db, &identities))?;
|
||||
env.ensure_stopped()
|
||||
});
|
||||
step(report, "Stopping the private server copy and verifying the installed database", 57);
|
||||
let stopped = crate::mysql_snapshot::stop(&fixture);
|
||||
let live_state = if result.is_ok() { crate::mysql_snapshot::stop(self.root).and_then(|()| crate::mysql_snapshot::unchanged(self.root, snapshot)) } else { Ok(()) };
|
||||
let logs: BTreeMap<_, _> = ["Core/Logs/auth-console.log", "Core/Logs/world-console.log", "Core/Logs/supervisor.log", "mysql/logs/mysql-error.log"].into_iter()
|
||||
.map(|path| (path, crate::diag::redact(&crate::health::tail(&fixture.join(path), 32768)))).collect();
|
||||
let mut schema_reports = Vec::<serde_json::Value>::new();
|
||||
if let Ok(entries) = fs::read_dir(metadata.join("diagnostics")) {
|
||||
for entry in entries.flatten().filter(|entry| entry.file_name().to_string_lossy().starts_with("schema-validation-")) {
|
||||
let path = fsx::ensure_within(&metadata, &entry.path())?;
|
||||
if fs::metadata(&path)?.len() <= 4 * 1024 * 1024 { schema_reports.push(fsx::read_json(&path)?); }
|
||||
}
|
||||
}
|
||||
let report = serde_json::json!({"schema":1,"checkedAt":chrono::Utc::now().to_rfc3339(),"toVersion":manifest.version,"recoveryPoint":id,
|
||||
"result":if result.is_ok() && stopped.is_ok() && live_state.is_ok() {"passed"} else {"failed"}, "error":result.as_ref().err().map(ToString::to_string), "stopError":stopped.as_ref().err().map(ToString::to_string), "liveStateError":live_state.as_ref().err().map(ToString::to_string), "logs":logs,"schemaReports":schema_reports,"fixture":fixture});
|
||||
let report_path = self.meta_dir.join("diagnostics").join(format!("database-rehearsal-{}.json", uuid::Uuid::new_v4()));
|
||||
fsx::atomic_write_json(&report_path, &report)?;
|
||||
stopped?;
|
||||
let parent = fixture.parent().unwrap();
|
||||
let owned = fsx::ensure_within(&self.meta_dir.join("rehearsals"), parent)?;
|
||||
fs::remove_dir_all(owned)?;
|
||||
live_state?;
|
||||
result
|
||||
}
|
||||
fn preflight(&self, manifest: &Manifest) -> Result<()> {
|
||||
crate::mysql_snapshot::stop_previous_rehearsals(self.meta_dir)?;
|
||||
if let Some(compatibility) = &manifest.compatibility {
|
||||
@@ -1084,7 +983,7 @@ impl Env for RepackEnv<'_> {
|
||||
if crate::docker::is_docker(self.root) {
|
||||
return Err(Error::Invalid(format!("The installed {} database does not match its upgrade source: {}.{}: {}", mode.name(), problem.database, problem.table, problem.detail)));
|
||||
}
|
||||
tracing::warn!(realm = mode.name(), table = %problem.table, "Installed schema differs; the private candidate rehearsal must qualify this database");
|
||||
tracing::warn!(realm = mode.name(), table = %problem.table, "Installed schema differs; pending migrations and target validation will run with a full recovery point");
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
@@ -1139,43 +1038,10 @@ impl Env for RepackEnv<'_> {
|
||||
}
|
||||
|
||||
fn migrate(&self, manifest: &Manifest, staged: &Path) -> Result<ApplyReport> {
|
||||
let root = self.root;
|
||||
crate::backup::with_database(root, |db| {
|
||||
let realms = crate::realms::state(root)?;
|
||||
if let Some(contract) = manifest.files.iter().find(|file| file.path == crate::schema_check::CONTRACT) {
|
||||
self.migration_snapshot()?;
|
||||
crate::schema_check::repair_missing_defaults(db, root, Some(&contract.sha256))?;
|
||||
}
|
||||
let mut result = crate::migrations::apply_pending(db, &manifest.migrations, staged, &|| {
|
||||
self.migration_snapshot()
|
||||
})?;
|
||||
if realms.wildcard_created && result.failed.is_none() {
|
||||
let other = if realms.active == crate::realms::Mode::Coa { crate::realms::Mode::Wildcard } else { crate::realms::Mode::Coa };
|
||||
let other_db = db.clone().for_realm(other);
|
||||
crate::schema_check::repair_missing_defaults(&other_db, root, manifest.files.iter().find(|file| file.path == crate::schema_check::CONTRACT).map(|file| file.sha256.as_str()))?;
|
||||
let shared_snapshot = result.snapshot.clone();
|
||||
let migrations: Vec<_> = manifest.migrations.iter().filter(|m| m.db != "auth").cloned().collect();
|
||||
let extra = crate::migrations::apply_pending(&other_db, &migrations, staged, &|| {
|
||||
if let Some(id) = &shared_snapshot { return Ok(id.clone()); }
|
||||
self.migration_snapshot()
|
||||
})?;
|
||||
result.applied.extend(extra.applied);
|
||||
result.failed = extra.failed;
|
||||
if result.snapshot.is_none() { result.snapshot = extra.snapshot; }
|
||||
if result.failed.is_none() {
|
||||
crate::schema_check::repair_missing_defaults(&other_db, root, manifest.files.iter().find(|file| file.path == crate::schema_check::CONTRACT).map(|file| file.sha256.as_str()))?;
|
||||
if let Some(p) = crate::schema_check::check_with_report(&other_db, root)?.first() {
|
||||
return Err(Error::Invalid(format!("Database validation failed on {}: {}.{}: {}", other.name(), p.table, p.column, p.detail)));
|
||||
}
|
||||
}
|
||||
}
|
||||
if result.failed.is_none() {
|
||||
crate::schema_check::repair_missing_defaults(db, root, manifest.files.iter().find(|file| file.path == crate::schema_check::CONTRACT).map(|file| file.sha256.as_str()))?;
|
||||
let problems = crate::schema_check::check_with_report(db, root)?;
|
||||
if let Some(p) = problems.first() {
|
||||
return Err(Error::Invalid(format!("Database validation failed: {}.{}.{}: {} ({} problems).", p.database, p.table, p.column, p.detail, problems.len())));
|
||||
}
|
||||
}
|
||||
crate::backup::with_database(self.root, |db| {
|
||||
let identities = database_identities(db)?;
|
||||
let result = migrate_databases(db, self.root, manifest, staged, &|| self.migration_snapshot())?;
|
||||
if result.failed.is_none() { verify_database_identities(db, &identities)?; }
|
||||
Ok(result)
|
||||
})
|
||||
}
|
||||
@@ -1191,23 +1057,24 @@ impl Env for RepackEnv<'_> {
|
||||
|
||||
impl RepackEnv<'_> {
|
||||
fn validate_server(&self, check_schema: bool) -> Result<()> {
|
||||
let stopped = crate::driver::run(self.root, crate::driver::Verb::StopAll)?;
|
||||
if !stopped.ok { return Err(Error::Invalid("Could not stop the server before isolated validation.".into())); }
|
||||
crate::mysql_snapshot::stop(self.root)?;
|
||||
self.ensure_stopped()?;
|
||||
self.recover_validation()?;
|
||||
let result = (|| -> Result<()> {
|
||||
crate::update_isolation::begin(self.root, self.meta_dir)?;
|
||||
use crate::process::{observe, ServiceState};
|
||||
if check_schema { crate::backup::with_database(self.root, |db| {
|
||||
let mut modes = vec![crate::realms::Mode::Coa];
|
||||
if crate::realms::state(self.root)?.wildcard_created { modes.push(crate::realms::Mode::Wildcard); }
|
||||
for mode in modes {
|
||||
if let Some(p) = crate::schema_check::check_with_report(&db.clone().for_realm(mode), self.root)?.first() {
|
||||
return Err(Error::Invalid(format!("Database validation failed on {}: {}.{}: {}", mode.name(), p.database, p.table, p.detail)));
|
||||
let identities = crate::backup::with_database(self.root, |db| {
|
||||
if check_schema {
|
||||
let mut modes = vec![crate::realms::Mode::Coa];
|
||||
if crate::realms::state(self.root)?.wildcard_created { modes.push(crate::realms::Mode::Wildcard); }
|
||||
for mode in modes {
|
||||
if let Some(p) = crate::schema_check::check_with_report(&db.clone().for_realm(mode), self.root)?.first() {
|
||||
return Err(Error::Invalid(format!("Database validation failed on {}: {}.{}: {}", mode.name(), p.database, p.table, p.detail)));
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
})?; }
|
||||
database_identities(db)
|
||||
})?;
|
||||
// The check start is the first start of the new build: give the module configs the settings the update added
|
||||
// (as a normal start does), or the server logs a "missing property" line for every one of them.
|
||||
match crate::registry::MetaDir::open(self.meta_dir) {
|
||||
@@ -1245,6 +1112,7 @@ impl RepackEnv<'_> {
|
||||
}
|
||||
};
|
||||
if healthy {
|
||||
crate::backup::with_database(self.root, |db| verify_database_identities(db, &identities))?;
|
||||
return Ok(());
|
||||
}
|
||||
let cause = crate::driver::startup_failure(self.root, &started);
|
||||
@@ -1252,10 +1120,7 @@ impl RepackEnv<'_> {
|
||||
let _ = crate::driver::run(self.root, crate::driver::Verb::StopAll);
|
||||
Err(Error::Invalid(cause))
|
||||
})();
|
||||
let stopped = crate::driver::run(self.root, crate::driver::Verb::StopAll)?;
|
||||
if !stopped.ok {
|
||||
return Err(Error::Invalid("Isolated validation could not stop the server; recovery configurations were preserved.".into()));
|
||||
}
|
||||
crate::mysql_snapshot::stop(self.root)?;
|
||||
self.ensure_stopped()?;
|
||||
self.recover_validation()?;
|
||||
result
|
||||
@@ -1263,6 +1128,40 @@ impl RepackEnv<'_> {
|
||||
|
||||
}
|
||||
|
||||
/// One migration pass for both realms, with shared history checks and one recovery point.
|
||||
fn migrate_databases(db: &crate::db::Db, root: &Path, manifest: &Manifest, staged: &Path, snapshot: &dyn Fn() -> Result<String>) -> Result<ApplyReport> {
|
||||
let realms = crate::realms::state(root)?;
|
||||
let mut modes = vec![realms.active];
|
||||
if realms.wildcard_created {
|
||||
modes.push(if realms.active == crate::realms::Mode::Coa { crate::realms::Mode::Wildcard } else { crate::realms::Mode::Coa });
|
||||
}
|
||||
// Reject a broken history in either realm before changing the first one.
|
||||
for (index, mode) in modes.iter().enumerate() {
|
||||
let list: Vec<_> = manifest.migrations.iter().filter(|m| index == 0 || !crate::migrations::shared_auth(&m.db)).cloned().collect();
|
||||
crate::migrations::preflight(&db.clone().for_realm(*mode), &list)?;
|
||||
}
|
||||
let contract = manifest.files.iter().find(|file| file.path == crate::schema_check::CONTRACT).map(|file| file.sha256.as_str());
|
||||
let mut result = ApplyReport { applied: vec![], failed: None, snapshot: None };
|
||||
if contract.is_some() { result.snapshot = Some(snapshot()?); }
|
||||
for (index, mode) in modes.into_iter().enumerate() {
|
||||
let db = db.clone().for_realm(mode);
|
||||
let list: Vec<_> = manifest.migrations.iter().filter(|m| index == 0 || !crate::migrations::shared_auth(&m.db)).cloned().collect();
|
||||
crate::schema_check::repair_missing_defaults(&db, root, contract)?;
|
||||
let extra = crate::migrations::apply_pending(&db, &list, staged, &|| {
|
||||
if let Some(id) = &result.snapshot { Ok(id.clone()) } else { snapshot() }
|
||||
})?;
|
||||
result.applied.extend(extra.applied);
|
||||
result.failed = extra.failed;
|
||||
if result.snapshot.is_none() { result.snapshot = extra.snapshot; }
|
||||
if result.failed.is_some() { return Ok(result); }
|
||||
crate::schema_check::repair_missing_defaults(&db, root, contract)?;
|
||||
if let Some(p) = crate::schema_check::check_with_report(&db, root)?.first() {
|
||||
return Err(Error::Invalid(format!("Database validation failed on {}: {}.{}: {}", mode.name(), p.table, p.column, p.detail)));
|
||||
}
|
||||
}
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
fn database_identities(db: &crate::db::Db) -> Result<BTreeMap<String, std::collections::BTreeSet<String>>> {
|
||||
let db = db.clone().for_realm(crate::realms::Mode::Coa);
|
||||
let mut identities = BTreeMap::new();
|
||||
@@ -1282,7 +1181,7 @@ fn verify_database_identities(db: &crate::db::Db, before: &BTreeMap<String, std:
|
||||
let after = database_identities(db)?;
|
||||
for (schema, expected) in before {
|
||||
if after.get(schema).is_none_or(|actual| !expected.is_subset(actual)) {
|
||||
return Err(Error::Invalid(format!("The private update changed or removed existing character or account identities in {schema}.")));
|
||||
return Err(Error::Invalid(format!("The update changed or removed existing character or account identities in {schema}.")));
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
@@ -1310,19 +1209,15 @@ mod tests {
|
||||
migrate_fail: Cell<bool>,
|
||||
preflight_fail: Cell<bool>,
|
||||
restore_fail: Cell<bool>,
|
||||
rehearsal_fail: Cell<bool>,
|
||||
}
|
||||
|
||||
impl Fake {
|
||||
fn ok() -> Fake {
|
||||
Fake { activation_expected: RefCell::new(None), activation_failed: Cell::new(false), activated: Cell::new(false), automatic_rollback: Cell::new(false), recovery_healthy: Cell::new(true), stopped: Cell::new(true), healthy: Cell::new(true), snapshot_ok: Cell::new(true), calls: Default::default(), migrate_fail: Cell::new(false), preflight_fail: Cell::new(false), restore_fail: Cell::new(false), rehearsal_fail: Cell::new(false) }
|
||||
Fake { activation_expected: RefCell::new(None), activation_failed: Cell::new(false), activated: Cell::new(false), automatic_rollback: Cell::new(false), recovery_healthy: Cell::new(true), stopped: Cell::new(true), healthy: Cell::new(true), snapshot_ok: Cell::new(true), calls: Default::default(), migrate_fail: Cell::new(false), preflight_fail: Cell::new(false), restore_fail: Cell::new(false) }
|
||||
}
|
||||
}
|
||||
|
||||
impl Env for Fake {
|
||||
fn rehearse(&self, _: &Manifest, _: &Path, _: &[PlanItem], _: &str) -> Result<()> {
|
||||
if self.rehearsal_fail.get() { Err(Error::Invalid("SQL failed in the private copy".into())) } else { Ok(()) }
|
||||
}
|
||||
fn activate(&self) -> Result<()> {
|
||||
if let Some((meta, version)) = self.activation_expected.borrow().as_ref() {
|
||||
ensure_recovered(meta)?;
|
||||
@@ -1581,6 +1476,8 @@ mod tests {
|
||||
let (_, mut meta) = MetaDir::open(&w.meta).unwrap();
|
||||
meta.original_hashes.insert("Scripts/manage.py".into(), fsx::sha256_bytes(integrated.as_bytes()));
|
||||
fsx::atomic_write_json(&w.meta.join("install.json"), &meta).unwrap();
|
||||
let original = fetch_manifest(&Source::Dir(w.pkg.clone()), &w.key).unwrap().0;
|
||||
for part in &original.archive.as_ref().unwrap().parts { fs::remove_file(w.pkg.join(&part.name)).unwrap(); }
|
||||
let p = preview(&w.root, &meta, &Source::Dir(w.pkg.clone()), &w.key, &BTreeMap::new()).unwrap();
|
||||
assert_eq!(p.items.iter().find(|item| item.path == "Scripts/manage.py").unwrap().action, Action::Skip);
|
||||
let manifest = fetch_manifest(&Source::Dir(w.pkg.clone()), &w.key).unwrap().0;
|
||||
@@ -1588,7 +1485,7 @@ mod tests {
|
||||
assert_eq!(applied_plan.iter().find(|item| item.path == "Scripts/manage.py").unwrap().action, Action::Skip);
|
||||
let mut changed = fetch_manifest(&Source::Dir(w.pkg.clone()), &w.key).unwrap().0;
|
||||
changed.files.iter_mut().find(|file| file.path == "Scripts/manage.py").unwrap().sha256 = fsx::sha256_bytes(b"new launcher");
|
||||
assert!(launcher_already_integrated(&w.root, &w.meta, &meta, &changed, &Source::Dir(w.pkg.clone())).is_err());
|
||||
assert!(!launcher_already_integrated(&w.root, &meta, &changed).unwrap());
|
||||
write(&w.root, "Scripts/manage.py", format!("{integrated}\n# user edit\n").as_bytes());
|
||||
// Same version: the owner's edit is not an update (Repair lists and restores it).
|
||||
let p = preview(&w.root, &meta, &Source::Dir(w.pkg.clone()), &w.key, &BTreeMap::new()).unwrap();
|
||||
@@ -1735,7 +1632,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn incompatible_source_or_platform_is_rejected_without_touching_installation() {
|
||||
fn unlisted_source_is_allowed_but_unknown_versions_and_other_platforms_are_rejected() {
|
||||
let w = world(&[], false);
|
||||
let (_, meta) = MetaDir::open(&w.meta).unwrap();
|
||||
let mut manifest = Manifest::parse(&fs::read(w.pkg.join("manifest.json")).unwrap()).unwrap();
|
||||
@@ -1748,7 +1645,12 @@ mod tests {
|
||||
manifest.validate().unwrap();
|
||||
validate_candidate(&meta, &manifest).unwrap();
|
||||
manifest.compatibility.as_mut().unwrap().source_versions = vec!["0.9.0".into()];
|
||||
assert!(validate_candidate(&meta, &manifest).unwrap_err().to_string().contains("compatibility matrix"));
|
||||
validate_candidate(&meta, &manifest).unwrap();
|
||||
let mut unknown = meta.clone();
|
||||
unknown.core.version = None;
|
||||
assert!(validate_candidate(&unknown, &manifest).unwrap_err().to_string().contains("unknown"));
|
||||
unknown.core.version = Some("unverified-repack".into());
|
||||
assert!(validate_candidate(&unknown, &manifest).is_err());
|
||||
let mut already_updated = meta.clone();
|
||||
already_updated.core.version = Some(manifest.version.clone());
|
||||
validate_candidate(&already_updated, &manifest).unwrap();
|
||||
@@ -2069,20 +1971,17 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn failed_rehearsal_preserves_installed_files_version_and_recovery_point() {
|
||||
fn update_saves_recovery_then_migrates_and_validates_once() {
|
||||
let w = world(&[], true);
|
||||
let env = Fake::ok();
|
||||
env.rehearsal_fail.set(true);
|
||||
let original = fsx::sha256_file(&w.meta.join("install.json")).unwrap();
|
||||
let error = run(&w, &env, BTreeMap::new(), None).unwrap_err();
|
||||
assert!(error.to_string().contains("installed server was not updated"));
|
||||
assert_eq!(read(&w, "Core/worldserver.exe"), b"world-v1");
|
||||
assert_eq!(fsx::sha256_file(&w.meta.join("install.json")).unwrap(), original);
|
||||
assert_eq!(&*env.calls.borrow(), &["stop", "snapshot"]);
|
||||
assert!(pending_checked(&w.meta).unwrap().is_none());
|
||||
let journal = journals(&w.meta).unwrap().remove(0);
|
||||
assert_eq!(journal.recovery_point.as_deref(), Some("rp-1"));
|
||||
assert!(!journal.databases_started && journal.ops.is_empty());
|
||||
let result = run(&w, &env, BTreeMap::new(), None).unwrap();
|
||||
assert_eq!(result.txn.state, State::Committed);
|
||||
let calls = env.calls.borrow();
|
||||
assert_eq!(calls.iter().filter(|call| **call == "snapshot").count(), 1);
|
||||
assert_eq!(calls.iter().filter(|call| **call == "migrate").count(), 1);
|
||||
assert_eq!(calls.iter().filter(|call| **call == "validate").count(), 1);
|
||||
assert!(calls.iter().position(|call| *call == "snapshot") < calls.iter().position(|call| *call == "migrate"));
|
||||
assert!(!w.meta.join("rehearsals").exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
use crate::{manifest::Manifest, pkgsource::{self, Source}, registry::InstallMeta, update, Result};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Selection {
|
||||
pub source: Source,
|
||||
// Retained for the frontend response shape; direct updates never offer a bridge.
|
||||
pub latest_version: Option<String>,
|
||||
}
|
||||
|
||||
pub fn select(meta: &InstallMeta, source: Source, key: &str) -> Result<Selection> {
|
||||
select_with(meta, source, &mut |source| pkgsource::fetch_manifest(source, key))
|
||||
}
|
||||
|
||||
fn select_with(meta: &InstallMeta, source: Source, fetch: &mut impl FnMut(&Source) -> Result<(Manifest, Vec<u8>)>) -> Result<Selection> {
|
||||
let (manifest, _) = fetch(&source)?;
|
||||
update::validate_candidate(meta, &manifest)?;
|
||||
Ok(Selection { source, latest_version: None })
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use base64::{engine::general_purpose::STANDARD, Engine};
|
||||
use ed25519_dalek::{Signer, SigningKey};
|
||||
use std::{fs, path::Path};
|
||||
|
||||
fn package() -> serde_json::Value {
|
||||
serde_json::json!({"schema":1,"kind":"update","version":"0.261015.58","core":{"commit":"a".repeat(40)},
|
||||
"builtAt":"test","minManagerVersion":"0.6.16","files":[],"migrations":[],"archive":null,
|
||||
"compatibility":{"schema":1,"platform":if cfg!(windows) {"windows-x86_64"} else {"linux-x86_64"},
|
||||
"coreCommit":"a".repeat(40),"moduleCommits":{"squid":"b".repeat(40)},"clientPatchVersion":"1.7",
|
||||
"sourceVersions":["0.261013.54"],"sourceDatabases":{"0.261013.54":{"manifestSha256":"c".repeat(64),"schemaSha256":null}}}})
|
||||
}
|
||||
|
||||
fn meta(version: &str) -> InstallMeta {
|
||||
let mut meta = InstallMeta::new(crate::registry::InstallKind::New, Path::new("unused"));
|
||||
meta.core.version = Some(version.into());
|
||||
meta
|
||||
}
|
||||
|
||||
fn fixture(value: &serde_json::Value, tamper: bool) -> (tempfile::TempDir, String) {
|
||||
let folder = tempfile::tempdir().unwrap();
|
||||
let signing = SigningKey::from_bytes(&[37; 32]);
|
||||
let bytes = serde_json::to_vec(value).unwrap();
|
||||
fs::write(folder.path().join("manifest.json.sig"), STANDARD.encode(signing.sign(&bytes).to_bytes())).unwrap();
|
||||
fs::write(folder.path().join("manifest.json"), if tamper { b"tampered".as_slice() } else { &bytes }).unwrap();
|
||||
(folder, STANDARD.encode(signing.verifying_key().to_bytes()))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_known_older_version_selects_the_latest_signed_package_once() {
|
||||
for installed in ["0.2.0", "0.261004.20", "0.261005.0", "0.261007.24", "0.261011.800006", "0.261013.54", "0.261015.58"] {
|
||||
let (folder, key) = fixture(&package(), false);
|
||||
for kind in [crate::registry::InstallKind::New, crate::registry::InstallKind::Imported] {
|
||||
let mut installation = meta(installed);
|
||||
installation.kind = kind;
|
||||
let mut calls = 0;
|
||||
let selected = select_with(&installation, Source::Dir(folder.path().into()), &mut |source| {
|
||||
calls += 1;
|
||||
pkgsource::fetch_manifest(source, &key)
|
||||
}).unwrap();
|
||||
assert!(matches!(selected.source, Source::Dir(path) if path == folder.path()));
|
||||
assert!(selected.latest_version.is_none());
|
||||
assert_eq!(calls, 1, "no intermediate package fetches for {installed}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unknown_versions_and_downgrades_remain_blocked() {
|
||||
let (folder, key) = fixture(&package(), false);
|
||||
for installed in ["unknown", "a65be06ec62f4", "0.261016.59"] {
|
||||
assert!(select(&meta(installed), Source::Dir(folder.path().into()), &key).is_err());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn signed_target_is_required_even_for_unlisted_old_versions() {
|
||||
let (folder, key) = fixture(&package(), true);
|
||||
assert!(select(&meta("0.261004.20"), Source::Dir(folder.path().into()), &key).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn platform_and_manager_requirements_are_still_enforced() {
|
||||
for (field, value) in [("minManagerVersion", "99.0.0"), ("platform", "other-platform")] {
|
||||
let mut target = package();
|
||||
if field == "platform" { target["compatibility"][field] = value.into(); }
|
||||
else { target[field] = value.into(); }
|
||||
let (folder, key) = fixture(&target, false);
|
||||
assert!(select(&meta("0.261004.20"), Source::Dir(folder.path().into()), &key).is_err());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -118,8 +118,11 @@ pub fn external_ip(gw: &Gateway) -> Result<Ipv4Addr> {
|
||||
}
|
||||
|
||||
pub fn add_mapping(gw: &Gateway, port: u16, lan: Ipv4Addr, what: &str) -> Result<()> {
|
||||
soap(
|
||||
gw,
|
||||
add_mapping_with(port, lan, what, |action, args| soap(gw, action, args))
|
||||
}
|
||||
|
||||
fn add_mapping_with(port: u16, lan: Ipv4Addr, what: &str, mut request: impl FnMut(&str, &[(&str, String)]) -> Result<String>) -> Result<()> {
|
||||
let result = request(
|
||||
"AddPortMapping",
|
||||
&[
|
||||
("NewRemoteHost", String::new()),
|
||||
@@ -131,8 +134,28 @@ pub fn add_mapping(gw: &Gateway, port: u16, lan: Ipv4Addr, what: &str) -> Result
|
||||
("NewPortMappingDescription", format!("{DESCRIPTION_PREFIX} - {what}")),
|
||||
("NewLeaseDuration", "0".into()),
|
||||
],
|
||||
)
|
||||
.map(|_| ())
|
||||
);
|
||||
match result {
|
||||
Ok(_) => Ok(()),
|
||||
Err(error) => {
|
||||
// Some routers reject a mapping that already points to us. Read it back;
|
||||
// never delete or replace another host's mapping.
|
||||
let existing = request("GetSpecificPortMappingEntry", &[
|
||||
("NewRemoteHost", String::new()),
|
||||
("NewExternalPort", port.to_string()),
|
||||
("NewProtocol", "TCP".into()),
|
||||
]);
|
||||
if let Ok(xml) = existing {
|
||||
let client = between(&xml, "<NewInternalClient>", "</NewInternalClient>").and_then(|v| v.parse::<Ipv4Addr>().ok());
|
||||
let internal_port = between(&xml, "<NewInternalPort>", "</NewInternalPort>").and_then(|v| v.parse::<u16>().ok());
|
||||
let enabled = between(&xml, "<NewEnabled>", "</NewEnabled>");
|
||||
if client == Some(lan) && internal_port == Some(port) && matches!(enabled, Some("1" | "true")) {
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
Err(Error::Invalid(format!("Could not forward TCP port {port}: {error}. Check the router's existing port forwarding rules for this port.")))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn remove_mapping(gw: &Gateway, port: u16) -> Result<()> {
|
||||
@@ -148,6 +171,53 @@ mod tests {
|
||||
<service><serviceType>urn:schemas-upnp-org:service:WANIPConnection:1</serviceType><controlURL>/ctl/IPConn</controlURL></service>\
|
||||
</serviceList></device></deviceList></device></deviceList></device></root>";
|
||||
|
||||
#[test]
|
||||
fn existing_mapping_is_accepted_only_for_the_requested_destination() {
|
||||
let lan = "192.168.1.5".parse().unwrap();
|
||||
for (client, port, enabled, accepted) in [
|
||||
("192.168.1.5", "3724", "1", true),
|
||||
("192.168.1.5", "3724", "true", true),
|
||||
("192.168.1.6", "3724", "1", false),
|
||||
("192.168.1.5", "8085", "1", false),
|
||||
("192.168.1.5", "3724", "0", false),
|
||||
("", "", "", false),
|
||||
] {
|
||||
let mut actions = Vec::new();
|
||||
let result = add_mapping_with(3724, lan, "Login", |action, args| {
|
||||
actions.push(action.to_string());
|
||||
assert!(args.contains(&("NewExternalPort", "3724".into())));
|
||||
assert!(args.contains(&("NewProtocol", "TCP".into())));
|
||||
match action {
|
||||
"AddPortMapping" => Err(Error::Invalid("ConflictInMappingEntry".into())),
|
||||
"GetSpecificPortMappingEntry" => Ok(format!("<NewInternalClient>{client}</NewInternalClient><NewInternalPort>{port}</NewInternalPort><NewEnabled>{enabled}</NewEnabled>")),
|
||||
_ => panic!("must not delete or modify an existing mapping"),
|
||||
}
|
||||
});
|
||||
assert_eq!(result.is_ok(), accepted);
|
||||
assert_eq!(actions, ["AddPortMapping", "GetSpecificPortMappingEntry"]);
|
||||
if let Err(error) = result {
|
||||
assert!(error.to_string().contains("TCP port 3724"));
|
||||
assert!(error.to_string().contains("ConflictInMappingEntry"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn successful_add_does_not_require_router_readback_support() {
|
||||
add_mapping_with(8085, "192.168.1.5".parse().unwrap(), "World", |action, _| {
|
||||
assert_eq!(action, "AddPortMapping");
|
||||
Ok(String::new())
|
||||
}).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn failed_readback_keeps_the_original_error() {
|
||||
let error = add_mapping_with(8085, "192.168.1.5".parse().unwrap(), "World", |action, _| {
|
||||
Err(Error::Invalid(if action == "AddPortMapping" { "ConflictInMappingEntry" } else { "Unsupported action" }.into()))
|
||||
}).unwrap_err().to_string();
|
||||
assert!(error.contains("ConflictInMappingEntry") && error.contains("8085"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parses_ssdp_location_and_description() {
|
||||
let resp = "HTTP/1.1 200 OK\r\nCACHE-CONTROL: max-age=120\r\nLocation: http://192.168.1.1:5000/rootDesc.xml\r\nST: x\r\n\r\n";
|
||||
|
||||
@@ -47,6 +47,13 @@ fn run() -> Result<(), String> {
|
||||
let e = |x: coa_core::Error| x.to_string();
|
||||
let part = a.get("part-size").and_then(|v| v.parse().ok()).unwrap_or(DEFAULT_PART_SIZE);
|
||||
match cmd.as_str() {
|
||||
"plan-update" => {
|
||||
let mut meta = coa_core::registry::InstallMeta::new(coa_core::registry::InstallKind::New, std::path::Path::new("unused"));
|
||||
meta.core.version = Some(need(&a, "from")?.clone());
|
||||
let selection = coa_core::update_route::select(&meta, coa_core::pkgsource::Source::Url(need(&a, "source")?.clone()), coa_core::signing::EMBEDDED_PUBLIC_KEY).map_err(e)?;
|
||||
let (manifest, _) = coa_core::pkgsource::fetch_manifest(&selection.source, coa_core::signing::EMBEDDED_PUBLIC_KEY).map_err(e)?;
|
||||
println!("{}", serde_json::json!({"from":meta.core.version,"next":manifest.version,"latest":selection.latest_version}));
|
||||
}
|
||||
"verify-install" => {
|
||||
coa_core::release_schema::verify_install_package(
|
||||
&PathBuf::from(need(&a, "dir")?), coa_core::signing::EMBEDDED_PUBLIC_KEY,
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# Update workflow
|
||||
|
||||
The Manager selects the latest signed package directly for any known older server version. The source-version list records release qualification; it is not an exclusive allowlist and does not prove that a particular installed database can apply the package. Unknown imported versions, downgrades, incompatible platforms and newer Manager requirements remain blocked.
|
||||
|
||||
The updater verifies the signed manifest and archive, checks file changes and database history, stops the server, and saves one complete recovery point. It then replaces files, applies pending SQL once, verifies the target schema and starts the updated server once for validation. Shared authentication migrations run once; both realm histories are checked before changing either. Account and character identities are compared before and after migration and startup.
|
||||
|
||||
Account migration history is stored in the shared account database. Read-only checks recognize legacy auth records from both realms. Write operations adopt existing records and preserve already-applied core history; unknown legacy checksums stay unknown. History is read in two batched client calls, with explicit physical schemas and consistent text collations. Use the current Manager for subsequent database operations.
|
||||
|
||||
Applied migrations are skipped; changed checksums and interrupted/failed records stop the update. Duplicate SQL identifiers for the same schema are rejected before execution. SQL or startup failure restores files and databases together. If recovery fails, startup remains blocked and the recovery artifacts remain available.
|
||||
|
||||
The per-update nested server rehearsal and intermediate-package routing have been removed. Full-copy upgrade/startup testing belongs to release qualification, on independent disposable installations. Cleanup of interrupted rehearsals from older Manager versions remains for compatibility. Signed packages, recovery verification, configuration merge and startup validation stay enabled. No migration guard is bypassed and no unexecuted SQL is marked applied. Retired source archives do not prevent a direct update, but the database history must still be consistent and target checks must pass.
|
||||
|
||||
## Verify with an actual installation copy
|
||||
|
||||
`cargo run -p coa-core --example upgrade_fixture -- <copy-root> <signed-package-directory>` exercises the production updater, including recovery copies and startup. It refuses mutation unless the directory name starts with `coa-schema-fixture-real` and contains `.coa-update-fixture`. Prepare a disposable copy from a verified recovery point, with separate ports, metadata and no client path. Never point it at a working installation.
|
||||
|
||||
`migration_plan <copy-root> <signed-manifest>` reads database history without creating a migration ledger. On a separate marked `update-database-diagnosis-*` copy, `--apply <migration-directory>` exercises the production database phase. `--sql-only <migration-directory>` verifies and applies the signed SQL list for both realms and compares account/character identities. SQL-only success is not full package/startup qualification and does not verify the target schema contract.
|
||||
|
||||
Record package signatures, exact source recovery point, actual result, repeat-run behavior and unavailable stages. Do not label a route universally tested based on a version list or SQL-only success.
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "coa-server-manager",
|
||||
"version": "0.6.17",
|
||||
"version": "0.6.21",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "coa-server-manager",
|
||||
"version": "0.6.17",
|
||||
"version": "0.6.21",
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^2.12.0",
|
||||
"@tauri-apps/plugin-dialog": "^2.8.0",
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "coa-server-manager",
|
||||
"private": true,
|
||||
"version": "0.6.17",
|
||||
"version": "0.6.21",
|
||||
"license": "AGPL-3.0-only",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
+194
-12
@@ -170,29 +170,211 @@
|
||||
"key": "Rate.Creature.Normal.Damage",
|
||||
"type": "float",
|
||||
"category": "advanced",
|
||||
"title": "Monster damage",
|
||||
"description": "Multiplier for damage dealt by normal monsters. Changes difficulty a lot.",
|
||||
"title": "Normal creature melee damage",
|
||||
"description": "Multiplier for normal creature melee damage. 1 is normal. Requires a world server restart.",
|
||||
"default": 1,
|
||||
"advanced": true,
|
||||
"restartRequired": "world",
|
||||
"dangerous": true,
|
||||
"min": 0.1,
|
||||
"max": 10,
|
||||
"unit": "x"
|
||||
"unit": "x",
|
||||
"advanced": true,
|
||||
"restartRequired": "world",
|
||||
"dangerous": true
|
||||
},
|
||||
{
|
||||
"key": "Rate.Creature.Normal.SpellDamage",
|
||||
"type": "float",
|
||||
"category": "advanced",
|
||||
"title": "Normal creature spell damage",
|
||||
"description": "Multiplier for normal creature spell damage. 1 is normal. Requires a world server restart.",
|
||||
"default": 1,
|
||||
"min": 0.1,
|
||||
"max": 10,
|
||||
"unit": "x",
|
||||
"advanced": true,
|
||||
"restartRequired": "world",
|
||||
"dangerous": true
|
||||
},
|
||||
{
|
||||
"key": "Rate.Creature.Normal.HP",
|
||||
"type": "float",
|
||||
"category": "advanced",
|
||||
"title": "Monster health",
|
||||
"description": "Multiplier for health of normal monsters. Changes difficulty a lot.",
|
||||
"title": "Normal creature health",
|
||||
"description": "Multiplier for normal creature health. 1 is normal. Requires a world server restart.",
|
||||
"default": 1,
|
||||
"advanced": true,
|
||||
"restartRequired": "world",
|
||||
"dangerous": true,
|
||||
"min": 0.1,
|
||||
"max": 10,
|
||||
"unit": "x"
|
||||
"unit": "x",
|
||||
"advanced": true,
|
||||
"restartRequired": "world",
|
||||
"dangerous": true
|
||||
},
|
||||
{
|
||||
"key": "Rate.Creature.Elite.Elite.Damage",
|
||||
"type": "float",
|
||||
"category": "advanced",
|
||||
"title": "Elite creature melee damage",
|
||||
"description": "Multiplier for elite creature melee damage. 1 is normal. Requires a world server restart.",
|
||||
"default": 1,
|
||||
"min": 0.1,
|
||||
"max": 10,
|
||||
"unit": "x",
|
||||
"advanced": true,
|
||||
"restartRequired": "world",
|
||||
"dangerous": true
|
||||
},
|
||||
{
|
||||
"key": "Rate.Creature.Elite.Elite.SpellDamage",
|
||||
"type": "float",
|
||||
"category": "advanced",
|
||||
"title": "Elite creature spell damage",
|
||||
"description": "Multiplier for elite creature spell damage. 1 is normal. Requires a world server restart.",
|
||||
"default": 1,
|
||||
"min": 0.1,
|
||||
"max": 10,
|
||||
"unit": "x",
|
||||
"advanced": true,
|
||||
"restartRequired": "world",
|
||||
"dangerous": true
|
||||
},
|
||||
{
|
||||
"key": "Rate.Creature.Elite.Elite.HP",
|
||||
"type": "float",
|
||||
"category": "advanced",
|
||||
"title": "Elite creature health",
|
||||
"description": "Multiplier for elite creature health. 1 is normal. Requires a world server restart.",
|
||||
"default": 1,
|
||||
"min": 0.1,
|
||||
"max": 10,
|
||||
"unit": "x",
|
||||
"advanced": true,
|
||||
"restartRequired": "world",
|
||||
"dangerous": true
|
||||
},
|
||||
{
|
||||
"key": "Rate.Creature.Elite.RARE.Damage",
|
||||
"type": "float",
|
||||
"category": "advanced",
|
||||
"title": "Rare creature melee damage",
|
||||
"description": "Multiplier for rare creature melee damage. 1 is normal. Requires a world server restart.",
|
||||
"default": 1,
|
||||
"min": 0.1,
|
||||
"max": 10,
|
||||
"unit": "x",
|
||||
"advanced": true,
|
||||
"restartRequired": "world",
|
||||
"dangerous": true
|
||||
},
|
||||
{
|
||||
"key": "Rate.Creature.Elite.RARE.SpellDamage",
|
||||
"type": "float",
|
||||
"category": "advanced",
|
||||
"title": "Rare creature spell damage",
|
||||
"description": "Multiplier for rare creature spell damage. 1 is normal. Requires a world server restart.",
|
||||
"default": 1,
|
||||
"min": 0.1,
|
||||
"max": 10,
|
||||
"unit": "x",
|
||||
"advanced": true,
|
||||
"restartRequired": "world",
|
||||
"dangerous": true
|
||||
},
|
||||
{
|
||||
"key": "Rate.Creature.Elite.RARE.HP",
|
||||
"type": "float",
|
||||
"category": "advanced",
|
||||
"title": "Rare creature health",
|
||||
"description": "Multiplier for rare creature health. 1 is normal. Requires a world server restart.",
|
||||
"default": 1,
|
||||
"min": 0.1,
|
||||
"max": 10,
|
||||
"unit": "x",
|
||||
"advanced": true,
|
||||
"restartRequired": "world",
|
||||
"dangerous": true
|
||||
},
|
||||
{
|
||||
"key": "Rate.Creature.Elite.RAREELITE.Damage",
|
||||
"type": "float",
|
||||
"category": "advanced",
|
||||
"title": "Rare elite creature melee damage",
|
||||
"description": "Multiplier for rare elite creature melee damage. 1 is normal. Requires a world server restart.",
|
||||
"default": 1,
|
||||
"min": 0.1,
|
||||
"max": 10,
|
||||
"unit": "x",
|
||||
"advanced": true,
|
||||
"restartRequired": "world",
|
||||
"dangerous": true
|
||||
},
|
||||
{
|
||||
"key": "Rate.Creature.Elite.RAREELITE.SpellDamage",
|
||||
"type": "float",
|
||||
"category": "advanced",
|
||||
"title": "Rare elite creature spell damage",
|
||||
"description": "Multiplier for rare elite creature spell damage. 1 is normal. Requires a world server restart.",
|
||||
"default": 1,
|
||||
"min": 0.1,
|
||||
"max": 10,
|
||||
"unit": "x",
|
||||
"advanced": true,
|
||||
"restartRequired": "world",
|
||||
"dangerous": true
|
||||
},
|
||||
{
|
||||
"key": "Rate.Creature.Elite.RAREELITE.HP",
|
||||
"type": "float",
|
||||
"category": "advanced",
|
||||
"title": "Rare elite creature health",
|
||||
"description": "Multiplier for rare elite creature health. 1 is normal. Requires a world server restart.",
|
||||
"default": 1,
|
||||
"min": 0.1,
|
||||
"max": 10,
|
||||
"unit": "x",
|
||||
"advanced": true,
|
||||
"restartRequired": "world",
|
||||
"dangerous": true
|
||||
},
|
||||
{
|
||||
"key": "Rate.Creature.Elite.WORLDBOSS.Damage",
|
||||
"type": "float",
|
||||
"category": "advanced",
|
||||
"title": "World boss melee damage",
|
||||
"description": "Multiplier for world boss melee damage. 1 is normal. Requires a world server restart.",
|
||||
"default": 1,
|
||||
"min": 0.1,
|
||||
"max": 10,
|
||||
"unit": "x",
|
||||
"advanced": true,
|
||||
"restartRequired": "world",
|
||||
"dangerous": true
|
||||
},
|
||||
{
|
||||
"key": "Rate.Creature.Elite.WORLDBOSS.SpellDamage",
|
||||
"type": "float",
|
||||
"category": "advanced",
|
||||
"title": "World boss spell damage",
|
||||
"description": "Multiplier for world boss spell damage. 1 is normal. Requires a world server restart.",
|
||||
"default": 1,
|
||||
"min": 0.1,
|
||||
"max": 10,
|
||||
"unit": "x",
|
||||
"advanced": true,
|
||||
"restartRequired": "world",
|
||||
"dangerous": true
|
||||
},
|
||||
{
|
||||
"key": "Rate.Creature.Elite.WORLDBOSS.HP",
|
||||
"type": "float",
|
||||
"category": "advanced",
|
||||
"title": "World boss health",
|
||||
"description": "Multiplier for world boss health. 1 is normal. Requires a world server restart.",
|
||||
"default": 1,
|
||||
"min": 0.1,
|
||||
"max": 10,
|
||||
"unit": "x",
|
||||
"advanced": true,
|
||||
"restartRequired": "world",
|
||||
"dangerous": true
|
||||
},
|
||||
{
|
||||
"key": "PlayerLimit",
|
||||
|
||||
@@ -847,8 +847,10 @@ async fn check_update(state: State<'_, AppState>, id: String, source: Option<Str
|
||||
let access = if background.unwrap_or(false) { update::DatabaseAccess::OnlyIfRunning } else { update::DatabaseAccess::Start };
|
||||
blocking(move || {
|
||||
let (_, meta) = install_meta(&root)?;
|
||||
let src = update_source(source)?;
|
||||
update::preview_with(&root, &meta, &src, coa_core::signing::EMBEDDED_PUBLIC_KEY, &Default::default(), access)
|
||||
let selection = coa_core::update_route::select(&meta, update_source(source)?, coa_core::signing::EMBEDDED_PUBLIC_KEY)?;
|
||||
let mut preview = update::preview_with(&root, &meta, &selection.source, coa_core::signing::EMBEDDED_PUBLIC_KEY, &Default::default(), access)?;
|
||||
preview.latest_version = selection.latest_version;
|
||||
Ok(preview)
|
||||
})
|
||||
.await
|
||||
}
|
||||
@@ -871,8 +873,8 @@ async fn apply_update(
|
||||
|
||||
let _guard = BusyGuard::acquire(&state, &id)?;
|
||||
blocking(move || {
|
||||
let src = update_source(source)?;
|
||||
let (dir, meta) = install_meta(&root)?;
|
||||
let src = coa_core::update_route::select(&meta, update_source(source)?, coa_core::signing::EMBEDDED_PUBLIC_KEY)?.source;
|
||||
let (manifest, _) = coa_core::pkgsource::fetch_manifest(&src, coa_core::signing::EMBEDDED_PUBLIC_KEY)?;
|
||||
update::validate_candidate(&meta, &manifest)?;
|
||||
// Files cannot be replaced while the server runs: stop it first (gracefully), like the Stop button.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "CoA Server Manager",
|
||||
"version": "0.6.17",
|
||||
"version": "0.6.21",
|
||||
"identifier": "com.coa.servermanager",
|
||||
"build": {
|
||||
"beforeDevCommand": "npm run dev",
|
||||
|
||||
@@ -430,6 +430,7 @@ const en = {
|
||||
"upd.folderHint": "Update package folder (leave empty to use the official source)",
|
||||
"upd.available": "Version {to} is available",
|
||||
"upd.availableFrom": "Version {to} is available (you have {from})",
|
||||
"upd.intermediate": "Update to {to} first, then check again to continue to {latest}. The package supports this version sequence; your database is checked when you update.",
|
||||
"upd.summary": "Download {size} · {files} file(s) change",
|
||||
"upd.summaryDb": "Download {size} · {files} file(s) change · {db} database update(s)",
|
||||
"upd.conflict": "This file was modified outside CoA Server Manager.",
|
||||
|
||||
@@ -412,6 +412,7 @@ const ru: Partial<Record<keyof typeof en, string>> = {
|
||||
"upd.folderHint": "Папка с пакетом обновления (оставьте пустым, чтобы использовать официальный источник)",
|
||||
"upd.available": "Доступна версия {to}",
|
||||
"upd.availableFrom": "Доступна версия {to} (у вас {from})",
|
||||
"upd.intermediate": "Сначала обновитесь до {to}, затем проверьте обновления ещё раз для перехода на {latest}. Пакет поддерживает эту последовательность версий; состояние вашей базы проверяется при обновлении.",
|
||||
"upd.summary": "Загрузка {size} · изменится файлов: {files}",
|
||||
"upd.summaryDb": "Загрузка {size} · изменится файлов: {files} · обновлений базы данных: {db}",
|
||||
"upd.conflict": "Этот файл был изменён вне CoA Server Manager.",
|
||||
|
||||
+56
-4
@@ -352,12 +352,12 @@
|
||||
"d": "Geschwindigkeit, mit der Erholungsbonus online in einem Ruhebereich aufgebaut wird."
|
||||
},
|
||||
"Rate.Creature.Normal.Damage": {
|
||||
"t": "Monsterschaden",
|
||||
"d": "Multiplikator für den Schaden normaler Monster. Verändert den Schwierigkeitsgrad stark."
|
||||
"t": "Normale Kreaturen — Nahkampfschaden",
|
||||
"d": "Multiplikator: Normale Kreaturen — Nahkampfschaden. 1 ist der normale Wert. Neustart des Weltservers erforderlich."
|
||||
},
|
||||
"Rate.Creature.Normal.HP": {
|
||||
"t": "Monstergesundheit",
|
||||
"d": "Multiplikator für die Gesundheit normaler Monster. Verändert den Schwierigkeitsgrad stark."
|
||||
"t": "Normale Kreaturen — Gesundheit",
|
||||
"d": "Multiplikator: Normale Kreaturen — Gesundheit. 1 ist der normale Wert. Neustart des Weltservers erforderlich."
|
||||
},
|
||||
"PlayerLimit": {
|
||||
"t": "Maximale Spielerzahl",
|
||||
@@ -550,6 +550,58 @@
|
||||
"Achievement.RealmFirstBlockBots": {
|
||||
"t": "Bots erhalten kein „Server-Erster“",
|
||||
"d": "Begleiter (Bots) können keine „Server-Erster“-Erfolge erringen und nehmen sie echten Spielern daher nie weg. Benötigt einen Server-Build vom 02.10.2026 oder neuer."
|
||||
},
|
||||
"Rate.Creature.Normal.SpellDamage": {
|
||||
"t": "Normale Kreaturen — Zauberschaden",
|
||||
"d": "Multiplikator: Normale Kreaturen — Zauberschaden. 1 ist der normale Wert. Neustart des Weltservers erforderlich."
|
||||
},
|
||||
"Rate.Creature.Elite.Elite.Damage": {
|
||||
"t": "Elite-Kreaturen — Nahkampfschaden",
|
||||
"d": "Multiplikator: Elite-Kreaturen — Nahkampfschaden. 1 ist der normale Wert. Neustart des Weltservers erforderlich."
|
||||
},
|
||||
"Rate.Creature.Elite.Elite.SpellDamage": {
|
||||
"t": "Elite-Kreaturen — Zauberschaden",
|
||||
"d": "Multiplikator: Elite-Kreaturen — Zauberschaden. 1 ist der normale Wert. Neustart des Weltservers erforderlich."
|
||||
},
|
||||
"Rate.Creature.Elite.Elite.HP": {
|
||||
"t": "Elite-Kreaturen — Gesundheit",
|
||||
"d": "Multiplikator: Elite-Kreaturen — Gesundheit. 1 ist der normale Wert. Neustart des Weltservers erforderlich."
|
||||
},
|
||||
"Rate.Creature.Elite.RARE.Damage": {
|
||||
"t": "Seltene Kreaturen — Nahkampfschaden",
|
||||
"d": "Multiplikator: Seltene Kreaturen — Nahkampfschaden. 1 ist der normale Wert. Neustart des Weltservers erforderlich."
|
||||
},
|
||||
"Rate.Creature.Elite.RARE.SpellDamage": {
|
||||
"t": "Seltene Kreaturen — Zauberschaden",
|
||||
"d": "Multiplikator: Seltene Kreaturen — Zauberschaden. 1 ist der normale Wert. Neustart des Weltservers erforderlich."
|
||||
},
|
||||
"Rate.Creature.Elite.RARE.HP": {
|
||||
"t": "Seltene Kreaturen — Gesundheit",
|
||||
"d": "Multiplikator: Seltene Kreaturen — Gesundheit. 1 ist der normale Wert. Neustart des Weltservers erforderlich."
|
||||
},
|
||||
"Rate.Creature.Elite.RAREELITE.Damage": {
|
||||
"t": "Seltene Elite-Kreaturen — Nahkampfschaden",
|
||||
"d": "Multiplikator: Seltene Elite-Kreaturen — Nahkampfschaden. 1 ist der normale Wert. Neustart des Weltservers erforderlich."
|
||||
},
|
||||
"Rate.Creature.Elite.RAREELITE.SpellDamage": {
|
||||
"t": "Seltene Elite-Kreaturen — Zauberschaden",
|
||||
"d": "Multiplikator: Seltene Elite-Kreaturen — Zauberschaden. 1 ist der normale Wert. Neustart des Weltservers erforderlich."
|
||||
},
|
||||
"Rate.Creature.Elite.RAREELITE.HP": {
|
||||
"t": "Seltene Elite-Kreaturen — Gesundheit",
|
||||
"d": "Multiplikator: Seltene Elite-Kreaturen — Gesundheit. 1 ist der normale Wert. Neustart des Weltservers erforderlich."
|
||||
},
|
||||
"Rate.Creature.Elite.WORLDBOSS.Damage": {
|
||||
"t": "Weltbosse — Nahkampfschaden",
|
||||
"d": "Multiplikator: Weltbosse — Nahkampfschaden. 1 ist der normale Wert. Neustart des Weltservers erforderlich."
|
||||
},
|
||||
"Rate.Creature.Elite.WORLDBOSS.SpellDamage": {
|
||||
"t": "Weltbosse — Zauberschaden",
|
||||
"d": "Multiplikator: Weltbosse — Zauberschaden. 1 ist der normale Wert. Neustart des Weltservers erforderlich."
|
||||
},
|
||||
"Rate.Creature.Elite.WORLDBOSS.HP": {
|
||||
"t": "Weltbosse — Gesundheit",
|
||||
"d": "Multiplikator: Weltbosse — Gesundheit. 1 ist der normale Wert. Neustart des Weltservers erforderlich."
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
|
||||
+56
-4
@@ -352,12 +352,12 @@
|
||||
"d": "Velocidad de acumulación de experiencia de descanso mientras estás conectado en una zona de descanso."
|
||||
},
|
||||
"Rate.Creature.Normal.Damage": {
|
||||
"t": "Daño de los monstruos",
|
||||
"d": "Multiplicador del daño de los monstruos normales. Cambia mucho la dificultad."
|
||||
"t": "Criaturas normales — daño cuerpo a cuerpo",
|
||||
"d": "Multiplicador: Criaturas normales — daño cuerpo a cuerpo. 1 es el valor normal. Requiere reiniciar el servidor de mundo."
|
||||
},
|
||||
"Rate.Creature.Normal.HP": {
|
||||
"t": "Salud de los monstruos",
|
||||
"d": "Multiplicador de la salud de los monstruos normales. Cambia mucho la dificultad."
|
||||
"t": "Criaturas normales — salud",
|
||||
"d": "Multiplicador: Criaturas normales — salud. 1 es el valor normal. Requiere reiniciar el servidor de mundo."
|
||||
},
|
||||
"PlayerLimit": {
|
||||
"t": "Máximo de jugadores",
|
||||
@@ -550,6 +550,58 @@
|
||||
"Achievement.RealmFirstBlockBots": {
|
||||
"t": "Los bots no logran «Primero del reino»",
|
||||
"d": "Los acompañantes (bots) no pueden conseguir los logros «Primero del reino», así que nunca se los quitan a los jugadores reales. Requiere una versión del servidor del 2 de octubre de 2026 o posterior."
|
||||
},
|
||||
"Rate.Creature.Normal.SpellDamage": {
|
||||
"t": "Criaturas normales — daño de hechizos",
|
||||
"d": "Multiplicador: Criaturas normales — daño de hechizos. 1 es el valor normal. Requiere reiniciar el servidor de mundo."
|
||||
},
|
||||
"Rate.Creature.Elite.Elite.Damage": {
|
||||
"t": "Criaturas élite — daño cuerpo a cuerpo",
|
||||
"d": "Multiplicador: Criaturas élite — daño cuerpo a cuerpo. 1 es el valor normal. Requiere reiniciar el servidor de mundo."
|
||||
},
|
||||
"Rate.Creature.Elite.Elite.SpellDamage": {
|
||||
"t": "Criaturas élite — daño de hechizos",
|
||||
"d": "Multiplicador: Criaturas élite — daño de hechizos. 1 es el valor normal. Requiere reiniciar el servidor de mundo."
|
||||
},
|
||||
"Rate.Creature.Elite.Elite.HP": {
|
||||
"t": "Criaturas élite — salud",
|
||||
"d": "Multiplicador: Criaturas élite — salud. 1 es el valor normal. Requiere reiniciar el servidor de mundo."
|
||||
},
|
||||
"Rate.Creature.Elite.RARE.Damage": {
|
||||
"t": "Criaturas raras — daño cuerpo a cuerpo",
|
||||
"d": "Multiplicador: Criaturas raras — daño cuerpo a cuerpo. 1 es el valor normal. Requiere reiniciar el servidor de mundo."
|
||||
},
|
||||
"Rate.Creature.Elite.RARE.SpellDamage": {
|
||||
"t": "Criaturas raras — daño de hechizos",
|
||||
"d": "Multiplicador: Criaturas raras — daño de hechizos. 1 es el valor normal. Requiere reiniciar el servidor de mundo."
|
||||
},
|
||||
"Rate.Creature.Elite.RARE.HP": {
|
||||
"t": "Criaturas raras — salud",
|
||||
"d": "Multiplicador: Criaturas raras — salud. 1 es el valor normal. Requiere reiniciar el servidor de mundo."
|
||||
},
|
||||
"Rate.Creature.Elite.RAREELITE.Damage": {
|
||||
"t": "Criaturas raras élite — daño cuerpo a cuerpo",
|
||||
"d": "Multiplicador: Criaturas raras élite — daño cuerpo a cuerpo. 1 es el valor normal. Requiere reiniciar el servidor de mundo."
|
||||
},
|
||||
"Rate.Creature.Elite.RAREELITE.SpellDamage": {
|
||||
"t": "Criaturas raras élite — daño de hechizos",
|
||||
"d": "Multiplicador: Criaturas raras élite — daño de hechizos. 1 es el valor normal. Requiere reiniciar el servidor de mundo."
|
||||
},
|
||||
"Rate.Creature.Elite.RAREELITE.HP": {
|
||||
"t": "Criaturas raras élite — salud",
|
||||
"d": "Multiplicador: Criaturas raras élite — salud. 1 es el valor normal. Requiere reiniciar el servidor de mundo."
|
||||
},
|
||||
"Rate.Creature.Elite.WORLDBOSS.Damage": {
|
||||
"t": "Jefes de mundo — daño cuerpo a cuerpo",
|
||||
"d": "Multiplicador: Jefes de mundo — daño cuerpo a cuerpo. 1 es el valor normal. Requiere reiniciar el servidor de mundo."
|
||||
},
|
||||
"Rate.Creature.Elite.WORLDBOSS.SpellDamage": {
|
||||
"t": "Jefes de mundo — daño de hechizos",
|
||||
"d": "Multiplicador: Jefes de mundo — daño de hechizos. 1 es el valor normal. Requiere reiniciar el servidor de mundo."
|
||||
},
|
||||
"Rate.Creature.Elite.WORLDBOSS.HP": {
|
||||
"t": "Jefes de mundo — salud",
|
||||
"d": "Multiplicador: Jefes de mundo — salud. 1 es el valor normal. Requiere reiniciar el servidor de mundo."
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
|
||||
+56
-4
@@ -352,12 +352,12 @@
|
||||
"d": "Vitesse d’accumulation du bonus de repos en ligne dans une zone de repos."
|
||||
},
|
||||
"Rate.Creature.Normal.Damage": {
|
||||
"t": "Dégâts des monstres",
|
||||
"d": "Multiplicateur des dégâts des monstres normaux. Change beaucoup la difficulté."
|
||||
"t": "Créatures normales — dégâts de mêlée",
|
||||
"d": "Multiplicateur : Créatures normales — dégâts de mêlée. 1 correspond à la valeur normale. Redémarrage du serveur de monde requis."
|
||||
},
|
||||
"Rate.Creature.Normal.HP": {
|
||||
"t": "Vie des monstres",
|
||||
"d": "Multiplicateur de la vie des monstres normaux. Change beaucoup la difficulté."
|
||||
"t": "Créatures normales — points de vie",
|
||||
"d": "Multiplicateur : Créatures normales — points de vie. 1 correspond à la valeur normale. Redémarrage du serveur de monde requis."
|
||||
},
|
||||
"PlayerLimit": {
|
||||
"t": "Nombre maximal de joueurs",
|
||||
@@ -550,6 +550,58 @@
|
||||
"Achievement.RealmFirstBlockBots": {
|
||||
"t": "Les bots n'obtiennent pas les « Premier du royaume »",
|
||||
"d": "Les compagnons (bots) ne peuvent pas obtenir les hauts faits « Premier du royaume » et ne les prennent donc jamais aux vrais joueurs. Nécessite une version du serveur du 2 octobre 2026 ou plus récente."
|
||||
},
|
||||
"Rate.Creature.Normal.SpellDamage": {
|
||||
"t": "Créatures normales — dégâts des sorts",
|
||||
"d": "Multiplicateur : Créatures normales — dégâts des sorts. 1 correspond à la valeur normale. Redémarrage du serveur de monde requis."
|
||||
},
|
||||
"Rate.Creature.Elite.Elite.Damage": {
|
||||
"t": "Créatures élites — dégâts de mêlée",
|
||||
"d": "Multiplicateur : Créatures élites — dégâts de mêlée. 1 correspond à la valeur normale. Redémarrage du serveur de monde requis."
|
||||
},
|
||||
"Rate.Creature.Elite.Elite.SpellDamage": {
|
||||
"t": "Créatures élites — dégâts des sorts",
|
||||
"d": "Multiplicateur : Créatures élites — dégâts des sorts. 1 correspond à la valeur normale. Redémarrage du serveur de monde requis."
|
||||
},
|
||||
"Rate.Creature.Elite.Elite.HP": {
|
||||
"t": "Créatures élites — points de vie",
|
||||
"d": "Multiplicateur : Créatures élites — points de vie. 1 correspond à la valeur normale. Redémarrage du serveur de monde requis."
|
||||
},
|
||||
"Rate.Creature.Elite.RARE.Damage": {
|
||||
"t": "Créatures rares — dégâts de mêlée",
|
||||
"d": "Multiplicateur : Créatures rares — dégâts de mêlée. 1 correspond à la valeur normale. Redémarrage du serveur de monde requis."
|
||||
},
|
||||
"Rate.Creature.Elite.RARE.SpellDamage": {
|
||||
"t": "Créatures rares — dégâts des sorts",
|
||||
"d": "Multiplicateur : Créatures rares — dégâts des sorts. 1 correspond à la valeur normale. Redémarrage du serveur de monde requis."
|
||||
},
|
||||
"Rate.Creature.Elite.RARE.HP": {
|
||||
"t": "Créatures rares — points de vie",
|
||||
"d": "Multiplicateur : Créatures rares — points de vie. 1 correspond à la valeur normale. Redémarrage du serveur de monde requis."
|
||||
},
|
||||
"Rate.Creature.Elite.RAREELITE.Damage": {
|
||||
"t": "Créatures rares élites — dégâts de mêlée",
|
||||
"d": "Multiplicateur : Créatures rares élites — dégâts de mêlée. 1 correspond à la valeur normale. Redémarrage du serveur de monde requis."
|
||||
},
|
||||
"Rate.Creature.Elite.RAREELITE.SpellDamage": {
|
||||
"t": "Créatures rares élites — dégâts des sorts",
|
||||
"d": "Multiplicateur : Créatures rares élites — dégâts des sorts. 1 correspond à la valeur normale. Redémarrage du serveur de monde requis."
|
||||
},
|
||||
"Rate.Creature.Elite.RAREELITE.HP": {
|
||||
"t": "Créatures rares élites — points de vie",
|
||||
"d": "Multiplicateur : Créatures rares élites — points de vie. 1 correspond à la valeur normale. Redémarrage du serveur de monde requis."
|
||||
},
|
||||
"Rate.Creature.Elite.WORLDBOSS.Damage": {
|
||||
"t": "Boss mondiaux — dégâts de mêlée",
|
||||
"d": "Multiplicateur : Boss mondiaux — dégâts de mêlée. 1 correspond à la valeur normale. Redémarrage du serveur de monde requis."
|
||||
},
|
||||
"Rate.Creature.Elite.WORLDBOSS.SpellDamage": {
|
||||
"t": "Boss mondiaux — dégâts des sorts",
|
||||
"d": "Multiplicateur : Boss mondiaux — dégâts des sorts. 1 correspond à la valeur normale. Redémarrage du serveur de monde requis."
|
||||
},
|
||||
"Rate.Creature.Elite.WORLDBOSS.HP": {
|
||||
"t": "Boss mondiaux — points de vie",
|
||||
"d": "Multiplicateur : Boss mondiaux — points de vie. 1 correspond à la valeur normale. Redémarrage du serveur de monde requis."
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
|
||||
+56
-4
@@ -352,12 +352,12 @@
|
||||
"d": "Скорость накопления опыта отдыха, пока персонаж находится онлайн в зоне отдыха."
|
||||
},
|
||||
"Rate.Creature.Normal.Damage": {
|
||||
"t": "Урон монстров",
|
||||
"d": "Множитель урона обычных монстров. Сильно меняет сложность."
|
||||
"t": "Обычные существа — урон в ближнем бою",
|
||||
"d": "Множитель: Обычные существа — урон в ближнем бою. 1 означает обычное значение. Требуется перезапуск мира."
|
||||
},
|
||||
"Rate.Creature.Normal.HP": {
|
||||
"t": "Здоровье монстров",
|
||||
"d": "Множитель здоровья обычных монстров. Сильно меняет сложность."
|
||||
"t": "Обычные существа — здоровье",
|
||||
"d": "Множитель: Обычные существа — здоровье. 1 означает обычное значение. Требуется перезапуск мира."
|
||||
},
|
||||
"PlayerLimit": {
|
||||
"t": "Максимум игроков",
|
||||
@@ -550,6 +550,58 @@
|
||||
"Achievement.RealmFirstBlockBots": {
|
||||
"t": "Боты не получают «Первый на сервере»",
|
||||
"d": "Спутники (боты) не могут получать достижения «Первый на сервере», поэтому никогда не отнимают их у настоящих игроков. Нужна сборка сервера от 2 октября 2026 или новее."
|
||||
},
|
||||
"Rate.Creature.Normal.SpellDamage": {
|
||||
"t": "Обычные существа — урон заклинаний",
|
||||
"d": "Множитель: Обычные существа — урон заклинаний. 1 означает обычное значение. Требуется перезапуск мира."
|
||||
},
|
||||
"Rate.Creature.Elite.Elite.Damage": {
|
||||
"t": "Элитные существа — урон в ближнем бою",
|
||||
"d": "Множитель: Элитные существа — урон в ближнем бою. 1 означает обычное значение. Требуется перезапуск мира."
|
||||
},
|
||||
"Rate.Creature.Elite.Elite.SpellDamage": {
|
||||
"t": "Элитные существа — урон заклинаний",
|
||||
"d": "Множитель: Элитные существа — урон заклинаний. 1 означает обычное значение. Требуется перезапуск мира."
|
||||
},
|
||||
"Rate.Creature.Elite.Elite.HP": {
|
||||
"t": "Элитные существа — здоровье",
|
||||
"d": "Множитель: Элитные существа — здоровье. 1 означает обычное значение. Требуется перезапуск мира."
|
||||
},
|
||||
"Rate.Creature.Elite.RARE.Damage": {
|
||||
"t": "Редкие существа — урон в ближнем бою",
|
||||
"d": "Множитель: Редкие существа — урон в ближнем бою. 1 означает обычное значение. Требуется перезапуск мира."
|
||||
},
|
||||
"Rate.Creature.Elite.RARE.SpellDamage": {
|
||||
"t": "Редкие существа — урон заклинаний",
|
||||
"d": "Множитель: Редкие существа — урон заклинаний. 1 означает обычное значение. Требуется перезапуск мира."
|
||||
},
|
||||
"Rate.Creature.Elite.RARE.HP": {
|
||||
"t": "Редкие существа — здоровье",
|
||||
"d": "Множитель: Редкие существа — здоровье. 1 означает обычное значение. Требуется перезапуск мира."
|
||||
},
|
||||
"Rate.Creature.Elite.RAREELITE.Damage": {
|
||||
"t": "Редкие элитные существа — урон в ближнем бою",
|
||||
"d": "Множитель: Редкие элитные существа — урон в ближнем бою. 1 означает обычное значение. Требуется перезапуск мира."
|
||||
},
|
||||
"Rate.Creature.Elite.RAREELITE.SpellDamage": {
|
||||
"t": "Редкие элитные существа — урон заклинаний",
|
||||
"d": "Множитель: Редкие элитные существа — урон заклинаний. 1 означает обычное значение. Требуется перезапуск мира."
|
||||
},
|
||||
"Rate.Creature.Elite.RAREELITE.HP": {
|
||||
"t": "Редкие элитные существа — здоровье",
|
||||
"d": "Множитель: Редкие элитные существа — здоровье. 1 означает обычное значение. Требуется перезапуск мира."
|
||||
},
|
||||
"Rate.Creature.Elite.WORLDBOSS.Damage": {
|
||||
"t": "Мировые боссы — урон в ближнем бою",
|
||||
"d": "Множитель: Мировые боссы — урон в ближнем бою. 1 означает обычное значение. Требуется перезапуск мира."
|
||||
},
|
||||
"Rate.Creature.Elite.WORLDBOSS.SpellDamage": {
|
||||
"t": "Мировые боссы — урон заклинаний",
|
||||
"d": "Множитель: Мировые боссы — урон заклинаний. 1 означает обычное значение. Требуется перезапуск мира."
|
||||
},
|
||||
"Rate.Creature.Elite.WORLDBOSS.HP": {
|
||||
"t": "Мировые боссы — здоровье",
|
||||
"d": "Множитель: Мировые боссы — здоровье. 1 означает обычное значение. Требуется перезапуск мира."
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
|
||||
+57
-5
@@ -352,12 +352,12 @@
|
||||
"d": "在线处于休息区域时,休息经验的积累速度。"
|
||||
},
|
||||
"Rate.Creature.Normal.Damage": {
|
||||
"t": "普通怪物伤害倍率",
|
||||
"d": "普通怪物造成的伤害乘数。大幅改变游戏战斗难度。"
|
||||
"t": "普通生物 — 近战伤害",
|
||||
"d": "普通生物近战伤害倍率。1 为正常值,需要重启世界服务器。"
|
||||
},
|
||||
"Rate.Creature.Normal.HP": {
|
||||
"t": "普通怪物生命值倍率",
|
||||
"d": "普通怪物的生命值上限乘数。大幅改变游戏战斗难度。"
|
||||
"t": "普通生物 — 生命值",
|
||||
"d": "普通生物生命值倍率。1 为正常值,需要重启世界服务器。"
|
||||
},
|
||||
"PlayerLimit": {
|
||||
"t": "最大同时在线玩家数",
|
||||
@@ -550,6 +550,58 @@
|
||||
"Achievement.RealmFirstBlockBots": {
|
||||
"t": "禁止机器人获取“服务器第一”成就",
|
||||
"d": "随从(机器人)无法获得“服务器第一!”成就,绝不抢占真实玩家的第一名荣誉。需要 2026-10-02 或更新的服务器核心版本。"
|
||||
},
|
||||
"Rate.Creature.Normal.SpellDamage": {
|
||||
"t": "普通生物 — 法术伤害",
|
||||
"d": "普通生物法术伤害倍率。1 为正常值,需要重启世界服务器。"
|
||||
},
|
||||
"Rate.Creature.Elite.Elite.Damage": {
|
||||
"t": "精英生物 — 近战伤害",
|
||||
"d": "精英生物近战伤害倍率。1 为正常值,需要重启世界服务器。"
|
||||
},
|
||||
"Rate.Creature.Elite.Elite.SpellDamage": {
|
||||
"t": "精英生物 — 法术伤害",
|
||||
"d": "精英生物法术伤害倍率。1 为正常值,需要重启世界服务器。"
|
||||
},
|
||||
"Rate.Creature.Elite.Elite.HP": {
|
||||
"t": "精英生物 — 生命值",
|
||||
"d": "精英生物生命值倍率。1 为正常值,需要重启世界服务器。"
|
||||
},
|
||||
"Rate.Creature.Elite.RARE.Damage": {
|
||||
"t": "稀有生物 — 近战伤害",
|
||||
"d": "稀有生物近战伤害倍率。1 为正常值,需要重启世界服务器。"
|
||||
},
|
||||
"Rate.Creature.Elite.RARE.SpellDamage": {
|
||||
"t": "稀有生物 — 法术伤害",
|
||||
"d": "稀有生物法术伤害倍率。1 为正常值,需要重启世界服务器。"
|
||||
},
|
||||
"Rate.Creature.Elite.RARE.HP": {
|
||||
"t": "稀有生物 — 生命值",
|
||||
"d": "稀有生物生命值倍率。1 为正常值,需要重启世界服务器。"
|
||||
},
|
||||
"Rate.Creature.Elite.RAREELITE.Damage": {
|
||||
"t": "稀有精英生物 — 近战伤害",
|
||||
"d": "稀有精英生物近战伤害倍率。1 为正常值,需要重启世界服务器。"
|
||||
},
|
||||
"Rate.Creature.Elite.RAREELITE.SpellDamage": {
|
||||
"t": "稀有精英生物 — 法术伤害",
|
||||
"d": "稀有精英生物法术伤害倍率。1 为正常值,需要重启世界服务器。"
|
||||
},
|
||||
"Rate.Creature.Elite.RAREELITE.HP": {
|
||||
"t": "稀有精英生物 — 生命值",
|
||||
"d": "稀有精英生物生命值倍率。1 为正常值,需要重启世界服务器。"
|
||||
},
|
||||
"Rate.Creature.Elite.WORLDBOSS.Damage": {
|
||||
"t": "世界首领 — 近战伤害",
|
||||
"d": "世界首领近战伤害倍率。1 为正常值,需要重启世界服务器。"
|
||||
},
|
||||
"Rate.Creature.Elite.WORLDBOSS.SpellDamage": {
|
||||
"t": "世界首领 — 法术伤害",
|
||||
"d": "世界首领法术伤害倍率。1 为正常值,需要重启世界服务器。"
|
||||
},
|
||||
"Rate.Creature.Elite.WORLDBOSS.HP": {
|
||||
"t": "世界首领 — 生命值",
|
||||
"d": "世界首领生命值倍率。1 为正常值,需要重启世界服务器。"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
@@ -598,4 +650,4 @@
|
||||
"d": "所有设置恢复为默认值。"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -307,6 +307,7 @@ export interface UpdatePlanItem {
|
||||
export interface UpdatePreview {
|
||||
from_version: string | null;
|
||||
to_version: string;
|
||||
latest_version?: string;
|
||||
items: UpdatePlanItem[];
|
||||
conflicts: string[];
|
||||
migrations: number;
|
||||
|
||||
@@ -545,6 +545,7 @@ export function Overview({ server, companions = true, onForget, onOpenUpdates, o
|
||||
{upd.available && upd.preview && (
|
||||
<div className="mt-4 rounded-md border border-gold/40 bg-gold/5 p-3 text-sm">
|
||||
<p>{t("overview.updateAvail", { to: upd.preview.to_version, from: upd.preview.from_version ?? "?" })}</p>
|
||||
{upd.preview.latest_version && <p>{t("upd.intermediate", { to: upd.preview.to_version, latest: upd.preview.latest_version })}</p>}
|
||||
{needsDecision && <p className="mt-1 text-muted">{t("overview.updateConflicts")}</p>}
|
||||
{upd.applying && (
|
||||
<div className="mt-2">
|
||||
|
||||
@@ -234,6 +234,7 @@ export function SettingsHome({ serverId, path, onForget }: { serverId: string; p
|
||||
<p className="font-medium">
|
||||
{preview.from_version ? t("upd.availableFrom", { to: preview.to_version, from: preview.from_version }) : t("upd.available", { to: preview.to_version })}
|
||||
</p>
|
||||
{preview.latest_version && <p className="mt-1 text-sm text-warn" role="status">{t("upd.intermediate", { to: preview.to_version, latest: preview.latest_version })}</p>}
|
||||
<p className="mt-1 text-sm text-muted">
|
||||
{!preview.database_check_error && (preview.pending_migrations ?? preview.migrations) > 0
|
||||
? t("upd.summaryDb", { size: mb(preview.download_bytes), files: preview.items.filter((i) => i.action !== "skip").length, db: preview.pending_migrations ?? preview.migrations })
|
||||
|
||||
@@ -17,8 +17,21 @@ R = [
|
||||
("Rate.Honor", "float", "rates", "Honor gain", "Multiplier for honor points earned.", 1, 0, 20, "x", False, "world", False),
|
||||
("Rate.Reputation.Gain", "float", "rates", "Reputation gain", "Multiplier for reputation earned.", 1, 0, 20, "x", False, "world", False),
|
||||
("Rate.Rest.InGame", "float", "rates", "Rested bonus while playing", "Speed at which rested experience accumulates while online in a rest area.", 1, 0, 10, "x", True, "world", False),
|
||||
("Rate.Creature.Normal.Damage", "float", "advanced", "Monster damage", "Multiplier for damage dealt by normal monsters. Changes difficulty a lot.", 1, 0.1, 10, "x", True, "world", True),
|
||||
("Rate.Creature.Normal.HP", "float", "advanced", "Monster health", "Multiplier for health of normal monsters. Changes difficulty a lot.", 1, 0.1, 10, "x", True, "world", True),
|
||||
('Rate.Creature.Normal.Damage', 'float', 'advanced', 'Normal creature melee damage', 'Multiplier for normal creature melee damage. 1 is normal. Requires a world server restart.', 1, 0.1, 10, 'x', True, 'world', True),
|
||||
('Rate.Creature.Normal.SpellDamage', 'float', 'advanced', 'Normal creature spell damage', 'Multiplier for normal creature spell damage. 1 is normal. Requires a world server restart.', 1, 0.1, 10, 'x', True, 'world', True),
|
||||
('Rate.Creature.Normal.HP', 'float', 'advanced', 'Normal creature health', 'Multiplier for normal creature health. 1 is normal. Requires a world server restart.', 1, 0.1, 10, 'x', True, 'world', True),
|
||||
('Rate.Creature.Elite.Elite.Damage', 'float', 'advanced', 'Elite creature melee damage', 'Multiplier for elite creature melee damage. 1 is normal. Requires a world server restart.', 1, 0.1, 10, 'x', True, 'world', True),
|
||||
('Rate.Creature.Elite.Elite.SpellDamage', 'float', 'advanced', 'Elite creature spell damage', 'Multiplier for elite creature spell damage. 1 is normal. Requires a world server restart.', 1, 0.1, 10, 'x', True, 'world', True),
|
||||
('Rate.Creature.Elite.Elite.HP', 'float', 'advanced', 'Elite creature health', 'Multiplier for elite creature health. 1 is normal. Requires a world server restart.', 1, 0.1, 10, 'x', True, 'world', True),
|
||||
('Rate.Creature.Elite.RARE.Damage', 'float', 'advanced', 'Rare creature melee damage', 'Multiplier for rare creature melee damage. 1 is normal. Requires a world server restart.', 1, 0.1, 10, 'x', True, 'world', True),
|
||||
('Rate.Creature.Elite.RARE.SpellDamage', 'float', 'advanced', 'Rare creature spell damage', 'Multiplier for rare creature spell damage. 1 is normal. Requires a world server restart.', 1, 0.1, 10, 'x', True, 'world', True),
|
||||
('Rate.Creature.Elite.RARE.HP', 'float', 'advanced', 'Rare creature health', 'Multiplier for rare creature health. 1 is normal. Requires a world server restart.', 1, 0.1, 10, 'x', True, 'world', True),
|
||||
('Rate.Creature.Elite.RAREELITE.Damage', 'float', 'advanced', 'Rare elite creature melee damage', 'Multiplier for rare elite creature melee damage. 1 is normal. Requires a world server restart.', 1, 0.1, 10, 'x', True, 'world', True),
|
||||
('Rate.Creature.Elite.RAREELITE.SpellDamage', 'float', 'advanced', 'Rare elite creature spell damage', 'Multiplier for rare elite creature spell damage. 1 is normal. Requires a world server restart.', 1, 0.1, 10, 'x', True, 'world', True),
|
||||
('Rate.Creature.Elite.RAREELITE.HP', 'float', 'advanced', 'Rare elite creature health', 'Multiplier for rare elite creature health. 1 is normal. Requires a world server restart.', 1, 0.1, 10, 'x', True, 'world', True),
|
||||
('Rate.Creature.Elite.WORLDBOSS.Damage', 'float', 'advanced', 'World boss melee damage', 'Multiplier for world boss melee damage. 1 is normal. Requires a world server restart.', 1, 0.1, 10, 'x', True, 'world', True),
|
||||
('Rate.Creature.Elite.WORLDBOSS.SpellDamage', 'float', 'advanced', 'World boss spell damage', 'Multiplier for world boss spell damage. 1 is normal. Requires a world server restart.', 1, 0.1, 10, 'x', True, 'world', True),
|
||||
('Rate.Creature.Elite.WORLDBOSS.HP', 'float', 'advanced', 'World boss health', 'Multiplier for world boss health. 1 is normal. Requires a world server restart.', 1, 0.1, 10, 'x', True, 'world', True),
|
||||
("PlayerLimit", "int", "world", "Maximum players", "How many players can be online at once. 0 means no limit.", 0, 0, 10000, None, False, "world", False),
|
||||
("GameType", "enum", "advanced", "Realm type", "The realm type shown in the realm list.", 0, None, None, None, True, "world", False),
|
||||
("RealmZone", "int", "advanced", "Realm zone", "The realm's language / region group shown to clients.", 1, 0, 30, None, True, "world", False),
|
||||
|
||||
Reference in new issue
Block a user