mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-19 11:25:56 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c004b90c54 | ||
|
|
d44e00f9ad | ||
|
|
dad10d8a5d | ||
|
|
b33821e7eb | ||
|
|
1288a84da2 | ||
|
|
e7b76137d1 | ||
|
|
7bb0ea9472 | ||
|
|
1dab6154c7 | ||
|
|
06a6302732 | ||
|
|
65631450ff | ||
|
|
2d9c6a65bb | ||
|
|
ce83f04d9d | ||
|
|
81f031b30f | ||
|
|
ee3ca2c517 | ||
|
|
50e858dcd5 | ||
|
|
8bbf16ed4f | ||
|
|
324e9810cc | ||
|
|
a8ab201d7d | ||
|
|
733d73ef76 | ||
|
|
5525325160 | ||
|
|
1aade1dcf9 | ||
|
|
787549237f | ||
|
|
088cd05e4f |
No files matched your search
@@ -25,4 +25,6 @@ jobs:
|
|||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: node tools/check-i18n.mjs
|
- run: node tools/check-i18n.mjs
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
|
- run: node --experimental-strip-types --test tools/*.test.mjs
|
||||||
|
- run: python -B -m unittest discover -s tools -p test_launcher_bridge.py
|
||||||
- run: cargo test --workspace --locked
|
- run: cargo test --workspace --locked
|
||||||
@@ -70,7 +70,9 @@ jobs:
|
|||||||
node-version: 22
|
node-version: 22
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- name: Tests
|
- name: Tests
|
||||||
run: cargo test --workspace -- --test-threads=1
|
run: cargo test --workspace --locked -- --test-threads=1
|
||||||
|
- run: node --experimental-strip-types --test tools/*.test.mjs
|
||||||
|
- run: python -B -m unittest discover -s tools -p test_launcher_bridge.py
|
||||||
- name: Build and sign (publish only when requested)
|
- name: Build and sign (publish only when requested)
|
||||||
id: tauri
|
id: tauri
|
||||||
uses: tauri-apps/tauri-action@v0
|
uses: tauri-apps/tauri-action@v0
|
||||||
|
|||||||
@@ -35,6 +35,16 @@ Every published Manager version, including a clearly marked Pre-release, belongs
|
|||||||
CHANGELOG.md and changelog/history.json. Its GitHub release notes use the same reviewed record.
|
CHANGELOG.md and changelog/history.json. Its GitHub release notes use the same reviewed record.
|
||||||
Promotion updates that entry without duplicating it; Manager and server histories remain separate.
|
Promotion updates that entry without duplicating it; Manager and server histories remain separate.
|
||||||
|
|
||||||
|
Translated release notes are a required preparation step before freezing a new Manager source. Follow the
|
||||||
|
runbook's "Mandatory translated release notes during preparation" checklist: translate every new reviewed
|
||||||
|
Manager/server note into Russian, German, French, Spanish and Simplified Chinese in
|
||||||
|
`src/data/latest-note-translations.json`, keyed by exact canonical English text. Preserve existing translations
|
||||||
|
and released fragments. Refresh the bundled server-history snapshot from a pinned canonical commit and record
|
||||||
|
its provenance. Run `node --test tools/release-history.test.mjs`, `node tools/check-i18n.mjs` and `npm run build`;
|
||||||
|
verify each new record, all six viewer languages, English fallback and offline use. Save source/version and checks
|
||||||
|
in the handoff. Translations ship with Manager: a server-only release must record the carrying Manager version or
|
||||||
|
pending translation delivery, without forcing another Manager release or changing already signed installers.
|
||||||
|
|
||||||
Before preparing or publishing a Manager/server release, read the maintained
|
Before preparing or publishing a Manager/server release, read the maintained
|
||||||
[release runbook](https://github.com/Corfirean/coa-server-build/blob/main/docs/server-release.md)
|
[release runbook](https://github.com/Corfirean/coa-server-build/blob/main/docs/server-release.md)
|
||||||
and [build agent instructions](https://github.com/Corfirean/coa-server-build/blob/main/AGENTS.md).
|
and [build agent instructions](https://github.com/Corfirean/coa-server-build/blob/main/AGENTS.md).
|
||||||
|
|||||||
@@ -8,6 +8,51 @@ Published releases and previews. Pre-release entries do not change the stable up
|
|||||||
|
|
||||||
Dates follow GitHub publication (UTC); legacy records retain their archived dates. Newest releases first.
|
Dates follow GitHub publication (UTC); legacy records retain their archived dates. Newest releases first.
|
||||||
|
|
||||||
|
## 0.9.3 — 2026-10-29
|
||||||
|
|
||||||
|
**Portable Characters are experimental and may contain bugs.**
|
||||||
|
|
||||||
|
- Slow server startup no longer triggers an early update rollback.
|
||||||
|
|
||||||
|
[Release](https://github.com/Corfirean/coa-server-manager/releases/tag/v0.9.3) · [Source changes](https://github.com/Corfirean/coa-server-manager/compare/v0.9.2...v0.9.3)
|
||||||
|
|
||||||
|
## 0.9.2 — 2026-10-28
|
||||||
|
|
||||||
|
**Portable Characters are experimental and may contain bugs.**
|
||||||
|
|
||||||
|
- New server installation waits for slower database startup.
|
||||||
|
- Find and edit CoA options in the existing server settings.
|
||||||
|
- Simultaneous update checks share results or wait their turn.
|
||||||
|
- Recovery can stop an unfinished world startup after restoring an older launcher.
|
||||||
|
|
||||||
|
[Release](https://github.com/Corfirean/coa-server-manager/releases/tag/v0.9.2) · [Source changes](https://github.com/Corfirean/coa-server-manager/compare/v0.9.1...v0.9.2)
|
||||||
|
|
||||||
|
## 0.9.1 — 2026-10-28
|
||||||
|
|
||||||
|
**Portable Characters are experimental and may contain bugs.**
|
||||||
|
|
||||||
|
- Existing unsupported character records no longer block unrelated server updates.
|
||||||
|
|
||||||
|
[Release](https://github.com/Corfirean/coa-server-manager/releases/tag/v0.9.1) · [Source changes](https://github.com/Corfirean/coa-server-manager/compare/v0.9.0...v0.9.1)
|
||||||
|
|
||||||
|
## 0.9.0 — 2026-10-28
|
||||||
|
|
||||||
|
**Portable Characters are experimental and may contain bugs.**
|
||||||
|
|
||||||
|
- Choose Parallel or Global level scaling in module settings.
|
||||||
|
- Report Content Scaling problems directly to its repository.
|
||||||
|
- Send custom race problem reports directly to their maintainer.
|
||||||
|
- Internet sharing restores the LAN address after server restarts.
|
||||||
|
- Configure custom race availability for new characters.
|
||||||
|
- Public listing offers every realm that starts together, not just the main one.
|
||||||
|
- Public listing is a short list of realms with a window for the details.
|
||||||
|
- Configure profession and defense skill gains in server settings.
|
||||||
|
- Starting a server sets the character classes of the realm chosen on Overview.
|
||||||
|
- Start Wildcard and Warcraft Reborn together with Conquest of Azeroth.
|
||||||
|
- Control portable characters and keep Manager running in the system tray.
|
||||||
|
|
||||||
|
[Release](https://github.com/Corfirean/coa-server-manager/releases/tag/v0.9.0) · [Source changes](https://github.com/Corfirean/coa-server-manager/compare/v0.8.2...v0.9.0)
|
||||||
|
|
||||||
## 0.8.2 — 2026-10-27
|
## 0.8.2 — 2026-10-27
|
||||||
|
|
||||||
**Portable Characters are experimental and may contain bugs.**
|
**Portable Characters are experimental and may contain bugs.**
|
||||||
|
|||||||
Generated
+3
-3
@@ -586,7 +586,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "coa-core"
|
name = "coa-core"
|
||||||
version = "0.9.0"
|
version = "0.9.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"chrono",
|
"chrono",
|
||||||
@@ -634,7 +634,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "coa-release"
|
name = "coa-release"
|
||||||
version = "0.9.0"
|
version = "0.9.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"coa-core",
|
"coa-core",
|
||||||
@@ -643,7 +643,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "coa-server-manager"
|
name = "coa-server-manager"
|
||||||
version = "0.9.0"
|
version = "0.9.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"coa-control-proto",
|
"coa-control-proto",
|
||||||
"coa-core",
|
"coa-core",
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ members = ["crates/coa-core", "crates/coa-release", "crates/coa-registry-proto",
|
|||||||
exclude = ["services/coa-registry", "services/coa-registry-e2e", "services/coa-coordinator", "services/coa-relay"]
|
exclude = ["services/coa-registry", "services/coa-registry-e2e", "services/coa-coordinator", "services/coa-relay"]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.9.0"
|
version = "0.9.4"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "AGPL-3.0-only"
|
license = "AGPL-3.0-only"
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
area: manager
|
||||||
|
type: added
|
||||||
|
audience: admins
|
||||||
|
title: Find and edit CoA options in the existing server settings
|
||||||
|
---
|
||||||
|
Search includes the separate CoA configuration, including legacy mount flight. Changes go to the correct file; realm profile controls stay managed by the Manager.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
area: manager
|
||||||
|
type: fixed
|
||||||
|
audience: admins
|
||||||
|
title: Existing unsupported character records no longer block unrelated server updates
|
||||||
|
---
|
||||||
|
Updates compare each affected character with its saved pre-update state. Unchanged older problems are reported as warnings without changing characters. Newly missing race/class data still blocks the update and triggers recovery; schema and identity checks remain enforced.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
area: manager
|
||||||
|
type: fixed
|
||||||
|
audience: admins
|
||||||
|
title: Recovery can stop an unfinished world startup after restoring an older launcher
|
||||||
|
---
|
||||||
|
If the world console is unavailable, stop only the verified recorded world process. Keep MySQL running if ownership or shutdown cannot be confirmed.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
area: manager
|
||||||
|
type: fixed
|
||||||
|
audience: admins
|
||||||
|
title: New server installation waits for slower database startup
|
||||||
|
---
|
||||||
|
Allow up to five minutes for MySQL to become ready. Failed installations stop their temporary database before cleaning up its files.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
area: manager
|
||||||
|
type: changed
|
||||||
|
audience: admins
|
||||||
|
title: Settings group updates, startup and maintenance with translated release history
|
||||||
|
---
|
||||||
|
Server and Manager keep separate update controls. Read their published changes in one place, including translations of the latest releases in all six interface languages. Saved notes remain available offline. Find public realm controls under Play with friends.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
area: manager
|
||||||
|
type: changed
|
||||||
|
audience: admins
|
||||||
|
title: Update and launch without updating share a divided button
|
||||||
|
---
|
||||||
|
Server and game client actions each use two adjacent segments of equal height. Both actions remain visible and keep their own availability checks.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
area: manager
|
||||||
|
type: fixed
|
||||||
|
audience: admins
|
||||||
|
title: Simultaneous update checks share results or wait their turn
|
||||||
|
---
|
||||||
|
Repeated checks no longer compete with another foreground or background check in the same Manager window. Maintenance and recovery locks remain enforced.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
area: manager
|
||||||
|
type: fixed
|
||||||
|
audience: admins
|
||||||
|
title: Maximizing the window keeps text and controls at a comfortable size
|
||||||
|
---
|
||||||
|
The interface no longer enlarges with window width. System display scaling and browser zoom still work, and large action buttons use more compact spacing.
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
area: manager
|
||||||
|
type: fixed
|
||||||
|
audience: admins
|
||||||
|
title: Slow server startup no longer triggers an early update rollback
|
||||||
|
---
|
||||||
|
World startup now allows up to 25 minutes with either bot system and waits for both game and console ports within one deadline. Servers that stop during startup still fail immediately.
|
||||||
+87
-1
@@ -123,6 +123,7 @@
|
|||||||
"Corfirean/coa-server-manager:20261021-scaling-health-settings.md",
|
"Corfirean/coa-server-manager:20261021-scaling-health-settings.md",
|
||||||
"Corfirean/coa-server-manager:20261021-warcraft-reborn-realm.md",
|
"Corfirean/coa-server-manager:20261021-warcraft-reborn-realm.md",
|
||||||
"Corfirean/coa-server-manager:20261022-custom-races-client.md",
|
"Corfirean/coa-server-manager:20261022-custom-races-client.md",
|
||||||
|
"Corfirean/coa-server-manager:20261022-scaling-progression-modes.md",
|
||||||
"Corfirean/coa-server-manager:20261023-ah-bot-single-switch.md",
|
"Corfirean/coa-server-manager:20261023-ah-bot-single-switch.md",
|
||||||
"Corfirean/coa-server-manager:20261023-interface-language-coverage.md",
|
"Corfirean/coa-server-manager:20261023-interface-language-coverage.md",
|
||||||
"Corfirean/coa-server-manager:20261023-online-players-exclude-squid-bots.md",
|
"Corfirean/coa-server-manager:20261023-online-players-exclude-squid-bots.md",
|
||||||
@@ -138,7 +139,23 @@
|
|||||||
"Corfirean/coa-server-manager:20261024-remote-refresh.md",
|
"Corfirean/coa-server-manager:20261024-remote-refresh.md",
|
||||||
"Corfirean/coa-server-manager:20261025-custom-races-191.md",
|
"Corfirean/coa-server-manager:20261025-custom-races-191.md",
|
||||||
"Corfirean/coa-server-manager:20261026-custom-races-192.md",
|
"Corfirean/coa-server-manager:20261026-custom-races-192.md",
|
||||||
"Corfirean/coa-server-manager:20261027-merged-database-migration-order.md"
|
"Corfirean/coa-server-manager:20261027-content-scaling-reports.md",
|
||||||
|
"Corfirean/coa-server-manager:20261027-custom-races-reports.md",
|
||||||
|
"Corfirean/coa-server-manager:20261027-internet-lan-address.md",
|
||||||
|
"Corfirean/coa-server-manager:20261027-merged-database-migration-order.md",
|
||||||
|
"Corfirean/coa-server-manager:20261027-per-race-server-settings.md",
|
||||||
|
"Corfirean/coa-server-manager:20261027-public-list-shows-every-running-realm.md",
|
||||||
|
"Corfirean/coa-server-manager:20261027-public-listing-window.md",
|
||||||
|
"Corfirean/coa-server-manager:20261027-skill-gain-controls.md",
|
||||||
|
"Corfirean/coa-server-manager:20261027-start-checks-the-realm-class-setting.md",
|
||||||
|
"Corfirean/coa-server-manager:20261027-start-wildcard-and-reborn-with-coa.md",
|
||||||
|
"Corfirean/coa-server-manager:20261028-coa-config-search.md",
|
||||||
|
"Corfirean/coa-server-manager:20261028-existing-character-update-validation.md",
|
||||||
|
"Corfirean/coa-server-manager:20261028-legacy-world-shutdown.md",
|
||||||
|
"Corfirean/coa-server-manager:20261028-mysql-install-startup.md",
|
||||||
|
"Corfirean/coa-server-manager:20261028-portable-settings-and-tray.md",
|
||||||
|
"Corfirean/coa-server-manager:20261028-update-check-queue.md",
|
||||||
|
"Corfirean/coa-server-manager:20261029-slow-world-startup.md"
|
||||||
],
|
],
|
||||||
"releases": [
|
"releases": [
|
||||||
{
|
{
|
||||||
@@ -721,6 +738,75 @@
|
|||||||
"experimentalFeatures": [
|
"experimentalFeatures": [
|
||||||
"portable-characters"
|
"portable-characters"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "v0.9.0",
|
||||||
|
"version": "0.9.0",
|
||||||
|
"date": "2026-10-28",
|
||||||
|
"url": "https://github.com/Corfirean/coa-server-manager/releases/tag/v0.9.0",
|
||||||
|
"notes": [
|
||||||
|
"Choose Parallel or Global level scaling in module settings",
|
||||||
|
"Report Content Scaling problems directly to its repository",
|
||||||
|
"Send custom race problem reports directly to their maintainer",
|
||||||
|
"Internet sharing restores the LAN address after server restarts",
|
||||||
|
"Configure custom race availability for new characters",
|
||||||
|
"Public listing offers every realm that starts together, not just the main one",
|
||||||
|
"Public listing is a short list of realms with a window for the details",
|
||||||
|
"Configure profession and defense skill gains in server settings",
|
||||||
|
"Starting a server sets the character classes of the realm chosen on Overview",
|
||||||
|
"Start Wildcard and Warcraft Reborn together with Conquest of Azeroth",
|
||||||
|
"Control portable characters and keep Manager running in the system tray"
|
||||||
|
],
|
||||||
|
"commit": "dc97095bd6b36d9b5111f04f0cfd88e1fb2ab1f1",
|
||||||
|
"compare": "https://github.com/Corfirean/coa-server-manager/compare/v0.8.2...v0.9.0",
|
||||||
|
"experimentalFeatures": [
|
||||||
|
"portable-characters"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "0.9.1",
|
||||||
|
"tag": "v0.9.1",
|
||||||
|
"date": "2026-10-28",
|
||||||
|
"notes": [
|
||||||
|
"Existing unsupported character records no longer block unrelated server updates"
|
||||||
|
],
|
||||||
|
"experimentalFeatures": [
|
||||||
|
"portable-characters"
|
||||||
|
],
|
||||||
|
"url": "https://github.com/Corfirean/coa-server-manager/releases/tag/v0.9.1",
|
||||||
|
"compare": "https://github.com/Corfirean/coa-server-manager/compare/v0.9.0...v0.9.1",
|
||||||
|
"commit": "8bbf16ed4f14e9b78c680783e4be5d8c580cc06b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "v0.9.2",
|
||||||
|
"version": "0.9.2",
|
||||||
|
"date": "2026-10-28",
|
||||||
|
"url": "https://github.com/Corfirean/coa-server-manager/releases/tag/v0.9.2",
|
||||||
|
"notes": [
|
||||||
|
"New server installation waits for slower database startup",
|
||||||
|
"Find and edit CoA options in the existing server settings",
|
||||||
|
"Simultaneous update checks share results or wait their turn",
|
||||||
|
"Recovery can stop an unfinished world startup after restoring an older launcher"
|
||||||
|
],
|
||||||
|
"commit": "2d9c6a65bbb1e296dc919e4c9e5785ed9d4a070b",
|
||||||
|
"compare": "https://github.com/Corfirean/coa-server-manager/compare/v0.9.1...v0.9.2",
|
||||||
|
"experimentalFeatures": [
|
||||||
|
"portable-characters"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag": "v0.9.3",
|
||||||
|
"version": "0.9.3",
|
||||||
|
"date": "2026-10-29",
|
||||||
|
"url": "https://github.com/Corfirean/coa-server-manager/releases/tag/v0.9.3",
|
||||||
|
"notes": [
|
||||||
|
"Slow server startup no longer triggers an early update rollback"
|
||||||
|
],
|
||||||
|
"commit": "e7b76137d1b22a7596c2b1fa05ca9d12403b99d3",
|
||||||
|
"compare": "https://github.com/Corfirean/coa-server-manager/compare/v0.9.2...v0.9.3",
|
||||||
|
"experimentalFeatures": [
|
||||||
|
"portable-characters"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
//! Every setting of the world server's configuration, for people who want more than the curated list: the documented
|
//! Every setting of the world server's configuration, for people who want more than the curated list: the documented
|
||||||
//! settings come from `worldserver.conf.dist` (the file that ships with the server and explains each one), the current
|
//! settings come from `worldserver.conf.dist` and `modules/coa.conf.dist`, the current
|
||||||
//! values from the configuration the next start will use. Anything that holds a password, a port, an address, a folder or
|
//! values from the configuration the next start will use. Anything that holds a password, a port, an address, a folder or
|
||||||
//! the database connection is left out; the Manager owns those.
|
//! the database connection is left out; the Manager owns those.
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ use std::path::Path;
|
|||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use crate::config::parser::ConfFile;
|
use crate::config::parser::ConfFile;
|
||||||
use crate::config::{take_snapshot, targets, Scope};
|
use crate::config::{take_snapshot, targets, Scope, Targets};
|
||||||
use crate::error::{Error, Result};
|
use crate::error::{Error, Result};
|
||||||
use crate::fsx;
|
use crate::fsx;
|
||||||
|
|
||||||
@@ -39,6 +39,14 @@ fn hidden(key: &str) -> bool {
|
|||||||
|| k.starts_with("logindatabase.")
|
|| k.starts_with("logindatabase.")
|
||||||
|| k.starts_with("worlddatabase.")
|
|| k.starts_with("worlddatabase.")
|
||||||
|| k.starts_with("characterdatabase.")
|
|| k.starts_with("characterdatabase.")
|
||||||
|
|| [
|
||||||
|
"coa.classmodel",
|
||||||
|
"coa.realmtype",
|
||||||
|
"coa.gamemodemask",
|
||||||
|
"coa.mapclass10towarrior",
|
||||||
|
"coa.clientbooleanconfigs",
|
||||||
|
]
|
||||||
|
.contains(&k.as_str())
|
||||||
|| [
|
|| [
|
||||||
"bindip",
|
"bindip",
|
||||||
"realmid",
|
"realmid",
|
||||||
@@ -121,52 +129,85 @@ fn dist_path(root: &Path) -> std::path::PathBuf {
|
|||||||
root.join("Core/configs/worldserver.conf.dist")
|
root.join("Core/configs/worldserver.conf.dist")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn sources(root: &Path) -> Result<Vec<(std::path::PathBuf, Targets)>> {
|
||||||
|
let mut result = vec![(dist_path(root), targets(root, Scope::Server)?)];
|
||||||
|
let dist = root.join("Core/configs/modules/coa.conf.dist");
|
||||||
|
if dist.is_file() {
|
||||||
|
let active = root.join("Core/configs/modules/coa.conf");
|
||||||
|
result.push((
|
||||||
|
dist,
|
||||||
|
Targets {
|
||||||
|
read: active.clone(),
|
||||||
|
writes: vec![active],
|
||||||
|
generated: None,
|
||||||
|
},
|
||||||
|
));
|
||||||
|
}
|
||||||
|
Ok(result)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn list(root: &Path) -> Result<Vec<Item>> {
|
pub fn list(root: &Path) -> Result<Vec<Item>> {
|
||||||
let dist = fs::read_to_string(dist_path(root)).map_err(|_| {
|
let mut items = Vec::new();
|
||||||
Error::Invalid(
|
for (dist_path, t) in sources(root)? {
|
||||||
"The documented settings file (worldserver.conf.dist) was not found on this server."
|
let dist = fs::read_to_string(&dist_path)?;
|
||||||
.into(),
|
let active = ConfFile::parse_bytes(&if t.read.exists() {
|
||||||
)
|
fs::read(&t.read)?
|
||||||
})?;
|
} else {
|
||||||
let t = targets(root, Scope::Server)?;
|
dist.as_bytes().to_vec()
|
||||||
let active = ConfFile::parse_bytes(&fs::read(&t.read)?)?;
|
})?;
|
||||||
Ok(parse_dist(&dist)
|
items.extend(
|
||||||
.into_iter()
|
parse_dist(&dist)
|
||||||
.filter(|(k, _, _)| !hidden(k))
|
.into_iter()
|
||||||
.map(|(key, default, doc)| {
|
.filter(|(k, _, _)| !hidden(k))
|
||||||
let value = active
|
.map(|(key, default, doc)| {
|
||||||
.get(&key)
|
let value = active
|
||||||
.map(|v| v.trim().to_string())
|
.get(&key)
|
||||||
.unwrap_or_else(|| default.clone());
|
.map(|v| v.trim().to_string())
|
||||||
let changed = value != default;
|
.unwrap_or_else(|| default.clone());
|
||||||
Item {
|
let changed = value != default;
|
||||||
key,
|
Item {
|
||||||
value,
|
key,
|
||||||
default,
|
value,
|
||||||
doc,
|
default,
|
||||||
changed,
|
doc,
|
||||||
}
|
changed,
|
||||||
})
|
}
|
||||||
.collect())
|
})
|
||||||
|
.collect::<Vec<_>>(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Ok(items)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Change settings that exist in the documented file. A value is one line of at most 500 characters. Returns the keys
|
/// Change settings that exist in the documented file. A value is one line of at most 500 characters. Returns the keys
|
||||||
/// that actually changed; the previous files are snapshotted first (and can be restored from Settings).
|
/// that actually changed; the previous files are snapshotted first (and can be restored from Settings).
|
||||||
pub fn save(root: &Path, meta: &Path, changes: &BTreeMap<String, String>) -> Result<Vec<String>> {
|
pub fn save(root: &Path, meta: &Path, changes: &BTreeMap<String, String>) -> Result<Vec<String>> {
|
||||||
let known: BTreeMap<String, String> =
|
let _lock = crate::update::operation_lock(meta)?;
|
||||||
parse_dist(&fs::read_to_string(dist_path(root)).map_err(|_| {
|
crate::update::ensure_recovered(meta)?;
|
||||||
Error::Invalid("worldserver.conf.dist was not found on this server.".into())
|
let sources = sources(root)?;
|
||||||
})?)
|
let mut known = BTreeMap::new();
|
||||||
.into_iter()
|
|
||||||
.map(|(k, d, _)| (k, d))
|
|
||||||
.collect();
|
|
||||||
let t = targets(root, Scope::Server)?;
|
|
||||||
let mut originals: Vec<(std::path::PathBuf, Vec<u8>)> = Vec::new();
|
let mut originals: Vec<(std::path::PathBuf, Vec<u8>)> = Vec::new();
|
||||||
let mut confs: Vec<ConfFile> = Vec::new();
|
let mut confs: Vec<ConfFile> = Vec::new();
|
||||||
for p in &t.writes {
|
let mut owners = Vec::new();
|
||||||
let bytes = fs::read(p)?;
|
for (index, (dist, t)) in sources.iter().enumerate() {
|
||||||
confs.push(ConfFile::parse_bytes(&bytes)?);
|
let defaults = fs::read(dist)?;
|
||||||
originals.push((p.clone(), bytes));
|
for (key, default, _) in parse_dist(&String::from_utf8_lossy(&defaults)) {
|
||||||
|
if known.insert(key.clone(), (default, index)).is_some() {
|
||||||
|
return Err(Error::Invalid(format!(
|
||||||
|
"{key} is documented in more than one configuration file."
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for p in &t.writes {
|
||||||
|
let bytes = if p.exists() {
|
||||||
|
fs::read(p)?
|
||||||
|
} else {
|
||||||
|
defaults.clone()
|
||||||
|
};
|
||||||
|
confs.push(ConfFile::parse_bytes(&bytes)?);
|
||||||
|
originals.push((p.clone(), bytes));
|
||||||
|
owners.push(index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let mut changed = Vec::new();
|
let mut changed = Vec::new();
|
||||||
for (key, value) in changes {
|
for (key, value) in changes {
|
||||||
@@ -181,10 +222,22 @@ pub fn save(root: &Path, meta: &Path, changes: &BTreeMap<String, String>) -> Res
|
|||||||
"The value of {key} must be one line of text."
|
"The value of {key} must be one line of text."
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
let same = confs.iter().all(|c| match c.get(key) {
|
let (default, owner) = &known[key];
|
||||||
Some(v) => v.trim() == value,
|
if default.parse::<f64>().is_ok() && !value.parse::<f64>().is_ok_and(f64::is_finite)
|
||||||
None => known[key] == value,
|
|| key == "CoA.LegacyMountFlight" && !matches!(value, "0" | "1")
|
||||||
});
|
{
|
||||||
|
return Err(Error::Invalid(format!(
|
||||||
|
"The value of {key} must be a number matching its documented default."
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
let same = confs
|
||||||
|
.iter()
|
||||||
|
.zip(&owners)
|
||||||
|
.filter(|(_, index)| *index == owner)
|
||||||
|
.all(|(c, _)| match c.get(key) {
|
||||||
|
Some(v) => v.trim() == value,
|
||||||
|
None => default == value,
|
||||||
|
});
|
||||||
if !same {
|
if !same {
|
||||||
changed.push((key.clone(), value.to_string()));
|
changed.push((key.clone(), value.to_string()));
|
||||||
}
|
}
|
||||||
@@ -192,20 +245,31 @@ pub fn save(root: &Path, meta: &Path, changes: &BTreeMap<String, String>) -> Res
|
|||||||
if changed.is_empty() {
|
if changed.is_empty() {
|
||||||
return Ok(Vec::new());
|
return Ok(Vec::new());
|
||||||
}
|
}
|
||||||
for c in &mut confs {
|
for (c, owner) in confs.iter_mut().zip(&owners) {
|
||||||
for (k, v) in &changed {
|
for (k, v) in &changed {
|
||||||
c.set(k, v, &["Added by CoA Server Manager"]);
|
if known[k].1 == *owner {
|
||||||
|
c.set(k, v, &["Added by CoA Server Manager"]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let texts: Vec<String> = confs.iter().map(ConfFile::to_text).collect();
|
let texts: Vec<String> = confs.iter().map(ConfFile::to_text).collect();
|
||||||
for text in &texts {
|
for (text, owner) in texts.iter().zip(&owners) {
|
||||||
let reread = ConfFile::parse(text);
|
let reread = ConfFile::parse(text);
|
||||||
for (k, v) in &changed {
|
for (k, v) in &changed {
|
||||||
if reread.get(k).map(str::trim) != Some(v.as_str()) {
|
if known[k].1 == *owner && reread.get(k).map(str::trim) != Some(v.as_str()) {
|
||||||
return Err(Error::Invalid(format!("internal check failed for {k}")));
|
return Err(Error::Invalid(format!("internal check failed for {k}")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let affected: std::collections::BTreeSet<_> =
|
||||||
|
changed.iter().map(|(key, _)| known[key].1).collect();
|
||||||
|
let (originals, texts): (Vec<_>, Vec<_>) = originals
|
||||||
|
.into_iter()
|
||||||
|
.zip(texts)
|
||||||
|
.zip(owners)
|
||||||
|
.filter(|(_, owner)| affected.contains(owner))
|
||||||
|
.map(|(pair, _)| pair)
|
||||||
|
.unzip();
|
||||||
take_snapshot(
|
take_snapshot(
|
||||||
meta,
|
meta,
|
||||||
Scope::Server,
|
Scope::Server,
|
||||||
@@ -232,6 +296,114 @@ pub fn save(root: &Path, meta: &Path, changes: &BTreeMap<String, String>) -> Res
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn unrelated_saves_do_not_create_coa_files_and_existing_realm_values_are_preserved() {
|
||||||
|
let d = tempfile::tempdir().unwrap();
|
||||||
|
let (root, meta) = server(d.path());
|
||||||
|
let module = root.join("Core/configs/modules");
|
||||||
|
fs::create_dir_all(&module).unwrap();
|
||||||
|
fs::write(
|
||||||
|
module.join("coa.conf.dist"),
|
||||||
|
"CoA.LegacyMountFlight = 0\nCoA.ClassModel = \"coa\"\n",
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
save(
|
||||||
|
&root,
|
||||||
|
&meta,
|
||||||
|
&BTreeMap::from([("Rate.Drop.Item.Rare".into(), "1.5".into())]),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
assert!(!module.join("coa.conf").exists());
|
||||||
|
fs::write(
|
||||||
|
module.join("coa.conf"),
|
||||||
|
"# Reborn realm\nCoA.ClassModel = \"wcr\"\nCustom.Preserved = 42\n",
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
assert!(save(
|
||||||
|
&root,
|
||||||
|
&meta,
|
||||||
|
&BTreeMap::from([("CoA.ClassModel".into(), "\"coa\"".into())])
|
||||||
|
)
|
||||||
|
.is_err());
|
||||||
|
save(
|
||||||
|
&root,
|
||||||
|
&meta,
|
||||||
|
&BTreeMap::from([("CoA.LegacyMountFlight".into(), "1".into())]),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
let actual = fs::read_to_string(module.join("coa.conf")).unwrap();
|
||||||
|
assert!(
|
||||||
|
actual.contains("CoA.ClassModel = \"wcr\"") && actual.contains("Custom.Preserved = 42")
|
||||||
|
);
|
||||||
|
assert!(actual.contains("# Reborn realm"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn coa_settings_are_found_saved_to_the_module_and_snapshotted_without_profile_overrides() {
|
||||||
|
let d = tempfile::tempdir().unwrap();
|
||||||
|
let (root, meta) = server(d.path());
|
||||||
|
let module = root.join("Core/configs/modules");
|
||||||
|
fs::create_dir_all(&module).unwrap();
|
||||||
|
let defaults = "[worldserver]\n# Mount flight rules\nCoA.LegacyMountFlight = 0\nCoA.ClassModel = \"coa\"\nCoA.RealmType = \"live\"\n";
|
||||||
|
fs::write(module.join("coa.conf.dist"), defaults).unwrap();
|
||||||
|
let original_world = fs::read(root.join("Core/configs/worldserver.conf")).unwrap();
|
||||||
|
let items = list(&root).unwrap();
|
||||||
|
assert!(items
|
||||||
|
.iter()
|
||||||
|
.any(|i| i.key == "CoA.LegacyMountFlight" && i.value == "0"));
|
||||||
|
assert!(!items
|
||||||
|
.iter()
|
||||||
|
.any(|i| i.key == "CoA.ClassModel" || i.key == "CoA.RealmType"));
|
||||||
|
for value in ["2", "invalid", "1\nInjected = 1"] {
|
||||||
|
assert!(save(
|
||||||
|
&root,
|
||||||
|
&meta,
|
||||||
|
&BTreeMap::from([("CoA.LegacyMountFlight".into(), value.into())])
|
||||||
|
)
|
||||||
|
.is_err());
|
||||||
|
}
|
||||||
|
assert!(!module.join("coa.conf").exists());
|
||||||
|
save(
|
||||||
|
&root,
|
||||||
|
&meta,
|
||||||
|
&BTreeMap::from([
|
||||||
|
("CoA.LegacyMountFlight".into(), "1".into()),
|
||||||
|
("Rate.Drop.Item.Rare".into(), "1.5".into()),
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
assert!(fs::read_to_string(module.join("coa.conf"))
|
||||||
|
.unwrap()
|
||||||
|
.contains("CoA.LegacyMountFlight = 1"));
|
||||||
|
let world = fs::read_to_string(root.join("Core/configs/worldserver.conf")).unwrap();
|
||||||
|
assert!(!world.contains("CoA.LegacyMountFlight"));
|
||||||
|
assert!(world.contains("Rate.Drop.Item.Rare = 1.5"));
|
||||||
|
assert!(!String::from_utf8(original_world)
|
||||||
|
.unwrap()
|
||||||
|
.contains("CoA.LegacyMountFlight"));
|
||||||
|
assert_eq!(
|
||||||
|
list(&root)
|
||||||
|
.unwrap()
|
||||||
|
.iter()
|
||||||
|
.find(|i| i.key == "CoA.LegacyMountFlight")
|
||||||
|
.unwrap()
|
||||||
|
.value,
|
||||||
|
"1"
|
||||||
|
);
|
||||||
|
assert!(!crate::config::list_snapshots(&meta).is_empty());
|
||||||
|
let saved = crate::config::list_snapshots(&meta).remove(0);
|
||||||
|
crate::config::restore_snapshot(&meta, &saved.id).unwrap();
|
||||||
|
assert_eq!(
|
||||||
|
list(&root)
|
||||||
|
.unwrap()
|
||||||
|
.iter()
|
||||||
|
.find(|i| i.key == "CoA.LegacyMountFlight")
|
||||||
|
.unwrap()
|
||||||
|
.value,
|
||||||
|
"0"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const DIST: &str = "[worldserver]\r\n\r\n###################\r\n# SECTION\r\n###################\r\n\r\n#\r\n# Rate.Drop.Item.Epic\r\n# Rate.Drop.Item.Rare\r\n# Description: Drop rates by quality.\r\n# Default: 1\r\n#\r\n\r\nRate.Drop.Item.Rare = 1\r\nRate.Drop.Item.Epic = 1\r\n\r\n#\r\n# LoginDatabaseInfo\r\n# Description: secret\r\n#\r\n\r\nLoginDatabaseInfo = \"127.0.0.1;3306;a;b;c\"\r\n\r\n#\r\n# Instance.ResetTimeHour\r\n# Description: Hour of the reset.\r\n# Important: Use 0-23.\r\n# Default: 4\r\n#\r\n\r\nInstance.ResetTimeHour = 4\r\n";
|
const DIST: &str = "[worldserver]\r\n\r\n###################\r\n# SECTION\r\n###################\r\n\r\n#\r\n# Rate.Drop.Item.Epic\r\n# Rate.Drop.Item.Rare\r\n# Description: Drop rates by quality.\r\n# Default: 1\r\n#\r\n\r\nRate.Drop.Item.Rare = 1\r\nRate.Drop.Item.Epic = 1\r\n\r\n#\r\n# LoginDatabaseInfo\r\n# Description: secret\r\n#\r\n\r\nLoginDatabaseInfo = \"127.0.0.1;3306;a;b;c\"\r\n\r\n#\r\n# Instance.ResetTimeHour\r\n# Description: Hour of the reset.\r\n# Important: Use 0-23.\r\n# Default: 4\r\n#\r\n\r\nInstance.ResetTimeHour = 4\r\n";
|
||||||
|
|
||||||
fn server(d: &Path) -> (std::path::PathBuf, std::path::PathBuf) {
|
fn server(d: &Path) -> (std::path::PathBuf, std::path::PathBuf) {
|
||||||
|
|||||||
@@ -0,0 +1,124 @@
|
|||||||
|
//! Update-only comparison of existing unsupported character starts. Never repairs or deletes rows.
|
||||||
|
use crate::{db::Db, Error, Result};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::collections::{BTreeMap, BTreeSet};
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
|
||||||
|
pub struct MissingStart {
|
||||||
|
pub guid: u32,
|
||||||
|
pub race: u32,
|
||||||
|
pub class: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct Baseline {
|
||||||
|
pub schema: u32,
|
||||||
|
pub realms: BTreeMap<String, BTreeSet<MissingStart>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn parse_missing(text: &str) -> Result<BTreeSet<MissingStart>> {
|
||||||
|
text.lines()
|
||||||
|
.map(|line| {
|
||||||
|
let values = line
|
||||||
|
.split('\t')
|
||||||
|
.map(str::parse::<u32>)
|
||||||
|
.collect::<std::result::Result<Vec<_>, _>>()
|
||||||
|
.map_err(|_| {
|
||||||
|
Error::Invalid("Cannot read existing character start identities.".into())
|
||||||
|
})?;
|
||||||
|
if values.len() != 3 {
|
||||||
|
return Err(Error::Invalid(
|
||||||
|
"Incomplete character start identity.".into(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
Ok(MissingStart {
|
||||||
|
guid: values[0],
|
||||||
|
race: values[1],
|
||||||
|
class: values[2],
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn missing(db: &Db) -> Result<BTreeSet<MissingStart>> {
|
||||||
|
parse_missing(&db.query("SELECT c.guid,c.race,c.class FROM acore_characters.characters c LEFT JOIN acore_world.playercreateinfo p ON p.race=c.race AND p.class=c.class WHERE p.race IS NULL;")?)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn capture(db: &Db, root: &Path) -> Result<Baseline> {
|
||||||
|
let mut realms = BTreeMap::new();
|
||||||
|
for mode in crate::realms::state(root)?.modes() {
|
||||||
|
realms.insert(
|
||||||
|
mode.name().to_owned(),
|
||||||
|
missing(&db.clone().for_realm(mode))?,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Ok(Baseline { schema: 1, realms })
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Match identity and race/class, never just totals: one new failure cannot replace an old one.
|
||||||
|
pub fn introduced(
|
||||||
|
current: &BTreeSet<MissingStart>,
|
||||||
|
before: &BTreeSet<MissingStart>,
|
||||||
|
) -> BTreeSet<MissingStart> {
|
||||||
|
current.difference(before).copied().collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
#[test]
|
||||||
|
fn old_gaps_are_not_new_character_loss() {
|
||||||
|
let before = parse_missing("1\t44\t14\n2\t44\t14\n3\t44\t14").unwrap();
|
||||||
|
assert!(introduced(&before, &before).is_empty());
|
||||||
|
assert!(introduced(&BTreeSet::new(), &before).is_empty());
|
||||||
|
let replaced = parse_missing("1\t44\t14\n2\t44\t14\n4\t44\t14").unwrap();
|
||||||
|
assert_eq!(
|
||||||
|
introduced(&replaced, &before),
|
||||||
|
parse_missing("4\t44\t14").unwrap()
|
||||||
|
);
|
||||||
|
let changed = parse_missing("1\t44\t15").unwrap();
|
||||||
|
assert_eq!(introduced(&changed, &before), changed);
|
||||||
|
assert_eq!(introduced(&before, &BTreeSet::new()), before);
|
||||||
|
}
|
||||||
|
#[test]
|
||||||
|
fn malformed_identity_is_not_silently_ignored() {
|
||||||
|
for text in ["1\t44", "bad\t44\t14", "1\t44\t14\t0", "1\t44\t-1"] {
|
||||||
|
assert!(parse_missing(text).is_err());
|
||||||
|
}
|
||||||
|
assert!(parse_missing("").unwrap().is_empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn reported_174_old_records_cannot_mask_one_newly_hidden_character() {
|
||||||
|
// Reproduce the report's scale without shipping another person's diagnostics or identities.
|
||||||
|
let before: BTreeSet<_> = (1..=174)
|
||||||
|
.map(|guid| MissingStart {
|
||||||
|
guid,
|
||||||
|
race: 44,
|
||||||
|
class: 14,
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
assert!(introduced(&before, &before).is_empty());
|
||||||
|
let mut after = before.clone();
|
||||||
|
after.remove(&MissingStart {
|
||||||
|
guid: 1,
|
||||||
|
race: 44,
|
||||||
|
class: 14,
|
||||||
|
});
|
||||||
|
after.insert(MissingStart {
|
||||||
|
guid: 175,
|
||||||
|
race: 44,
|
||||||
|
class: 14,
|
||||||
|
});
|
||||||
|
assert_eq!(after.len(), before.len());
|
||||||
|
assert_eq!(
|
||||||
|
introduced(&after, &before),
|
||||||
|
BTreeSet::from([MissingStart {
|
||||||
|
guid: 175,
|
||||||
|
race: 44,
|
||||||
|
class: 14
|
||||||
|
}])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -31,36 +31,17 @@ impl Verb {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn timeout(self, root: &Path) -> Duration {
|
fn timeout(self, _root: &Path) -> Duration {
|
||||||
match self {
|
match self {
|
||||||
Verb::StartAll | Verb::StartWorld if squid_enabled(root) => Duration::from_secs(2700),
|
// Includes database startup, optional bot provisioning and the shared 25-minute
|
||||||
Verb::StartAll | Verb::StartWorld => Duration::from_secs(420),
|
// world/console wait in launcher_bridge.py, even for older installed scripts.
|
||||||
Verb::StartMysql => Duration::from_secs(120),
|
Verb::StartAll | Verb::StartWorld => Duration::from_secs(3600),
|
||||||
|
Verb::StartMysql => Duration::from_secs(360),
|
||||||
Verb::StopAll => Duration::from_secs(240),
|
Verb::StopAll => Duration::from_secs(240),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn squid_enabled(root: &Path) -> bool {
|
|
||||||
let active = root.join("Core/configs/modules/playerbots.conf");
|
|
||||||
let path = if active.exists() {
|
|
||||||
active
|
|
||||||
} else {
|
|
||||||
root.join("Core/configs/modules/playerbots.conf.dist")
|
|
||||||
};
|
|
||||||
std::fs::read(path)
|
|
||||||
.ok()
|
|
||||||
.and_then(|bytes| crate::config::parser::ConfFile::parse_bytes(&bytes).ok())
|
|
||||||
.is_some_and(|config| {
|
|
||||||
config.get("AiPlayerbot.Enabled").is_none_or(|value| {
|
|
||||||
!matches!(
|
|
||||||
value.trim().trim_matches('"').to_ascii_lowercase().as_str(),
|
|
||||||
"0" | "false" | "no" | "off"
|
|
||||||
)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize)]
|
#[derive(Debug, Clone, Serialize)]
|
||||||
pub struct DriverOutcome {
|
pub struct DriverOutcome {
|
||||||
pub ok: bool,
|
pub ok: bool,
|
||||||
@@ -230,6 +211,13 @@ fn run_inner(root: &Path, verb: Verb, validating_update: bool) -> Result<DriverO
|
|||||||
let mut output = out_t.join().unwrap_or_default();
|
let mut output = out_t.join().unwrap_or_default();
|
||||||
output.push_str(&err_t.join().unwrap_or_default());
|
output.push_str(&err_t.join().unwrap_or_default());
|
||||||
let mut output = output.trim().to_string();
|
let mut output = output.trim().to_string();
|
||||||
|
if status.is_none() {
|
||||||
|
output.push_str(&format!(
|
||||||
|
"\nLauncher {} exceeded its {} second deadline; check the server logs.",
|
||||||
|
verb.arg(),
|
||||||
|
verb.timeout(&root).as_secs()
|
||||||
|
));
|
||||||
|
}
|
||||||
let (ok, exit_code) = match status {
|
let (ok, exit_code) = match status {
|
||||||
Some(st) => (st.success(), st.code()),
|
Some(st) => (st.success(), st.code()),
|
||||||
None => (false, None),
|
None => (false, None),
|
||||||
@@ -393,7 +381,7 @@ fn recover_mysql_launcher_state(root: &Path, prefer_listener: bool) -> Result<()
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
const LAUNCH_SCRIPT: &str = "import runpy,sys\nfrom pathlib import Path\nscript=sys.argv[1]\nsys.path.insert(0,str(Path(script).resolve().parent))\nsys.argv=sys.argv[1:]\nif sys.argv[1]=='stop-all':\n launcher=runpy.run_path(script,run_name='coa_manager_shutdown')\n config=launcher['settings']()\n with launcher['control_lock']():\n launcher['stop_all'](config)\nelse:\n runpy.run_path(script,run_name='__main__')";
|
const LAUNCH_SCRIPT: &str = include_str!("launcher_bridge.py");
|
||||||
|
|
||||||
pub(crate) fn patch_launcher_imports(text: &str) -> Result<String> {
|
pub(crate) fn patch_launcher_imports(text: &str) -> Result<String> {
|
||||||
let line = "sys.path.insert(0, str(Path(__file__).resolve().parent))";
|
let line = "sys.path.insert(0, str(Path(__file__).resolve().parent))";
|
||||||
@@ -604,7 +592,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn large_squid_provisioning_has_time_to_finish_without_extending_shutdown() {
|
fn slow_world_startup_has_time_with_either_bot_system_without_extending_shutdown() {
|
||||||
let folder = tempfile::tempdir().unwrap();
|
let folder = tempfile::tempdir().unwrap();
|
||||||
let modules = folder.path().join("Core/configs/modules");
|
let modules = folder.path().join("Core/configs/modules");
|
||||||
std::fs::create_dir_all(&modules).unwrap();
|
std::fs::create_dir_all(&modules).unwrap();
|
||||||
@@ -615,7 +603,7 @@ mod tests {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Verb::StartAll.timeout(folder.path()),
|
Verb::StartAll.timeout(folder.path()),
|
||||||
Duration::from_secs(2700)
|
Duration::from_secs(3600)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Verb::StopAll.timeout(folder.path()),
|
Verb::StopAll.timeout(folder.path()),
|
||||||
@@ -624,7 +612,11 @@ mod tests {
|
|||||||
std::fs::write(modules.join("playerbots.conf"), "AiPlayerbot.Enabled = 0\n").unwrap();
|
std::fs::write(modules.join("playerbots.conf"), "AiPlayerbot.Enabled = 0\n").unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Verb::StartWorld.timeout(folder.path()),
|
Verb::StartWorld.timeout(folder.path()),
|
||||||
Duration::from_secs(420)
|
Duration::from_secs(3600)
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
Verb::StartMysql.timeout(folder.path()),
|
||||||
|
Duration::from_secs(360)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -239,14 +239,14 @@ fn bootstrap_database_inner(root: &Path) -> Result<()> {
|
|||||||
}
|
}
|
||||||
fs::copy(&boot, &target)?; // launcher needs database.json to render its files at first start
|
fs::copy(&boot, &target)?; // launcher needs database.json to render its files at first start
|
||||||
|
|
||||||
let started = driver::run(root, Verb::StartMysql)?;
|
|
||||||
if !started.ok {
|
|
||||||
return Err(Error::Invalid(format!(
|
|
||||||
"The database could not be started. {}",
|
|
||||||
driver::startup_failure(root, &started)
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
let result = (|| -> Result<()> {
|
let result = (|| -> Result<()> {
|
||||||
|
let started = driver::run(root, Verb::StartMysql)?;
|
||||||
|
if !started.ok {
|
||||||
|
return Err(Error::Invalid(format!(
|
||||||
|
"The database could not be started. {}",
|
||||||
|
driver::startup_failure(root, &started)
|
||||||
|
)));
|
||||||
|
}
|
||||||
let db = Db::from_repack(root, Account::Admin)?;
|
let db = Db::from_repack(root, Account::Admin)?;
|
||||||
let (root_pw, app_pw) = (random_hex(48), random_hex(48));
|
let (root_pw, app_pw) = (random_hex(48), random_hex(48));
|
||||||
let accounts = db.query(
|
let accounts = db.query(
|
||||||
@@ -362,6 +362,7 @@ pub fn install_base(p: &Params, report: &dyn Fn(Step)) -> Result<Installed> {
|
|||||||
// 3. Extract into our own staging folder.
|
// 3. Extract into our own staging folder.
|
||||||
if staging_root.exists() {
|
if staging_root.exists() {
|
||||||
if staging_root.join(MARKER).is_file() {
|
if staging_root.join(MARKER).is_file() {
|
||||||
|
stop_installation(&staging_root)?;
|
||||||
fs::remove_dir_all(&staging_root)?; // leftover of an earlier failed attempt that we created
|
fs::remove_dir_all(&staging_root)?; // leftover of an earlier failed attempt that we created
|
||||||
} else {
|
} else {
|
||||||
return Err(Error::Invalid(format!("{} is left over from an earlier installation that did not finish, and the Manager cannot tell whether it may be deleted. Delete that folder yourself, then try again.", staging_root.display())));
|
return Err(Error::Invalid(format!("{} is left over from an earlier installation that did not finish, and the Manager cannot tell whether it may be deleted. Delete that folder yourself, then try again.", staging_root.display())));
|
||||||
@@ -426,24 +427,60 @@ pub fn install_base(p: &Params, report: &dyn Fn(Step)) -> Result<Installed> {
|
|||||||
})();
|
})();
|
||||||
|
|
||||||
if result.is_err() {
|
if result.is_err() {
|
||||||
if staging_root.join(MARKER).exists() {
|
let unfinished = if staging_root.join(MARKER).is_file() {
|
||||||
// Unfinished work of ours; the destination was never touched.
|
Some(&staging_root)
|
||||||
let _ = driver::run(&staging_root, Verb::StopAll);
|
|
||||||
let _ = fs::remove_dir_all(&staging_root);
|
|
||||||
} else if dest.join(MARKER).is_file() {
|
} else if dest.join(MARKER).is_file() {
|
||||||
// Failed after the folder was moved into place. The destination was empty or absent before (preflight),
|
Some(&dest)
|
||||||
// so what carries our marker is only our unfinished install.
|
} else {
|
||||||
let _ = driver::run(&dest, Verb::StopAll);
|
None
|
||||||
let _ = fs::remove_dir_all(&dest);
|
};
|
||||||
|
if let Some(unfinished) = unfinished {
|
||||||
|
if let Err(cleanup) = stop_installation(unfinished) {
|
||||||
|
return Err(Error::Invalid(format!(
|
||||||
|
"{} {cleanup}",
|
||||||
|
result.as_ref().unwrap_err()
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
let _ = fs::remove_dir_all(unfinished);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn stop_installation(root: &Path) -> Result<()> {
|
||||||
|
if !root.join("Scripts/manage.py").is_file() {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
let stopped = driver::run(root, Verb::StopAll)?;
|
||||||
|
if !stopped.ok {
|
||||||
|
return Err(Error::Invalid(format!(
|
||||||
|
"The unfinished installation could not be stopped; its files were kept. {}",
|
||||||
|
driver::startup_failure(root, &stopped)
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn an_unstoppable_partial_installation_keeps_its_files_for_recovery() {
|
||||||
|
let folder = tempfile::tempdir().unwrap();
|
||||||
|
let root = folder.path();
|
||||||
|
fs::create_dir_all(root.join("Scripts")).unwrap();
|
||||||
|
fs::write(root.join("Scripts/manage.py"), "# incomplete launcher").unwrap();
|
||||||
|
fs::write(root.join(MARKER), "").unwrap();
|
||||||
|
fs::write(root.join("database-preserved"), "unchanged").unwrap();
|
||||||
|
assert!(stop_installation(root).is_err());
|
||||||
|
assert_eq!(
|
||||||
|
fs::read_to_string(root.join("database-preserved")).unwrap(),
|
||||||
|
"unchanged"
|
||||||
|
);
|
||||||
|
assert!(root.join(MARKER).is_file());
|
||||||
|
}
|
||||||
|
|
||||||
fn reg(d: &Path) -> Registry {
|
fn reg(d: &Path) -> Registry {
|
||||||
Registry::at(d.join("reg/installs.json"))
|
Registry::at(d.join("reg/installs.json"))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
import runpy
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
script = sys.argv[1]
|
||||||
|
sys.path.insert(0, str(Path(script).resolve().parent))
|
||||||
|
sys.argv = sys.argv[1:]
|
||||||
|
launcher = runpy.run_path(script, run_name="coa_manager_launcher")
|
||||||
|
original_wait = launcher["wait_ready"]
|
||||||
|
world_deadline = None
|
||||||
|
|
||||||
|
|
||||||
|
def wait_ready(name, port, seconds=180):
|
||||||
|
global world_deadline
|
||||||
|
if name == "mysql":
|
||||||
|
seconds = max(seconds, 300)
|
||||||
|
elif name == "world":
|
||||||
|
# Both game and console listeners belong to one startup, including on old repacks.
|
||||||
|
# Ordinary CoA worlds can load slowly too; this must not depend on SQUID.
|
||||||
|
if world_deadline is None:
|
||||||
|
world_deadline = time.monotonic() + max(seconds, 1500)
|
||||||
|
seconds = max(0, world_deadline - time.monotonic())
|
||||||
|
return original_wait(name, port, seconds)
|
||||||
|
|
||||||
|
|
||||||
|
launcher["start_mysql"].__globals__["wait_ready"] = wait_ready
|
||||||
|
if sys.argv[1] == "stop-all":
|
||||||
|
shutdown = launcher["stop_all"].__globals__
|
||||||
|
if "ra" in shutdown:
|
||||||
|
original_ra = shutdown["ra"]
|
||||||
|
|
||||||
|
class UnsafeShutdown(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def shutdown_command(command, config):
|
||||||
|
try:
|
||||||
|
return original_ra(command, config)
|
||||||
|
except (OSError, RuntimeError):
|
||||||
|
if not command.startswith("server shutdown "):
|
||||||
|
raise
|
||||||
|
world = shutdown["process"]("world")
|
||||||
|
if not world:
|
||||||
|
return "Worldserver has already stopped."
|
||||||
|
expected = Path(script).resolve().parents[1] / "Core" / "worldserver.exe"
|
||||||
|
if Path(world.get("exe", "")) != expected or not shutdown["same_process"](world):
|
||||||
|
raise UnsafeShutdown("World process ownership could not be verified; the database was left running.")
|
||||||
|
try:
|
||||||
|
shutdown["terminate"](world)
|
||||||
|
except (OSError, RuntimeError) as error:
|
||||||
|
raise UnsafeShutdown("Worldserver could not be stopped safely; its database was left running.") from error
|
||||||
|
if not shutdown["wait_stopped"](world, 90):
|
||||||
|
raise UnsafeShutdown("Worldserver is still stopping; its database was left running.")
|
||||||
|
return "Stopped this server's recorded world process without its unavailable console."
|
||||||
|
|
||||||
|
shutdown["ra"] = shutdown_command
|
||||||
|
config = launcher["settings"]()
|
||||||
|
with launcher["control_lock"]():
|
||||||
|
launcher["stop_all"](config)
|
||||||
|
else:
|
||||||
|
launcher["main"]()
|
||||||
@@ -11,6 +11,7 @@ pub mod accounts;
|
|||||||
pub mod allsettings;
|
pub mod allsettings;
|
||||||
pub mod backup;
|
pub mod backup;
|
||||||
pub mod channels;
|
pub mod channels;
|
||||||
|
pub mod character_start_check;
|
||||||
pub mod cleanbase;
|
pub mod cleanbase;
|
||||||
pub mod client;
|
pub mod client;
|
||||||
pub mod clientdl;
|
pub mod clientdl;
|
||||||
@@ -54,6 +55,7 @@ pub mod realmlist;
|
|||||||
pub mod realms;
|
pub mod realms;
|
||||||
pub mod registry;
|
pub mod registry;
|
||||||
pub mod release;
|
pub mod release;
|
||||||
|
pub mod release_history;
|
||||||
pub mod release_schema;
|
pub mod release_schema;
|
||||||
pub mod remote_client;
|
pub mod remote_client;
|
||||||
pub mod repair;
|
pub mod repair;
|
||||||
|
|||||||
@@ -497,7 +497,12 @@ mod tests {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let err = set_reborn_enabled(t.path(), true).unwrap_err().to_string();
|
let err = set_reborn_enabled(t.path(), true).unwrap_err().to_string();
|
||||||
assert!(err.contains("Select Conquest of Azeroth first"), "{err}");
|
let expected = if cfg!(windows) {
|
||||||
|
"Select Conquest of Azeroth first"
|
||||||
|
} else {
|
||||||
|
"Simultaneous realms currently require Windows"
|
||||||
|
};
|
||||||
|
assert!(err.contains(expected), "{err}");
|
||||||
assert!(!realms::state(t.path()).unwrap().with_reborn);
|
assert!(!realms::state(t.path()).unwrap().with_reborn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1004,6 +1004,89 @@ mod tests {
|
|||||||
};
|
};
|
||||||
let mut server = start();
|
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();
|
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();
|
||||||
|
// Regression: an upgrade must distinguish pre-existing unsupported character starts
|
||||||
|
// from a newly lost start, without weakening any structural schema check.
|
||||||
|
db.query("CREATE TABLE acore_characters.characters(guid INT UNSIGNED PRIMARY KEY,race INT UNSIGNED NOT NULL,class INT UNSIGNED NOT NULL); CREATE TABLE acore_world.playercreateinfo(race INT UNSIGNED,class INT UNSIGNED,PRIMARY KEY(race,class)); INSERT INTO acore_characters.characters VALUES(100,44,14),(101,44,14),(102,7,14);").unwrap();
|
||||||
|
let starts = [1, 2, 3, 4, 5, 6, 7, 8, 10, 11]
|
||||||
|
.into_iter()
|
||||||
|
.flat_map(|race| (12..=32).map(move |class| format!("({race},{class})")))
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join(",");
|
||||||
|
db.query(&format!(
|
||||||
|
"INSERT INTO acore_world.playercreateinfo VALUES {starts};"
|
||||||
|
))
|
||||||
|
.unwrap();
|
||||||
|
crate::schema_check::capture(&db, &root).unwrap();
|
||||||
|
let baseline = crate::character_start_check::capture(&db, &root).unwrap();
|
||||||
|
assert_eq!(baseline.realms[crate::realms::Mode::Coa.name()].len(), 2);
|
||||||
|
assert!(
|
||||||
|
!crate::schema_check::check(&db, &root).unwrap().is_empty(),
|
||||||
|
"ordinary diagnostics stay strict"
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
crate::schema_check::check_update_with_report(&db, &root, Some(&baseline))
|
||||||
|
.unwrap()
|
||||||
|
.is_empty(),
|
||||||
|
"unchanged old gaps must not block an unrelated upgrade"
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
db.query("SELECT COUNT(*) FROM acore_characters.characters;")
|
||||||
|
.unwrap()
|
||||||
|
.trim(),
|
||||||
|
"3"
|
||||||
|
);
|
||||||
|
let report_dir = crate::registry::metadata_dir_for(&root)
|
||||||
|
.unwrap()
|
||||||
|
.join("diagnostics");
|
||||||
|
let report_path = fs::read_dir(report_dir)
|
||||||
|
.unwrap()
|
||||||
|
.flatten()
|
||||||
|
.map(|e| e.path())
|
||||||
|
.find(|p| {
|
||||||
|
p.file_name()
|
||||||
|
.unwrap()
|
||||||
|
.to_string_lossy()
|
||||||
|
.starts_with("schema-validation-")
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
let report: serde_json::Value = fsx::read_json(&report_path).unwrap();
|
||||||
|
assert_eq!(report["preexistingUnsupportedCharacters"], 2);
|
||||||
|
assert_eq!(
|
||||||
|
report["preexistingCharacterStarts"],
|
||||||
|
serde_json::json!([{"race":44,"class":14,"count":2}])
|
||||||
|
);
|
||||||
|
assert_eq!(report["problems"], serde_json::json!([]));
|
||||||
|
// Same count and race/class but a different GUID must still block.
|
||||||
|
db.query("UPDATE acore_characters.characters SET guid=103 WHERE guid=101;")
|
||||||
|
.unwrap();
|
||||||
|
assert!(
|
||||||
|
!crate::schema_check::check_update_with_report(&db, &root, Some(&baseline))
|
||||||
|
.unwrap()
|
||||||
|
.is_empty()
|
||||||
|
);
|
||||||
|
db.query("UPDATE acore_characters.characters SET guid=101 WHERE guid=103;")
|
||||||
|
.unwrap();
|
||||||
|
// Loss of a formerly valid start is never grandfathered.
|
||||||
|
db.query("DELETE FROM acore_world.playercreateinfo WHERE race=7 AND class=14;")
|
||||||
|
.unwrap();
|
||||||
|
assert!(
|
||||||
|
!crate::schema_check::check_update_with_report(&db, &root, Some(&baseline))
|
||||||
|
.unwrap()
|
||||||
|
.is_empty()
|
||||||
|
);
|
||||||
|
db.query("INSERT INTO acore_world.playercreateinfo VALUES(7,14);")
|
||||||
|
.unwrap();
|
||||||
|
db.query("ALTER TABLE acore_world.probe MODIFY id VARCHAR(30) NOT NULL DEFAULT '0';")
|
||||||
|
.unwrap();
|
||||||
|
assert!(
|
||||||
|
!crate::schema_check::check_update_with_report(&db, &root, Some(&baseline))
|
||||||
|
.unwrap()
|
||||||
|
.is_empty(),
|
||||||
|
"existing character warnings cannot hide a structural failure"
|
||||||
|
);
|
||||||
|
db.query("ALTER TABLE acore_world.probe MODIFY id INT NOT NULL DEFAULT 0; DROP TABLE acore_characters.characters; DROP TABLE acore_world.playercreateinfo;").unwrap();
|
||||||
|
fs::remove_file(root.join(crate::schema_check::CONTRACT)).unwrap();
|
||||||
|
|
||||||
// Shared auth must not run again when the active realm changes.
|
// Shared auth must not run again when the active realm changes.
|
||||||
use crate::migrations::Store;
|
use crate::migrations::Store;
|
||||||
db.query("CREATE DATABASE acore_world_wildcard;").unwrap();
|
db.query("CREATE DATABASE acore_world_wildcard;").unwrap();
|
||||||
|
|||||||
@@ -0,0 +1,170 @@
|
|||||||
|
//! Read-only, bounded canonical histories. Offline fallback is also bundled in the UI.
|
||||||
|
use serde_json::Value;
|
||||||
|
use std::{io::Read, path::Path, time::Duration};
|
||||||
|
|
||||||
|
const LIMIT: u64 = 2 * 1024 * 1024;
|
||||||
|
|
||||||
|
fn repository(component: &str) -> Result<(&'static str, &'static str), String> {
|
||||||
|
match component {
|
||||||
|
"server" => Ok(("Corfirean/coa-server-build", "main")),
|
||||||
|
"manager" => Ok(("Corfirean/coa-server-manager", "master")),
|
||||||
|
_ => Err("Unknown release component".into()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn validate(bytes: &[u8], component: &str) -> Result<Value, String> {
|
||||||
|
let (repo, _) = repository(component)?;
|
||||||
|
if bytes.len() as u64 > LIMIT {
|
||||||
|
return Err("Release history is too large".into());
|
||||||
|
}
|
||||||
|
let value: Value = serde_json::from_slice(bytes).map_err(|e| e.to_string())?;
|
||||||
|
if value["schema"] != 1 || value["component"] != component || value["repository"] != repo {
|
||||||
|
return Err("Release history identity mismatch".into());
|
||||||
|
}
|
||||||
|
let releases = value["releases"].as_array().ok_or("Missing releases")?;
|
||||||
|
if releases.len() > 2000 {
|
||||||
|
return Err("Too many releases".into());
|
||||||
|
}
|
||||||
|
for release in releases {
|
||||||
|
if release.get("prerelease").is_some_and(|v| !v.is_boolean())
|
||||||
|
|| release.get("experimentalFeatures").is_some_and(|v| {
|
||||||
|
v.as_array()
|
||||||
|
.is_none_or(|items| items.iter().any(|item| !item.is_string()))
|
||||||
|
})
|
||||||
|
{
|
||||||
|
return Err("Invalid release flags".into());
|
||||||
|
}
|
||||||
|
for field in ["tag", "date"] {
|
||||||
|
if release[field]
|
||||||
|
.as_str()
|
||||||
|
.is_none_or(|s| s.is_empty() || s.len() > 100)
|
||||||
|
{
|
||||||
|
return Err("Invalid release metadata".into());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let version = release["version"].as_str().ok_or("Missing version")?;
|
||||||
|
if version.len() > 80
|
||||||
|
|| !version
|
||||||
|
.bytes()
|
||||||
|
.all(|b| b.is_ascii_alphanumeric() || b".-+".contains(&b))
|
||||||
|
{
|
||||||
|
return Err("Invalid version".into());
|
||||||
|
}
|
||||||
|
let notes = release["notes"].as_array().ok_or("Missing notes")?;
|
||||||
|
if notes.len() > 500
|
||||||
|
|| notes
|
||||||
|
.iter()
|
||||||
|
.any(|n| n.as_str().is_none_or(|s| s.len() > 10000))
|
||||||
|
{
|
||||||
|
return Err("Invalid release notes".into());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn load(component: &str, cache_dir: &Path) -> Result<Value, String> {
|
||||||
|
let (repo, branch) = repository(component)?;
|
||||||
|
let cache = cache_dir.join(format!("{component}.json"));
|
||||||
|
let cached = || {
|
||||||
|
let mut bytes = Vec::new();
|
||||||
|
std::fs::File::open(&cache)
|
||||||
|
.ok()?
|
||||||
|
.take(LIMIT + 1)
|
||||||
|
.read_to_end(&mut bytes)
|
||||||
|
.ok()?;
|
||||||
|
validate(&bytes, component).ok()
|
||||||
|
};
|
||||||
|
if cache
|
||||||
|
.metadata()
|
||||||
|
.and_then(|m| m.modified())
|
||||||
|
.ok()
|
||||||
|
.and_then(|t| t.elapsed().ok())
|
||||||
|
.is_some_and(|age| age < Duration::from_secs(3600))
|
||||||
|
{
|
||||||
|
if let Some(mut v) = cached() {
|
||||||
|
v["source"] = "cache".into();
|
||||||
|
return Ok(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let remote = || -> Result<Value, String> {
|
||||||
|
let client = reqwest::blocking::Client::builder()
|
||||||
|
.timeout(Duration::from_secs(8))
|
||||||
|
.redirect(reqwest::redirect::Policy::none())
|
||||||
|
.build()
|
||||||
|
.map_err(|e| e.to_string())?;
|
||||||
|
let response = client
|
||||||
|
.get(format!(
|
||||||
|
"https://raw.githubusercontent.com/{repo}/{branch}/changelog/history.json"
|
||||||
|
))
|
||||||
|
.send()
|
||||||
|
.and_then(|r| r.error_for_status())
|
||||||
|
.map_err(|e| e.to_string())?;
|
||||||
|
let mut bytes = Vec::new();
|
||||||
|
response
|
||||||
|
.take(LIMIT + 1)
|
||||||
|
.read_to_end(&mut bytes)
|
||||||
|
.map_err(|e| e.to_string())?;
|
||||||
|
let mut value = validate(&bytes, component)?;
|
||||||
|
if std::fs::create_dir_all(cache_dir).is_ok() {
|
||||||
|
let _ = std::fs::write(&cache, &bytes);
|
||||||
|
}
|
||||||
|
value["source"] = "remote".into();
|
||||||
|
Ok(value)
|
||||||
|
};
|
||||||
|
remote().or_else(|error| {
|
||||||
|
cached()
|
||||||
|
.map(|mut v| {
|
||||||
|
v["source"] = "cache".into();
|
||||||
|
v
|
||||||
|
})
|
||||||
|
.ok_or(error)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
#[test]
|
||||||
|
fn accepts_both_complete_bundled_canonical_histories() {
|
||||||
|
assert!(validate(include_bytes!("../../../changelog/history.json"), "manager").is_ok());
|
||||||
|
assert!(validate(
|
||||||
|
include_bytes!("../../../src/data/server-history.json"),
|
||||||
|
"server"
|
||||||
|
)
|
||||||
|
.is_ok());
|
||||||
|
}
|
||||||
|
#[test]
|
||||||
|
fn rejects_cross_component_and_untrusted_components() {
|
||||||
|
let bytes = br#"{"schema":1,"component":"manager","repository":"Corfirean/coa-server-manager","releases":[]}"#;
|
||||||
|
assert!(validate(bytes, "manager").is_ok());
|
||||||
|
assert!(validate(bytes, "server").is_err());
|
||||||
|
assert!(repository("../../other").is_err());
|
||||||
|
assert!(validate(&vec![b' '; LIMIT as usize + 1], "manager").is_err());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn rejects_malformed_records_before_the_ui_can_use_them() {
|
||||||
|
let mut value = serde_json::json!({"schema": 1, "component": "server",
|
||||||
|
"repository": "Corfirean/coa-server-build", "releases": [{
|
||||||
|
"version": "0.261028.83", "tag": "0.261028.83", "date": "2026-10-28",
|
||||||
|
"notes": ["Reviewed note"]
|
||||||
|
}]});
|
||||||
|
assert!(validate(&serde_json::to_vec(&value).unwrap(), "server").is_ok());
|
||||||
|
value["releases"][0]["date"] = Value::Null;
|
||||||
|
assert!(validate(&serde_json::to_vec(&value).unwrap(), "server").is_err());
|
||||||
|
value["releases"][0]["date"] = "2026-10-28".into();
|
||||||
|
value["releases"][0]["notes"] = serde_json::json!([{"html": "not a text note"}]);
|
||||||
|
assert!(validate(&serde_json::to_vec(&value).unwrap(), "server").is_err());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn fresh_valid_cache_is_available_without_network() {
|
||||||
|
let dir = std::env::temp_dir().join(format!("coa-history-{}", uuid::Uuid::new_v4()));
|
||||||
|
std::fs::create_dir_all(&dir).unwrap();
|
||||||
|
std::fs::write(dir.join("manager.json"), br#"{"schema":1,"component":"manager","repository":"Corfirean/coa-server-manager","releases":[]}"#).unwrap();
|
||||||
|
let result = load("manager", &dir).unwrap();
|
||||||
|
assert_eq!(result["source"], "cache");
|
||||||
|
std::fs::remove_file(dir.join("manager.json")).unwrap();
|
||||||
|
std::fs::remove_dir(dir).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -95,13 +95,42 @@ pub struct Problem {
|
|||||||
|
|
||||||
/// Keep all differences for support; never change a database to match a contract automatically.
|
/// Keep all differences for support; never change a database to match a contract automatically.
|
||||||
pub fn check_with_report(db: &Db, root: &Path) -> Result<Vec<Problem>> {
|
pub fn check_with_report(db: &Db, root: &Path) -> Result<Vec<Problem>> {
|
||||||
let problems = check(db, root)?;
|
check_update_with_report(db, root, None)
|
||||||
if problems.is_empty() {
|
}
|
||||||
|
|
||||||
|
/// Only a hash-verified pre-update baseline may downgrade unchanged missing starts to warnings.
|
||||||
|
pub fn check_update_with_report(
|
||||||
|
db: &Db,
|
||||||
|
root: &Path,
|
||||||
|
baseline: Option<&crate::character_start_check::Baseline>,
|
||||||
|
) -> Result<Vec<Problem>> {
|
||||||
|
let mut preexisting = BTreeMap::new();
|
||||||
|
let before = match baseline {
|
||||||
|
Some(b) if b.schema == 1 => Some(b.realms.get(db.realm().name()).ok_or_else(|| {
|
||||||
|
crate::Error::Invalid("The character baseline does not contain this realm.".into())
|
||||||
|
})?),
|
||||||
|
Some(_) => {
|
||||||
|
return Err(crate::Error::Invalid(
|
||||||
|
"Unsupported character start baseline.".into(),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
None => None,
|
||||||
|
};
|
||||||
|
let problems = check_inner(db, root, before, &mut preexisting)?;
|
||||||
|
let existing: usize = preexisting.values().sum();
|
||||||
|
let preexisting_details: Vec<_> = preexisting.into_iter().map(|((race, class), count)| serde_json::json!({"race": race, "class": class, "count": count})).collect();
|
||||||
|
if existing > 0 {
|
||||||
|
tracing::warn!(realm = db.realm().name(), characters = existing, "Unchanged pre-update characters with missing starting data retained; no character records were repaired or deleted");
|
||||||
|
}
|
||||||
|
if problems.is_empty() && existing == 0 {
|
||||||
return Ok(problems);
|
return Ok(problems);
|
||||||
}
|
}
|
||||||
let report = serde_json::json!({
|
let report = serde_json::json!({
|
||||||
"schema": 1, "checkedAt": chrono::Utc::now().to_rfc3339(),
|
"schema": 1, "checkedAt": chrono::Utc::now().to_rfc3339(),
|
||||||
"realm": db.realm().name(), "problems": problems,
|
"realm": db.realm().name(), "problems": problems,
|
||||||
|
"preexistingUnsupportedCharacters": existing,
|
||||||
|
"preexistingCharacterStarts": preexisting_details,
|
||||||
|
"note": "Unchanged pre-update missing starts are reported separately. New missing character starts and all schema errors still block the update.",
|
||||||
});
|
});
|
||||||
let path = crate::registry::metadata_dir_for(root)?
|
let path = crate::registry::metadata_dir_for(root)?
|
||||||
.join("diagnostics")
|
.join("diagnostics")
|
||||||
@@ -245,6 +274,15 @@ pub(crate) fn repair_missing_defaults(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn check(db: &Db, root: &Path) -> Result<Vec<Problem>> {
|
pub fn check(db: &Db, root: &Path) -> Result<Vec<Problem>> {
|
||||||
|
check_inner(db, root, None, &mut BTreeMap::new())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn check_inner(
|
||||||
|
db: &Db,
|
||||||
|
root: &Path,
|
||||||
|
before: Option<&BTreeSet<crate::character_start_check::MissingStart>>,
|
||||||
|
existing: &mut BTreeMap<(u32, u32), usize>,
|
||||||
|
) -> Result<Vec<Problem>> {
|
||||||
let contract = if root.join(CONTRACT).is_file() {
|
let contract = if root.join(CONTRACT).is_file() {
|
||||||
let contract: Contract = fsx::read_json(&root.join(CONTRACT))?;
|
let contract: Contract = fsx::read_json(&root.join(CONTRACT))?;
|
||||||
if contract.schema != 1 {
|
if contract.schema != 1 {
|
||||||
@@ -367,12 +405,24 @@ pub fn check(db: &Db, root: &Path) -> Result<Vec<Problem>> {
|
|||||||
}
|
}
|
||||||
// Check owned characters too, including legacy classes and Wildcard characters. Their rows
|
// Check owned characters too, including legacy classes and Wildcard characters. Their rows
|
||||||
// must not silently disappear from character selection after an otherwise healthy update.
|
// must not silently disappear from character selection after an otherwise healthy update.
|
||||||
let missing = db.query("SELECT c.race,c.class,COUNT(*) FROM acore_characters.characters c LEFT JOIN acore_world.playercreateinfo p ON p.race=c.race AND p.class=c.class WHERE p.race IS NULL GROUP BY c.race,c.class;")?;
|
let current = crate::character_start_check::missing(db)?;
|
||||||
for row in missing.lines() {
|
let blocking = if let Some(before) = before {
|
||||||
let fields: Vec<_> = row.split('\t').collect();
|
let introduced = crate::character_start_check::introduced(¤t, before);
|
||||||
if fields.len() == 3 {
|
for character in current.intersection(before) {
|
||||||
problems.push(Problem { database: "world".into(), table: "playercreateinfo".into(), column: String::new(), detail: format!("{} existing characters have no starting data for race {} / class {} and would be hidden from character selection", fields[2], fields[0], fields[1]) });
|
*existing
|
||||||
|
.entry((character.race, character.class))
|
||||||
|
.or_default() += 1;
|
||||||
}
|
}
|
||||||
|
introduced
|
||||||
|
} else {
|
||||||
|
current
|
||||||
|
};
|
||||||
|
let mut counts = BTreeMap::<(u32, u32), usize>::new();
|
||||||
|
for character in blocking {
|
||||||
|
*counts.entry((character.race, character.class)).or_default() += 1;
|
||||||
|
}
|
||||||
|
for ((race, class), count) in counts {
|
||||||
|
problems.push(Problem { database: "world".into(), table: "playercreateinfo".into(), column: String::new(), detail: format!("{count} existing characters have no starting data for race {race} / class {class} and would be hidden from character selection") });
|
||||||
}
|
}
|
||||||
Ok(problems)
|
Ok(problems)
|
||||||
}
|
}
|
||||||
|
|||||||
+248
-17
@@ -22,6 +22,8 @@ use crate::pkgsource::{fetch_manifest, fetch_parts, Source};
|
|||||||
use crate::registry::{InstallMeta, MetaDir};
|
use crate::registry::{InstallMeta, MetaDir};
|
||||||
|
|
||||||
const STAGED_PREFIX: &str = "_migrations/";
|
const STAGED_PREFIX: &str = "_migrations/";
|
||||||
|
const CHARACTER_BASELINE: &str = "character-start-baseline.json";
|
||||||
|
const CHARACTER_BASELINE_HASH: &str = "@character-starts";
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "kebab-case")]
|
||||||
@@ -106,6 +108,9 @@ pub trait Env {
|
|||||||
fn verify_snapshot(&self, _id: &str) -> Result<()> {
|
fn verify_snapshot(&self, _id: &str) -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
fn character_start_baseline(&self) -> Result<Option<crate::character_start_check::Baseline>> {
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
fn snapshot(&self) -> Result<String>;
|
fn snapshot(&self) -> Result<String>;
|
||||||
fn restore_snapshot(&self, id: &str) -> Result<()>;
|
fn restore_snapshot(&self, id: &str) -> Result<()>;
|
||||||
fn migrate(&self, manifest: &Manifest, staged_migrations: &Path) -> Result<ApplyReport>;
|
fn migrate(&self, manifest: &Manifest, staged_migrations: &Path) -> Result<ApplyReport>;
|
||||||
@@ -223,11 +228,12 @@ fn read_journal(path: &Path) -> Result<Txn> {
|
|||||||
"Update journal contains invalid recovery hashes.".into(),
|
"Update journal contains invalid recovery hashes.".into(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
for key in txn
|
for key in txn.recovery_hashes.keys().filter(|key| {
|
||||||
.recovery_hashes
|
!matches!(
|
||||||
.keys()
|
key.as_str(),
|
||||||
.filter(|key| !matches!(key.as_str(), "@install" | "@point"))
|
"@install" | "@point" | CHARACTER_BASELINE_HASH
|
||||||
{
|
)
|
||||||
|
}) {
|
||||||
fsx::safe_join(path.parent().unwrap(), key)?;
|
fsx::safe_join(path.parent().unwrap(), key)?;
|
||||||
}
|
}
|
||||||
if completed_legacy_repair {
|
if completed_legacy_repair {
|
||||||
@@ -684,6 +690,7 @@ pub struct Params<'a> {
|
|||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
pub struct Outcome {
|
pub struct Outcome {
|
||||||
pub txn: Txn,
|
pub txn: Txn,
|
||||||
|
pub preexisting_character_count: usize,
|
||||||
pub migrations: Option<ApplyReport>,
|
pub migrations: Option<ApplyReport>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -816,6 +823,26 @@ pub fn apply(p: &Params, report: &dyn Fn(&str, u8)) -> Result<Outcome> {
|
|||||||
.insert("@point".into(), fsx::sha256_file(&point_meta)?);
|
.insert("@point".into(), fsx::sha256_file(&point_meta)?);
|
||||||
}
|
}
|
||||||
save(meta_dir, &txn)?;
|
save(meta_dir, &txn)?;
|
||||||
|
// Capture before any new files or SQL are applied; retry must reuse these exact bytes.
|
||||||
|
let baseline = match p.env.character_start_baseline() {
|
||||||
|
Ok(baseline) => baseline,
|
||||||
|
Err(error) => {
|
||||||
|
txn.state = State::Failed;
|
||||||
|
txn.message = Some(format!("The update was not applied because the character baseline could not be captured: {error}"));
|
||||||
|
save(meta_dir, &txn)?;
|
||||||
|
return Err(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let preexisting_character_count = baseline
|
||||||
|
.as_ref()
|
||||||
|
.map_or(0, |b| b.realms.values().map(|r| r.len()).sum());
|
||||||
|
if let Some(baseline) = &baseline {
|
||||||
|
let path = tdir.join(CHARACTER_BASELINE);
|
||||||
|
fsx::atomic_write_json(&path, baseline)?;
|
||||||
|
txn.recovery_hashes
|
||||||
|
.insert(CHARACTER_BASELINE_HASH.into(), fsx::sha256_file(&path)?);
|
||||||
|
save(meta_dir, &txn)?;
|
||||||
|
}
|
||||||
txn.ops = items
|
txn.ops = items
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|i| i.action != Action::Skip)
|
.filter(|i| i.action != Action::Skip)
|
||||||
@@ -909,6 +936,7 @@ pub fn apply(p: &Params, report: &dyn Fn(&str, u8)) -> Result<Outcome> {
|
|||||||
save(meta_dir, &txn)?;
|
save(meta_dir, &txn)?;
|
||||||
return Ok(Outcome {
|
return Ok(Outcome {
|
||||||
txn,
|
txn,
|
||||||
|
preexisting_character_count,
|
||||||
migrations: migrated,
|
migrations: migrated,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -919,6 +947,7 @@ pub fn apply(p: &Params, report: &dyn Fn(&str, u8)) -> Result<Outcome> {
|
|||||||
let _ = archive;
|
let _ = archive;
|
||||||
Ok(Outcome {
|
Ok(Outcome {
|
||||||
txn,
|
txn,
|
||||||
|
preexisting_character_count,
|
||||||
migrations: migrated,
|
migrations: migrated,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1039,6 +1068,7 @@ pub fn retry_validation(
|
|||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
read_character_baseline(meta_dir, &txn)?;
|
||||||
env.ensure_stopped()?;
|
env.ensure_stopped()?;
|
||||||
if let Err(error) = env.validate() {
|
if let Err(error) = env.validate() {
|
||||||
txn.message = Some(format!(
|
txn.message = Some(format!(
|
||||||
@@ -1115,7 +1145,13 @@ fn restore_transaction(
|
|||||||
txn: &mut Txn,
|
txn: &mut Txn,
|
||||||
env: &dyn Env,
|
env: &dyn Env,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
for (rel, expected) in &txn.recovery_hashes {
|
// This baseline is a validation input, not a recovery copy: corruption must block
|
||||||
|
// retry/commit, but must never prevent restoration of the verified safety backup.
|
||||||
|
for (rel, expected) in txn
|
||||||
|
.recovery_hashes
|
||||||
|
.iter()
|
||||||
|
.filter(|(key, _)| key.as_str() != CHARACTER_BASELINE_HASH)
|
||||||
|
{
|
||||||
let saved = match rel.as_str() {
|
let saved = match rel.as_str() {
|
||||||
"@install" => before.join("manager-install.json"),
|
"@install" => before.join("manager-install.json"),
|
||||||
"@point" => crate::backup::point_json(
|
"@point" => crate::backup::point_json(
|
||||||
@@ -1504,6 +1540,33 @@ fn prune(meta_dir: &Path, keep: usize) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn read_character_baseline(
|
||||||
|
meta: &Path,
|
||||||
|
txn: &Txn,
|
||||||
|
) -> Result<Option<crate::character_start_check::Baseline>> {
|
||||||
|
let path = txn_dir(meta, &txn.id)?.join(CHARACTER_BASELINE);
|
||||||
|
let Some(expected) = txn.recovery_hashes.get(CHARACTER_BASELINE_HASH) else {
|
||||||
|
if path.exists() {
|
||||||
|
return Err(Error::Invalid(
|
||||||
|
"An unverified character start baseline was found.".into(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
return Ok(None); // Older transactions remain strict; never learn a baseline after applying SQL.
|
||||||
|
};
|
||||||
|
if fsx::sha256_file(&path)? != *expected {
|
||||||
|
return Err(Error::Invalid(
|
||||||
|
"The saved character start baseline failed verification.".into(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
let baseline: crate::character_start_check::Baseline = fsx::read_json(&path)?;
|
||||||
|
if baseline.schema != 1 {
|
||||||
|
return Err(Error::Invalid(
|
||||||
|
"Unsupported character start baseline.".into(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
Ok(Some(baseline))
|
||||||
|
}
|
||||||
|
|
||||||
/// The real environment: a repack-shaped installation driven through its launcher.
|
/// The real environment: a repack-shaped installation driven through its launcher.
|
||||||
pub struct RepackEnv<'a> {
|
pub struct RepackEnv<'a> {
|
||||||
pub root: &'a Path,
|
pub root: &'a Path,
|
||||||
@@ -1511,6 +1574,12 @@ pub struct RepackEnv<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl RepackEnv<'_> {
|
impl RepackEnv<'_> {
|
||||||
|
fn saved_character_baseline(&self) -> Result<Option<crate::character_start_check::Baseline>> {
|
||||||
|
match unfinished(self.meta_dir) {
|
||||||
|
Some(txn) => read_character_baseline(self.meta_dir, &txn),
|
||||||
|
None => Ok(None),
|
||||||
|
}
|
||||||
|
}
|
||||||
pub fn pending_migrations(&self, manifest: &Manifest) -> Result<usize> {
|
pub fn pending_migrations(&self, manifest: &Manifest) -> Result<usize> {
|
||||||
Ok(self
|
Ok(self
|
||||||
.pending_migrations_with(manifest, DatabaseAccess::Start)?
|
.pending_migrations_with(manifest, DatabaseAccess::Start)?
|
||||||
@@ -1527,9 +1596,9 @@ impl RepackEnv<'_> {
|
|||||||
return Ok(Some(0));
|
return Ok(Some(0));
|
||||||
}
|
}
|
||||||
let count = |db: &crate::db::Db| -> Result<usize> {
|
let count = |db: &crate::db::Db| -> Result<usize> {
|
||||||
let db = db.clone().with_read_deadline(
|
let db = db
|
||||||
std::time::Instant::now() + std::time::Duration::from_secs(15),
|
.clone()
|
||||||
);
|
.with_read_deadline(std::time::Instant::now() + std::time::Duration::from_secs(15));
|
||||||
let realms = crate::realms::state(self.root)?;
|
let realms = crate::realms::state(self.root)?;
|
||||||
let modes = realms.modes();
|
let modes = realms.modes();
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
@@ -1772,12 +1841,25 @@ impl Env for RepackEnv<'_> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn character_start_baseline(&self) -> Result<Option<crate::character_start_check::Baseline>> {
|
||||||
|
crate::backup::with_database(self.root, |db| {
|
||||||
|
crate::character_start_check::capture(db, self.root)
|
||||||
|
})
|
||||||
|
.map(Some)
|
||||||
|
}
|
||||||
|
|
||||||
fn migrate(&self, manifest: &Manifest, staged: &Path) -> Result<ApplyReport> {
|
fn migrate(&self, manifest: &Manifest, staged: &Path) -> Result<ApplyReport> {
|
||||||
crate::backup::with_database(self.root, |db| {
|
crate::backup::with_database(self.root, |db| {
|
||||||
let identities = database_identities(db)?;
|
let identities = database_identities(db)?;
|
||||||
let result = migrate_databases(db, self.root, manifest, staged, &|| {
|
let baseline = self.saved_character_baseline()?;
|
||||||
self.migration_snapshot()
|
let result = migrate_databases(
|
||||||
})?;
|
db,
|
||||||
|
self.root,
|
||||||
|
manifest,
|
||||||
|
staged,
|
||||||
|
&|| self.migration_snapshot(),
|
||||||
|
baseline.as_ref(),
|
||||||
|
)?;
|
||||||
if result.failed.is_none() {
|
if result.failed.is_none() {
|
||||||
verify_database_identities(db, &identities)?;
|
verify_database_identities(db, &identities)?;
|
||||||
}
|
}
|
||||||
@@ -1799,6 +1881,11 @@ impl RepackEnv<'_> {
|
|||||||
crate::mysql_snapshot::stop(self.root)?;
|
crate::mysql_snapshot::stop(self.root)?;
|
||||||
self.ensure_stopped()?;
|
self.ensure_stopped()?;
|
||||||
self.recover_validation()?;
|
self.recover_validation()?;
|
||||||
|
let baseline = if check_schema {
|
||||||
|
self.saved_character_baseline()?
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
let result = (|| -> Result<()> {
|
let result = (|| -> Result<()> {
|
||||||
crate::update_isolation::begin(self.root, self.meta_dir)?;
|
crate::update_isolation::begin(self.root, self.meta_dir)?;
|
||||||
use crate::process::{observe, ServiceState};
|
use crate::process::{observe, ServiceState};
|
||||||
@@ -1806,9 +1893,10 @@ impl RepackEnv<'_> {
|
|||||||
if check_schema {
|
if check_schema {
|
||||||
let modes = crate::realms::state(self.root)?.modes();
|
let modes = crate::realms::state(self.root)?.modes();
|
||||||
for mode in modes {
|
for mode in modes {
|
||||||
if let Some(p) = crate::schema_check::check_with_report(
|
if let Some(p) = crate::schema_check::check_update_with_report(
|
||||||
&db.clone().for_realm(mode),
|
&db.clone().for_realm(mode),
|
||||||
self.root,
|
self.root,
|
||||||
|
baseline.as_ref(),
|
||||||
)?
|
)?
|
||||||
.first()
|
.first()
|
||||||
{
|
{
|
||||||
@@ -1851,8 +1939,7 @@ impl RepackEnv<'_> {
|
|||||||
if o.mysql.state == ServiceState::Running
|
if o.mysql.state == ServiceState::Running
|
||||||
&& o.auth.state == ServiceState::Running
|
&& o.auth.state == ServiceState::Running
|
||||||
&& o.world.state == ServiceState::Running
|
&& o.world.state == ServiceState::Running
|
||||||
&& o.extra_worlds()
|
&& o.extra_worlds().all(|s| s.state == ServiceState::Running)
|
||||||
.all(|s| s.state == ServiceState::Running)
|
|
||||||
{
|
{
|
||||||
let since = ready_since.get_or_insert_with(std::time::Instant::now);
|
let since = ready_since.get_or_insert_with(std::time::Instant::now);
|
||||||
if since.elapsed() >= std::time::Duration::from_secs(10) {
|
if since.elapsed() >= std::time::Duration::from_secs(10) {
|
||||||
@@ -1869,7 +1956,26 @@ impl RepackEnv<'_> {
|
|||||||
};
|
};
|
||||||
if healthy {
|
if healthy {
|
||||||
crate::backup::with_database(self.root, |db| {
|
crate::backup::with_database(self.root, |db| {
|
||||||
verify_database_identities(db, &identities)
|
verify_database_identities(db, &identities)?;
|
||||||
|
if check_schema {
|
||||||
|
for mode in crate::realms::state(self.root)?.modes() {
|
||||||
|
if let Some(problem) = crate::schema_check::check_update_with_report(
|
||||||
|
&db.clone().for_realm(mode),
|
||||||
|
self.root,
|
||||||
|
baseline.as_ref(),
|
||||||
|
)?
|
||||||
|
.first()
|
||||||
|
{
|
||||||
|
return Err(Error::Invalid(format!(
|
||||||
|
"Database validation failed after startup on {}: {}: {}",
|
||||||
|
mode.name(),
|
||||||
|
problem.table,
|
||||||
|
problem.detail
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
})?;
|
})?;
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
@@ -1892,6 +1998,7 @@ fn migrate_databases(
|
|||||||
manifest: &Manifest,
|
manifest: &Manifest,
|
||||||
staged: &Path,
|
staged: &Path,
|
||||||
snapshot: &dyn Fn() -> Result<String>,
|
snapshot: &dyn Fn() -> Result<String>,
|
||||||
|
baseline: Option<&crate::character_start_check::Baseline>,
|
||||||
) -> Result<ApplyReport> {
|
) -> Result<ApplyReport> {
|
||||||
let realms = crate::realms::state(root)?;
|
let realms = crate::realms::state(root)?;
|
||||||
let modes = realms.modes();
|
let modes = realms.modes();
|
||||||
@@ -1943,7 +2050,8 @@ fn migrate_databases(
|
|||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
crate::schema_check::repair_missing_defaults(&db, root, contract)?;
|
crate::schema_check::repair_missing_defaults(&db, root, contract)?;
|
||||||
if let Some(p) = crate::schema_check::check_with_report(&db, root)?.first() {
|
if let Some(p) = crate::schema_check::check_update_with_report(&db, root, baseline)?.first()
|
||||||
|
{
|
||||||
return Err(Error::Invalid(format!(
|
return Err(Error::Invalid(format!(
|
||||||
"Database validation failed on {}: {}.{}: {}",
|
"Database validation failed on {}: {}.{}: {}",
|
||||||
mode.name(),
|
mode.name(),
|
||||||
@@ -2010,6 +2118,8 @@ mod tests {
|
|||||||
use std::cell::{Cell, RefCell};
|
use std::cell::{Cell, RefCell};
|
||||||
|
|
||||||
struct Fake {
|
struct Fake {
|
||||||
|
character_baseline: RefCell<Option<crate::character_start_check::Baseline>>,
|
||||||
|
baseline_failed: Cell<bool>,
|
||||||
activation_expected: RefCell<Option<(PathBuf, String)>>,
|
activation_expected: RefCell<Option<(PathBuf, String)>>,
|
||||||
activation_failed: Cell<bool>,
|
activation_failed: Cell<bool>,
|
||||||
activated: Cell<bool>,
|
activated: Cell<bool>,
|
||||||
@@ -2027,6 +2137,8 @@ mod tests {
|
|||||||
impl Fake {
|
impl Fake {
|
||||||
fn ok() -> Fake {
|
fn ok() -> Fake {
|
||||||
Fake {
|
Fake {
|
||||||
|
character_baseline: RefCell::new(None),
|
||||||
|
baseline_failed: Cell::new(false),
|
||||||
activation_expected: RefCell::new(None),
|
activation_expected: RefCell::new(None),
|
||||||
activation_failed: Cell::new(false),
|
activation_failed: Cell::new(false),
|
||||||
activated: Cell::new(false),
|
activated: Cell::new(false),
|
||||||
@@ -2044,6 +2156,14 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Env for Fake {
|
impl Env for Fake {
|
||||||
|
fn character_start_baseline(
|
||||||
|
&self,
|
||||||
|
) -> Result<Option<crate::character_start_check::Baseline>> {
|
||||||
|
if self.baseline_failed.get() {
|
||||||
|
return Err(Error::Invalid("fixture baseline unavailable".into()));
|
||||||
|
}
|
||||||
|
Ok(self.character_baseline.borrow().clone())
|
||||||
|
}
|
||||||
fn activate(&self) -> Result<()> {
|
fn activate(&self) -> Result<()> {
|
||||||
if let Some((meta, version)) = self.activation_expected.borrow().as_ref() {
|
if let Some((meta, version)) = self.activation_expected.borrow().as_ref() {
|
||||||
ensure_recovered(meta)?;
|
ensure_recovered(meta)?;
|
||||||
@@ -3485,4 +3605,115 @@ mod tests {
|
|||||||
.iter()
|
.iter()
|
||||||
.any(|i| i.path == "Core/newfile.dll" && i.action == Action::Create));
|
.any(|i| i.path == "Core/newfile.dll" && i.action == Action::Create));
|
||||||
}
|
}
|
||||||
|
fn baseline_fixture() -> crate::character_start_check::Baseline {
|
||||||
|
crate::character_start_check::Baseline {
|
||||||
|
schema: 1,
|
||||||
|
realms: BTreeMap::from([(
|
||||||
|
"coa".into(),
|
||||||
|
crate::character_start_check::parse_missing("1\t44\t14\n2\t44\t14\n3\t44\t14")
|
||||||
|
.unwrap(),
|
||||||
|
)]),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn character_baseline_is_captured_once_persisted_and_verified_for_retry() {
|
||||||
|
let w = world(&[], true);
|
||||||
|
let env = Fake::ok();
|
||||||
|
*env.character_baseline.borrow_mut() = Some(baseline_fixture());
|
||||||
|
env.healthy.set(false);
|
||||||
|
let out = run(&w, &env, BTreeMap::new(), None).unwrap();
|
||||||
|
assert_eq!(out.txn.state, State::NeedsDecision);
|
||||||
|
assert_eq!(out.preexisting_character_count, 3);
|
||||||
|
let baseline_path = txn_dir(&w.meta, &out.txn.id)
|
||||||
|
.unwrap()
|
||||||
|
.join(CHARACTER_BASELINE);
|
||||||
|
let original = fs::read(&baseline_path).unwrap();
|
||||||
|
assert_eq!(
|
||||||
|
read_character_baseline(&w.meta, &out.txn)
|
||||||
|
.unwrap()
|
||||||
|
.unwrap()
|
||||||
|
.realms["coa"]
|
||||||
|
.len(),
|
||||||
|
3
|
||||||
|
);
|
||||||
|
// A retry may not learn new gaps from an already modified database.
|
||||||
|
*env.character_baseline.borrow_mut() = None;
|
||||||
|
env.healthy.set(true);
|
||||||
|
fs::write(&baseline_path, b"{}").unwrap();
|
||||||
|
assert!(retry_validation(
|
||||||
|
&w.root,
|
||||||
|
&w.meta,
|
||||||
|
&out.txn.id,
|
||||||
|
&Source::Dir(w.pkg.clone()),
|
||||||
|
&w.key,
|
||||||
|
&env
|
||||||
|
)
|
||||||
|
.is_err());
|
||||||
|
fs::write(&baseline_path, original).unwrap();
|
||||||
|
let done = retry_validation(
|
||||||
|
&w.root,
|
||||||
|
&w.meta,
|
||||||
|
&out.txn.id,
|
||||||
|
&Source::Dir(w.pkg.clone()),
|
||||||
|
&w.key,
|
||||||
|
&env,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
assert_eq!(done.state, State::Committed);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn corrupt_character_baseline_does_not_prevent_safe_rollback() {
|
||||||
|
let w = world(&[], true);
|
||||||
|
let env = Fake::ok();
|
||||||
|
*env.character_baseline.borrow_mut() = Some(baseline_fixture());
|
||||||
|
env.healthy.set(false);
|
||||||
|
let out = run(&w, &env, BTreeMap::new(), None).unwrap();
|
||||||
|
fs::write(
|
||||||
|
txn_dir(&w.meta, &out.txn.id)
|
||||||
|
.unwrap()
|
||||||
|
.join(CHARACTER_BASELINE),
|
||||||
|
b"bad",
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
let restored = rollback(&w.root, &w.meta, &out.txn.id, &env).unwrap();
|
||||||
|
assert_eq!(restored.state, State::RolledBack);
|
||||||
|
assert_eq!(read(&w, "Core/worldserver.exe"), b"world-v1");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn missing_or_unverified_character_baselines_fail_closed() {
|
||||||
|
let w = world(&[], true);
|
||||||
|
let env = Fake::ok();
|
||||||
|
env.healthy.set(false);
|
||||||
|
let out = run(&w, &env, BTreeMap::new(), None).unwrap();
|
||||||
|
assert!(read_character_baseline(&w.meta, &out.txn)
|
||||||
|
.unwrap()
|
||||||
|
.is_none());
|
||||||
|
let path = txn_dir(&w.meta, &out.txn.id)
|
||||||
|
.unwrap()
|
||||||
|
.join(CHARACTER_BASELINE);
|
||||||
|
fsx::atomic_write_json(&path, &baseline_fixture()).unwrap();
|
||||||
|
assert!(read_character_baseline(&w.meta, &out.txn).is_err());
|
||||||
|
let mut txn = out.txn;
|
||||||
|
txn.recovery_hashes.insert(
|
||||||
|
CHARACTER_BASELINE_HASH.into(),
|
||||||
|
fsx::sha256_file(&path).unwrap(),
|
||||||
|
);
|
||||||
|
fs::remove_file(path).unwrap();
|
||||||
|
assert!(read_character_baseline(&w.meta, &txn).is_err());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn baseline_capture_failure_precedes_file_and_database_changes() {
|
||||||
|
let w = world(&[], true);
|
||||||
|
let env = Fake::ok();
|
||||||
|
env.baseline_failed.set(true);
|
||||||
|
assert!(run(&w, &env, BTreeMap::new(), None).is_err());
|
||||||
|
assert_eq!(read(&w, "Core/worldserver.exe"), b"world-v1");
|
||||||
|
assert!(!env.calls.borrow().contains(&"migrate"));
|
||||||
|
assert!(!env.calls.borrow().contains(&"validate"));
|
||||||
|
assert!(unfinished(&w.meta).is_none());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "coa-server-manager",
|
"name": "coa-server-manager",
|
||||||
"version": "0.9.0",
|
"version": "0.9.4",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "coa-server-manager",
|
"name": "coa-server-manager",
|
||||||
"version": "0.9.0",
|
"version": "0.9.4",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tauri-apps/api": "^2.12.0",
|
"@tauri-apps/api": "^2.12.0",
|
||||||
"@tauri-apps/plugin-dialog": "^2.8.0",
|
"@tauri-apps/plugin-dialog": "^2.8.0",
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "coa-server-manager",
|
"name": "coa-server-manager",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.9.0",
|
"version": "0.9.4",
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -28,6 +28,16 @@ use tauri::{AppHandle, Emitter, Manager, State};
|
|||||||
|
|
||||||
mod control_cmds;
|
mod control_cmds;
|
||||||
|
|
||||||
|
/// Informational release notes only; never used to select or authorize an update.
|
||||||
|
#[tauri::command]
|
||||||
|
async fn release_history(component: String) -> std::result::Result<Value, String> {
|
||||||
|
tauri::async_runtime::spawn_blocking(move || {
|
||||||
|
coa_core::release_history::load(&component, &data_dir().join("release-history"))
|
||||||
|
})
|
||||||
|
.await
|
||||||
|
.map_err(|e| e.to_string())?
|
||||||
|
}
|
||||||
|
|
||||||
struct AppState {
|
struct AppState {
|
||||||
registry: Registry,
|
registry: Registry,
|
||||||
/// Installation ids with a start/stop currently running (one action at a time per server).
|
/// Installation ids with a start/stop currently running (one action at a time per server).
|
||||||
@@ -2806,6 +2816,7 @@ pub fn run() {
|
|||||||
host_control,
|
host_control,
|
||||||
})
|
})
|
||||||
.invoke_handler(tauri::generate_handler![
|
.invoke_handler(tauri::generate_handler![
|
||||||
|
release_history,
|
||||||
default_install_dir,
|
default_install_dir,
|
||||||
game_data_folder,
|
game_data_folder,
|
||||||
set_game_data_folder,
|
set_game_data_folder,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://schema.tauri.app/config/2",
|
"$schema": "https://schema.tauri.app/config/2",
|
||||||
"productName": "CoA Server Manager",
|
"productName": "CoA Server Manager",
|
||||||
"version": "0.9.0",
|
"version": "0.9.4",
|
||||||
"identifier": "com.coa.servermanager",
|
"identifier": "com.coa.servermanager",
|
||||||
"build": {
|
"build": {
|
||||||
"beforeDevCommand": "npm run dev",
|
"beforeDevCommand": "npm run dev",
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const buttonVariants = cva(
|
|||||||
size: {
|
size: {
|
||||||
sm: "h-9 px-3 text-sm",
|
sm: "h-9 px-3 text-sm",
|
||||||
md: "h-11 px-5 text-[15px]",
|
md: "h-11 px-5 text-[15px]",
|
||||||
xl: "h-16 px-10 text-lg tracking-wide",
|
xl: "h-12 px-6 text-base",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
defaultVariants: { variant: "secondary", size: "md" },
|
defaultVariants: { variant: "secondary", size: "md" },
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import { Button, type ButtonProps } from "./button";
|
||||||
|
|
||||||
|
/** Two explicit actions, each with its own enabled state and keyboard focus. */
|
||||||
|
export function SplitButton({ label, primary, secondary }: {
|
||||||
|
label: string;
|
||||||
|
primary: ButtonProps;
|
||||||
|
secondary: ButtonProps;
|
||||||
|
}) {
|
||||||
|
return <div role="group" aria-label={label} className="inline-flex max-w-full items-stretch rounded-md">
|
||||||
|
<Button type="button" variant="primary" {...primary}
|
||||||
|
className="h-auto min-h-12 min-w-0 rounded-r-none px-5 py-2 text-sm whitespace-normal" />
|
||||||
|
<Button type="button" variant="secondary" {...secondary}
|
||||||
|
className="h-auto min-h-12 min-w-0 rounded-l-none border-l border-l-gold/30 px-4 py-2 text-sm whitespace-normal" />
|
||||||
|
</div>;
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
# Release history data (internal)
|
||||||
|
|
||||||
|
The Manager feed is imported from the canonical `changelog/history.json`. The
|
||||||
|
server snapshot in this directory is copied from `Corfirean/coa-server-build`
|
||||||
|
commit `9bf1411de93e98cbcd0e8ebbcdac3a457d5fbaf0`, path
|
||||||
|
`changelog/history.json`, on 2026-10-28. Only schema, component, repository and
|
||||||
|
releases are retained. Do not independently edit historical records here.
|
||||||
|
|
||||||
|
At runtime the native read-only command fetches the fixed canonical URL, bounds
|
||||||
|
and validates the feed, and caches it for offline use. The bundled records appear
|
||||||
|
immediately and remain available if neither network nor cache is usable. These
|
||||||
|
records cannot select a package or authorize an update.
|
||||||
|
|
||||||
|
`latest-note-translations.json` contains the reviewed Manager notes through 0.9.3, the new
|
||||||
|
0.9.4 Manager entries, and the 0.261028.83 server notes in Russian, German, French, Spanish and Simplified
|
||||||
|
Chinese. English remains canonical. Translations are keyed by exact original
|
||||||
|
text: changing an original invalidates its translation. A partly translated
|
||||||
|
release falls back entirely to English and displays an explicit notice.
|
||||||
|
|
||||||
|
When preparing future release notes, refresh the server snapshot from a pinned
|
||||||
|
canonical commit and add all five translations for each new original note.
|
||||||
|
Never rewrite released fragments to add translations. Run
|
||||||
|
`node --test tools/release-history.test.mjs`; its completeness check expects the
|
||||||
|
latest bundled record of each component to have every translation.
|
||||||
@@ -0,0 +1,291 @@
|
|||||||
|
{
|
||||||
|
"manager": {
|
||||||
|
"ru": {
|
||||||
|
"Choose Parallel or Global level scaling in module settings": "Выбирайте параллельное или глобальное масштабирование уровней в настройках модуля",
|
||||||
|
"Report Content Scaling problems directly to its repository": "Отправляйте отчёты о проблемах Content Scaling прямо в его репозиторий",
|
||||||
|
"Send custom race problem reports directly to their maintainer": "Отправляйте отчёты о проблемах дополнительных рас напрямую их разработчику",
|
||||||
|
"Internet sharing restores the LAN address after server restarts": "Общий доступ через интернет восстанавливает адрес локальной сети после перезапуска сервера",
|
||||||
|
"Configure custom race availability for new characters": "Настраивайте доступность дополнительных рас для новых персонажей",
|
||||||
|
"Public listing offers every realm that starts together, not just the main one": "Публиковать можно каждый реалм, запускаемый вместе с основным",
|
||||||
|
"Public listing is a short list of realms with a window for the details": "Публичные реалмы представлены компактным списком с отдельным окном подробностей",
|
||||||
|
"Configure profession and defense skill gains in server settings": "Настраивайте рост навыков профессий и защиты в настройках сервера",
|
||||||
|
"Starting a server sets the character classes of the realm chosen on Overview": "При запуске применяются классы персонажей реалма, выбранного на экране «Обзор»",
|
||||||
|
"Start Wildcard and Warcraft Reborn together with Conquest of Azeroth": "Запускайте Wildcard и Warcraft Reborn вместе с Conquest of Azeroth",
|
||||||
|
"Control portable characters and keep Manager running in the system tray": "Управляйте переносимыми персонажами и оставляйте Manager работать в системном трее",
|
||||||
|
"Existing unsupported character records no longer block unrelated server updates": "Старые неподдерживаемые записи персонажей больше не блокируют несвязанные обновления сервера",
|
||||||
|
"New server installation waits for slower database startup": "Установка нового сервера дольше ожидает запуска базы на медленных дисках",
|
||||||
|
"Find and edit CoA options in the existing server settings": "Параметры CoA доступны для поиска и редактирования в настройках сервера",
|
||||||
|
"Simultaneous update checks share results or wait their turn": "Одновременные проверки обновлений используют общий результат или ожидают своей очереди",
|
||||||
|
"Recovery can stop an unfinished world startup after restoring an older launcher": "Восстановление может остановить зависший запуск мира после возврата старого launcher",
|
||||||
|
"Slow server startup no longer triggers an early update rollback": "Медленный запуск сервера больше не вызывает преждевременный откат обновления",
|
||||||
|
"Settings group updates, startup and maintenance with translated release history": "Настройки сгруппированы по обновлениям, запуску и обслуживанию с переведённой историей выпусков",
|
||||||
|
"Update and launch without updating share a divided button": "Обновление и запуск без обновления объединены в разделённую кнопку",
|
||||||
|
"Maximizing the window keeps text and controls at a comfortable size": "При разворачивании окна текст и элементы управления сохраняют удобный размер"
|
||||||
|
},
|
||||||
|
"de": {
|
||||||
|
"Choose Parallel or Global level scaling in module settings": "Parallele oder globale Levelskalierung in den Moduleinstellungen wählen",
|
||||||
|
"Report Content Scaling problems directly to its repository": "Probleme mit Content Scaling direkt in dessen Repository melden",
|
||||||
|
"Send custom race problem reports directly to their maintainer": "Probleme mit zusätzlichen Völkern direkt an deren Entwickler melden",
|
||||||
|
"Internet sharing restores the LAN address after server restarts": "Internetfreigabe stellt nach Serverneustarts die LAN-Adresse wieder her",
|
||||||
|
"Configure custom race availability for new characters": "Verfügbarkeit zusätzlicher Völker für neue Charaktere festlegen",
|
||||||
|
"Public listing offers every realm that starts together, not just the main one": "Alle gemeinsam gestarteten Realms können veröffentlicht werden, nicht nur der Hauptrealm",
|
||||||
|
"Public listing is a short list of realms with a window for the details": "Öffentliche Realms erscheinen als kurze Liste mit einem Detailfenster",
|
||||||
|
"Configure profession and defense skill gains in server settings": "Zuwachs von Berufs- und Verteidigungsfertigkeiten in den Servereinstellungen festlegen",
|
||||||
|
"Starting a server sets the character classes of the realm chosen on Overview": "Beim Serverstart werden die Charakterklassen des in der Übersicht gewählten Realms angewendet",
|
||||||
|
"Start Wildcard and Warcraft Reborn together with Conquest of Azeroth": "Wildcard und Warcraft Reborn gemeinsam mit Conquest of Azeroth starten",
|
||||||
|
"Control portable characters and keep Manager running in the system tray": "Portable Charaktere verwalten und Manager im Infobereich weiterlaufen lassen",
|
||||||
|
"Existing unsupported character records no longer block unrelated server updates": "Bestehende nicht unterstützte Charakterdatensätze blockieren keine unabhängigen Serverupdates mehr",
|
||||||
|
"New server installation waits for slower database startup": "Die Neuinstallation wartet länger auf einen langsamen Datenbankstart",
|
||||||
|
"Find and edit CoA options in the existing server settings": "CoA-Optionen in den bestehenden Servereinstellungen suchen und bearbeiten",
|
||||||
|
"Simultaneous update checks share results or wait their turn": "Gleichzeitige Updateprüfungen teilen Ergebnisse oder warten aufeinander",
|
||||||
|
"Recovery can stop an unfinished world startup after restoring an older launcher": "Die Wiederherstellung stoppt einen unvollständigen Weltstart auch mit altem Launcher",
|
||||||
|
"Slow server startup no longer triggers an early update rollback": "Ein langsamer Serverstart löst keinen vorzeitigen Update-Rollback mehr aus",
|
||||||
|
"Settings group updates, startup and maintenance with translated release history": "Einstellungen bündeln Updates, Start und Wartung mit übersetztem Versionsverlauf",
|
||||||
|
"Update and launch without updating share a divided button": "Aktualisieren und ohne Update starten teilen sich eine geteilte Schaltfläche",
|
||||||
|
"Maximizing the window keeps text and controls at a comfortable size": "Beim Maximieren bleiben Text und Bedienelemente angenehm groß"
|
||||||
|
},
|
||||||
|
"fr": {
|
||||||
|
"Choose Parallel or Global level scaling in module settings": "Choisissez une progression parallèle ou globale des niveaux dans les paramètres du module",
|
||||||
|
"Report Content Scaling problems directly to its repository": "Signalez les problèmes de Content Scaling directement dans son dépôt",
|
||||||
|
"Send custom race problem reports directly to their maintainer": "Envoyez les signalements concernant les races supplémentaires directement à leur développeur",
|
||||||
|
"Internet sharing restores the LAN address after server restarts": "Le partage Internet rétablit l’adresse du réseau local après un redémarrage du serveur",
|
||||||
|
"Configure custom race availability for new characters": "Configurez les races supplémentaires disponibles pour les nouveaux personnages",
|
||||||
|
"Public listing offers every realm that starts together, not just the main one": "Tous les royaumes démarrant ensemble peuvent être publiés, pas seulement le principal",
|
||||||
|
"Public listing is a short list of realms with a window for the details": "Les royaumes publics apparaissent dans une liste compacte avec une fenêtre de détails",
|
||||||
|
"Configure profession and defense skill gains in server settings": "Configurez les gains de compétences de métier et de défense dans les paramètres du serveur",
|
||||||
|
"Starting a server sets the character classes of the realm chosen on Overview": "Le démarrage applique les classes du royaume choisi sur l’écran Aperçu",
|
||||||
|
"Start Wildcard and Warcraft Reborn together with Conquest of Azeroth": "Démarrez Wildcard et Warcraft Reborn avec Conquest of Azeroth",
|
||||||
|
"Control portable characters and keep Manager running in the system tray": "Gérez les personnages portables et laissez Manager fonctionner dans la zone de notification",
|
||||||
|
"Existing unsupported character records no longer block unrelated server updates": "Les anciennes fiches de personnage non prises en charge ne bloquent plus les mises à jour sans rapport",
|
||||||
|
"New server installation waits for slower database startup": "L’installation attend le démarrage de la base sur les disques plus lents",
|
||||||
|
"Find and edit CoA options in the existing server settings": "Recherchez et modifiez les options CoA dans les paramètres du serveur",
|
||||||
|
"Simultaneous update checks share results or wait their turn": "Les vérifications simultanées partagent leurs résultats ou attendent leur tour",
|
||||||
|
"Recovery can stop an unfinished world startup after restoring an older launcher": "La restauration peut arrêter un démarrage du monde inachevé avec un ancien lanceur",
|
||||||
|
"Slow server startup no longer triggers an early update rollback": "Un démarrage lent du serveur ne déclenche plus un retour arrière prématuré",
|
||||||
|
"Settings group updates, startup and maintenance with translated release history": "Les paramètres regroupent les mises à jour, le démarrage et la maintenance avec un historique traduit",
|
||||||
|
"Update and launch without updating share a divided button": "La mise à jour et le lancement sans mise à jour partagent un bouton divisé",
|
||||||
|
"Maximizing the window keeps text and controls at a comfortable size": "Le texte et les commandes gardent une taille confortable lorsque la fenêtre est maximisée"
|
||||||
|
},
|
||||||
|
"es": {
|
||||||
|
"Choose Parallel or Global level scaling in module settings": "Elige escalado de nivel paralelo o global en los ajustes del módulo",
|
||||||
|
"Report Content Scaling problems directly to its repository": "Informa de problemas de Content Scaling directamente en su repositorio",
|
||||||
|
"Send custom race problem reports directly to their maintainer": "Envía los informes sobre razas adicionales directamente a su desarrollador",
|
||||||
|
"Internet sharing restores the LAN address after server restarts": "El acceso por Internet restaura la dirección de red local tras reiniciar el servidor",
|
||||||
|
"Configure custom race availability for new characters": "Configura las razas adicionales disponibles para personajes nuevos",
|
||||||
|
"Public listing offers every realm that starts together, not just the main one": "Puedes publicar todos los reinos que se inician juntos, no solo el principal",
|
||||||
|
"Public listing is a short list of realms with a window for the details": "Los reinos públicos se muestran en una lista breve con una ventana de detalles",
|
||||||
|
"Configure profession and defense skill gains in server settings": "Configura las mejoras de habilidades de profesión y defensa en los ajustes del servidor",
|
||||||
|
"Starting a server sets the character classes of the realm chosen on Overview": "Al iniciar el servidor se aplican las clases del reino elegido en Resumen",
|
||||||
|
"Start Wildcard and Warcraft Reborn together with Conquest of Azeroth": "Inicia Wildcard y Warcraft Reborn junto con Conquest of Azeroth",
|
||||||
|
"Control portable characters and keep Manager running in the system tray": "Gestiona personajes portátiles y mantén Manager en la bandeja del sistema",
|
||||||
|
"Existing unsupported character records no longer block unrelated server updates": "Los registros antiguos de personajes no compatibles ya no bloquean actualizaciones del servidor no relacionadas",
|
||||||
|
"New server installation waits for slower database startup": "La instalación espera más tiempo al inicio de la base de datos en discos lentos",
|
||||||
|
"Find and edit CoA options in the existing server settings": "Busca y edita opciones de CoA en la configuración actual del servidor",
|
||||||
|
"Simultaneous update checks share results or wait their turn": "Las comprobaciones simultáneas comparten resultados o esperan su turno",
|
||||||
|
"Recovery can stop an unfinished world startup after restoring an older launcher": "La recuperación puede detener el inicio del mundo tras restaurar un lanzador antiguo",
|
||||||
|
"Slow server startup no longer triggers an early update rollback": "El inicio lento del servidor ya no provoca una reversión prematura de la actualización",
|
||||||
|
"Settings group updates, startup and maintenance with translated release history": "Los ajustes agrupan actualizaciones, inicio y mantenimiento con un historial de versiones traducido",
|
||||||
|
"Update and launch without updating share a divided button": "Actualizar e iniciar sin actualizar comparten un botón dividido",
|
||||||
|
"Maximizing the window keeps text and controls at a comfortable size": "Al maximizar la ventana, el texto y los controles mantienen un tamaño cómodo"
|
||||||
|
},
|
||||||
|
"zh": {
|
||||||
|
"Choose Parallel or Global level scaling in module settings": "在模块设置中选择并行或全局等级缩放",
|
||||||
|
"Report Content Scaling problems directly to its repository": "直接向 Content Scaling 仓库报告问题",
|
||||||
|
"Send custom race problem reports directly to their maintainer": "将自定义种族问题直接报告给其维护者",
|
||||||
|
"Internet sharing restores the LAN address after server restarts": "服务器重启后,互联网共享会恢复局域网地址",
|
||||||
|
"Configure custom race availability for new characters": "设置新角色可选的自定义种族",
|
||||||
|
"Public listing offers every realm that starts together, not just the main one": "可以发布所有同时启动的服务器,而不仅是主服务器",
|
||||||
|
"Public listing is a short list of realms with a window for the details": "公开服务器使用简短列表展示,详情在单独窗口中查看",
|
||||||
|
"Configure profession and defense skill gains in server settings": "在服务器设置中调整专业和防御技能的提升",
|
||||||
|
"Starting a server sets the character classes of the realm chosen on Overview": "启动时会应用“概览”中所选服务器的角色职业",
|
||||||
|
"Start Wildcard and Warcraft Reborn together with Conquest of Azeroth": "将 Wildcard 和 Warcraft Reborn 与 Conquest of Azeroth 一同启动",
|
||||||
|
"Control portable characters and keep Manager running in the system tray": "管理可携带角色,并让 Manager 继续在系统托盘中运行",
|
||||||
|
"Existing unsupported character records no longer block unrelated server updates": "已有的不受支持角色记录不再阻止无关的服务器更新",
|
||||||
|
"New server installation waits for slower database startup": "安装新服务器时会等待较慢的数据库启动",
|
||||||
|
"Find and edit CoA options in the existing server settings": "在现有服务器设置中查找和编辑 CoA 选项",
|
||||||
|
"Simultaneous update checks share results or wait their turn": "同时进行的更新检查会共用结果或依次执行",
|
||||||
|
"Recovery can stop an unfinished world startup after restoring an older launcher": "恢复旧版启动器后,恢复流程也能停止未完成启动的世界服务器",
|
||||||
|
"Slow server startup no longer triggers an early update rollback": "服务器启动缓慢不再导致更新过早回滚",
|
||||||
|
"Settings group updates, startup and maintenance with translated release history": "设置按更新、启动和维护分组,并提供已翻译的版本历史",
|
||||||
|
"Update and launch without updating share a divided button": "更新和不更新直接启动使用同一个分段按钮",
|
||||||
|
"Maximizing the window keeps text and controls at a comfortable size": "最大化窗口时,文字和控件仍保持舒适的大小"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"server": {
|
||||||
|
"ru": {
|
||||||
|
"Restrict new characters by custom race without changing existing characters": "Ограничивайте выбор дополнительных рас для новых персонажей, не меняя существующих",
|
||||||
|
"More class abilities, items and Pale Reach quests work as intended": "Исправлена работа ряда классовых способностей, предметов и заданий Pale Reach",
|
||||||
|
"Witch Doctor and Guardian bots use their totems and standards, and fewer casts are refused": "Боты Witch Doctor и Guardian используют тотемы и штандарты; заклинания реже отклоняются",
|
||||||
|
"Venomancer Fortitude tanks use their real defensive abilities": "Танки Venomancer Fortitude используют свои настоящие защитные способности",
|
||||||
|
"Healer bots waste fewer big heals and tank bots spread their defensives": "Лекари реже тратят мощное исцеление впустую, а танки распределяют защитные способности",
|
||||||
|
"Dungeon bots drink and rest until the tank is ready to go on": "Боты в подземельях пьют и отдыхают, пока танк не будет готов продолжить",
|
||||||
|
"Archery Rangers use Precision Shot and Brutal Shot": "Archery Ranger использует Precision Shot и Brutal Shot",
|
||||||
|
"Black Knight tank bots can pull in auto-dungeon mode": "Танк Black Knight может начинать бой в автоматическом режиме подземелий",
|
||||||
|
"Boltslinger bots use spells they actually know": "Boltslinger использует только изученные заклинания",
|
||||||
|
"Bots with unsuitable gear are refitted at login": "Боты с неподходящим снаряжением переодеваются при входе",
|
||||||
|
"Bots with full bags make room to hand in finished quests": "Боты с полными сумками освобождают место для сдачи выполненных заданий",
|
||||||
|
"Bots pick weapons and shields for their combat spells, not for enchanting recipes": "Боты подбирают оружие и щиты для боевых способностей, а не для рецептов зачарования",
|
||||||
|
"Bots get their gear repaired and stop looping to the repairer": "Боты чинят снаряжение и перестают ходить к ремонтнику по кругу",
|
||||||
|
"Bots stay out of Outland and Northrend when those are not scaled to the level cap": "Боты не отправляются в Запределье и Нордскол, если те не масштабированы под предел уровня",
|
||||||
|
"Bots plan long walks around areas too strong for them": "При дальних переходах боты обходят слишком опасные для них области",
|
||||||
|
"Dead bots run back to their bodies and come back healthy": "Погибшие боты возвращаются к телам и воскресают здоровыми",
|
||||||
|
"Meet travelling companions and rivals in dynamic open-world encounters": "Встречайте попутчиков и соперников в динамических событиях открытого мира",
|
||||||
|
"New companions respect the server's custom race restrictions": "Новые компаньоны соблюдают ограничения сервера на кастомные расы",
|
||||||
|
"Ranged bots no longer stand still while Auto Shot or Shoot is active": "Боты дальнего боя больше не замирают при активном Auto Shot или Shoot",
|
||||||
|
"Battleground bots no longer travel in a straight line": "Боты на полях боя больше не перемещаются по прямой",
|
||||||
|
"Far less server lag with hundreds of bots online": "Значительно снижены задержки сервера при сотнях ботов в сети",
|
||||||
|
"Inspect the mana restoration spells recognized by an online companion": "Просматривайте заклинания восстановления маны, распознанные у спутника в сети",
|
||||||
|
"Bots stop hitting mobs they cannot reach": "Боты прекращают атаковать недоступных противников",
|
||||||
|
"Bot economy errands skip groups, battlegrounds and dungeons": "Экономические поручения ботов не выполняются в группах, на полях боя и в подземельях",
|
||||||
|
"Dungeon finder fills your group with bots that really join you": "Поиск подземелий заполняет группу ботами, которые действительно присоединяются к вам",
|
||||||
|
"Stop an unfinished server startup before restoring its database": "Перед восстановлением базы данных можно остановить незавершённый запуск сервера",
|
||||||
|
"Imported 40 upstream commits with class, item and Pale Reach quest fixes, optional account-wide friends, and corrected Vanity purchases": "Включены 40 изменений апстрима: исправления классов, предметов и заданий Pale Reach, необязательные друзья на весь аккаунт и исправленные покупки Vanity",
|
||||||
|
"Server includes newer upstream class, quest and dungeon updates": "Сервер включает новые обновления классов, заданий и подземелий из апстрима",
|
||||||
|
"Dungeon scaling preserves the level differences between creatures": "Масштабирование подземелий сохраняет разницу уровней между существами",
|
||||||
|
"Normal Classic dungeons retain their authored damage at full party size": "Обычные подземелья классики сохраняют исходный урон при полной группе",
|
||||||
|
"Interactive World Map displays allied bots, guild tasks and events": "Интерактивная карта мира показывает союзных ботов, задания гильдии и события",
|
||||||
|
"Database startup allows time for slower hard drives": "Запуск базы данных допускает более долгое ожидание на медленных дисках",
|
||||||
|
"Option to make low-health runners walk": "Добавлена возможность замедлить убегающих существ с низким здоровьем до шага"
|
||||||
|
},
|
||||||
|
"de": {
|
||||||
|
"Restrict new characters by custom race without changing existing characters": "Neue Charaktere nach zusätzlichem Volk beschränken, ohne bestehende Charaktere zu ändern",
|
||||||
|
"More class abilities, items and Pale Reach quests work as intended": "Weitere Klassenfähigkeiten, Gegenstände und Pale-Reach-Quests funktionieren korrekt",
|
||||||
|
"Witch Doctor and Guardian bots use their totems and standards, and fewer casts are refused": "Witch-Doctor- und Guardian-Bots nutzen Totems und Standarten; weniger Zauber werden abgelehnt",
|
||||||
|
"Venomancer Fortitude tanks use their real defensive abilities": "Venomancer-Fortitude-Tanks nutzen ihre tatsächlichen Defensivfähigkeiten",
|
||||||
|
"Healer bots waste fewer big heals and tank bots spread their defensives": "Heiler verschwenden weniger große Heilungen und Tanks verteilen ihre Defensivfähigkeiten",
|
||||||
|
"Dungeon bots drink and rest until the tank is ready to go on": "Dungeon-Bots trinken und ruhen, bis der Tank bereit ist",
|
||||||
|
"Archery Rangers use Precision Shot and Brutal Shot": "Archery Ranger nutzen Precision Shot und Brutal Shot",
|
||||||
|
"Black Knight tank bots can pull in auto-dungeon mode": "Black-Knight-Tanks können im automatischen Dungeonmodus Gegner heranziehen",
|
||||||
|
"Boltslinger bots use spells they actually know": "Boltslinger nutzen nur tatsächlich erlernte Zauber",
|
||||||
|
"Bots with unsuitable gear are refitted at login": "Bots mit ungeeigneter Ausrüstung werden beim Anmelden neu ausgestattet",
|
||||||
|
"Bots with full bags make room to hand in finished quests": "Bots mit vollen Taschen schaffen Platz zum Abgeben erledigter Quests",
|
||||||
|
"Bots pick weapons and shields for their combat spells, not for enchanting recipes": "Bots wählen Waffen und Schilde nach Kampffähigkeiten statt Verzauberungsrezepten",
|
||||||
|
"Bots get their gear repaired and stop looping to the repairer": "Bots reparieren Ausrüstung und laufen nicht mehr wiederholt zum Reparateur",
|
||||||
|
"Bots stay out of Outland and Northrend when those are not scaled to the level cap": "Bots meiden Scherbenwelt und Nordend, wenn diese nicht auf das Levellimit skaliert sind",
|
||||||
|
"Bots plan long walks around areas too strong for them": "Bots umgehen auf langen Wegen Gebiete mit zu starken Gegnern",
|
||||||
|
"Dead bots run back to their bodies and come back healthy": "Tote Bots kehren zu ihren Körpern zurück und werden gesund wiederbelebt",
|
||||||
|
"Meet travelling companions and rivals in dynamic open-world encounters": "Begegne reisenden Begleitern und Rivalen in dynamischen Ereignissen der offenen Welt",
|
||||||
|
"New companions respect the server's custom race restrictions": "Neue Begleiter beachten die serverseitigen Beschränkungen eigener Völker",
|
||||||
|
"Ranged bots no longer stand still while Auto Shot or Shoot is active": "Fernkampf-Bots bleiben bei aktivem Auto Shot oder Shoot nicht mehr stehen",
|
||||||
|
"Battleground bots no longer travel in a straight line": "Schlachtfeld-Bots bewegen sich nicht mehr geradlinig",
|
||||||
|
"Far less server lag with hundreds of bots online": "Deutlich weniger Serververzögerungen bei Hunderten aktiven Bots",
|
||||||
|
"Inspect the mana restoration spells recognized by an online companion": "Erkannte Manaregeneration-Zauber eines aktiven Begleiters anzeigen",
|
||||||
|
"Bots stop hitting mobs they cannot reach": "Bots greifen unerreichbare Gegner nicht weiter an",
|
||||||
|
"Bot economy errands skip groups, battlegrounds and dungeons": "Wirtschaftsaufgaben der Bots überspringen Gruppen, Schlachtfelder und Dungeons",
|
||||||
|
"Dungeon finder fills your group with bots that really join you": "Der Dungeonfinder füllt Gruppen mit Bots, die sich tatsächlich anschließen",
|
||||||
|
"Stop an unfinished server startup before restoring its database": "Unvollständigen Serverstart vor dem Wiederherstellen der Datenbank stoppen",
|
||||||
|
"Imported 40 upstream commits with class, item and Pale Reach quest fixes, optional account-wide friends, and corrected Vanity purchases": "40 Upstream-Änderungen mit Klassen-, Gegenstands- und Pale-Reach-Questkorrekturen, optionalen accountweiten Freunden und korrigierten Vanity-Käufen übernommen",
|
||||||
|
"Server includes newer upstream class, quest and dungeon updates": "Der Server enthält neuere Upstream-Updates für Klassen, Quests und Dungeons",
|
||||||
|
"Dungeon scaling preserves the level differences between creatures": "Die Dungeon-Skalierung erhält die Stufenunterschiede zwischen Kreaturen",
|
||||||
|
"Normal Classic dungeons retain their authored damage at full party size": "Normale Classic-Dungeons behalten bei voller Gruppe ihren ursprünglichen Schaden",
|
||||||
|
"Interactive World Map displays allied bots, guild tasks and events": "Die interaktive Weltkarte zeigt verbündete Bots, Gildenaufgaben und Ereignisse",
|
||||||
|
"Database startup allows time for slower hard drives": "Der Datenbankstart lässt langsameren Festplatten mehr Zeit",
|
||||||
|
"Option to make low-health runners walk": "Fliehende Kreaturen mit wenig Gesundheit können im Schritttempo laufen"
|
||||||
|
},
|
||||||
|
"fr": {
|
||||||
|
"Restrict new characters by custom race without changing existing characters": "Restreignez les races supplémentaires des nouveaux personnages sans modifier les personnages existants",
|
||||||
|
"More class abilities, items and Pale Reach quests work as intended": "Davantage de capacités de classe, d’objets et de quêtes de Pale Reach fonctionnent correctement",
|
||||||
|
"Witch Doctor and Guardian bots use their totems and standards, and fewer casts are refused": "Les bots Witch Doctor et Guardian utilisent leurs totems et étendards ; moins de sorts sont refusés",
|
||||||
|
"Venomancer Fortitude tanks use their real defensive abilities": "Les tanks Venomancer Fortitude utilisent leurs véritables capacités défensives",
|
||||||
|
"Healer bots waste fewer big heals and tank bots spread their defensives": "Les soigneurs gaspillent moins de gros soins et les tanks répartissent leurs défenses",
|
||||||
|
"Dungeon bots drink and rest until the tank is ready to go on": "Les bots de donjon boivent et se reposent jusqu’à ce que le tank soit prêt",
|
||||||
|
"Archery Rangers use Precision Shot and Brutal Shot": "Les Archery Rangers utilisent Precision Shot et Brutal Shot",
|
||||||
|
"Black Knight tank bots can pull in auto-dungeon mode": "Les tanks Black Knight peuvent engager les ennemis en mode donjon automatique",
|
||||||
|
"Boltslinger bots use spells they actually know": "Les Boltslingers utilisent les sorts qu’ils connaissent réellement",
|
||||||
|
"Bots with unsuitable gear are refitted at login": "Les bots mal équipés reçoivent un équipement adapté à la connexion",
|
||||||
|
"Bots with full bags make room to hand in finished quests": "Les bots aux sacs pleins font de la place pour rendre les quêtes terminées",
|
||||||
|
"Bots pick weapons and shields for their combat spells, not for enchanting recipes": "Les bots choisissent armes et boucliers selon leurs sorts de combat, pas les recettes d’enchantement",
|
||||||
|
"Bots get their gear repaired and stop looping to the repairer": "Les bots font réparer leur équipement sans retourner en boucle chez le réparateur",
|
||||||
|
"Bots stay out of Outland and Northrend when those are not scaled to the level cap": "Les bots évitent l’Outreterre et le Norfendre si leur niveau n’est pas adapté au plafond",
|
||||||
|
"Bots plan long walks around areas too strong for them": "Les bots contournent les zones trop dangereuses lors des longs trajets",
|
||||||
|
"Dead bots run back to their bodies and come back healthy": "Les bots morts rejoignent leur corps et reviennent en bonne santé",
|
||||||
|
"Meet travelling companions and rivals in dynamic open-world encounters": "Rencontrez des compagnons voyageurs et des rivaux lors d’événements dynamiques en monde ouvert",
|
||||||
|
"New companions respect the server's custom race restrictions": "Les nouveaux compagnons respectent les restrictions du serveur sur les races personnalisées",
|
||||||
|
"Ranged bots no longer stand still while Auto Shot or Shoot is active": "Les bots à distance ne restent plus immobiles lorsque Auto Shot ou Shoot est actif",
|
||||||
|
"Battleground bots no longer travel in a straight line": "Les bots des champs de bataille ne se déplacent plus en ligne droite",
|
||||||
|
"Far less server lag with hundreds of bots online": "Beaucoup moins de ralentissements avec des centaines de bots connectés",
|
||||||
|
"Inspect the mana restoration spells recognized by an online companion": "Consultez les sorts de restauration de mana reconnus chez un compagnon connecté",
|
||||||
|
"Bots stop hitting mobs they cannot reach": "Les bots cessent d’attaquer les ennemis inaccessibles",
|
||||||
|
"Bot economy errands skip groups, battlegrounds and dungeons": "Les tâches économiques des bots ignorent groupes, champs de bataille et donjons",
|
||||||
|
"Dungeon finder fills your group with bots that really join you": "La recherche de donjon remplit votre groupe avec des bots qui vous rejoignent réellement",
|
||||||
|
"Stop an unfinished server startup before restoring its database": "Arrêtez un démarrage de serveur inachevé avant de restaurer sa base de données",
|
||||||
|
"Imported 40 upstream commits with class, item and Pale Reach quest fixes, optional account-wide friends, and corrected Vanity purchases": "Intégration de 40 changements amont : classes, objets et quêtes de Pale Reach corrigés, amis de compte facultatifs et achats Vanity corrigés",
|
||||||
|
"Server includes newer upstream class, quest and dungeon updates": "Le serveur intègre de nouvelles mises à jour des classes, quêtes et donjons provenant du projet amont",
|
||||||
|
"Dungeon scaling preserves the level differences between creatures": "La mise à l’échelle des donjons conserve les écarts de niveau entre les créatures",
|
||||||
|
"Normal Classic dungeons retain their authored damage at full party size": "Les donjons Classic normaux conservent leurs dégâts d’origine avec un groupe complet",
|
||||||
|
"Interactive World Map displays allied bots, guild tasks and events": "La carte du monde interactive affiche les bots alliés, les tâches de guilde et les événements",
|
||||||
|
"Database startup allows time for slower hard drives": "Le démarrage de la base de données laisse plus de temps aux disques lents",
|
||||||
|
"Option to make low-health runners walk": "Une option permet aux créatures affaiblies de fuir en marchant"
|
||||||
|
},
|
||||||
|
"es": {
|
||||||
|
"Restrict new characters by custom race without changing existing characters": "Restringe las razas adicionales de personajes nuevos sin modificar los existentes",
|
||||||
|
"More class abilities, items and Pale Reach quests work as intended": "Más habilidades de clase, objetos y misiones de Pale Reach funcionan correctamente",
|
||||||
|
"Witch Doctor and Guardian bots use their totems and standards, and fewer casts are refused": "Los bots Witch Doctor y Guardian usan sus tótems y estandartes y se rechazan menos hechizos",
|
||||||
|
"Venomancer Fortitude tanks use their real defensive abilities": "Los tanques Venomancer Fortitude usan sus verdaderas habilidades defensivas",
|
||||||
|
"Healer bots waste fewer big heals and tank bots spread their defensives": "Los sanadores desperdician menos curas grandes y los tanques distribuyen sus defensivos",
|
||||||
|
"Dungeon bots drink and rest until the tank is ready to go on": "Los bots de mazmorra beben y descansan hasta que el tanque está listo",
|
||||||
|
"Archery Rangers use Precision Shot and Brutal Shot": "Los Archery Rangers usan Precision Shot y Brutal Shot",
|
||||||
|
"Black Knight tank bots can pull in auto-dungeon mode": "Los tanques Black Knight pueden iniciar combates en el modo automático de mazmorras",
|
||||||
|
"Boltslinger bots use spells they actually know": "Los Boltslingers usan hechizos que realmente conocen",
|
||||||
|
"Bots with unsuitable gear are refitted at login": "Los bots con equipo inadecuado reciben equipo apropiado al conectarse",
|
||||||
|
"Bots with full bags make room to hand in finished quests": "Los bots con bolsas llenas hacen espacio para entregar misiones completadas",
|
||||||
|
"Bots pick weapons and shields for their combat spells, not for enchanting recipes": "Los bots eligen armas y escudos por sus hechizos de combate, no por recetas de encantamiento",
|
||||||
|
"Bots get their gear repaired and stop looping to the repairer": "Los bots reparan su equipo y dejan de volver al reparador en bucle",
|
||||||
|
"Bots stay out of Outland and Northrend when those are not scaled to the level cap": "Los bots evitan Terrallende y Rasganorte si no están escalados al límite de nivel",
|
||||||
|
"Bots plan long walks around areas too strong for them": "Los bots evitan zonas demasiado peligrosas en los viajes largos",
|
||||||
|
"Dead bots run back to their bodies and come back healthy": "Los bots muertos vuelven a sus cuerpos y regresan con buena salud",
|
||||||
|
"Meet travelling companions and rivals in dynamic open-world encounters": "Encuentra compañeros viajeros y rivales en encuentros dinámicos de mundo abierto",
|
||||||
|
"New companions respect the server's custom race restrictions": "Los nuevos compañeros respetan las restricciones del servidor sobre razas personalizadas",
|
||||||
|
"Ranged bots no longer stand still while Auto Shot or Shoot is active": "Los bots a distancia ya no se quedan inmóviles con Auto Shot o Shoot activo",
|
||||||
|
"Battleground bots no longer travel in a straight line": "Los bots de campos de batalla ya no viajan en línea recta",
|
||||||
|
"Far less server lag with hundreds of bots online": "Mucho menos lag del servidor con cientos de bots conectados",
|
||||||
|
"Inspect the mana restoration spells recognized by an online companion": "Consulta los hechizos de restauración de maná reconocidos en un compañero conectado",
|
||||||
|
"Bots stop hitting mobs they cannot reach": "Los bots dejan de atacar a enemigos inalcanzables",
|
||||||
|
"Bot economy errands skip groups, battlegrounds and dungeons": "Las tareas económicas de los bots omiten grupos, campos de batalla y mazmorras",
|
||||||
|
"Dungeon finder fills your group with bots that really join you": "El buscador de mazmorras llena tu grupo con bots que realmente se unen",
|
||||||
|
"Stop an unfinished server startup before restoring its database": "Detén un inicio de servidor incompleto antes de restaurar su base de datos",
|
||||||
|
"Imported 40 upstream commits with class, item and Pale Reach quest fixes, optional account-wide friends, and corrected Vanity purchases": "Integrados 40 cambios del proyecto original: correcciones de clases, objetos y misiones de Pale Reach, amigos opcionales de toda la cuenta y compras Vanity corregidas",
|
||||||
|
"Server includes newer upstream class, quest and dungeon updates": "El servidor incorpora nuevas actualizaciones de clases, misiones y mazmorras del proyecto original",
|
||||||
|
"Dungeon scaling preserves the level differences between creatures": "El escalado de las mazmorras conserva las diferencias de nivel entre criaturas",
|
||||||
|
"Normal Classic dungeons retain their authored damage at full party size": "Las mazmorras Classic normales conservan su daño original con un grupo completo",
|
||||||
|
"Interactive World Map displays allied bots, guild tasks and events": "El mapa del mundo interactivo muestra bots aliados, tareas de hermandad y eventos",
|
||||||
|
"Database startup allows time for slower hard drives": "El inicio de la base de datos permite más tiempo en discos lentos",
|
||||||
|
"Option to make low-health runners walk": "Una opción permite que las criaturas con poca salud huyan caminando"
|
||||||
|
},
|
||||||
|
"zh": {
|
||||||
|
"Restrict new characters by custom race without changing existing characters": "限制新角色可选的自定义种族,不影响现有角色",
|
||||||
|
"More class abilities, items and Pale Reach quests work as intended": "修复更多职业技能、物品和 Pale Reach 任务",
|
||||||
|
"Witch Doctor and Guardian bots use their totems and standards, and fewer casts are refused": "Witch Doctor 和 Guardian 机器人会使用图腾和旗帜,施法被拒绝的情况减少",
|
||||||
|
"Venomancer Fortitude tanks use their real defensive abilities": "Venomancer Fortitude 坦克会使用实际拥有的防御技能",
|
||||||
|
"Healer bots waste fewer big heals and tank bots spread their defensives": "治疗机器人减少浪费大型治疗,坦克会错开使用防御技能",
|
||||||
|
"Dungeon bots drink and rest until the tank is ready to go on": "副本机器人会喝水和休息,直到坦克准备好继续",
|
||||||
|
"Archery Rangers use Precision Shot and Brutal Shot": "Archery Ranger 会使用 Precision Shot 和 Brutal Shot",
|
||||||
|
"Black Knight tank bots can pull in auto-dungeon mode": "Black Knight 坦克可以在自动副本模式中拉怪",
|
||||||
|
"Boltslinger bots use spells they actually know": "Boltslinger 只会使用实际学会的法术",
|
||||||
|
"Bots with unsuitable gear are refitted at login": "装备不合适的机器人会在登录时更换装备",
|
||||||
|
"Bots with full bags make room to hand in finished quests": "背包已满的机器人会腾出空间以提交已完成的任务",
|
||||||
|
"Bots pick weapons and shields for their combat spells, not for enchanting recipes": "机器人根据战斗法术选择武器和盾牌,而不是根据附魔配方",
|
||||||
|
"Bots get their gear repaired and stop looping to the repairer": "机器人会修理装备,不再反复往返修理商",
|
||||||
|
"Bots stay out of Outland and Northrend when those are not scaled to the level cap": "如果外域和诺森德未缩放到等级上限,机器人会避开这些地区",
|
||||||
|
"Bots plan long walks around areas too strong for them": "机器人长途行走时会绕开过于危险的区域",
|
||||||
|
"Dead bots run back to their bodies and come back healthy": "死亡的机器人会跑回尸体并以健康状态复活",
|
||||||
|
"Meet travelling companions and rivals in dynamic open-world encounters": "在动态开放世界事件中遇见旅行伙伴和对手",
|
||||||
|
"New companions respect the server's custom race restrictions": "新同伴遵守服务器对自定义种族的限制",
|
||||||
|
"Ranged bots no longer stand still while Auto Shot or Shoot is active": "远程机器人不再因 Auto Shot 或 Shoot 启用而原地不动",
|
||||||
|
"Battleground bots no longer travel in a straight line": "战场机器人不再沿直线移动",
|
||||||
|
"Far less server lag with hundreds of bots online": "数百个机器人在线时,服务器延迟显著降低",
|
||||||
|
"Inspect the mana restoration spells recognized by an online companion": "查看在线伙伴所识别的法力恢复法术",
|
||||||
|
"Bots stop hitting mobs they cannot reach": "机器人会停止攻击无法接近的敌人",
|
||||||
|
"Bot economy errands skip groups, battlegrounds and dungeons": "机器人的经济事务会跳过队伍、战场和副本",
|
||||||
|
"Dungeon finder fills your group with bots that really join you": "地下城查找器会用真正加入队伍的机器人补齐队伍",
|
||||||
|
"Stop an unfinished server startup before restoring its database": "恢复数据库前可以停止尚未完成的服务器启动",
|
||||||
|
"Imported 40 upstream commits with class, item and Pale Reach quest fixes, optional account-wide friends, and corrected Vanity purchases": "合入 40 项上游更改:职业、物品及 Pale Reach 任务修复,可选的账号共享好友,以及 Vanity 购买修复",
|
||||||
|
"Server includes newer upstream class, quest and dungeon updates": "服务器整合了上游新的职业、任务和地下城更新",
|
||||||
|
"Dungeon scaling preserves the level differences between creatures": "地下城缩放保留生物之间的等级差异",
|
||||||
|
"Normal Classic dungeons retain their authored damage at full party size": "普通经典地下城在满员队伍下保留原始伤害",
|
||||||
|
"Interactive World Map displays allied bots, guild tasks and events": "交互式世界地图显示友方机器人、公会任务和事件",
|
||||||
|
"Database startup allows time for slower hard drives": "数据库启动为较慢的硬盘预留更多等待时间",
|
||||||
|
"Option to make low-health runners walk": "新增选项,可让低生命值的逃跑生物改为步行"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
+7
-2
@@ -25,9 +25,14 @@ export {};
|
|||||||
notes:["worldserver.exe differs from the one listed in RELEASE.json (release 2026-09-11); this looks like a customised build."],modifies_files:false};
|
notes:["worldserver.exe differs from the one listed in RELEASE.json (release 2026-09-11); this looks like a customised build."],modifies_files:false};
|
||||||
const svc=(n: string,p: number,st: string)=>({name:n,state:st,pid:st==="running"?100:null,port:p,port_ready:st==="running",conflict:null,uptime_secs:st==="running"?4206:null});
|
const svc=(n: string,p: number,st: string)=>({name:n,state:st,pid:st==="running"?100:null,port:p,port_ready:st==="running",conflict:null,uptime_secs:st==="running"?4206:null});
|
||||||
{ const q = new URLSearchParams(location.search); const w0 = window as any; if (q.get("client")) w0.__client = q.get("client"); if (q.get("modified")) w0.__modified = true; }
|
{ const q = new URLSearchParams(location.search); const w0 = window as any; if (q.get("client")) w0.__client = q.get("client"); if (q.get("modified")) w0.__modified = true; }
|
||||||
|
(window as any).__TAURI_EVENT_PLUGIN_INTERNALS__ = { unregisterListener() {} };
|
||||||
(window as any).__TAURI_INTERNALS__ = {
|
(window as any).__TAURI_INTERNALS__ = {
|
||||||
transformCallback: (cb: unknown)=>cb, unregisterCallback(){}, convertFileSrc:(x: unknown)=>x,
|
transformCallback: (cb: unknown)=>cb, unregisterCallback(){}, convertFileSrc:(x: unknown)=>x,
|
||||||
invoke: async (cmd: string, args?: any)=>{
|
invoke: async (cmd: string, args?: any)=>{
|
||||||
|
if(cmd==="open_link") return null;
|
||||||
|
if(cmd==="pending_update") return null;
|
||||||
|
if(cmd==="plugin:app|version") return "0.8.2";
|
||||||
|
if(cmd==="release_history") throw new Error("Offline demo: using bundled notes");
|
||||||
if(cmd==="realm_profiles") return {active:realm,wildcard_created:wildcardCreated,reborn_created:rebornCreated,reborn_supported:true,supported:true,recovery_pending:false,simultaneous,secondary_world_port:simultaneous?8086:null,secondary_running:simultaneous&&running,with_reborn:withReborn,reborn_world_port:withReborn?8087:null,reborn_running:withReborn&&running};
|
if(cmd==="realm_profiles") return {active:realm,wildcard_created:wildcardCreated,reborn_created:rebornCreated,reborn_supported:true,supported:true,recovery_pending:false,simultaneous,secondary_world_port:simultaneous?8086:null,secondary_running:simultaneous&&running,with_reborn:withReborn,reborn_world_port:withReborn?8087:null,reborn_running:withReborn&&running};
|
||||||
if(cmd==="realm_simultaneous") { if(running) throw new Error("Stop both realms before changing simultaneous startup."); simultaneous=args.enabled; wildcardCreated ||= simultaneous; return {active:realm,wildcard_created:wildcardCreated,reborn_created:rebornCreated,reborn_supported:true,supported:true,recovery_pending:false,simultaneous,secondary_world_port:simultaneous?8086:null,secondary_running:false,with_reborn:withReborn,reborn_world_port:withReborn?8087:null,reborn_running:false}; }
|
if(cmd==="realm_simultaneous") { if(running) throw new Error("Stop both realms before changing simultaneous startup."); simultaneous=args.enabled; wildcardCreated ||= simultaneous; return {active:realm,wildcard_created:wildcardCreated,reborn_created:rebornCreated,reborn_supported:true,supported:true,recovery_pending:false,simultaneous,secondary_world_port:simultaneous?8086:null,secondary_running:false,with_reborn:withReborn,reborn_world_port:withReborn?8087:null,reborn_running:false}; }
|
||||||
if(cmd==="realm_with_reborn") { if(running) throw new Error("Stop all realms before changing which realms start together."); withReborn=args.enabled; rebornCreated ||= withReborn; return {active:realm,wildcard_created:wildcardCreated,reborn_created:rebornCreated,reborn_supported:true,supported:true,recovery_pending:false,simultaneous,secondary_world_port:simultaneous?8086:null,secondary_running:false,with_reborn:withReborn,reborn_world_port:withReborn?8087:null,reborn_running:false}; }
|
if(cmd==="realm_with_reborn") { if(running) throw new Error("Stop all realms before changing which realms start together."); withReborn=args.enabled; rebornCreated ||= withReborn; return {active:realm,wildcard_created:wildcardCreated,reborn_created:rebornCreated,reborn_supported:true,supported:true,recovery_pending:false,simultaneous,secondary_world_port:simultaneous?8086:null,secondary_running:false,with_reborn:withReborn,reborn_world_port:withReborn?8087:null,reborn_running:false}; }
|
||||||
@@ -49,8 +54,8 @@ export {};
|
|||||||
if(cmd==="preview_preset"){const a=args;const sc=a.scope==="server"?serverSchema:botsSchema;const pr=(a.scope==="server"?serverPresets:botsPresets).presets as any[];const p=pr.find(x=>x.id===a.preset)??{id:a.preset??"defaults",title:"Recommended defaults",description:"Every setting returns to its default value."};const st=(sc.settings as any[]).filter(x=>x.type==="int"||x.type==="float"||x.type==="enum").slice(0,3);return {id:p.id,title:p.title,description:p.description,changes:st.map(x=>({key:x.key,title:x.title,from:x.default,to:x.type==="enum"?(x.options?.[1]?.value??x.default):(Number(x.default)||1)*2,dangerous:false}))};}
|
if(cmd==="preview_preset"){const a=args;const sc=a.scope==="server"?serverSchema:botsSchema;const pr=(a.scope==="server"?serverPresets:botsPresets).presets as any[];const p=pr.find(x=>x.id===a.preset)??{id:a.preset??"defaults",title:"Recommended defaults",description:"Every setting returns to its default value."};const st=(sc.settings as any[]).filter(x=>x.type==="int"||x.type==="float"||x.type==="enum").slice(0,3);return {id:p.id,title:p.title,description:p.description,changes:st.map(x=>({key:x.key,title:x.title,from:x.default,to:x.type==="enum"?(x.options?.[1]?.value??x.default):(Number(x.default)||1)*2,dangerous:false}))};}
|
||||||
if(cmd==="companion_sizes") return {hardware:{cores:16,ram_gb:31,free_ram_gb:12},sizes:[{id:"small",title:"Small",bots:50,warning:null},{id:"medium",title:"Medium",bots:250,warning:null},{id:"large",title:"Large",bots:500,warning:"500 companions may need more CPU and memory than this computer has (8 cores, 16 GB)."}]};
|
if(cmd==="companion_sizes") return {hardware:{cores:16,ram_gb:31,free_ram_gb:12},sizes:[{id:"small",title:"Small",bots:50,warning:null},{id:"medium",title:"Medium",bots:250,warning:null},{id:"large",title:"Large",bots:500,warning:"500 companions may need more CPU and memory than this computer has (8 cores, 16 GB)."}]};
|
||||||
if(cmd==="add_companions"){const base=(window as any).__bots??85;(window as any).__target=base+args.count;return {spawned:"queued",created:null,baseline:base};}
|
if(cmd==="add_companions"){const base=(window as any).__bots??85;(window as any).__target=base+args.count;return {spawned:"queued",created:null,baseline:base};}
|
||||||
if(cmd==="check_update") return {from_version:(window as any).__updated?"0.261001.8":"0.260930.5",to_version:"0.261001.8",items:[],conflicts:[],migrations:5,pending_migrations:(window as any).__updated?0:5,download_bytes:6000000};
|
if(cmd==="check_update") return {from_version:(window as any).__updated?"0.261028.83":"0.261026.81",to_version:"0.261028.83",items:[],conflicts:[],migrations:5,pending_migrations:(window as any).__updated?0:5,download_bytes:6000000};
|
||||||
if(cmd==="apply_update"){const w=window as any;for(let i=1;i<=8;i++){await new Promise((r: any)=>setTimeout(r,700));(w.__handlers?.["update-progress"]??[]).forEach((h: any)=>h({event:"update-progress",id:1,payload:{step:i<4?"Downloading the update":i<7?"Applying the update":"Finishing",percent:i*12}}));}(window as any).__updated=true;return {txn:{state:"committed",to_version:"0.261001.8"},migrations:null};}
|
if(cmd==="apply_update"){const w=window as any;for(let i=1;i<=8;i++){await new Promise((r: any)=>setTimeout(r,700));(w.__handlers?.["update-progress"]??[]).forEach((h: any)=>h({event:"update-progress",id:1,payload:{step:i<4?"Downloading the update":i<7?"Applying the update":"Finishing",percent:i*12}}));}(window as any).__updated=true;return {txn:{state:"committed",to_version:"0.261028.83"},migrations:null};}
|
||||||
if(cmd==="get_population"){if(!running) return null;let b=(window as any).__bots??85;const t=(window as any).__target??0;if(t>b){b=Math.min(t,b+25);(window as any).__bots=b;}return {online_total:b,bots_online:Math.max(0,b-7),players_online:0,bots_total:b};}
|
if(cmd==="get_population"){if(!running) return null;let b=(window as any).__bots??85;const t=(window as any).__target??0;if(t>b){b=Math.min(t,b+25);(window as any).__bots=b;}return {online_total:b,bots_online:Math.max(0,b-7),players_online:0,bots_total:b};}
|
||||||
if(cmd==="get_performance") return running?{mean_ms:14,median_ms:15,p95_ms:24,p99_ms:30,max_ms:61,ticks_per_sec:71.4}:null;
|
if(cmd==="get_performance") return running?{mean_ms:14,median_ms:15,p95_ms:24,p99_ms:30,max_ms:61,ticks_per_sec:71.4}:null;
|
||||||
if(cmd==="run_diagnostics") return {problems:2,checks:[{id:"files",title:"Server files",level:"ok",detail:"All expected server parts were found."},{id:"world",title:"World server",level:"warn",detail:"Not running."},{id:"disk",title:"Free disk space",level:"warn",detail:"Only 3 GB free; backups and updates need room."},{id:"exposure",title:"Private services",level:"ok",detail:"Database and server console are not reachable from the network."}]};
|
if(cmd==="run_diagnostics") return {problems:2,checks:[{id:"files",title:"Server files",level:"ok",detail:"All expected server parts were found."},{id:"world",title:"World server",level:"warn",detail:"Not running."},{id:"disk",title:"Free disk space",level:"warn",detail:"Only 3 GB free; backups and updates need room."},{id:"exposure",title:"Private services",level:"ok",detail:"Database and server console are not reachable from the network."}]};
|
||||||
|
|||||||
@@ -2,6 +2,34 @@ import type en from "./en";
|
|||||||
|
|
||||||
/** Deutsch. Entwurf einer Übersetzung; vor der Veröffentlichung von Muttersprachlern zu prüfen. */
|
/** Deutsch. Entwurf einer Übersetzung; vor der Veröffentlichung von Muttersprachlern zu prüfen. */
|
||||||
const de: Partial<Record<keyof typeof en, string>> = {
|
const de: Partial<Record<keyof typeof en, string>> = {
|
||||||
|
"upd.preexistingCharacters": "Bereits vor dem Update fehlten bei {n} Charakterdatensätzen die Startdaten für Volk/Klasse. Unveränderte Datensätze wurden bewahrt und blockierten das Update nicht. Details stehen in der Diagnose; diese älteren Unstimmigkeiten wurden nicht automatisch behoben.",
|
||||||
|
"settings.autoManager": "Updates im Hintergrund herunterladen",
|
||||||
|
"settings.startServer": "Nach dem Update starten",
|
||||||
|
"settings.version": "Version {v}",
|
||||||
|
"settings.startupHelp": "Details zum Start",
|
||||||
|
|
||||||
|
"settings.section.updates": "Updates",
|
||||||
|
"settings.section.startup": "Start",
|
||||||
|
"settings.section.client": "Client und Dateien",
|
||||||
|
"settings.section.service": "Wartung",
|
||||||
|
"settings.section.interface": "Oberfläche",
|
||||||
|
"settings.organized": "Updates, Serverstart und Spieldateien verwalten",
|
||||||
|
"settings.clientLink": "Clientdateien und Spieldaten",
|
||||||
|
"history.title": "Änderungsverlauf",
|
||||||
|
"history.open": "Was sich ändert",
|
||||||
|
"history.server": "Server",
|
||||||
|
"history.manager": "Manager",
|
||||||
|
"history.all": "Alle Versionen",
|
||||||
|
"history.range": "Für dieses Update",
|
||||||
|
"history.language": "Sprache der Einträge",
|
||||||
|
"history.fallback": "Englisches Original: Diese Version wurde noch nicht übersetzt",
|
||||||
|
"history.empty": "Für dieses Update sind noch keine Einträge veröffentlicht",
|
||||||
|
"history.files": "Dateiänderungen",
|
||||||
|
"history.offline": "Gespeicherter Verlauf · offline verfügbar",
|
||||||
|
"history.refreshed": "Veröffentlichter Verlauf aktualisiert",
|
||||||
|
"history.experimental": "Portable Charaktere sind experimentell. Sichere deine Charaktere vor der Verwendung.",
|
||||||
|
"settings.attention": "Ein Update erfordert Aufmerksamkeit. Öffne Updates für die Wiederherstellungsoptionen.",
|
||||||
|
|
||||||
"races.unknownIds": "Nicht mehr im Katalog vorhandene Völker-IDs: {ids}. Beim Speichern werden diese alten Einschränkungen entfernt.",
|
"races.unknownIds": "Nicht mehr im Katalog vorhandene Völker-IDs: {ids}. Beim Speichern werden diese alten Einschränkungen entfernt.",
|
||||||
"races.reviewCatalog": "Der Völkerkatalog wurde geändert oder noch nicht geprüft. Prüfe die Liste und speichere sie erneut.",
|
"races.reviewCatalog": "Der Völkerkatalog wurde geändert oder noch nicht geprüft. Prüfe die Liste und speichere sie erneut.",
|
||||||
"races.available": "Verfügbare Völker",
|
"races.available": "Verfügbare Völker",
|
||||||
|
|||||||
+29
-1
@@ -1,5 +1,33 @@
|
|||||||
/** English is the source of truth: every key must exist here; other locales fall back to it. */
|
/** English is the source of truth: every key must exist here; other locales fall back to it. */
|
||||||
const en = {
|
const en = {
|
||||||
|
"upd.preexistingCharacters": "Before the update, {n} character records already lacked race/class starting data. Unchanged records were preserved and did not block the update. Details are saved in diagnostics; these older inconsistencies have not been automatically repaired.",
|
||||||
|
"settings.autoManager": "Download updates in the background",
|
||||||
|
"settings.startServer": "Start after updating",
|
||||||
|
"settings.version": "Version {v}",
|
||||||
|
"settings.startupHelp": "Startup details",
|
||||||
|
|
||||||
|
"settings.section.updates": "Updates",
|
||||||
|
"settings.section.startup": "Startup",
|
||||||
|
"settings.section.client": "Client and files",
|
||||||
|
"settings.section.service": "Maintenance",
|
||||||
|
"settings.section.interface": "Interface",
|
||||||
|
"settings.organized": "Manage updates, startup and your game files",
|
||||||
|
"settings.clientLink": "Client files and game data",
|
||||||
|
"history.title": "Release history",
|
||||||
|
"history.open": "What changed",
|
||||||
|
"history.server": "Server",
|
||||||
|
"history.manager": "Manager",
|
||||||
|
"history.all": "All versions",
|
||||||
|
"history.range": "For this update",
|
||||||
|
"history.language": "Notes language",
|
||||||
|
"history.fallback": "Original English notes: this release has not been translated yet",
|
||||||
|
"history.empty": "No published notes for this update",
|
||||||
|
"history.files": "File changes",
|
||||||
|
"history.offline": "Saved release history · available offline",
|
||||||
|
"history.refreshed": "Published notes refreshed",
|
||||||
|
"history.experimental": "Portable Characters is experimental. Back up your characters before using it.",
|
||||||
|
"settings.attention": "An update needs attention. Open Updates to review recovery options.",
|
||||||
|
|
||||||
"races.unknownIds": "RaceIDs no longer in this catalog: {ids}. Saving the reviewed list removes these old restrictions.",
|
"races.unknownIds": "RaceIDs no longer in this catalog: {ids}. Saving the reviewed list removes these old restrictions.",
|
||||||
"races.reviewCatalog": "The race catalog changed or has not been verified. Review the list and save it before applying restrictions.",
|
"races.reviewCatalog": "The race catalog changed or has not been verified. Review the list and save it before applying restrictions.",
|
||||||
"races.available": "Available races",
|
"races.available": "Available races",
|
||||||
@@ -1123,7 +1151,7 @@ const en = {
|
|||||||
"browse.offlineWarning": "The server is currently offline. Joining with a portable character will become available once the host starts the server.",
|
"browse.offlineWarning": "The server is currently offline. Joining with a portable character will become available once the host starts the server.",
|
||||||
"browse.play": "Play",
|
"browse.play": "Play",
|
||||||
"browse.playSoon": "Joining arrives with the account support of the next step.",
|
"browse.playSoon": "Joining arrives with the account support of the next step.",
|
||||||
"registry.title": "Public listing",
|
"registry.title": "Public realms",
|
||||||
"registry.dialogTitle": "Public listing · {realm}",
|
"registry.dialogTitle": "Public listing · {realm}",
|
||||||
"registry.publishAll": "Publish all realms",
|
"registry.publishAll": "Publish all realms",
|
||||||
"registry.publishAllText": "One description, language and region for every realm that is not listed yet. Each realm is listed under the server name; the realms that start next to the main one get their realm name added.",
|
"registry.publishAllText": "One description, language and region for every realm that is not listed yet. Each realm is listed under the server name; the realms that start next to the main one get their realm name added.",
|
||||||
|
|||||||
@@ -2,6 +2,34 @@ import type en from "./en";
|
|||||||
|
|
||||||
/** Español. Traducción provisional; debe revisarla un hablante nativo antes de publicarse. */
|
/** Español. Traducción provisional; debe revisarla un hablante nativo antes de publicarse. */
|
||||||
const es: Partial<Record<keyof typeof en, string>> = {
|
const es: Partial<Record<keyof typeof en, string>> = {
|
||||||
|
"upd.preexistingCharacters": "Antes de actualizar, a {n} registros de personaje ya les faltaban datos iniciales de raza/clase. Los registros sin cambios se conservaron y no bloquearon la actualización. Los detalles están en el diagnóstico; estas inconsistencias anteriores no se repararon automáticamente.",
|
||||||
|
"settings.autoManager": "Descargar actualizaciones en segundo plano",
|
||||||
|
"settings.startServer": "Iniciar tras actualizar",
|
||||||
|
"settings.version": "Versión {v}",
|
||||||
|
"settings.startupHelp": "Detalles del inicio",
|
||||||
|
|
||||||
|
"settings.section.updates": "Actualizaciones",
|
||||||
|
"settings.section.startup": "Inicio",
|
||||||
|
"settings.section.client": "Cliente y archivos",
|
||||||
|
"settings.section.service": "Mantenimiento",
|
||||||
|
"settings.section.interface": "Interfaz",
|
||||||
|
"settings.organized": "Gestiona actualizaciones, inicio y archivos del juego",
|
||||||
|
"settings.clientLink": "Archivos del cliente y datos del juego",
|
||||||
|
"history.title": "Historial de cambios",
|
||||||
|
"history.open": "Qué cambia",
|
||||||
|
"history.server": "Servidor",
|
||||||
|
"history.manager": "Manager",
|
||||||
|
"history.all": "Todas las versiones",
|
||||||
|
"history.range": "Para esta actualización",
|
||||||
|
"history.language": "Idioma de las notas",
|
||||||
|
"history.fallback": "Original en inglés: esta versión aún no está traducida",
|
||||||
|
"history.empty": "No hay notas publicadas para esta actualización",
|
||||||
|
"history.files": "Cambios en archivos",
|
||||||
|
"history.offline": "Historial guardado · disponible sin conexión",
|
||||||
|
"history.refreshed": "Historial publicado actualizado",
|
||||||
|
"history.experimental": "Los personajes portátiles son experimentales. Haz una copia de seguridad de tus personajes antes de usarlos.",
|
||||||
|
"settings.attention": "Una actualización requiere atención. Abre Actualizaciones para ver las opciones de recuperación.",
|
||||||
|
|
||||||
"races.unknownIds": "RaceID que ya no están en el catálogo: {ids}. Al guardar la lista revisada se eliminan estas restricciones antiguas.",
|
"races.unknownIds": "RaceID que ya no están en el catálogo: {ids}. Al guardar la lista revisada se eliminan estas restricciones antiguas.",
|
||||||
"races.reviewCatalog": "El catálogo de razas ha cambiado o aún no está verificado. Revisa la lista y guárdala.",
|
"races.reviewCatalog": "El catálogo de razas ha cambiado o aún no está verificado. Revisa la lista y guárdala.",
|
||||||
"races.available": "Razas disponibles",
|
"races.available": "Razas disponibles",
|
||||||
|
|||||||
@@ -2,6 +2,34 @@ import type en from "./en";
|
|||||||
|
|
||||||
/** Français. Traduction provisoire ; à faire relire par un locuteur natif avant la publication. */
|
/** Français. Traduction provisoire ; à faire relire par un locuteur natif avant la publication. */
|
||||||
const fr: Partial<Record<keyof typeof en, string>> = {
|
const fr: Partial<Record<keyof typeof en, string>> = {
|
||||||
|
"upd.preexistingCharacters": "Avant la mise à jour, {n} fiches de personnage n’avaient déjà pas de données de départ pour leur race/classe. Les fiches inchangées ont été conservées sans bloquer la mise à jour. Les détails sont dans le diagnostic ; ces incohérences anciennes n’ont pas été corrigées automatiquement.",
|
||||||
|
"settings.autoManager": "Télécharger les mises à jour en arrière-plan",
|
||||||
|
"settings.startServer": "Démarrer après la mise à jour",
|
||||||
|
"settings.version": "Version {v}",
|
||||||
|
"settings.startupHelp": "Détails du démarrage",
|
||||||
|
|
||||||
|
"settings.section.updates": "Mises à jour",
|
||||||
|
"settings.section.startup": "Démarrage",
|
||||||
|
"settings.section.client": "Client et fichiers",
|
||||||
|
"settings.section.service": "Maintenance",
|
||||||
|
"settings.section.interface": "Interface",
|
||||||
|
"settings.organized": "Gérer les mises à jour, le démarrage et les fichiers du jeu",
|
||||||
|
"settings.clientLink": "Fichiers du client et données du jeu",
|
||||||
|
"history.title": "Historique des changements",
|
||||||
|
"history.open": "Ce qui change",
|
||||||
|
"history.server": "Serveur",
|
||||||
|
"history.manager": "Manager",
|
||||||
|
"history.all": "Toutes les versions",
|
||||||
|
"history.range": "Pour cette mise à jour",
|
||||||
|
"history.language": "Langue des notes",
|
||||||
|
"history.fallback": "Original anglais : cette version n’est pas encore traduite",
|
||||||
|
"history.empty": "Aucune note publiée pour cette mise à jour",
|
||||||
|
"history.files": "Fichiers modifiés",
|
||||||
|
"history.offline": "Historique enregistré · disponible hors ligne",
|
||||||
|
"history.refreshed": "Historique publié actualisé",
|
||||||
|
"history.experimental": "Les personnages portables sont expérimentaux. Sauvegardez vos personnages avant utilisation.",
|
||||||
|
"settings.attention": "Une mise à jour nécessite votre attention. Ouvrez Mises à jour pour les options de récupération.",
|
||||||
|
|
||||||
"races.unknownIds": "RaceID absents de ce catalogue : {ids}. Sauvegarder la liste vérifiée supprime ces anciennes restrictions.",
|
"races.unknownIds": "RaceID absents de ce catalogue : {ids}. Sauvegarder la liste vérifiée supprime ces anciennes restrictions.",
|
||||||
"races.reviewCatalog": "Le catalogue des races a changé ou n’a pas été vérifié. Vérifiez la liste et sauvegardez-la.",
|
"races.reviewCatalog": "Le catalogue des races a changé ou n’a pas été vérifié. Vérifiez la liste et sauvegardez-la.",
|
||||||
"races.available": "Races disponibles",
|
"races.available": "Races disponibles",
|
||||||
|
|||||||
+29
-1
@@ -2,6 +2,34 @@ import type en from "./en";
|
|||||||
|
|
||||||
/** Русский. Черновой перевод; требует проверки носителем перед релизом. */
|
/** Русский. Черновой перевод; требует проверки носителем перед релизом. */
|
||||||
const ru: Partial<Record<keyof typeof en, string>> = {
|
const ru: Partial<Record<keyof typeof en, string>> = {
|
||||||
|
"upd.preexistingCharacters": "До обновления у {n} записей персонажей уже отсутствовали стартовые данные расы/класса. Неизменившиеся записи сохранены и не заблокировали обновление. Подробности есть в диагностике; эти старые несоответствия автоматически не исправлялись.",
|
||||||
|
"settings.autoManager": "Скачивать обновления в фоне",
|
||||||
|
"settings.startServer": "Запустить после обновления",
|
||||||
|
"settings.version": "Версия {v}",
|
||||||
|
"settings.startupHelp": "Подробнее о запуске",
|
||||||
|
|
||||||
|
"settings.section.updates": "Обновления",
|
||||||
|
"settings.section.startup": "Запуск",
|
||||||
|
"settings.section.client": "Клиент и файлы",
|
||||||
|
"settings.section.service": "Обслуживание",
|
||||||
|
"settings.section.interface": "Интерфейс",
|
||||||
|
"settings.organized": "Обновления, запуск сервера и файлы игры",
|
||||||
|
"settings.clientLink": "Файлы клиента и игровые данные",
|
||||||
|
"history.title": "История изменений",
|
||||||
|
"history.open": "Что изменится",
|
||||||
|
"history.server": "Сервер",
|
||||||
|
"history.manager": "Manager",
|
||||||
|
"history.all": "Все версии",
|
||||||
|
"history.range": "К обновлению",
|
||||||
|
"history.language": "Язык записей",
|
||||||
|
"history.fallback": "Английский оригинал: этот выпуск пока не переведён",
|
||||||
|
"history.empty": "Для этого обновления пока нет опубликованных записей",
|
||||||
|
"history.files": "Изменения файлов",
|
||||||
|
"history.offline": "Сохранённая история · доступна без сети",
|
||||||
|
"history.refreshed": "Опубликованная история обновлена",
|
||||||
|
"history.experimental": "Переносимые персонажи — экспериментальная функция. Перед использованием сохраните резервную копию персонажей.",
|
||||||
|
"settings.attention": "Обновление требует внимания. Откройте «Обновления», чтобы выбрать способ восстановления.",
|
||||||
|
|
||||||
"races.unknownIds": "RaceID, которых больше нет в каталоге: {ids}. Сохранение проверенного списка удалит эти старые ограничения.",
|
"races.unknownIds": "RaceID, которых больше нет в каталоге: {ids}. Сохранение проверенного списка удалит эти старые ограничения.",
|
||||||
"races.reviewCatalog": "Каталог рас изменился или ещё не проверен. Проверьте список и сохраните его перед применением ограничений.",
|
"races.reviewCatalog": "Каталог рас изменился или ещё не проверен. Проверьте список и сохраните его перед применением ограничений.",
|
||||||
"races.available": "Доступные расы",
|
"races.available": "Доступные расы",
|
||||||
@@ -1105,7 +1133,7 @@ const ru: Partial<Record<keyof typeof en, string>> = {
|
|||||||
"browse.offlineWarning": "Сервер сейчас не запущен хостом. Игра переносимым персонажем станет доступна, когда владелец включит сервер.",
|
"browse.offlineWarning": "Сервер сейчас не запущен хостом. Игра переносимым персонажем станет доступна, когда владелец включит сервер.",
|
||||||
"browse.play": "Играть",
|
"browse.play": "Играть",
|
||||||
"browse.playSoon": "Вход на сервер появится вместе с поддержкой аккаунтов на следующем шаге.",
|
"browse.playSoon": "Вход на сервер появится вместе с поддержкой аккаунтов на следующем шаге.",
|
||||||
"registry.title": "Публичный список",
|
"registry.title": "Публичные реалмы",
|
||||||
"registry.dialogTitle": "Публичный список · {realm}",
|
"registry.dialogTitle": "Публичный список · {realm}",
|
||||||
"registry.publishAll": "Опубликовать все реалмы",
|
"registry.publishAll": "Опубликовать все реалмы",
|
||||||
"registry.publishAllText": "Одно описание, язык и регион для каждого реалма, которого ещё нет в списке. Реалмы публикуются под названием сервера; к реалмам, которые запускаются рядом с основным, добавляется название реалма.",
|
"registry.publishAllText": "Одно описание, язык и регион для каждого реалма, которого ещё нет в списке. Реалмы публикуются под названием сервера; к реалмам, которые запускаются рядом с основным, добавляется название реалма.",
|
||||||
|
|||||||
@@ -1,5 +1,33 @@
|
|||||||
/** Simplified Chinese localization (zh-CN) */
|
/** Simplified Chinese localization (zh-CN) */
|
||||||
const zh = {
|
const zh = {
|
||||||
|
"upd.preexistingCharacters": "更新前已有 {n} 条角色记录缺少种族/职业初始数据。未变化的记录已保留,不会阻止更新。详情已保存到诊断报告;这些既有问题尚未自动修复。",
|
||||||
|
"settings.autoManager": "在后台下载更新",
|
||||||
|
"settings.startServer": "更新后启动",
|
||||||
|
"settings.version": "版本 {v}",
|
||||||
|
"settings.startupHelp": "启动详情",
|
||||||
|
|
||||||
|
"settings.section.updates": "更新",
|
||||||
|
"settings.section.startup": "启动",
|
||||||
|
"settings.section.client": "客户端与文件",
|
||||||
|
"settings.section.service": "维护",
|
||||||
|
"settings.section.interface": "界面",
|
||||||
|
"settings.organized": "管理更新、服务器启动与游戏文件",
|
||||||
|
"settings.clientLink": "客户端文件与游戏数据",
|
||||||
|
"history.title": "更新日志",
|
||||||
|
"history.open": "更新内容",
|
||||||
|
"history.server": "服务器",
|
||||||
|
"history.manager": "Manager",
|
||||||
|
"history.all": "所有版本",
|
||||||
|
"history.range": "本次更新",
|
||||||
|
"history.language": "日志语言",
|
||||||
|
"history.fallback": "英文原文:此版本尚未翻译",
|
||||||
|
"history.empty": "本次更新暂无已发布的日志",
|
||||||
|
"history.files": "文件变更",
|
||||||
|
"history.offline": "已保存的日志 · 离线可用",
|
||||||
|
"history.refreshed": "已刷新发布日志",
|
||||||
|
"history.experimental": "可携带角色功能仍处于实验阶段。使用前请备份角色。",
|
||||||
|
"settings.attention": "某次更新需要处理。请打开“更新”查看恢复选项。",
|
||||||
|
|
||||||
"races.unknownIds": "此目录中已不存在的种族 ID:{ids}。保存检查后的列表将移除这些旧限制。",
|
"races.unknownIds": "此目录中已不存在的种族 ID:{ids}。保存检查后的列表将移除这些旧限制。",
|
||||||
"races.reviewCatalog": "种族目录已更改或尚未验证。请检查列表并保存后再应用限制。",
|
"races.reviewCatalog": "种族目录已更改或尚未验证。请检查列表并保存后再应用限制。",
|
||||||
"races.available": "可用种族",
|
"races.available": "可用种族",
|
||||||
|
|||||||
+3
-3
@@ -16,10 +16,10 @@
|
|||||||
--font-sans: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
|
--font-sans: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Everything is sized in rem, so scaling the root font grows the whole interface with the window
|
/* Window size changes layout, not UI density. Keep rem tied to the user's default
|
||||||
(16px up to about 1280px wide, then gradually larger; capped at 26px). */
|
font size; browser zoom and operating-system display scaling still apply. */
|
||||||
html {
|
html {
|
||||||
font-size: clamp(16px, calc(0.75vw + 6.4px), 26px);
|
font-size: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
html,
|
html,
|
||||||
|
|||||||
+8
-2
@@ -1,4 +1,7 @@
|
|||||||
import { invoke } from "@tauri-apps/api/core";
|
import { invoke } from "@tauri-apps/api/core";
|
||||||
|
import { updateCheckQueue } from "./updateCheckQueue";
|
||||||
|
|
||||||
|
const queuedUpdateCheck = updateCheckQueue<UpdatePreview>();
|
||||||
|
|
||||||
export const REMOTE_CLIENT_ID = "@remote-client";
|
export const REMOTE_CLIENT_ID = "@remote-client";
|
||||||
export interface RemoteConnection { host: string; client_path: string | null }
|
export interface RemoteConnection { host: string; client_path: string | null }
|
||||||
@@ -539,10 +542,13 @@ export const api = {
|
|||||||
createAccount: (id: string, username: string, password: string, administrator: boolean) =>
|
createAccount: (id: string, username: string, password: string, administrator: boolean) =>
|
||||||
invoke<void>("create_account", { id, username, password, administrator }),
|
invoke<void>("create_account", { id, username, password, administrator }),
|
||||||
/** `background`: the repeating check, which must not start the database of a stopped server. */
|
/** `background`: the repeating check, which must not start the database of a stopped server. */
|
||||||
checkUpdate: (id: string, source?: string, background?: boolean) => invoke<UpdatePreview>("check_update", { id, source: source ?? null, background: background ?? false }),
|
checkUpdate: (id: string, source?: string, background?: boolean) => queuedUpdateCheck(
|
||||||
|
id, JSON.stringify([source ?? null, background ?? false]),
|
||||||
|
() => invoke<UpdatePreview>("check_update", { id, source: source ?? null, background: background ?? false }),
|
||||||
|
),
|
||||||
pendingUpdate: (id: string) => invoke<UpdateTxn | null>("pending_update", { id }),
|
pendingUpdate: (id: string) => invoke<UpdateTxn | null>("pending_update", { id }),
|
||||||
applyUpdate: (id: string, resolutions: Record<string, "keep" | "replace">, source?: string) =>
|
applyUpdate: (id: string, resolutions: Record<string, "keep" | "replace">, source?: string) =>
|
||||||
invoke<{ txn: UpdateTxn }>("apply_update", { id, source: source ?? null, resolutions }),
|
invoke<{ txn: UpdateTxn; preexisting_character_count?: number }>("apply_update", { id, source: source ?? null, resolutions }),
|
||||||
rollbackUpdate: (id: string, txn: string) => invoke<UpdateTxn>("rollback_update", { id, txn }),
|
rollbackUpdate: (id: string, txn: string) => invoke<UpdateTxn>("rollback_update", { id, txn }),
|
||||||
retryUpdateValidation: (id: string, txn: string) => invoke<UpdateTxn>("retry_update_validation", { id, txn }),
|
retryUpdateValidation: (id: string, txn: string) => invoke<UpdateTxn>("retry_update_validation", { id, txn }),
|
||||||
population: (id: string) => invoke<Population | null>("get_population", { id }),
|
population: (id: string) => invoke<Population | null>("get_population", { id }),
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import manager from "../../changelog/history.json";
|
||||||
|
import server from "@/data/server-history.json";
|
||||||
|
import translations from "@/data/latest-note-translations.json";
|
||||||
|
import type { Locale } from "@/i18n";
|
||||||
|
|
||||||
|
import { localizeNotes, type Component, type History, type Release } from "./releaseHistoryModel";
|
||||||
|
export { compareVersions, releasesForUpdate } from "./releaseHistoryModel";
|
||||||
|
export type { Component, History } from "./releaseHistoryModel";
|
||||||
|
export const bundledHistories: Record<Component, History> = { manager: manager as History, server: server as History };
|
||||||
|
export const repositories = { manager: "Corfirean/coa-server-manager", server: "Corfirean/coa-server-build" };
|
||||||
|
|
||||||
|
export function translatedNotes(component: Component, release: Release, locale: Locale): { notes: string[]; fallback: boolean } {
|
||||||
|
if (locale === "en") return { notes: release.notes, fallback: false };
|
||||||
|
const dict = (translations[component] as Record<string, Record<string, string>>)[locale] ?? {};
|
||||||
|
return localizeNotes(release.notes, dict);
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
export type Component = "server" | "manager";
|
||||||
|
export interface Release { version: string; tag: string; date: string; notes: string[]; prerelease?: boolean; experimentalFeatures?: string[] }
|
||||||
|
export interface History { component: Component; releases: Release[]; source?: "remote" | "cache" }
|
||||||
|
|
||||||
|
// Only stable numeric versions participate in an installed-to-target update range.
|
||||||
|
export function compareVersions(a: string, b: string): number {
|
||||||
|
const aa = a.split(".").map(Number), bb = b.split(".").map(Number);
|
||||||
|
for (let i = 0; i < Math.max(aa.length, bb.length); i++) {
|
||||||
|
const d = (aa[i] ?? 0) - (bb[i] ?? 0);
|
||||||
|
if (d) return d;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
export function releasesForUpdate(releases: Release[], from?: string, to?: string): Release[] {
|
||||||
|
if (!to || !/^\d+(\.\d+)+$/.test(to)) return [];
|
||||||
|
const knownFrom = from && /^\d+(\.\d+)+$/.test(from);
|
||||||
|
return releases.filter(r => !r.prerelease && /^\d+(\.\d+)+$/.test(r.version) &&
|
||||||
|
(knownFrom ? compareVersions(r.version, from) > 0 && compareVersions(r.version, to) <= 0 : r.version === to));
|
||||||
|
}
|
||||||
|
export function localizeNotes(notes: string[], dictionary: Record<string, string> = {}) {
|
||||||
|
const complete = notes.every(note => dictionary[note]);
|
||||||
|
return { notes: complete ? notes.map(note => dictionary[note]) : notes, fallback: !complete };
|
||||||
|
}
|
||||||
@@ -21,7 +21,7 @@ export interface ServerUpdateState {
|
|||||||
stateError: UiError | null;
|
stateError: UiError | null;
|
||||||
stateRevision: number;
|
stateRevision: number;
|
||||||
/** How the last update ended; kept here so the Settings card can show it after the user left and came back. */
|
/** How the last update ended; kept here so the Settings card can show it after the user left and came back. */
|
||||||
result: { committed: string } | { pending: UpdateTxn } | null;
|
result: { committed: string; preexistingCharacters?: number } | { pending: UpdateTxn } | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const EMPTY: ServerUpdateState = { preview: null, available: false, checking: false, applying: false, step: null, percent: 0, error: null, uiError: null, stateError: null, stateRevision: 0, result: null };
|
const EMPTY: ServerUpdateState = { preview: null, available: false, checking: false, applying: false, step: null, percent: 0, error: null, uiError: null, stateError: null, stateRevision: 0, result: null };
|
||||||
@@ -98,7 +98,7 @@ export async function applyServerUpdate(id: string, opts?: { choices: Record<str
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const out = await api.applyUpdate(id, opts?.choices ?? {}, opts?.source);
|
const out = await api.applyUpdate(id, opts?.choices ?? {}, opts?.source);
|
||||||
set(id, { result: out.txn.state === "committed" ? { committed: out.txn.to_version ?? "" } : { pending: out.txn } });
|
set(id, { result: out.txn.state === "committed" ? { committed: out.txn.to_version ?? "", ...(out.preexisting_character_count ? { preexistingCharacters: out.preexisting_character_count } : {}) } : { pending: out.txn } });
|
||||||
if (out.txn.state === "committed" && !wasRunning && !startAfterUpdate("server", id)) await api.stop(id).catch(() => undefined);
|
if (out.txn.state === "committed" && !wasRunning && !startAfterUpdate("server", id)) await api.stop(id).catch(() => undefined);
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
export function updateCheckQueue<T>() {
|
||||||
|
const requests = new Map<string, Promise<T>>();
|
||||||
|
const servers = new Map<string, Promise<unknown>>();
|
||||||
|
return (server: string, request: string, run: () => Promise<T>): Promise<T> => {
|
||||||
|
const key = JSON.stringify([server, request]);
|
||||||
|
const existing = requests.get(key);
|
||||||
|
if (existing) return existing;
|
||||||
|
const previous = servers.get(server) ?? Promise.resolve();
|
||||||
|
const result = previous.catch(() => undefined).then(run);
|
||||||
|
requests.set(key, result);
|
||||||
|
servers.set(server, result);
|
||||||
|
const clear = () => {
|
||||||
|
if (requests.get(key) === result) requests.delete(key);
|
||||||
|
if (servers.get(server) === result) servers.delete(server);
|
||||||
|
};
|
||||||
|
void result.then(clear, clear);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
}
|
||||||
+11
-33
@@ -1,12 +1,12 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { getVersion } from "@tauri-apps/api/app";
|
import { getVersion } from "@tauri-apps/api/app";
|
||||||
import { Loader2 } from "lucide-react";
|
import { Loader2, RefreshCw, Monitor } from "lucide-react";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Card } from "@/components/ui/card";
|
import { Card } from "@/components/ui/card";
|
||||||
import { useT } from "@/i18n";
|
import { useT } from "@/i18n";
|
||||||
import { autoUpdateEnabled, installNow, lookForUpdate, setAutoUpdate, useSelfUpdate } from "@/lib/selfUpdate";
|
import { autoUpdateEnabled, installNow, lookForUpdate, setAutoUpdate, useSelfUpdate } from "@/lib/selfUpdate";
|
||||||
|
|
||||||
export function AboutCard() {
|
export function AboutCard({ onHistory }: { onHistory?: () => void }) {
|
||||||
const t = useT();
|
const t = useT();
|
||||||
const s = useSelfUpdate();
|
const s = useSelfUpdate();
|
||||||
const [version, setVersion] = useState("");
|
const [version, setVersion] = useState("");
|
||||||
@@ -21,37 +21,12 @@ export function AboutCard() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="mt-6 p-6">
|
<Card className="mt-6 p-6">
|
||||||
<h2 className="font-semibold">{t("app.name")}</h2>
|
<div className="flex items-start justify-between gap-3">
|
||||||
<p className="mt-1 text-sm text-muted">{t("about.version", { v: version || "…" })}</p>
|
<div><h2 className="flex items-center gap-2 font-semibold"><Monitor className="h-4 w-4 text-gold" aria-hidden />{t("history.manager")}</h2><p className="mt-2 text-sm text-muted">{t("settings.version", { v: version || "…" })}</p></div>
|
||||||
|
<Button size="sm" disabled={busy} aria-label={t("about.check")} title={t("about.check")} onClick={() => { setAsked(true); void lookForUpdate({ download: false }); }}><RefreshCw className={`h-4 w-4 ${s.phase === "checking" ? "animate-spin" : ""}`} aria-hidden /></Button>
|
||||||
<label className="mt-3 flex cursor-pointer items-start gap-2 text-sm">
|
</div>
|
||||||
<input
|
<p className="mt-3 text-xs text-muted">{t("about.autoHint")}</p>
|
||||||
type="checkbox"
|
|
||||||
className="mt-1"
|
|
||||||
checked={auto}
|
|
||||||
onChange={(e) => {
|
|
||||||
setAuto(e.target.checked);
|
|
||||||
setAutoUpdate(e.target.checked);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<span>
|
|
||||||
{t("about.auto")}
|
|
||||||
<span className="block text-xs text-muted">{t("about.autoHint")}</span>
|
|
||||||
</span>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<div className="mt-4 flex flex-wrap items-center gap-3">
|
<div className="mt-4 flex flex-wrap items-center gap-3">
|
||||||
<Button
|
|
||||||
size="sm"
|
|
||||||
disabled={busy}
|
|
||||||
onClick={() => {
|
|
||||||
setAsked(true);
|
|
||||||
void lookForUpdate({ download: false });
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{s.phase === "checking" && <Loader2 className="h-4 w-4 animate-spin" aria-hidden />}
|
|
||||||
{t("about.check")}
|
|
||||||
</Button>
|
|
||||||
{s.version && s.phase !== "current" && (
|
{s.version && s.phase !== "current" && (
|
||||||
<Button size="sm" variant="primary" disabled={busy} onClick={() => void installNow()}>
|
<Button size="sm" variant="primary" disabled={busy} onClick={() => void installNow()}>
|
||||||
{(s.phase === "downloading" || s.phase === "installing") && <Loader2 className="h-4 w-4 animate-spin" aria-hidden />}
|
{(s.phase === "downloading" || s.phase === "installing") && <Loader2 className="h-4 w-4 animate-spin" aria-hidden />}
|
||||||
@@ -64,7 +39,7 @@ export function AboutCard() {
|
|||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{s.version && s.notes && s.phase !== "current" && <p className="mt-3 whitespace-pre-line text-sm text-muted">{s.notes}</p>}
|
{onHistory ? <button className="mt-3 cursor-pointer text-sm text-gold hover:underline" onClick={onHistory}>{t(s.version && s.phase !== "current" ? "history.open" : "history.title")}</button> : s.version && s.notes && s.phase !== "current" && <p className="mt-3 whitespace-pre-line text-sm text-muted">{s.notes}</p>}
|
||||||
{s.phase === "ready" && <p className="mt-3 text-sm text-ok" role="status">{t("selfupd.onClose")}</p>}
|
{s.phase === "ready" && <p className="mt-3 text-sm text-ok" role="status">{t("selfupd.onClose")}</p>}
|
||||||
{asked && s.phase === "current" && <p className="mt-3 text-sm text-ok" role="status">{t("about.upToDate")}</p>}
|
{asked && s.phase === "current" && <p className="mt-3 text-sm text-ok" role="status">{t("about.upToDate")}</p>}
|
||||||
{s.phase === "error" && (
|
{s.phase === "error" && (
|
||||||
@@ -73,6 +48,9 @@ export function AboutCard() {
|
|||||||
{s.error && <p className="selectable mt-1 break-all text-xs text-muted">{s.error}</p>}
|
{s.error && <p className="selectable mt-1 break-all text-xs text-muted">{s.error}</p>}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
<label className="mt-5 flex cursor-pointer items-center justify-between gap-3 border-t border-line pt-4 text-sm" title={t("about.auto")}>
|
||||||
|
<span>{t("settings.autoManager")}</span><input type="checkbox" role="switch" aria-description={t("about.auto")} checked={auto} onChange={e => { setAuto(e.target.checked); setAutoUpdate(e.target.checked); }} className="h-4 w-4 accent-[#c9a24a]" />
|
||||||
|
</label>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
+14
-26
@@ -15,6 +15,7 @@ import { PublishRealmDialog } from "@/screens/PublishDialog";
|
|||||||
import { useRegistryStatus } from "@/lib/registry";
|
import { useRegistryStatus } from "@/lib/registry";
|
||||||
import { usePublishRealms, type PublishRealm } from "@/lib/publishRealms";
|
import { usePublishRealms, type PublishRealm } from "@/lib/publishRealms";
|
||||||
import { useAutoRestart } from "@/lib/autoRestartPrefs";
|
import { useAutoRestart } from "@/lib/autoRestartPrefs";
|
||||||
|
import { SplitButton } from "@/components/ui/split-button";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Card } from "@/components/ui/card";
|
import { Card } from "@/components/ui/card";
|
||||||
|
|
||||||
@@ -410,32 +411,21 @@ export function Overview({ server, companions = true, onForget, onOpenUpdates, o
|
|||||||
|
|
||||||
<div className="mt-7 flex flex-wrap items-center gap-x-4 gap-y-3">
|
<div className="mt-7 flex flex-wrap items-center gap-x-4 gap-y-3">
|
||||||
{running ? (
|
{running ? (
|
||||||
<Button variant="secondary" size="xl" disabled={transitioning} onClick={() => run("stopping")} className="min-w-56">
|
<Button variant="secondary" size="xl" disabled={transitioning} onClick={() => run("stopping")} className="min-w-40">
|
||||||
{transitioning && <Loader2 className="h-5 w-5 animate-spin" aria-hidden />}
|
{transitioning && <Loader2 className="h-5 w-5 animate-spin" aria-hidden />}
|
||||||
{t("btn.stop")}
|
{t("btn.stop")}
|
||||||
</Button>
|
</Button>
|
||||||
) : upd.available ? (
|
) : upd.available ? (
|
||||||
<Button
|
<SplitButton label={t("overview.server")}
|
||||||
variant="primary"
|
primary={{ disabled: transitioning || upd.applying, onClick: () => (needsDecision ? onOpenUpdates() : void runServerUpdate()), children: <>{upd.applying && <Loader2 className="h-4 w-4 animate-spin" aria-hidden />}{upd.applying ? t("btn.updating") : needsDecision ? t("overview.openUpdates") : t("btn.update")}</> }}
|
||||||
size="xl"
|
secondary={{ disabled: transitioning || upd.applying, onClick: () => run("starting"), children: t("btn.startWithoutUpdate") }}
|
||||||
disabled={transitioning || upd.applying}
|
/>
|
||||||
onClick={() => (needsDecision ? onOpenUpdates() : void runServerUpdate())}
|
|
||||||
className="min-w-56"
|
|
||||||
>
|
|
||||||
{upd.applying && <Loader2 className="h-5 w-5 animate-spin" aria-hidden />}
|
|
||||||
{upd.applying ? t("btn.updating") : needsDecision ? t("overview.openUpdates") : t("btn.update")}
|
|
||||||
</Button>
|
|
||||||
) : (
|
) : (
|
||||||
<Button variant="primary" size="xl" disabled={transitioning} onClick={() => run("starting")} className="min-w-56">
|
<Button variant="primary" size="xl" disabled={transitioning} onClick={() => run("starting")} className="min-w-40">
|
||||||
{transitioning && <Loader2 className="h-5 w-5 animate-spin" aria-hidden />}
|
{transitioning && <Loader2 className="h-5 w-5 animate-spin" aria-hidden />}
|
||||||
{transitioning ? (action === "stopping" ? t("btn.stoppingCaps") : t("btn.startingCaps")) : t("btn.start")}
|
{transitioning ? (action === "stopping" ? t("btn.stoppingCaps") : t("btn.startingCaps")) : t("btn.start")}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{!running && upd.available && (
|
|
||||||
<Button variant="secondary" size="sm" disabled={transitioning || upd.applying} onClick={() => run("starting")}>
|
|
||||||
{t("btn.startWithoutUpdate")}
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
{running && (
|
{running && (
|
||||||
<Button variant="ghost" size="sm" disabled={transitioning || upd.applying} onClick={() => run("restarting")}>
|
<Button variant="ghost" size="sm" disabled={transitioning || upd.applying} onClick={() => run("restarting")}>
|
||||||
{t("btn.restart")}
|
{t("btn.restart")}
|
||||||
@@ -456,7 +446,7 @@ export function Overview({ server, companions = true, onForget, onOpenUpdates, o
|
|||||||
{client && <RealmlistMenu serverId={server.id} />}
|
{client && <RealmlistMenu serverId={server.id} />}
|
||||||
{client && jobBusy ? (
|
{client && jobBusy ? (
|
||||||
<div
|
<div
|
||||||
className="relative flex h-16 min-w-64 items-center overflow-hidden rounded-md border border-gold/50 bg-card-2"
|
className="relative flex h-12 min-w-64 items-center overflow-hidden rounded-md border border-gold/50 bg-card-2"
|
||||||
role="progressbar"
|
role="progressbar"
|
||||||
aria-valuenow={jobPct}
|
aria-valuenow={jobPct}
|
||||||
aria-valuemin={0}
|
aria-valuemin={0}
|
||||||
@@ -482,9 +472,10 @@ export function Overview({ server, companions = true, onForget, onOpenUpdates, o
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
) : client && (clientStatus?.update_available || job.phase === "choose") ? (
|
) : client && (clientStatus?.update_available || job.phase === "choose") ? (
|
||||||
<Button variant="primary" size="xl" disabled={playing || job.phase === "choose"} onClick={() => void startClientUpdate(server.id)} className="min-w-40">
|
<SplitButton label={t("btn.play")}
|
||||||
{t("btn.updateClient")}
|
primary={{ disabled: playing || job.phase === "choose", onClick: () => void startClientUpdate(server.id), children: t("btn.updateClient") }}
|
||||||
</Button>
|
secondary={{ disabled: realmBusy || playing || upd.applying, onClick: () => void play(), children: <>{playing && <Loader2 className="h-4 w-4 animate-spin" aria-hidden />}{t("btn.playWithoutUpdate")}</> }}
|
||||||
|
/>
|
||||||
) : client ? (
|
) : client ? (
|
||||||
<Button variant="primary" size="xl" disabled={realmBusy || playing} onClick={() => void play()} className="min-w-40">
|
<Button variant="primary" size="xl" disabled={realmBusy || playing} onClick={() => void play()} className="min-w-40">
|
||||||
{playing && <Loader2 className="h-5 w-5 animate-spin" aria-hidden />}
|
{playing && <Loader2 className="h-5 w-5 animate-spin" aria-hidden />}
|
||||||
@@ -495,11 +486,6 @@ export function Overview({ server, companions = true, onForget, onOpenUpdates, o
|
|||||||
{t("btn.setupClient")}
|
{t("btn.setupClient")}
|
||||||
</Button>
|
</Button>
|
||||||
) : null}
|
) : null}
|
||||||
{client && !jobBusy && (clientStatus?.update_available || job.phase === "choose") && (
|
|
||||||
<Button variant="secondary" size="sm" disabled={realmBusy || playing || upd.applying} onClick={() => void play()}>
|
|
||||||
{t("btn.playWithoutUpdate")}
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-6 flex flex-wrap items-center justify-between gap-3 border-t border-line/60 pt-4 text-xs text-muted">
|
<div className="mt-6 flex flex-wrap items-center justify-between gap-3 border-t border-line/60 pt-4 text-xs text-muted">
|
||||||
@@ -554,10 +540,12 @@ export function Overview({ server, companions = true, onForget, onOpenUpdates, o
|
|||||||
<Button size="sm" variant="ghost" onClick={() => void startClientUpdate(server.id)}>{t("client.dl.retry")}</Button>
|
<Button size="sm" variant="ghost" onClick={() => void startClientUpdate(server.id)}>{t("client.dl.retry")}</Button>
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
{upd.result && "committed" in upd.result && !!upd.result.preexistingCharacters && <p className="mt-3 text-sm text-warn" role="status">{t("upd.preexistingCharacters", { n: upd.result.preexistingCharacters })}</p>}
|
||||||
{upd.available && upd.preview && (
|
{upd.available && upd.preview && (
|
||||||
<div className="mt-4 rounded-md border border-gold/40 bg-gold/5 p-3 text-sm">
|
<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>
|
<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>}
|
{upd.preview.latest_version && <p>{t("upd.intermediate", { to: upd.preview.to_version, latest: upd.preview.latest_version })}</p>}
|
||||||
|
<button className="mt-2 cursor-pointer text-gold hover:underline" onClick={onOpenUpdates}>{t("history.open")}</button>
|
||||||
{needsDecision && <p className="mt-1 text-muted">{t("overview.updateConflicts")}</p>}
|
{needsDecision && <p className="mt-1 text-muted">{t("overview.updateConflicts")}</p>}
|
||||||
{upd.applying && (
|
{upd.applying && (
|
||||||
<div className="mt-2">
|
<div className="mt-2">
|
||||||
|
|||||||
@@ -2,10 +2,11 @@ import { useState } from "react";
|
|||||||
import { Globe, Network } from "lucide-react";
|
import { Globe, Network } from "lucide-react";
|
||||||
import { useT } from "@/i18n";
|
import { useT } from "@/i18n";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
import { PublishCard } from "./PublishCard";
|
||||||
import { BrowsePage } from "@/screens/BrowsePage";
|
import { BrowsePage } from "@/screens/BrowsePage";
|
||||||
import { FriendsPage } from "@/screens/FriendsPage";
|
import { FriendsPage } from "@/screens/FriendsPage";
|
||||||
|
|
||||||
export function PlayWithFriends({ serverId }: { serverId: string; path?: string }) {
|
export function PlayWithFriends({ serverId, serverName = "" }: { serverId: string; serverName?: string; path?: string }) {
|
||||||
const t = useT();
|
const t = useT();
|
||||||
const [tab, setTab] = useState<"servers" | "lan">("servers");
|
const [tab, setTab] = useState<"servers" | "lan">("servers");
|
||||||
|
|
||||||
@@ -38,7 +39,7 @@ export function PlayWithFriends({ serverId }: { serverId: string; path?: string
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{tab === "servers" && <BrowsePage />}
|
{tab === "servers" && <><PublishCard serverId={serverId} serverName={serverName} /><BrowsePage /></>}
|
||||||
{tab === "lan" && <FriendsPage serverId={serverId} />}
|
{tab === "lan" && <FriendsPage serverId={serverId} />}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export function RealmStartupSettings({ serverId }: { serverId: string }) {
|
|||||||
{view?.with_reborn && <p className="mt-1 text-sm text-muted">{t("realm.rebornPort", { port: view.reborn_world_port ?? "—" })}</p>}
|
{view?.with_reborn && <p className="mt-1 text-sm text-muted">{t("realm.rebornPort", { port: view.reborn_world_port ?? "—" })}</p>}
|
||||||
{view && view.active !== "coa" && !view.with_reborn && <p className="mt-1 text-sm text-warn">{t("realm.rebornNeedsCoa")}</p>}
|
{view && view.active !== "coa" && !view.with_reborn && <p className="mt-1 text-sm text-warn">{t("realm.rebornNeedsCoa")}</p>}
|
||||||
{view?.simultaneous && view.with_reborn && <p className="mt-3 text-sm">{t("realm.allThree")}</p>}
|
{view?.simultaneous && view.with_reborn && <p className="mt-3 text-sm">{t("realm.allThree")}</p>}
|
||||||
<p className="mt-3 text-sm text-muted">{t("realm.simultaneousHint")}</p>
|
<details className="mt-4 text-sm text-muted"><summary className="cursor-pointer">{t("settings.startupHelp")}</summary><p className="mt-2 leading-relaxed">{t("realm.simultaneousHint")}</p></details>
|
||||||
{busy && <p className="mt-2 text-sm" role="status">{t("realm.preparing")}</p>}
|
{busy && <p className="mt-2 text-sm" role="status">{t("realm.preparing")}</p>}
|
||||||
{error && <p className="mt-3 text-sm text-bad" role="alert">{error}</p>}
|
{error && <p className="mt-3 text-sm text-bad" role="alert">{error}</p>}
|
||||||
</Card>;
|
</Card>;
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ export function RealmlistMenu({ serverId, className }: { serverId: string; class
|
|||||||
onClick={() => setOpen((v) => !v)}
|
onClick={() => setOpen((v) => !v)}
|
||||||
aria-haspopup="menu"
|
aria-haspopup="menu"
|
||||||
aria-expanded={open}
|
aria-expanded={open}
|
||||||
className="flex h-16 cursor-pointer items-center gap-3 rounded-md border border-line bg-card-2 px-4 text-left transition-colors hover:border-gold/50"
|
className="flex h-12 cursor-pointer items-center gap-3 rounded-md border border-line bg-card-2 px-4 text-left transition-colors hover:border-gold/50"
|
||||||
>
|
>
|
||||||
<span>
|
<span>
|
||||||
<span className="block text-[11px] uppercase tracking-wide text-muted">{t("realm.label")}</span>
|
<span className="block text-[11px] uppercase tracking-wide text-muted">{t("realm.label")}</span>
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
import { useEffect, useRef, useState } from "react";
|
||||||
|
import { invoke } from "@tauri-apps/api/core";
|
||||||
|
import { getVersion } from "@tauri-apps/api/app";
|
||||||
|
import { useI18n, LOCALES, type Locale } from "@/i18n";
|
||||||
|
import { useSelfUpdate } from "@/lib/selfUpdate";
|
||||||
|
import { bundledHistories, compareVersions, releasesForUpdate, repositories, translatedNotes, type Component, type History } from "@/lib/releaseHistory";
|
||||||
|
import { api } from "@/lib/api";
|
||||||
|
import { Card } from "@/components/ui/card";
|
||||||
|
|
||||||
|
export interface HistorySelection { component: Component; from?: string; to?: string }
|
||||||
|
export function ReleaseHistory({ selection, onSelect }: { selection: HistorySelection; onSelect: (selection: HistorySelection) => void }) {
|
||||||
|
const { locale, t } = useI18n();
|
||||||
|
const [language, setLanguage] = useState<Locale>(locale);
|
||||||
|
const [feeds, setFeeds] = useState(bundledHistories);
|
||||||
|
const [fresh, setFresh] = useState<Partial<Record<Component, boolean>>>({});
|
||||||
|
const [mode, setMode] = useState<"all" | "range">("all");
|
||||||
|
const [selected, setSelected] = useState("");
|
||||||
|
const [installed, setInstalled] = useState<string>();
|
||||||
|
const updater = useSelfUpdate();
|
||||||
|
const { component } = selection;
|
||||||
|
const lastServer = useRef<HistorySelection>({ component: "server" });
|
||||||
|
const [linkError, setLinkError] = useState<string>();
|
||||||
|
useEffect(() => { if (component === "server") lastServer.current = selection; setLinkError(undefined); }, [selection, component]);
|
||||||
|
const target = component === "manager" ? updater.version : selection.to;
|
||||||
|
const from = component === "manager" ? installed : selection.from;
|
||||||
|
useEffect(() => setLanguage(locale), [locale]);
|
||||||
|
useEffect(() => { void getVersion().then(setInstalled).catch(() => {}); }, []);
|
||||||
|
useEffect(() => {
|
||||||
|
setSelected("");
|
||||||
|
setMode(selection.to || (component === "manager" && updater.version) ? "range" : "all");
|
||||||
|
}, [selection, component, updater.version]);
|
||||||
|
useEffect(() => {
|
||||||
|
let live = true;
|
||||||
|
void invoke<History>("release_history", { component }).then(feed => {
|
||||||
|
if (live && feed.component === component && Array.isArray(feed.releases)) {
|
||||||
|
setFeeds(previous => ({ ...previous, [component]: feed }));
|
||||||
|
setFresh(previous => ({ ...previous, [component]: feed.source === "remote" }));
|
||||||
|
}
|
||||||
|
}).catch(() => {}); // Bundled reviewed notes remain visible offline.
|
||||||
|
return () => { live = false; };
|
||||||
|
}, [component]);
|
||||||
|
const releases = [...(mode === "range" ? releasesForUpdate(feeds[component].releases, from, target) : feeds[component].releases)]
|
||||||
|
.sort((a, b) => compareVersions(b.version.split("-")[0], a.version.split("-")[0]) || b.date.localeCompare(a.date));
|
||||||
|
const record = releases.find(r => r.version === selected) ?? releases[0];
|
||||||
|
const notes = record ? translatedNotes(component, record, language) : undefined;
|
||||||
|
return <Card id="release-history" tabIndex={-1} className="mt-6 scroll-mt-4 overflow-hidden">
|
||||||
|
<div className="flex flex-wrap items-center justify-between gap-4 border-b border-line p-5">
|
||||||
|
<h2 className="font-semibold">{t("history.title")}</h2>
|
||||||
|
<div className="flex rounded-md border border-line p-1" aria-label={t("history.title")}>
|
||||||
|
{(["server", "manager"] as const).map(c => <button key={c} aria-pressed={component === c} onClick={() => onSelect(c === "server" ? lastServer.current : { component: c })} className={`cursor-pointer rounded px-3 py-1.5 text-sm ${component === c ? "bg-gold/10 text-gold" : "text-muted hover:text-ink"}`}>{t(`history.${c}`)}</button>)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-wrap items-center justify-between gap-3 border-b border-line px-5 py-3 text-sm">
|
||||||
|
<div className="flex gap-3">
|
||||||
|
<button className={mode === "all" ? "text-gold" : "cursor-pointer text-muted"} aria-pressed={mode === "all"} onClick={() => setMode("all")}>{t("history.all")}</button>
|
||||||
|
{target && <button className={mode === "range" ? "text-gold" : "cursor-pointer text-muted"} aria-pressed={mode === "range"} onClick={() => setMode("range")}>{t("history.range")}{from ? ` · ${from} → ${target}` : ` · ${target}`}</button>}
|
||||||
|
</div>
|
||||||
|
<label className="flex items-center gap-2 text-muted">{t("history.language")}<select value={language} onChange={e => setLanguage(e.target.value as Locale)} className="rounded border border-line bg-panel px-2 py-1 text-ink">{LOCALES.map(l => <option key={l.id} value={l.id}>{l.name}</option>)}</select></label>
|
||||||
|
</div>
|
||||||
|
<div className="grid min-h-64 md:grid-cols-[180px_1fr]">
|
||||||
|
<div className="flex max-h-96 gap-1 overflow-auto border-b border-line p-3 md:block md:border-r md:border-b-0" aria-label={t("history.all")}>
|
||||||
|
{releases.map(r => <button key={r.tag} aria-pressed={r.version === record?.version} onClick={() => setSelected(r.version)} className={`mb-1 block shrink-0 cursor-pointer rounded-md px-3 py-2 text-left text-sm md:w-full ${r.version === record?.version ? "bg-gold/10 text-gold" : "text-muted hover:bg-white/5"}`}><span className="block font-medium">{r.version}</span><span className="text-xs text-muted">{r.date}{r.prerelease ? " · Pre-release" : ""}</span></button>)}
|
||||||
|
</div>
|
||||||
|
<div className="min-w-0 p-5" aria-live="polite">
|
||||||
|
{record && notes ? <><h3 className="text-lg font-semibold">{t(`history.${component}`)} {record.version}</h3>
|
||||||
|
{notes.fallback && <p className="mt-2 text-xs text-warn">{t("history.fallback")}</p>}
|
||||||
|
<ul lang={notes.fallback ? "en" : language} className="mt-4 list-disc space-y-2 pl-5 text-sm leading-relaxed">{notes.notes.map((note, i) => <li key={i}>{note}</li>)}</ul>
|
||||||
|
{record.experimentalFeatures?.includes("portable-characters") && <p className="mt-4 rounded border border-warn/30 p-3 text-sm text-warn">{t("history.experimental")}</p>}
|
||||||
|
<a className="mt-5 inline-block text-sm text-gold hover:underline" href={`https://github.com/${repositories[component]}/releases/tag/${encodeURIComponent(record.tag)}`} onClick={e => { e.preventDefault(); void api.openLink(e.currentTarget.href).catch(error => setLinkError(String(error))); }}>GitHub ↗</a>
|
||||||
|
{linkError && <p className="mt-2 break-words text-xs text-bad" role="alert">{linkError}</p>}
|
||||||
|
</> : <p className="text-sm text-muted">{t("history.empty")}</p>}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p className="border-t border-line px-5 py-3 text-xs text-muted">{fresh[component] ? t("history.refreshed") : t("history.offline")}</p>
|
||||||
|
</Card>;
|
||||||
|
}
|
||||||
@@ -0,0 +1,256 @@
|
|||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { open } from "@tauri-apps/plugin-dialog";
|
||||||
|
import { ChevronDown, ChevronRight, Loader2, RefreshCw, Server } from "lucide-react";
|
||||||
|
import { applyServerUpdate, clearServerUpdateResult, refreshServerUpdateState, useServerUpdate } from "@/lib/serverUpdate";
|
||||||
|
import { isUpdateCurrent } from "@/lib/serverUpdateStatus";
|
||||||
|
import { api, asUiError, type UiError, type UpdatePreview, type UpdateTxn } from "@/lib/api";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { Card } from "@/components/ui/card";
|
||||||
|
import { useStartAfterUpdate } from "@/lib/updatePrefs";
|
||||||
|
import { hasKey, useHuman, useI18n, type Key } from "@/i18n";
|
||||||
|
|
||||||
|
function mb(bytes: number) {
|
||||||
|
return bytes >= 1 << 20 ? `${(bytes / (1 << 20)).toFixed(1)} MB` : `${Math.max(1, Math.round(bytes / 1024))} KB`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ServerUpdateCard({ serverId, onHistory, onAttention }: { serverId: string; onHistory: (from?: string | null, to?: string) => void; onAttention: (value: boolean) => void }) {
|
||||||
|
const { t } = useI18n();
|
||||||
|
const upd = useServerUpdate(serverId);
|
||||||
|
const human = useHuman();
|
||||||
|
const [preview, setPreview] = useState<UpdatePreview | null>(upd.preview);
|
||||||
|
const [pending, setPending] = useState<UpdateTxn | null>(null);
|
||||||
|
const [pendingChecked, setPendingChecked] = useState(false);
|
||||||
|
const [pendingStateError, setPendingStateError] = useState<UiError | null>(null);
|
||||||
|
const [localBusy, setBusy] = useState<"check" | "rollback" | "retry" | null>(null);
|
||||||
|
// an update keeps running in the background when this tab is left, so its state is the shared one
|
||||||
|
const busy = upd.applying ? "update" : localBusy;
|
||||||
|
const progress = upd.applying ? { step: upd.step ?? "Starting", percent: upd.percent } : null;
|
||||||
|
const [localError, setError] = useState<UiError | null>(null);
|
||||||
|
const error = pendingStateError ?? localError ?? upd.uiError;
|
||||||
|
const [localDone, setDone] = useState<string | null>(null);
|
||||||
|
const done = upd.result && "committed" in upd.result ? t("upd.updatedTo", { v: upd.result.committed }) : localDone;
|
||||||
|
const [choices, setChoices] = useState<Record<string, "keep" | "replace">>(() => Object.fromEntries((upd.preview?.conflicts ?? []).map(c => [c, "keep" as const])));
|
||||||
|
const [advanced, setAdvanced] = useState(false);
|
||||||
|
const [source, setSource] = useState("");
|
||||||
|
const [startAfter, setStartAfter] = useStartAfterUpdate("server", serverId);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let active = true;
|
||||||
|
setPendingChecked(false);
|
||||||
|
setPending(null);
|
||||||
|
setPendingStateError(null);
|
||||||
|
void api.pendingUpdate(serverId).then((txn) => {
|
||||||
|
if (active) { setPending(txn); setPendingChecked(true); }
|
||||||
|
}).catch((e) => { if (active) setPendingStateError(asUiError(e)); });
|
||||||
|
return () => { active = false; };
|
||||||
|
}, [serverId]);
|
||||||
|
|
||||||
|
// Every finished attempt refreshes the disk state, including failures in the background.
|
||||||
|
useEffect(() => {
|
||||||
|
if (!upd.stateRevision) return;
|
||||||
|
setPreview(null);
|
||||||
|
setPendingChecked(!upd.stateError);
|
||||||
|
setPendingStateError(upd.stateError);
|
||||||
|
if (!upd.stateError) setPending(upd.result && "pending" in upd.result ? upd.result.pending : null);
|
||||||
|
}, [upd.stateRevision, serverId]);
|
||||||
|
|
||||||
|
useEffect(() => { onAttention(!!pending || !!pendingStateError); }, [pending, pendingStateError, onAttention]);
|
||||||
|
|
||||||
|
async function refreshPending() {
|
||||||
|
setPendingChecked(false);
|
||||||
|
try {
|
||||||
|
const txn = await refreshServerUpdateState(serverId);
|
||||||
|
setPending(txn);
|
||||||
|
setPendingStateError(null);
|
||||||
|
setPendingChecked(true);
|
||||||
|
return txn;
|
||||||
|
} catch (e) { setPendingStateError(asUiError(e)); throw e; }
|
||||||
|
}
|
||||||
|
|
||||||
|
async function check() {
|
||||||
|
setBusy("check");
|
||||||
|
setError(null);
|
||||||
|
setDone(null);
|
||||||
|
clearServerUpdateResult(serverId);
|
||||||
|
setPreview(null);
|
||||||
|
try {
|
||||||
|
const txn = await refreshPending();
|
||||||
|
if (txn) return;
|
||||||
|
const p = await api.checkUpdate(serverId, source.trim() || undefined);
|
||||||
|
setPreview(p);
|
||||||
|
setChoices(Object.fromEntries(p.conflicts.map((c) => [c, "keep" as const])));
|
||||||
|
} catch (e) {
|
||||||
|
setError(asUiError(e));
|
||||||
|
} finally {
|
||||||
|
setBusy(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function update() {
|
||||||
|
if (!pendingChecked || pendingStateError || pending) return;
|
||||||
|
setError(null);
|
||||||
|
setDone(null);
|
||||||
|
await applyServerUpdate(serverId, { choices, source: source.trim() || undefined });
|
||||||
|
}
|
||||||
|
|
||||||
|
async function rollback(txn: UpdateTxn) {
|
||||||
|
if (!window.confirm(t("upd.confirmBack"))) return;
|
||||||
|
setBusy("rollback");
|
||||||
|
setError(null);
|
||||||
|
try {
|
||||||
|
await api.rollbackUpdate(serverId, txn.id);
|
||||||
|
setPending(null);
|
||||||
|
setDone(t("upd.wentBack"));
|
||||||
|
} catch (e) {
|
||||||
|
setError(asUiError(e));
|
||||||
|
} finally {
|
||||||
|
try { await refreshPending(); } catch { /* Keep the disk-state error visible. */ }
|
||||||
|
setBusy(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function retryValidation(txn: UpdateTxn) {
|
||||||
|
setBusy("retry");
|
||||||
|
setError(null);
|
||||||
|
try {
|
||||||
|
const result = await api.retryUpdateValidation(serverId, txn.id);
|
||||||
|
if (result.state === "committed") {
|
||||||
|
setPending(null);
|
||||||
|
setPreview(null);
|
||||||
|
setDone(t("upd.updatedTo", { v: result.to_version }));
|
||||||
|
clearServerUpdateResult(serverId);
|
||||||
|
} else setPending(result);
|
||||||
|
} catch (e) { setError(asUiError(e)); }
|
||||||
|
finally {
|
||||||
|
try { await refreshPending(); } catch { /* Keep the disk-state error visible. */ }
|
||||||
|
setBusy(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function browse() {
|
||||||
|
const p = await open({ directory: true, multiple: false, title: t("upd.dialogTitle") });
|
||||||
|
if (typeof p === "string") setSource(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{pending && (
|
||||||
|
<Card className="mt-6 border-warn/40 p-5" role="alert">
|
||||||
|
<p className="font-medium text-warn">
|
||||||
|
{pending.state === "needs-decision" ? t("upd.pendingBad") : t("upd.pendingUnfinished")}
|
||||||
|
</p>
|
||||||
|
<p className="mt-1 whitespace-pre-wrap text-sm text-muted">{pending.message ?? t("upd.safeBack")}</p>
|
||||||
|
{pending.state === "needs-decision" && (
|
||||||
|
<Button className="mt-3 mr-3" size="sm" disabled={!!busy} onClick={() => void retryValidation(pending)}>
|
||||||
|
{busy === "retry" && <Loader2 className="h-4 w-4 animate-spin" aria-hidden />}
|
||||||
|
{t("upd.retryValidation")}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
<p className="mt-1 text-sm text-muted">{t("upd.backNote")}</p>
|
||||||
|
<Button className="mt-3" size="sm" disabled={!!busy} onClick={() => void rollback(pending)}>
|
||||||
|
{busy === "rollback" && <Loader2 className="h-4 w-4 animate-spin" aria-hidden />}
|
||||||
|
{pending.from_version ? t("upd.goBackTo", { v: pending.from_version }) : t("upd.goBackBefore")}
|
||||||
|
</Button>
|
||||||
|
</Card>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<Card className="mt-6 p-6">
|
||||||
|
<div className="flex items-start justify-between gap-3">
|
||||||
|
<div><h2 className="flex items-center gap-2 font-semibold"><Server className="h-4 w-4 text-gold" aria-hidden />{t("history.server")}</h2>
|
||||||
|
<p className="mt-2 text-sm text-muted">{preview?.from_version ? t("settings.version", { v: preview.from_version }) : "…"}</p></div>
|
||||||
|
<Button size="sm" disabled={!!busy} onClick={() => void check()} aria-label={t("upd.check")} title={t("upd.check")}><RefreshCw className={`h-4 w-4 ${busy === "check" ? "animate-spin" : ""}`} aria-hidden /></Button>
|
||||||
|
</div>
|
||||||
|
<button className="mt-3 cursor-pointer text-sm text-gold hover:underline" onClick={() => onHistory(preview?.from_version, preview && !isUpdateCurrent(preview) ? preview.to_version : undefined)}>{t(preview && !isUpdateCurrent(preview) ? "history.open" : "history.title")}</button>
|
||||||
|
<div className="mt-3"><button onClick={() => setAdvanced((v) => !v)} aria-expanded={advanced} className="flex cursor-pointer items-center gap-1 text-xs text-muted hover:text-ink">
|
||||||
|
{advanced ? <ChevronDown className="h-3 w-3" aria-hidden /> : <ChevronRight className="h-3 w-3" aria-hidden />}{t("install.advanced")}
|
||||||
|
</button></div>
|
||||||
|
{advanced && (
|
||||||
|
<div className="mt-3 flex gap-2">
|
||||||
|
<input aria-label={t("upd.folderLabel")} value={source} onChange={(e) => setSource(e.target.value)} placeholder={t("upd.folderHint")} className="selectable flex-1 rounded-md border border-line bg-bg px-3 py-2 text-sm outline-none focus:border-gold" />
|
||||||
|
<Button size="sm" onClick={browse}>{t("install.browse")}</Button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{done && pendingChecked && !pendingStateError && <p className="mt-4 text-sm text-ok" role="status">{done}</p>}
|
||||||
|
{error && (
|
||||||
|
<div className="mt-4" role="alert">
|
||||||
|
<p className="selectable whitespace-pre-wrap break-words text-sm text-bad">
|
||||||
|
{error.human.code === "unknown" ? error.technical : human(error.human).message}
|
||||||
|
</p>
|
||||||
|
<button className="mt-1 cursor-pointer text-xs text-muted underline" onClick={() => void navigator.clipboard.writeText(error.technical)}>
|
||||||
|
{t("common.copyError")}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{preview?.database_check_error && (
|
||||||
|
<p className="selectable mt-4 break-words text-sm text-warn" role="status">{t("upd.dbUnchecked", { why: preview.database_check_error })}</p>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{preview && isUpdateCurrent(preview) && (
|
||||||
|
<div className="mt-5 border-t border-line pt-4">
|
||||||
|
<p className="font-medium text-ok" role="status">{t("upd.current", { v: preview.to_version })}</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{preview && !isUpdateCurrent(preview) && (
|
||||||
|
<div className="mt-5 border-t border-line pt-4">
|
||||||
|
<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 })
|
||||||
|
: t("upd.summary", { size: mb(preview.download_bytes), files: preview.items.filter((i) => i.action !== "skip").length })}
|
||||||
|
</p>
|
||||||
|
<details className="mt-3" open={preview.items.some(i => i.action === "conflict")}><summary className="cursor-pointer text-sm text-muted">{t("history.files")}</summary><ul className="mt-3 max-h-56 divide-y divide-line overflow-auto text-sm">
|
||||||
|
{preview.items.filter((i) => i.action !== "skip").map((i) => (
|
||||||
|
<li key={i.path} className="py-2">
|
||||||
|
<div className="flex justify-between gap-3">
|
||||||
|
<span className="selectable break-all">{i.path}</span>
|
||||||
|
<span className={i.action === "conflict" ? "shrink-0 text-warn" : "shrink-0 text-muted"}>{t(`upd.act.${i.action}` as Key)}</span>
|
||||||
|
</div>
|
||||||
|
{i.action === "conflict" && (
|
||||||
|
<fieldset className="mt-2 flex flex-wrap gap-4 text-xs text-muted">
|
||||||
|
<legend className="sr-only">{t("upd.conflict")}</legend>
|
||||||
|
<span className="text-warn">{t("upd.conflict")}</span>
|
||||||
|
{(["keep", "replace"] as const).map((c) => (
|
||||||
|
<label key={c} className="flex cursor-pointer items-center gap-1">
|
||||||
|
<input type="radio" name={i.path} checked={choices[i.path] === c} onChange={() => setChoices((x) => ({ ...x, [i.path]: c }))} />
|
||||||
|
{c === "keep" ? t("upd.keep") : t("upd.replace")}
|
||||||
|
</label>
|
||||||
|
))}
|
||||||
|
</fieldset>
|
||||||
|
)}
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul></details>
|
||||||
|
<Button className="mt-4" variant="primary" disabled={!!busy || !pendingChecked || !!pendingStateError || !!pending} onClick={() => void update()}>
|
||||||
|
{busy === "update" && <Loader2 className="h-4 w-4 animate-spin" aria-hidden />}
|
||||||
|
{t("upd.now")}
|
||||||
|
</Button>
|
||||||
|
<p className="mt-2 text-xs text-muted">{t("upd.stopNote")}</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{busy === "update" && progress && (
|
||||||
|
<div className="mt-5">
|
||||||
|
<div className="flex justify-between text-sm">
|
||||||
|
<span role="status">{hasKey(`ustep.${progress.step}`) ? t(`ustep.${progress.step}` as Key) : progress.step}</span>
|
||||||
|
<span className="text-muted">{progress.percent}%</span>
|
||||||
|
</div>
|
||||||
|
<div className="mt-2 h-2 overflow-hidden rounded-full bg-white/10" role="progressbar" aria-valuenow={progress.percent} aria-valuemin={0} aria-valuemax={100}>
|
||||||
|
<div className="h-full rounded-full bg-gold transition-[width] duration-300" style={{ width: `${progress.percent}%` }} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<label className="mt-5 flex cursor-pointer items-center justify-between gap-3 border-t border-line pt-4 text-sm" title={t("upd.startAfter")}>
|
||||||
|
<span>{t("settings.startServer")}</span><input type="checkbox" role="switch" checked={startAfter} onChange={(e) => setStartAfter(e.target.checked)} className="h-4 w-4 accent-[#c9a24a]" />
|
||||||
|
</label>
|
||||||
|
</Card>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
+49
-285
@@ -1,291 +1,55 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useState } from "react";
|
||||||
import { open } from "@tauri-apps/plugin-dialog";
|
import { Download, Power, FolderOpen, Wrench, Languages } from "lucide-react";
|
||||||
import { ChevronDown, ChevronRight, Loader2 } from "lucide-react";
|
import { useI18n } from "@/i18n";
|
||||||
import { applyServerUpdate, clearServerUpdateResult, refreshServerUpdateState, useServerUpdate } from "@/lib/serverUpdate";
|
|
||||||
import { isUpdateCurrent } from "@/lib/serverUpdateStatus";
|
|
||||||
import { api, asUiError, type UiError, type UpdatePreview, type UpdateTxn } from "@/lib/api";
|
|
||||||
import { Button } from "@/components/ui/button";
|
|
||||||
import { Card } from "@/components/ui/card";
|
|
||||||
import { ClientCard } from "@/screens/ClientCard";
|
|
||||||
import { GameDataCard } from "@/screens/GameDataCard";
|
|
||||||
import { DiagnosticsCard } from "@/screens/DiagnosticsCard";
|
|
||||||
import { AboutCard } from "@/screens/AboutCard";
|
|
||||||
import { RemoveServerCard } from "@/screens/RemoveServerCard";
|
|
||||||
import { useStartAfterUpdate } from "@/lib/updatePrefs";
|
|
||||||
import { hasKey, useHuman, useI18n, type Key } from "@/i18n";
|
|
||||||
import { LanguagePicker } from "@/components/LanguagePicker";
|
import { LanguagePicker } from "@/components/LanguagePicker";
|
||||||
import { RealmStartupSettings } from "@/screens/RealmStartupSettings";
|
import { Card } from "@/components/ui/card";
|
||||||
import { RepairCard } from "@/screens/RepairCard";
|
import { useServerUpdate } from "@/lib/serverUpdate";
|
||||||
import { PublishCard } from "@/screens/PublishCard";
|
import { ServerUpdateCard } from "./ServerUpdateCard";
|
||||||
import { AutoRestartSettings } from "@/screens/AutoRestartSettings";
|
import { AboutCard } from "./AboutCard";
|
||||||
|
import { ReleaseHistory, type HistorySelection } from "./ReleaseHistory";
|
||||||
|
import { ClientCard } from "./ClientCard";
|
||||||
|
import { GameDataCard } from "./GameDataCard";
|
||||||
|
import { RealmStartupSettings } from "./RealmStartupSettings";
|
||||||
|
import { AutoRestartSettings } from "./AutoRestartSettings";
|
||||||
|
import { DiagnosticsCard } from "./DiagnosticsCard";
|
||||||
|
import { RepairCard } from "./RepairCard";
|
||||||
|
import { RemoveServerCard } from "./RemoveServerCard";
|
||||||
|
|
||||||
function mb(bytes: number) {
|
const sections = [["updates", Download], ["startup", Power], ["client", FolderOpen], ["service", Wrench], ["interface", Languages]] as const;
|
||||||
return bytes >= 1 << 20 ? `${(bytes / (1 << 20)).toFixed(1)} MB` : `${Math.max(1, Math.round(bytes / 1024))} KB`;
|
export function SettingsHome({ serverId, path, onForget }: { serverId: string; serverName?: string; path: string; onForget: () => Promise<void> }) {
|
||||||
}
|
|
||||||
|
|
||||||
export function SettingsHome({ serverId, serverName = "", path, onForget }: { serverId: string; serverName?: string; path: string; onForget: () => Promise<void> }) {
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const upd = useServerUpdate(serverId);
|
const [section, setSection] = useState<(typeof sections)[number][0]>("updates");
|
||||||
const human = useHuman();
|
const [attention, setAttention] = useState(false);
|
||||||
const [preview, setPreview] = useState<UpdatePreview | null>(null);
|
const update = useServerUpdate(serverId);
|
||||||
const [pending, setPending] = useState<UpdateTxn | null>(null);
|
const [history, setHistory] = useState<HistorySelection>(() => ({ component: "server", from: update.preview?.from_version ?? undefined, to: update.available ? update.preview?.to_version : undefined }));
|
||||||
const [pendingChecked, setPendingChecked] = useState(false);
|
function showHistory(selection: HistorySelection) {
|
||||||
const [pendingStateError, setPendingStateError] = useState<UiError | null>(null);
|
setHistory(selection);
|
||||||
const [localBusy, setBusy] = useState<"check" | "rollback" | "retry" | null>(null);
|
requestAnimationFrame(() => {
|
||||||
// an update keeps running in the background when this tab is left, so its state is the shared one
|
const element = document.getElementById("release-history");
|
||||||
const busy = upd.applying ? "update" : localBusy;
|
element?.scrollIntoView({ behavior: "smooth", block: "start" });
|
||||||
const progress = upd.applying ? { step: upd.step ?? "Starting", percent: upd.percent } : null;
|
element?.focus({ preventScroll: true });
|
||||||
const [localError, setError] = useState<UiError | null>(null);
|
});
|
||||||
const error = pendingStateError ?? localError ?? upd.uiError;
|
|
||||||
const [localDone, setDone] = useState<string | null>(null);
|
|
||||||
const done = upd.result && "committed" in upd.result ? t("upd.updatedTo", { v: upd.result.committed }) : localDone;
|
|
||||||
const [choices, setChoices] = useState<Record<string, "keep" | "replace">>({});
|
|
||||||
const [advanced, setAdvanced] = useState(false);
|
|
||||||
const [source, setSource] = useState("");
|
|
||||||
const [startAfter, setStartAfter] = useStartAfterUpdate("server", serverId);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
let active = true;
|
|
||||||
setPendingChecked(false);
|
|
||||||
setPending(null);
|
|
||||||
setPreview(null);
|
|
||||||
setPendingStateError(null);
|
|
||||||
void api.pendingUpdate(serverId).then((txn) => {
|
|
||||||
if (active) { setPending(txn); setPendingChecked(true); }
|
|
||||||
}).catch((e) => { if (active) setPendingStateError(asUiError(e)); });
|
|
||||||
return () => { active = false; };
|
|
||||||
}, [serverId]);
|
|
||||||
|
|
||||||
// Every finished attempt refreshes the disk state, including failures in the background.
|
|
||||||
useEffect(() => {
|
|
||||||
if (!upd.stateRevision) return;
|
|
||||||
setPreview(null);
|
|
||||||
setPendingChecked(!upd.stateError);
|
|
||||||
setPendingStateError(upd.stateError);
|
|
||||||
if (!upd.stateError) setPending(upd.result && "pending" in upd.result ? upd.result.pending : null);
|
|
||||||
}, [upd.stateRevision, serverId]);
|
|
||||||
|
|
||||||
async function refreshPending() {
|
|
||||||
setPendingChecked(false);
|
|
||||||
try {
|
|
||||||
const txn = await refreshServerUpdateState(serverId);
|
|
||||||
setPending(txn);
|
|
||||||
setPendingStateError(null);
|
|
||||||
setPendingChecked(true);
|
|
||||||
return txn;
|
|
||||||
} catch (e) { setPendingStateError(asUiError(e)); throw e; }
|
|
||||||
}
|
}
|
||||||
|
return <div className="mx-auto w-full max-w-5xl pb-8">
|
||||||
async function check() {
|
<h1 className="text-2xl font-semibold">{t("settings.title")}</h1>
|
||||||
setBusy("check");
|
<p className="mt-1 text-sm text-muted">{t("settings.organized")}</p>
|
||||||
setError(null);
|
<nav aria-label={t("settings.title")} className="mt-6 flex flex-wrap gap-1 border-b border-line pb-3">
|
||||||
setDone(null);
|
{sections.map(([id, Icon]) => <button key={id} aria-current={section === id ? "page" : undefined} onClick={() => setSection(id)} className={`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm ${section === id ? "bg-gold/10 text-gold" : "text-muted hover:bg-white/5 hover:text-ink"}`}>
|
||||||
clearServerUpdateResult(serverId);
|
<Icon className="h-4 w-4" aria-hidden />{t(`settings.section.${id}`)}
|
||||||
setPreview(null);
|
</button>)}
|
||||||
try {
|
</nav>
|
||||||
const txn = await refreshPending();
|
{attention && section !== "updates" && <button role="alert" onClick={() => setSection("updates")} className="mt-4 w-full cursor-pointer rounded-lg border border-warn/40 p-4 text-left text-sm text-warn">{t("settings.attention")}</button>}
|
||||||
if (txn) return;
|
<div hidden={section !== "updates"}>
|
||||||
const p = await api.checkUpdate(serverId, source.trim() || undefined);
|
<div className="grid items-start gap-x-5 lg:grid-cols-2">
|
||||||
setPreview(p);
|
<ServerUpdateCard onAttention={setAttention} serverId={serverId} onHistory={(from, to) => showHistory({ component: "server", from: from ?? undefined, to })} />
|
||||||
setChoices(Object.fromEntries(p.conflicts.map((c) => [c, "keep" as const])));
|
<AboutCard onHistory={() => showHistory({ component: "manager" })} />
|
||||||
} catch (e) {
|
</div>
|
||||||
setError(asUiError(e));
|
<button onClick={() => setSection("client")} className="mt-5 flex w-full cursor-pointer items-center justify-between gap-3 rounded-lg border border-line px-5 py-4 text-left text-sm hover:bg-white/5"><span>{t("settings.clientLink")}</span><span aria-hidden>→</span></button>
|
||||||
} finally {
|
<ReleaseHistory selection={history} onSelect={setHistory} />
|
||||||
setBusy(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function update() {
|
|
||||||
if (!pendingChecked || pendingStateError || pending) return;
|
|
||||||
setError(null);
|
|
||||||
setDone(null);
|
|
||||||
await applyServerUpdate(serverId, { choices, source: source.trim() || undefined });
|
|
||||||
}
|
|
||||||
|
|
||||||
async function rollback(txn: UpdateTxn) {
|
|
||||||
if (!window.confirm(t("upd.confirmBack"))) return;
|
|
||||||
setBusy("rollback");
|
|
||||||
setError(null);
|
|
||||||
try {
|
|
||||||
await api.rollbackUpdate(serverId, txn.id);
|
|
||||||
setPending(null);
|
|
||||||
setDone(t("upd.wentBack"));
|
|
||||||
} catch (e) {
|
|
||||||
setError(asUiError(e));
|
|
||||||
} finally {
|
|
||||||
try { await refreshPending(); } catch { /* Keep the disk-state error visible. */ }
|
|
||||||
setBusy(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function retryValidation(txn: UpdateTxn) {
|
|
||||||
setBusy("retry");
|
|
||||||
setError(null);
|
|
||||||
try {
|
|
||||||
const result = await api.retryUpdateValidation(serverId, txn.id);
|
|
||||||
if (result.state === "committed") {
|
|
||||||
setPending(null);
|
|
||||||
setPreview(null);
|
|
||||||
setDone(t("upd.updatedTo", { v: result.to_version }));
|
|
||||||
clearServerUpdateResult(serverId);
|
|
||||||
} else setPending(result);
|
|
||||||
} catch (e) { setError(asUiError(e)); }
|
|
||||||
finally {
|
|
||||||
try { await refreshPending(); } catch { /* Keep the disk-state error visible. */ }
|
|
||||||
setBusy(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function browse() {
|
|
||||||
const p = await open({ directory: true, multiple: false, title: t("upd.dialogTitle") });
|
|
||||||
if (typeof p === "string") setSource(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="max-w-2xl">
|
|
||||||
<h1 className="text-2xl font-semibold">{t("settings.title")}</h1>
|
|
||||||
<p className="mt-1 text-muted">{t("q.settings")}</p>
|
|
||||||
|
|
||||||
{pending && (
|
|
||||||
<Card className="mt-6 border-warn/40 p-5" role="alert">
|
|
||||||
<p className="font-medium text-warn">
|
|
||||||
{pending.state === "needs-decision" ? t("upd.pendingBad") : t("upd.pendingUnfinished")}
|
|
||||||
</p>
|
|
||||||
<p className="mt-1 whitespace-pre-wrap text-sm text-muted">{pending.message ?? t("upd.safeBack")}</p>
|
|
||||||
{pending.state === "needs-decision" && (
|
|
||||||
<Button className="mt-3 mr-3" size="sm" disabled={!!busy} onClick={() => void retryValidation(pending)}>
|
|
||||||
{busy === "retry" && <Loader2 className="h-4 w-4 animate-spin" aria-hidden />}
|
|
||||||
{t("upd.retryValidation")}
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
<p className="mt-1 text-sm text-muted">{t("upd.backNote")}</p>
|
|
||||||
<Button className="mt-3" size="sm" disabled={!!busy} onClick={() => void rollback(pending)}>
|
|
||||||
{busy === "rollback" && <Loader2 className="h-4 w-4 animate-spin" aria-hidden />}
|
|
||||||
{pending.from_version ? t("upd.goBackTo", { v: pending.from_version }) : t("upd.goBackBefore")}
|
|
||||||
</Button>
|
|
||||||
</Card>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<Card className="mt-6 p-6">
|
|
||||||
<h2 className="font-semibold">{t("settings.language")}</h2>
|
|
||||||
<p className="mt-1 text-sm text-muted">{t("settings.languageHint")}</p>
|
|
||||||
<LanguagePicker className="mt-3" />
|
|
||||||
</Card>
|
|
||||||
|
|
||||||
<ClientCard serverId={serverId} />
|
|
||||||
<RealmStartupSettings serverId={serverId} />
|
|
||||||
<AutoRestartSettings serverId={serverId} />
|
|
||||||
|
|
||||||
<GameDataCard serverId={serverId} />
|
|
||||||
|
|
||||||
<DiagnosticsCard serverId={serverId} />
|
|
||||||
<RepairCard key={serverId} serverId={serverId} />
|
|
||||||
<PublishCard key={`publish-${serverId}`} serverId={serverId} serverName={serverName} />
|
|
||||||
|
|
||||||
<AboutCard />
|
|
||||||
|
|
||||||
<Card className="mt-6 p-6">
|
|
||||||
<h2 className="font-semibold">{t("upd.title")}</h2>
|
|
||||||
<p className="mt-1 text-sm text-muted">{t("upd.text")}</p>
|
|
||||||
<label className="mt-3 flex cursor-pointer items-center gap-2 text-sm">
|
|
||||||
<input type="checkbox" checked={startAfter} onChange={(e) => setStartAfter(e.target.checked)} className="h-4 w-4 accent-[#c9a24a]" />
|
|
||||||
<span>{t("upd.startAfter")}</span>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<div className="mt-4 flex items-center gap-3">
|
|
||||||
<Button variant="primary" disabled={!!busy} onClick={() => void check()}>
|
|
||||||
{busy === "check" && <Loader2 className="h-4 w-4 animate-spin" aria-hidden />}
|
|
||||||
{t("upd.check")}
|
|
||||||
</Button>
|
|
||||||
<button onClick={() => setAdvanced((v) => !v)} aria-expanded={advanced} className="flex cursor-pointer items-center gap-1 text-sm text-muted hover:text-ink">
|
|
||||||
{advanced ? <ChevronDown className="h-4 w-4" aria-hidden /> : <ChevronRight className="h-4 w-4" aria-hidden />}
|
|
||||||
{t("install.advanced")}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
{advanced && (
|
|
||||||
<div className="mt-3 flex gap-2">
|
|
||||||
<input aria-label={t("upd.folderLabel")} value={source} onChange={(e) => setSource(e.target.value)} placeholder={t("upd.folderHint")} className="selectable flex-1 rounded-md border border-line bg-bg px-3 py-2 text-sm outline-none focus:border-gold" />
|
|
||||||
<Button size="sm" onClick={browse}>{t("install.browse")}</Button>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{done && pendingChecked && !pendingStateError && <p className="mt-4 text-sm text-ok" role="status">{done}</p>}
|
|
||||||
{error && (
|
|
||||||
<div className="mt-4" role="alert">
|
|
||||||
<p className="selectable whitespace-pre-wrap break-words text-sm text-bad">
|
|
||||||
{error.human.code === "unknown" ? error.technical : human(error.human).message}
|
|
||||||
</p>
|
|
||||||
<button className="mt-1 cursor-pointer text-xs text-muted underline" onClick={() => void navigator.clipboard.writeText(error.technical)}>
|
|
||||||
{t("common.copyError")}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{preview?.database_check_error && (
|
|
||||||
<p className="selectable mt-4 break-words text-sm text-warn" role="status">{t("upd.dbUnchecked", { why: preview.database_check_error })}</p>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{preview && isUpdateCurrent(preview) && (
|
|
||||||
<div className="mt-5 border-t border-line pt-4">
|
|
||||||
<p className="font-medium text-ok" role="status">{t("upd.current", { v: preview.to_version })}</p>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{preview && !isUpdateCurrent(preview) && (
|
|
||||||
<div className="mt-5 border-t border-line pt-4">
|
|
||||||
<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 })
|
|
||||||
: t("upd.summary", { size: mb(preview.download_bytes), files: preview.items.filter((i) => i.action !== "skip").length })}
|
|
||||||
</p>
|
|
||||||
<ul className="mt-3 max-h-56 divide-y divide-line overflow-auto text-sm">
|
|
||||||
{preview.items.filter((i) => i.action !== "skip").map((i) => (
|
|
||||||
<li key={i.path} className="py-2">
|
|
||||||
<div className="flex justify-between gap-3">
|
|
||||||
<span className="selectable break-all">{i.path}</span>
|
|
||||||
<span className={i.action === "conflict" ? "shrink-0 text-warn" : "shrink-0 text-muted"}>{t(`upd.act.${i.action}` as Key)}</span>
|
|
||||||
</div>
|
|
||||||
{i.action === "conflict" && (
|
|
||||||
<fieldset className="mt-2 flex flex-wrap gap-4 text-xs text-muted">
|
|
||||||
<legend className="sr-only">{t("upd.conflict")}</legend>
|
|
||||||
<span className="text-warn">{t("upd.conflict")}</span>
|
|
||||||
{(["keep", "replace"] as const).map((c) => (
|
|
||||||
<label key={c} className="flex cursor-pointer items-center gap-1">
|
|
||||||
<input type="radio" name={i.path} checked={choices[i.path] === c} onChange={() => setChoices((x) => ({ ...x, [i.path]: c }))} />
|
|
||||||
{c === "keep" ? t("upd.keep") : t("upd.replace")}
|
|
||||||
</label>
|
|
||||||
))}
|
|
||||||
</fieldset>
|
|
||||||
)}
|
|
||||||
</li>
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
<Button className="mt-4" variant="primary" disabled={!!busy || !pendingChecked || !!pendingStateError || !!pending} onClick={() => void update()}>
|
|
||||||
{busy === "update" && <Loader2 className="h-4 w-4 animate-spin" aria-hidden />}
|
|
||||||
{t("upd.now")}
|
|
||||||
</Button>
|
|
||||||
<p className="mt-2 text-xs text-muted">{t("upd.stopNote")}</p>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{busy === "update" && progress && (
|
|
||||||
<div className="mt-5">
|
|
||||||
<div className="flex justify-between text-sm">
|
|
||||||
<span role="status">{hasKey(`ustep.${progress.step}`) ? t(`ustep.${progress.step}` as Key) : progress.step}</span>
|
|
||||||
<span className="text-muted">{progress.percent}%</span>
|
|
||||||
</div>
|
|
||||||
<div className="mt-2 h-2 overflow-hidden rounded-full bg-white/10" role="progressbar" aria-valuenow={progress.percent} aria-valuemin={0} aria-valuemax={100}>
|
|
||||||
<div className="h-full rounded-full bg-gold transition-[width] duration-300" style={{ width: `${progress.percent}%` }} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</Card>
|
|
||||||
|
|
||||||
<RemoveServerCard serverId={serverId} path={path} onForget={onForget} />
|
|
||||||
</div>
|
</div>
|
||||||
);
|
<div hidden={section !== "startup"} className="max-w-3xl"><RealmStartupSettings serverId={serverId} /><AutoRestartSettings serverId={serverId} /></div>
|
||||||
|
<div hidden={section !== "client"} className="max-w-3xl"><ClientCard serverId={serverId} /><GameDataCard serverId={serverId} /></div>
|
||||||
|
<div hidden={section !== "service"} className="max-w-3xl"><DiagnosticsCard serverId={serverId} /><RepairCard serverId={serverId} /><RemoveServerCard serverId={serverId} path={path} onForget={onForget} /></div>
|
||||||
|
<div hidden={section !== "interface"} className="max-w-3xl"><Card className="mt-6 p-6"><h2 className="font-semibold">{t("settings.language")}</h2><p className="mt-1 text-sm text-muted">{t("settings.languageHint")}</p><LanguagePicker className="mt-4" /></Card></div>
|
||||||
|
</div>;
|
||||||
}
|
}
|
||||||
@@ -284,8 +284,8 @@ export function SettingsPage(props: {
|
|||||||
const q = query.trim().toLowerCase();
|
const q = query.trim().toLowerCase();
|
||||||
const searching = q !== "";
|
const searching = q !== "";
|
||||||
const hit = (...parts: string[]) => parts.some((x) => x.toLowerCase().includes(q));
|
const hit = (...parts: string[]) => parts.some((x) => x.toLowerCase().includes(q));
|
||||||
const curatedKeys = new Set(view.settings.map((s) => s.key));
|
|
||||||
const collections = collectionsOf(cols);
|
const collections = collectionsOf(cols);
|
||||||
|
const curatedKeys = new Set([...view.settings.map((s) => s.key), ...collections.map((c) => c.item.key)]);
|
||||||
const curatedHits = searching ? view.settings.filter((s) => hit(s.key, sx.title(s), sx.description(s))) : [];
|
const curatedHits = searching ? view.settings.filter((s) => hit(s.key, sx.title(s), sx.description(s))) : [];
|
||||||
const collectionHits = searching ? collections.filter((c) => hit(c.item.key, t(c.label), t(c.text))) : [];
|
const collectionHits = searching ? collections.filter((c) => hit(c.item.key, t(c.label), t(c.text))) : [];
|
||||||
const rawHits = (raw ?? []).filter(
|
const rawHits = (raw ?? []).filter(
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ export function Shell(props: {
|
|||||||
) : page === "report" ? (
|
) : page === "report" ? (
|
||||||
<ReportPage key={server.id} serverId={server.id} />
|
<ReportPage key={server.id} serverId={server.id} />
|
||||||
) : page === "friends" ? (
|
) : page === "friends" ? (
|
||||||
<PlayWithFriends key={server.id} serverId={server.id} path={server.path} />
|
<PlayWithFriends key={server.id} serverName={server.name} serverId={server.id} path={server.path} />
|
||||||
) : page === "settings" ? (
|
) : page === "settings" ? (
|
||||||
<SettingsHome key={server.id} serverId={server.id} serverName={server.name} path={server.path} onForget={() => props.onForget(server.id)} />
|
<SettingsHome key={server.id} serverId={server.id} serverName={server.name} path={server.path} onForget={() => props.onForget(server.id)} />
|
||||||
) : page === "characters" ? (
|
) : page === "characters" ? (
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ const stubs = {
|
|||||||
"@/lib/clientJob": `export const dismissClientJob=()=>{}; export const startClientUpdate=()=>{}; export const stopClientJob=()=>{}; export const syncClient=()=>{}; export const useClientJob=()=>({phase:'idle'});`,
|
"@/lib/clientJob": `export const dismissClientJob=()=>{}; export const startClientUpdate=()=>{}; export const stopClientJob=()=>{}; export const syncClient=()=>{}; export const useClientJob=()=>({phase:'idle'});`,
|
||||||
"@/lib/clientUpdate": `export const checkClient=()=>{}; export const useClientStatus=()=>({status:null});`,
|
"@/lib/clientUpdate": `export const checkClient=()=>{}; export const useClientStatus=()=>({status:null});`,
|
||||||
"@/lib/autoRestartPrefs": `export const useAutoRestart=()=>[false,()=>{}];`,
|
"@/lib/autoRestartPrefs": `export const useAutoRestart=()=>[false,()=>{}];`,
|
||||||
|
"@/screens/PublishCard": `export const ListingChip=()=>null;`,
|
||||||
|
"@/screens/PublishDialog": `export const PublishRealmDialog=()=>null;`,
|
||||||
|
"@/lib/registry": `export const useRegistryStatus=()=>({status:null});`,
|
||||||
|
"@/lib/publishRealms": `export const usePublishRealms=()=>[];`,
|
||||||
"@/components/ui/button": `import {createElement} from 'react'; export const Button=({children,disabled,onClick,className})=>createElement('button',{disabled,onClick,className},children);`,
|
"@/components/ui/button": `import {createElement} from 'react'; export const Button=({children,disabled,onClick,className})=>createElement('button',{disabled,onClick,className},children);`,
|
||||||
"@/components/ui/card": `import {createElement} from 'react'; export const Card=({children,...props})=>createElement('div',props,children);`,
|
"@/components/ui/card": `import {createElement} from 'react'; export const Card=({children,...props})=>createElement('div',props,children);`,
|
||||||
};
|
};
|
||||||
@@ -24,6 +28,7 @@ const bundle = await rolldown({
|
|||||||
external: (id, importer) => id === "react/jsx-runtime" || id === "lucide-react" || (id === "react" && !importer?.endsWith("Overview.tsx")),
|
external: (id, importer) => id === "react/jsx-runtime" || id === "lucide-react" || (id === "react" && !importer?.endsWith("Overview.tsx")),
|
||||||
plugins: [{ name: "overview-test",
|
plugins: [{ name: "overview-test",
|
||||||
resolveId(id, importer) {
|
resolveId(id, importer) {
|
||||||
|
if (id === "@/components/ui/split-button") return fileURLToPath(new URL("../src/components/ui/split-button.tsx", import.meta.url));
|
||||||
if (id.startsWith("@/") || (id === "react" && importer?.endsWith("Overview.tsx"))) return "\0" + id;
|
if (id.startsWith("@/") || (id === "react" && importer?.endsWith("Overview.tsx"))) return "\0" + id;
|
||||||
},
|
},
|
||||||
load(id) {
|
load(id) {
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import assert from "node:assert/strict";
|
||||||
|
import test from "node:test";
|
||||||
|
import { readFileSync } from "node:fs";
|
||||||
|
import { releasesForUpdate, localizeNotes } from "../src/lib/releaseHistoryModel.ts";
|
||||||
|
|
||||||
|
const release = (version, prerelease = false) => ({ version, prerelease, notes: [], tag: version, date: "2026-10-28" });
|
||||||
|
test("intermediate update shows only versions actually being installed", () => {
|
||||||
|
const records = [release("0.9.0"), release("0.10.0"), release("0.11.0"), release("0.10.1", true)];
|
||||||
|
assert.deepEqual(releasesForUpdate(records, "0.9.0", "0.10.0").map(r => r.version), ["0.10.0"]);
|
||||||
|
assert.deepEqual(releasesForUpdate(records, "0.9.0", "0.11.0").map(r => r.version), ["0.10.0", "0.11.0"]);
|
||||||
|
assert.deepEqual(releasesForUpdate(records, "custom", "0.10.0").map(r => r.version), ["0.10.0"]);
|
||||||
|
assert.deepEqual(releasesForUpdate(records, "0.10.0", "0.10.0"), []);
|
||||||
|
});
|
||||||
|
test("a changed or partly translated record falls back as a whole", () => {
|
||||||
|
assert.deepEqual(localizeNotes(["Changed", "New"], { Changed: "Переведено" }), { notes: ["Changed", "New"], fallback: true });
|
||||||
|
});
|
||||||
|
test("latest published Manager and server records have complete translations in five languages", () => {
|
||||||
|
const translations = JSON.parse(readFileSync(new URL("../src/data/latest-note-translations.json", import.meta.url)));
|
||||||
|
for (const component of ["server", "manager"]) {
|
||||||
|
const path = component === "server" ? "../src/data/server-history.json" : "../changelog/history.json";
|
||||||
|
const history = JSON.parse(readFileSync(new URL(path, import.meta.url)));
|
||||||
|
const latest = history.releases.at(-1);
|
||||||
|
for (const locale of ["ru", "de", "fr", "es", "zh"]) {
|
||||||
|
assert.equal(localizeNotes(latest.notes, translations[component][locale]).fallback, false, `${component}/${locale}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -52,6 +52,19 @@ test("refresh after recovery returns the latest disk state, then its absence", a
|
|||||||
assert.equal(await refreshServerUpdateState("recovery-case"), null);
|
assert.equal(await refreshServerUpdateState("recovery-case"), null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("successful update keeps the existing-character warning across disk refresh", async () => {
|
||||||
|
const original = globalThis.__hotfixApi.applyUpdate;
|
||||||
|
try {
|
||||||
|
applyFailure = false;
|
||||||
|
stateFailure = false;
|
||||||
|
pending = null;
|
||||||
|
globalThis.__hotfixApi.applyUpdate = async () => ({ txn: { state: "committed", to_version: "2" }, preexisting_character_count: 174 });
|
||||||
|
assert.equal(await applyServerUpdate("old-character-warnings", { choices: {} }), true);
|
||||||
|
await refreshServerUpdateState("old-character-warnings");
|
||||||
|
assert.deepEqual(useServerUpdate("old-character-warnings").result, { committed: "2", preexistingCharacters: 174 });
|
||||||
|
} finally { globalThis.__hotfixApi.applyUpdate = original; }
|
||||||
|
});
|
||||||
|
|
||||||
test("a stopped server is left stopped after a successful update by default", async () => {
|
test("a stopped server is left stopped after a successful update by default", async () => {
|
||||||
calls.length = 0;
|
calls.length = 0;
|
||||||
serverRunning = false;
|
serverRunning = false;
|
||||||
|
|||||||
@@ -0,0 +1,171 @@
|
|||||||
|
import pathlib
|
||||||
|
import runpy
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
import unittest
|
||||||
|
import time
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
BRIDGE = pathlib.Path(__file__).resolve().parents[1] / 'crates/coa-core/src/launcher_bridge.py'
|
||||||
|
|
||||||
|
|
||||||
|
class LauncherBridgeTests(unittest.TestCase):
|
||||||
|
def launch(self, action, body):
|
||||||
|
with tempfile.TemporaryDirectory() as directory:
|
||||||
|
script = pathlib.Path(directory) / 'Scripts/manage.py'
|
||||||
|
script.parent.mkdir()
|
||||||
|
script.write_text(body, encoding='utf8')
|
||||||
|
original = runpy.run_path
|
||||||
|
def capture(*args, **kwargs):
|
||||||
|
self.launcher = original(*args, **kwargs)
|
||||||
|
return self.launcher
|
||||||
|
with patch.object(sys, 'argv', ['bridge', str(script), action]), patch.object(runpy, 'run_path', side_effect=capture):
|
||||||
|
return original(str(BRIDGE))
|
||||||
|
|
||||||
|
def shutdown_fixture(self, *, console_error='RuntimeError', stopped=True, foreign=False, same=True, modern=False, terminate_error=False):
|
||||||
|
return f'''
|
||||||
|
from pathlib import Path
|
||||||
|
from contextlib import nullcontext
|
||||||
|
calls = []
|
||||||
|
world = {{'pid': 123, 'created': 456, 'exe': str(Path(__file__).resolve().parents[1] / {'"foreign.exe"' if foreign else '"Core/worldserver.exe"'})}}
|
||||||
|
def wait_ready(*args): pass
|
||||||
|
def start_mysql(): raise AssertionError('must not start')
|
||||||
|
def main(): raise AssertionError('must not prepare')
|
||||||
|
def settings(): return {{}}
|
||||||
|
def control_lock(): return nullcontext()
|
||||||
|
def process(name): return world if name == 'world' else None
|
||||||
|
def same_process(record): return {same!r}
|
||||||
|
def ra(command, config):
|
||||||
|
calls.append('console')
|
||||||
|
{'raise '+console_error+'("Start this repack worldserver first")' if console_error else 'return "Graceful shutdown"'}
|
||||||
|
def terminate(record):
|
||||||
|
assert record is world
|
||||||
|
calls.append('terminate')
|
||||||
|
{'raise RuntimeError("identity changed")' if terminate_error else 'pass'}
|
||||||
|
def wait_stopped(record, seconds):
|
||||||
|
assert record is world
|
||||||
|
calls.append('wait')
|
||||||
|
return {stopped!r}
|
||||||
|
def stop_all(config):
|
||||||
|
record = process('world')
|
||||||
|
if record:
|
||||||
|
if {modern!r}:
|
||||||
|
try: ra('server shutdown 1s 0', config)
|
||||||
|
except (OSError, RuntimeError): terminate(record)
|
||||||
|
else:
|
||||||
|
ra('server shutdown 1s 0', config)
|
||||||
|
if not wait_stopped(record, 60): raise RuntimeError('world still alive')
|
||||||
|
calls.append('mysql-shutdown')
|
||||||
|
'''
|
||||||
|
|
||||||
|
def test_unavailable_console_in_restored_legacy_launcher_stops_owned_world_before_mysql(self):
|
||||||
|
for error in ['RuntimeError', 'OSError']:
|
||||||
|
with self.subTest(error=error):
|
||||||
|
result = self.launch('stop-all', self.shutdown_fixture(console_error=error))
|
||||||
|
self.assertEqual(result['launcher']['calls'], ['console', 'terminate', 'wait', 'wait', 'mysql-shutdown'])
|
||||||
|
|
||||||
|
def test_healthy_console_keeps_graceful_shutdown(self):
|
||||||
|
result = self.launch('stop-all', self.shutdown_fixture(console_error=None))
|
||||||
|
self.assertEqual(result['launcher']['calls'], ['console', 'wait', 'mysql-shutdown'])
|
||||||
|
|
||||||
|
def test_foreign_or_reused_process_is_never_terminated_even_by_a_modern_launcher_catch(self):
|
||||||
|
for modern in [False, True]:
|
||||||
|
for identity in [{'foreign': True}, {'same': False}]:
|
||||||
|
with self.subTest(modern=modern, **identity):
|
||||||
|
with self.assertRaisesRegex(Exception, 'ownership could not be verified'):
|
||||||
|
self.launch('stop-all', self.shutdown_fixture(modern=modern, **identity))
|
||||||
|
self.assertEqual(self.launcher['calls'], ['console'])
|
||||||
|
|
||||||
|
def test_world_that_stays_alive_blocks_database_shutdown(self):
|
||||||
|
for modern in [False, True]:
|
||||||
|
with self.subTest(modern=modern):
|
||||||
|
with self.assertRaisesRegex(Exception, 'database was left running'):
|
||||||
|
self.launch('stop-all', self.shutdown_fixture(stopped=False, modern=modern))
|
||||||
|
self.assertEqual(self.launcher['calls'], ['console', 'terminate', 'wait'])
|
||||||
|
|
||||||
|
def test_termination_identity_failure_leaves_mysql_untouched(self):
|
||||||
|
for modern in [False, True]:
|
||||||
|
with self.subTest(modern=modern):
|
||||||
|
with self.assertRaisesRegex(Exception, 'could not be stopped safely'):
|
||||||
|
self.launch('stop-all', self.shutdown_fixture(terminate_error=True, modern=modern))
|
||||||
|
self.assertEqual(self.launcher['calls'], ['console', 'terminate'])
|
||||||
|
|
||||||
|
def test_slow_mysql_gets_time_to_finish_but_other_waits_are_unchanged(self):
|
||||||
|
result = self.launch('start-mysql', '''
|
||||||
|
calls = []
|
||||||
|
def wait_ready(name, port, seconds=180):
|
||||||
|
calls.append((name, seconds))
|
||||||
|
if name == 'mysql' and seconds < 162:
|
||||||
|
raise RuntimeError('mysql is still starting')
|
||||||
|
def start_mysql():
|
||||||
|
wait_ready('mysql', 12345, 60)
|
||||||
|
def main():
|
||||||
|
start_mysql()
|
||||||
|
wait_ready('world', 23456, 180)
|
||||||
|
wait_ready('mysql', 12345, 900)
|
||||||
|
''')
|
||||||
|
calls = result['launcher']['calls']
|
||||||
|
self.assertEqual(calls[0], ('mysql', 300))
|
||||||
|
self.assertEqual(calls[2], ('mysql', 900))
|
||||||
|
self.assertEqual(calls[1][0], 'world')
|
||||||
|
self.assertAlmostEqual(calls[1][1], 1500, delta=1)
|
||||||
|
|
||||||
|
def world_start(self, *, game_at=420, console_at=480, dies_at=None, requested=180):
|
||||||
|
clock = [0.0]
|
||||||
|
def sleep(seconds): clock[0] += seconds
|
||||||
|
body = f'''
|
||||||
|
import time
|
||||||
|
calls = []
|
||||||
|
dies_at = {dies_at!r}
|
||||||
|
def wait_ready(name, port, seconds=180):
|
||||||
|
until = time.monotonic() + seconds
|
||||||
|
while time.monotonic() < until:
|
||||||
|
if dies_at is not None and time.monotonic() >= dies_at:
|
||||||
|
raise RuntimeError('world stopped during startup')
|
||||||
|
if time.monotonic() >= ({game_at!r} if port == 1 else {console_at!r}):
|
||||||
|
calls.append(port)
|
||||||
|
return
|
||||||
|
time.sleep(0.5)
|
||||||
|
raise RuntimeError('world is still starting')
|
||||||
|
def start_mysql(): pass
|
||||||
|
def main():
|
||||||
|
wait_ready('world', 1, {requested})
|
||||||
|
wait_ready('world', 2, {requested})
|
||||||
|
'''
|
||||||
|
with patch('time.monotonic', side_effect=lambda: clock[0]), patch('time.sleep', side_effect=sleep):
|
||||||
|
result = self.launch('start-all', body)
|
||||||
|
return clock[0], result['launcher']['calls']
|
||||||
|
|
||||||
|
def test_legacy_coa_world_waits_for_both_ports_after_three_minutes(self):
|
||||||
|
elapsed, calls = self.world_start()
|
||||||
|
self.assertEqual((elapsed, calls), (480, [1, 2]))
|
||||||
|
|
||||||
|
def test_console_wait_shares_the_world_deadline(self):
|
||||||
|
with self.assertRaisesRegex(RuntimeError, 'still starting'):
|
||||||
|
self.world_start(game_at=1490, console_at=1510)
|
||||||
|
self.assertEqual(self.launcher['calls'], [1])
|
||||||
|
|
||||||
|
def test_world_exit_is_reported_without_waiting_out_the_extended_budget(self):
|
||||||
|
with self.assertRaisesRegex(RuntimeError, 'stopped during startup'):
|
||||||
|
self.world_start(dies_at=12)
|
||||||
|
self.assertEqual(self.launcher['calls'], [])
|
||||||
|
|
||||||
|
def test_existing_longer_world_timeout_is_preserved(self):
|
||||||
|
self.assertEqual(self.world_start(game_at=1600, console_at=1700, requested=1800), (1700, [1, 2]))
|
||||||
|
|
||||||
|
def test_stop_dispatch_does_not_prepare_or_start_anything(self):
|
||||||
|
result = self.launch('stop-all', '''
|
||||||
|
from contextlib import nullcontext
|
||||||
|
calls = []
|
||||||
|
def wait_ready(*args): raise AssertionError('must not wait')
|
||||||
|
def start_mysql(): raise AssertionError('must not start')
|
||||||
|
def main(): raise AssertionError('must not prepare')
|
||||||
|
def settings(): return {'mysqlPort': 12345}
|
||||||
|
def control_lock(): return nullcontext()
|
||||||
|
def stop_all(config): calls.append(config['mysqlPort'])
|
||||||
|
''')
|
||||||
|
self.assertEqual(result['launcher']['calls'], [12345])
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import assert from "node:assert/strict";
|
||||||
|
import test from "node:test";
|
||||||
|
import { updateCheckQueue } from "../src/lib/updateCheckQueue.ts";
|
||||||
|
|
||||||
|
test("duplicate checks share one result and foreground waits for background on the same server", async () => {
|
||||||
|
const check = updateCheckQueue();
|
||||||
|
let release;
|
||||||
|
let calls = 0;
|
||||||
|
const background = check("server", "background", () => { calls++; return new Promise(resolve => { release = resolve; }); });
|
||||||
|
assert.equal(check("server", "background", () => { throw Error("duplicate"); }), background);
|
||||||
|
const foreground = check("server", "foreground", async () => { calls++; return "full preview"; });
|
||||||
|
await Promise.resolve();
|
||||||
|
await Promise.resolve();
|
||||||
|
assert.equal(calls, 1);
|
||||||
|
release("background preview");
|
||||||
|
assert.equal(await background, "background preview");
|
||||||
|
assert.equal(await foreground, "full preview");
|
||||||
|
assert.equal(calls, 2);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("one server's failure releases its queue and does not block other servers", async () => {
|
||||||
|
const check = updateCheckQueue();
|
||||||
|
let fail;
|
||||||
|
const first = check("one", "a", () => new Promise((_, reject) => { fail = reject; }));
|
||||||
|
const failed = assert.rejects(first, /offline/);
|
||||||
|
const next = check("one", "b", async () => "retry");
|
||||||
|
assert.equal(await check("two", "a", async () => "independent"), "independent");
|
||||||
|
fail(Error("offline"));
|
||||||
|
await failed;
|
||||||
|
assert.equal(await next, "retry");
|
||||||
|
assert.equal(await check("one", "a", async () => "recovered"), "recovered");
|
||||||
|
});
|
||||||
Reference in new issue
Block a user