Compare commits

...
Author SHA1 Message Date
ДмитрийandClaude Sonnet 5.5 2b7dbf8e1e feat(settings): translations and changelog for weekly restart and log auto-cleanup
The weekly restart schedule and the server log auto-cleanup (previous commit) had strings only in
en and ru and no changelog fragments. Adds de/es/fr/zh for the weekday names, the weekly toggle
and the log settings, and one fragment per change.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-20 21:37:01 +05:00
Дмитрий 4ff190f6d1 feat(settings): add weekly restart schedule and server log auto-cleanup 2026-11-20 21:34:23 +05:00
ДмитрийandClaude Sonnet 5.5 41977442e9 Merge master into integrate/manager-0.9.15
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-19 13:12:54 +05:00
github-actions[bot] c75785d13e Update published Manager changelog 2026-11-19 07:59:40 +00:00
ДмитрийandClaude Sonnet 5.5 2b9021ce07 Manager 0.9.15: Custom Races client 2.0.2
Installs the 2.0.2 client set (retail body cache, subclass and HD patches, current
CoACustomRace.exe, newer subclass addon without the Skinshifter collection),
with the 2.0 inventory kept for installs that still carry that manifest.
Archive sizes and hashes verified against the real release archives.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-18 21:38:11 +05:00
Corfirean b9e663079e Merge integrate/manager-0.9.14: Manager 0.9.14 (Rust launcher, fast races switch, ports, realm names, addons, companions on Wildcard/Reborn) 2026-11-16 18:14:10 +05:00
github-actions[bot] d7693b0878 Update published Manager changelog 2026-11-16 10:21:01 +00:00
27 changed files with 8216 additions and 74 deletions

No files matched your search

+23
View File
@@ -8,6 +8,29 @@ 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.
## 0.9.15 — 2026-11-19
- The Custom Races client update brings version 2.0.2.
[Release](https://github.com/Corfirean/coa-server-manager/releases/tag/v0.9.15) · [Source changes](https://github.com/Corfirean/coa-server-manager/compare/v0.9.14...v0.9.15)
## 0.9.14 — 2026-11-16
- Install community addons from the Manager.
- Old item and creature data is cleared before every Play.
- Turning the custom races client patch on or off takes seconds again.
- The database moves to a free port when Windows reserves or another program takes 3307.
- Your own MySQL settings survive restarts and updates.
- Disabled custom races stay disabled after a server update that adds races.
- Rename your realms in the Manager.
- The account for a friend's server is in the login box at every Play.
- Restart the world every day at a chosen time.
- Switches for the Custom Races V2 subclasses, Hero Races and the /dev menu.
- Companion bots on Wildcard and Warcraft Reborn.
- The Custom Races card tells which characters stay out while races are off.
[Release](https://github.com/Corfirean/coa-server-manager/releases/tag/v0.9.14) · [Source changes](https://github.com/Corfirean/coa-server-manager/compare/v0.9.13...v0.9.14)
## 0.9.13 — 2026-11-15
- The custom races client is updated to Custom Races V2.
Generated
+4 -4
View File
@@ -586,7 +586,7 @@ dependencies = [
[[package]]
name = "coa-core"
version = "0.9.14"
version = "0.9.15"
dependencies = [
"base64 0.22.1",
"chrono",
@@ -621,7 +621,7 @@ dependencies = [
[[package]]
name = "coa-launcher"
version = "0.9.14"
version = "0.9.15"
dependencies = [
"coa-core",
"serde_json",
@@ -644,7 +644,7 @@ dependencies = [
[[package]]
name = "coa-release"
version = "0.9.14"
version = "0.9.15"
dependencies = [
"chrono",
"coa-core",
@@ -653,7 +653,7 @@ dependencies = [
[[package]]
name = "coa-server-manager"
version = "0.9.14"
version = "0.9.15"
dependencies = [
"coa-control-proto",
"coa-core",
+1 -1
View File
@@ -4,7 +4,7 @@ members = ["crates/coa-core", "crates/coa-launcher", "crates/coa-release", "crat
exclude = ["services/coa-registry", "services/coa-registry-e2e", "services/coa-coordinator", "services/coa-relay"]
[workspace.package]
version = "0.9.14"
version = "0.9.15"
edition = "2021"
license = "AGPL-3.0-only"
@@ -0,0 +1,7 @@
---
area: manager
type: changed
audience: players
title: The Custom Races client update brings version 2.0.2
---
Updating the Custom Races client now installs 2.0.2: the retail body model files, the subclass and HD patches, the current CoACustomRace.exe and the newer subclass interface with the Two-Players bar. The 2.0 archives already downloaded are reused, so about 4.4 GB of new files are fetched. Update the Manager before the server: the matching server release needs this version.
@@ -0,0 +1,7 @@
---
area: manager
type: added
audience: admins
title: Clean server logs by hand or automatically when they grow too big
---
Server logging settings show how much the logs take and clean them with one button. Optionally the Manager cleans them above a size you choose; logs the running server uses are kept.
@@ -0,0 +1,7 @@
---
area: manager
type: added
audience: admins
title: Restart the world every week on a chosen day and time
---
Next to the daily restart, pick a weekday, a time and the in-game countdown in the scheduled restart settings. Existing daily schedules keep working.
+47 -1
View File
@@ -178,7 +178,20 @@
"Corfirean/coa-server-manager:20261031-validation-mysql-reuse.md",
"Corfirean/coa-server-manager:20261103-isolated-login-port.md",
"Corfirean/coa-server-manager:20261107-bot-strength-scaling-settings.md",
"Corfirean/coa-server-manager:20261115-custom-races-v2-client.md"
"Corfirean/coa-server-manager:20261115-addon-catalog.md",
"Corfirean/coa-server-manager:20261115-clear-game-cache.md",
"Corfirean/coa-server-manager:20261115-custom-races-fast-toggle.md",
"Corfirean/coa-server-manager:20261115-custom-races-v2-client.md",
"Corfirean/coa-server-manager:20261115-database-port-relocation.md",
"Corfirean/coa-server-manager:20261115-mysql-custom-options.md",
"Corfirean/coa-server-manager:20261115-race-restriction-kept.md",
"Corfirean/coa-server-manager:20261115-realm-names.md",
"Corfirean/coa-server-manager:20261115-remembered-friend-login.md",
"Corfirean/coa-server-manager:20261115-scheduled-restart.md",
"Corfirean/coa-server-manager:20261115-v2-feature-switches.md",
"Corfirean/coa-server-manager:20261116-companions-wildcard-reborn.md",
"Corfirean/coa-server-manager:20261116-custom-race-characters-off.md",
"Corfirean/coa-server-manager:20261118-custom-races-2-0-2-client.md"
],
"releases": [
{
@@ -936,6 +949,39 @@
],
"commit": "d3527312803fb5a3e1cd48e01496645a8bbc9dcf",
"compare": "https://github.com/Corfirean/coa-server-manager/compare/v0.9.12...v0.9.13"
},
{
"tag": "v0.9.14",
"version": "0.9.14",
"date": "2026-11-16",
"url": "https://github.com/Corfirean/coa-server-manager/releases/tag/v0.9.14",
"notes": [
"Install community addons from the Manager",
"Old item and creature data is cleared before every Play",
"Turning the custom races client patch on or off takes seconds again",
"The database moves to a free port when Windows reserves or another program takes 3307",
"Your own MySQL settings survive restarts and updates",
"Disabled custom races stay disabled after a server update that adds races",
"Rename your realms in the Manager",
"The account for a friend's server is in the login box at every Play",
"Restart the world every day at a chosen time",
"Switches for the Custom Races V2 subclasses, Hero Races and the /dev menu",
"Companion bots on Wildcard and Warcraft Reborn",
"The Custom Races card tells which characters stay out while races are off"
],
"commit": "1f64da3ae064b3f02d2bb11d818c44d26a557045",
"compare": "https://github.com/Corfirean/coa-server-manager/compare/v0.9.13...v0.9.14"
},
{
"tag": "v0.9.15",
"version": "0.9.15",
"date": "2026-11-19",
"url": "https://github.com/Corfirean/coa-server-manager/releases/tag/v0.9.15",
"notes": [
"The Custom Races client update brings version 2.0.2"
],
"commit": "2b9021ce072e3b6c7e9c8106f8a54f59f1b37424",
"compare": "https://github.com/Corfirean/coa-server-manager/compare/v0.9.14...v0.9.15"
}
]
}
+83 -16
View File
@@ -14,24 +14,34 @@ use crate::download::Cancel;
use crate::error::{Error, Result};
use crate::fsx;
pub const CLIENT_VERSION: &str = "2.0";
pub const CLIENT_VERSION: &str = "2.0.2";
pub const MANIFEST_FILENAME: &str = "custom_races_patch_manifest.txt";
/// Files earlier releases installed that the current release no longer ships (removed on update).
#[cfg(test)]
const RETIRED_FILES: &[&str] = &["Ascension.exe"];
/// The client archives of the coa-custom-2.0 release. The server archive is read only for its client
/// addons (files/addons: subclass interface, dev menu, teleports, spell activation overlay).
/// The client archives of the coa-custom-2.0.2 release. Clients 1 to 9 are byte for byte the 2.0 archives and keep their
/// 2.0 file names, so a verified copy in the cache or in Downloads is not fetched again. The server archive is read
/// only for its client addons; the SkinCollection (Skinshifter) addon in Client 17 is not installed (see RACE_ADDONS).
/// Order matters: a later archive replaces a file of an earlier one, and Client 17 carries the newer Ascension_Subclass.
pub const ARCHIVES: &[(&str, &str)] = &[
("CoA-Custom-V2-Client-1.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-1.zip"),
("CoA-Custom-V2-Client-2.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-2.zip"),
("CoA-Custom-V2-Client-3.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-3.zip"),
("CoA-Custom-V2-Client-4.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-4.zip"),
("CoA-Custom-V2-Client-5.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-5.zip"),
("CoA-Custom-V2-Client-6.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-6.zip"),
("CoA-Custom-V2-Client-7.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-7.zip"),
("CoA-Custom-V2-Client-8.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-8.zip"),
("CoA-Custom-V2-Client-9.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Client-9.zip"),
("CoA-Custom-V2-Server.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0/CoA-Custom-V2-Server.zip"),
("CoA-Custom-V2-Client-1.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-1.zip"),
("CoA-Custom-V2-Client-2.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-2.zip"),
("CoA-Custom-V2-Client-3.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-3.zip"),
("CoA-Custom-V2-Client-4.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-4.zip"),
("CoA-Custom-V2-Client-5.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-5.zip"),
("CoA-Custom-V2-Client-6.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-6.zip"),
("CoA-Custom-V2-Client-7.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-7.zip"),
("CoA-Custom-V2-Client-8.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-8.zip"),
("CoA-Custom-V2-Client-9.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-9.zip"),
("CoA-Custom-V2.0.2-Client-10.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-10.zip"),
("CoA-Custom-V2.0.2-Client-11.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-11.zip"),
("CoA-Custom-V2.0.2-Client-12.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-12.zip"),
("CoA-Custom-V2.0.2-Client-13.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-13.zip"),
("CoA-Custom-V2.0.2-Client-14.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-14.zip"),
("CoA-Custom-V2.0.2-Client-15.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-15.zip"),
("CoA-Custom-V2.0.2-Client-16.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-16.zip"),
("CoA-Custom-V2.0.2-Server.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Server.zip"),
("CoA-Custom-V2.0.2-Client-17.zip", "https://github.com/ilusixn/CustomRacesCoa/releases/download/coa-custom-2.0.2/CoA-Custom-V2.0.2-Client-17.zip"),
];
pub const RACE_MPQS: &[&str] = &[
@@ -111,6 +121,24 @@ pub const RACE_MPQS: &[&str] = &[
"patch-ZZZZZW.MPQ",
"patch-ZZZZZX.MPQ",
"patch-ZZZZZY.MPQ",
"patch-ZZZZZY-SUBMA.MPQ",
"patch-ZZZZZY-SUBVA.MPQ",
"patch-ZZZZZY-SUBVB.MPQ",
"patch-ZZZZZY-SUBVC.MPQ",
"patch-ZZZZZY-SUBXA-HD.MPQ",
"patch-ZZZZZY-SUBXB-HD.MPQ",
"patch-ZZZZZY-SUBXC-HD.MPQ",
"patch-ZZZZZZ.MPQ",
"patch-ZZZZZZA.MPQ",
"patch-ZZZZZZB.MPQ",
"patch-ZZZZZZC.MPQ",
"patch-ZZZZZZD.MPQ",
"patch-ZZZZZZE.MPQ",
"patch-retail-001.mpq",
"patch-retail-002.mpq",
"patch-retail-003.mpq",
"patch-retail-004.mpq",
"patch-retail-005.mpq",
];
pub const RACE_ADDONS: &[&str] = &[
@@ -118,13 +146,18 @@ pub const RACE_ADDONS: &[&str] = &[
"Ascension_Subclass/Ascension_Subclass.toc",
"Ascension_Subclass/Bindings.xml",
"Ascension_Subclass/SubclassBar.lua",
"Ascension_Subclass/SubclassBonk.lua",
"Ascension_Subclass/SubclassCarry.lua",
"Ascension_Subclass/SubclassCastBar.lua",
"Ascension_Subclass/SubclassChoices.lua",
"Ascension_Subclass/SubclassGlow.lua",
"Ascension_Subclass/SubclassNodes.lua",
"Ascension_Subclass/SubclassOrbs.lua",
"Ascension_Subclass/SubclassPairs.lua",
"Ascension_Subclass/SubclassPetBar.lua",
"Ascension_Subclass/SubclassPowerBar.lua",
"Ascension_Subclass/SubclassRaceBackground.lua",
"Ascension_Subclass/Textures/IceFrame.tga",
"CoAHideArmor/CoAHideArmor.lua",
"CoAHideArmor/CoAHideArmor.toc",
"CoAQuestSafe/CoAQuestSafe.lua",
@@ -405,6 +438,8 @@ fn patch_files(client: &Path) -> Result<Vec<PatchFile>> {
include_str!("custom_races_hashes_1_9_1.json")
} else if manifest.lines().any(|line| line == "# CoA Custom 1.9.2") {
include_str!("custom_races_hashes_1_9_2.json")
} else if manifest.lines().any(|line| line == "# CoA Custom 2.0") {
include_str!("custom_races_hashes_2_0.json")
} else {
include_str!("custom_races_hashes.json")
};
@@ -1100,9 +1135,41 @@ fn archive_job(filename: &str, url: &str, cache: &Path) -> Result<crate::downloa
195_235_400,
"0764893543084a12d15578fe734f66ba4519740794a6b3b3a38a08594c38c640",
),
"CoA-Custom-V2-Server.zip" => (
63_983_587,
"8970d61eea40f53cea4c27481edd85d2b2647cd32eb88932e0077da3b4a77d23",
"CoA-Custom-V2.0.2-Client-10.zip" => (
73_099_250,
"035720776b66a18b965bbd7262154ea398f5425b8cd116fdfc5f663cd800316e",
),
"CoA-Custom-V2.0.2-Client-11.zip" => (
178_667_276,
"9a66f782be47f66ce4ec9f4f70cb1970218fe48950a031b39aa79c091008901b",
),
"CoA-Custom-V2.0.2-Client-12.zip" => (
1_053_880_101,
"f7a90890a0248967eb4572c641f5dee1bd0cafba12d1841360821b79cd5b1c3e",
),
"CoA-Custom-V2.0.2-Client-13.zip" => (
950_360_503,
"8ae00b9bebc4e21d6d6d32ddbf319c341f3c418349a3aeb3d840dffb0fa14d3f",
),
"CoA-Custom-V2.0.2-Client-14.zip" => (
971_472_467,
"511ec3fd1933b9342920262f6a5eae7e451671a49679e93612632b77c31ba57f",
),
"CoA-Custom-V2.0.2-Client-15.zip" => (
1_106_537_793,
"b65505a047508cbd15f4fec670d3953873014250efc484aa3bdb75cb3b3cbbf1",
),
"CoA-Custom-V2.0.2-Client-16.zip" => (
11_874_081,
"5442dc06147e60140c43eebfae14f6ad5f19e6fed974db471b65211497609a27",
),
"CoA-Custom-V2.0.2-Client-17.zip" => (
947_478,
"707e09c8b95926e2d83bdc16adab763901951566caf6bf4fcebfdf4d7ba0e62a",
),
"CoA-Custom-V2.0.2-Server.zip" => (
96_857_277,
"36d0cba993623064ce01f364116f99330423cec3cef22101e50cf941dfd85afe",
),
_ => return Err(Error::Invalid("Unknown custom races archive.".into())),
};
+30 -7
View File
@@ -1,5 +1,5 @@
{
"CoACustomRace.exe": "428e41f5cb349f66b9ac133c711c2ffb92bd2be28c595f67268924df8a5c89cc",
"CoACustomRace.exe": "8c283dcd464418e6859217dd53ad522b6a61f064c6db349c77d3cb90412690d9",
"CoAVolFog-regions.ini": "a21c2616c866ea29bdf2c75af2607e8cb982fdaaef1167375b23f1490325a0a5",
"CoAVolFog.dll": "65c9abb6d44ce41bc943b25a83ab4292dd0697d6490a60385e75610fe66801ce",
"CoAVolFog.ini": "921d99e3dd5a85db4d815c4baf94851639e85e74a5bb5b5f610548a0fbf94483",
@@ -4798,7 +4798,7 @@
"Data/patch-ZZZZX.MPQ": "d4b1352e62f3b47b2a8fe38cf751825f20f58e4feee0a1b04e935e2211554f30",
"Data/patch-ZZZZY.MPQ": "f9d05e9e0b0c31264c5d5dfd3bb3d486acfd0f3380186a3dec73cd2fa92c4859",
"Data/patch-ZZZZZ.MPQ": "9d94a39178f2e8b34e612321ed1ad484d60be395520a38818546b5a8e96c94f4",
"Data/patch-ZZZZZA.MPQ": "23d62f92116106039afbe37e7ad8199a99ec8401e6c65728d6293c8155591e89",
"Data/patch-ZZZZZA.MPQ": "dad9d283885b69d4f11daacfd667acec691220cfc22d3abbbad557739a38da51",
"Data/patch-ZZZZZB.MPQ": "07146bfd6501d3022133bf661786f1061e57393993b79b6115b12ddc77e9946c",
"Data/patch-ZZZZZC.MPQ": "94b21941edef2e81b4461716f8945d7b19e8f0fb09071f4b777c26d9dccd2670",
"Data/patch-ZZZZZM.MPQ": "cebe58e8c25192593afeabab9e23ec2757de6811e944823350af709ba15b6ab8",
@@ -4813,7 +4813,25 @@
"Data/patch-ZZZZZV.MPQ": "f0a7c595575ae2bbb58b6c525fc61c613ae2960e9b76742c128a83247f6b240c",
"Data/patch-ZZZZZW.MPQ": "80d9288310710cb6a438621f95dfa22798f335a347b4a62c7cabd22a656b431b",
"Data/patch-ZZZZZX.MPQ": "775539db1818068f4d676cbcb7fb1f87f61f303f0952d9843e273fe105eba019",
"Data/patch-ZZZZZY-SUBMA.MPQ": "389255c799b27a8c82d2f39911433cc3e91c4f4ad1f244cccc9661ccb1dc82a2",
"Data/patch-ZZZZZY-SUBVA.MPQ": "93c6aad4289ade86eee6c49377d21f34b7b29fa92edb31bb1798df9cc66b1494",
"Data/patch-ZZZZZY-SUBVB.MPQ": "ea1d10a77c84dae77f137ff7307bc00e27891ee873789a58ddf924681e0ada5b",
"Data/patch-ZZZZZY-SUBVC.MPQ": "23b02a87cde6a443046de12ac13fc7b1ea3e1a74e7f5ce3723292da24ff3f099",
"Data/patch-ZZZZZY-SUBXA-HD.MPQ": "19c88cd704511375ee98730d05e9aded49894c9497d9ee2ad7823028b0104668",
"Data/patch-ZZZZZY-SUBXB-HD.MPQ": "7fb6172edd64f6fc27816964d0ed13ba351afc9c07b2920564a5d41694e5ae1b",
"Data/patch-ZZZZZY-SUBXC-HD.MPQ": "765a0158bc501c435b828e64923f06f981a1408ea27b42a38b9ea2b467dcd54f",
"Data/patch-ZZZZZY.MPQ": "05b8cbd7a45cc9933a84ee991ff3193063cb2d040296843b947e190e8c64e741",
"Data/patch-ZZZZZZ.MPQ": "b3f95a34f2c5d2157f54191124e864db4d2cb559156d2b7fccb119d9ae247ec8",
"Data/patch-ZZZZZZA.MPQ": "2c8f9caef8e3f3cf33b9b35bf5782123b4759a8fecb92a326be59d2f918608f7",
"Data/patch-ZZZZZZB.MPQ": "cb3107c155b57e6b77e92d881be3f2113a5401c101be185175d06b0a7ffdf6ab",
"Data/patch-ZZZZZZC.MPQ": "0fbd43a7208a11ee02a2ed31ed1da90bf4240074e7e508ed801f20de50e697d4",
"Data/patch-ZZZZZZD.MPQ": "53f4dac665280030ac8764cd2b45fc8ff65c5e85981b3f3ddcff34d5bc8d3c7f",
"Data/patch-ZZZZZZE.MPQ": "64fb42fc12367bc0b8b95489315c882d36c195c90732bd5a8ed449f7373653cf",
"Data/patch-retail-001.mpq": "1b0fafbdc6d01b92b5f09566f05510361972879a0407a79c03d1146f3440b764",
"Data/patch-retail-002.mpq": "6802c1c9530a9fb4107fd56bf18185484257cda69ead36a170ab557cea5b64d3",
"Data/patch-retail-003.mpq": "ae3f030fdb0b340a420ee9a3f027c47798e2646ab73bcac62b6f6b6c8589ca9b",
"Data/patch-retail-004.mpq": "ed857958adcf96266d25c2ab2da882359fc302d9d2f2da9032010061a0ca0a37",
"Data/patch-retail-005.mpq": "4fb237c92ccfccb7de90ff3ef184d04edb08dfda0ed2b2f16de802dff0455a5e",
"EsteriaAppearance.bin": "90d9cfaeaf6de10f014f1d1610ea10453ec9b240255759aea99513cac488a3ec",
"EsteriaAppearance.dll": "88e268d3be9eca3b0644f543d823f4bdcc04a9700a6e8ed73fd2a1260ad191af",
"EsteriaAppearanceGeometry.bin": "cacd2086eabf43391bca07b622e17444de91b30593827e9e1e54758fe4dcd8e7",
@@ -4894,17 +4912,22 @@
"EsteriaVulperaTextures.bin": "1ab844e74684aced2b069f1b91cd563aade45e05bd5e23f866a6c0c301cb098e",
"EsteriaWretched.bin": "a407b49ef55e6d76411bee2f522a2087b3571e8ec5d12b630a859cdbcdbde890",
"EsteriaWretchedTextures.bin": "837774377ca055e6a5c79c1a4cfd8151e7c1f7ce2c16990b00fd445281137433",
"Interface/AddOns/Ascension_Subclass/Ascension_Subclass.lua": "30710edd3d3bbdf393c6665850bd022f5cabffa58ae66bd1476769799635c7a0",
"Interface/AddOns/Ascension_Subclass/Ascension_Subclass.toc": "9498ac1dd7f810d3314b0bf4a2404c3f49df9825b73469952a72c28c2419ff7c",
"Interface/AddOns/Ascension_Subclass/Ascension_Subclass.lua": "b769f6c64d93c5e1850456782cfaebca073e97ad23fbf5e6b0068a58399d64ad",
"Interface/AddOns/Ascension_Subclass/Ascension_Subclass.toc": "c840e4396adb66534586f5d55ee58586d0f2343108383322e6de5bbbceee563c",
"Interface/AddOns/Ascension_Subclass/Bindings.xml": "cd057da400c0d40277ca5b310f021b78ac2b4e95b6a9445460b8651fffa83b8e",
"Interface/AddOns/Ascension_Subclass/SubclassBar.lua": "c3b809a024780ba7fac3689b329dc3b906aa046ede233fc5ef522a029d7ed2fe",
"Interface/AddOns/Ascension_Subclass/SubclassBar.lua": "af91304e5628d6e0327dfa2472fcbf9ad317ee32ca7777b3c09cfe60062174fe",
"Interface/AddOns/Ascension_Subclass/SubclassBonk.lua": "3cdc86792529c75d4186accaa1ed5b8a7541c17b0b9a022cf3ebdadf802b4c54",
"Interface/AddOns/Ascension_Subclass/SubclassCarry.lua": "e915f4a2e52f0d417e46654d5e5d438cc258be429661018c0155c4cd007aacb9",
"Interface/AddOns/Ascension_Subclass/SubclassCastBar.lua": "395ccda4bc0733cfa34dd506a2578ae73867305b5cd09dc988ff615a7d8a1e78",
"Interface/AddOns/Ascension_Subclass/SubclassChoices.lua": "3e313f30eade45b32c7827d8e045ed74ff05ff5fb9263d8f28e4c6c98ad74288",
"Interface/AddOns/Ascension_Subclass/SubclassGlow.lua": "c9a4c900c97a4f215f00ed3fd3c703058522c4f5180d8c4dd76e60b1611e0366",
"Interface/AddOns/Ascension_Subclass/SubclassNodes.lua": "cdc91d73d066664133bc3f621c4994360474486bd6ffe1bc96964bfc35faf2c7",
"Interface/AddOns/Ascension_Subclass/SubclassOrbs.lua": "cc29fbabe955cdd994d0f3281dff758ea4146dbe5fd6e65e0ad87b8b5fd2238e",
"Interface/AddOns/Ascension_Subclass/SubclassOrbs.lua": "e4d337628d267f338846b5d0aefe5204de91e1dec6d933a4bca208eccfdf0052",
"Interface/AddOns/Ascension_Subclass/SubclassPairs.lua": "670b67e6fc400ead68ef0324172467219e14342dce9b9015e674414d1a6efc5d",
"Interface/AddOns/Ascension_Subclass/SubclassPetBar.lua": "ab487a1b2eabef221a2c23eb8e3f52dfb90194a75db46c88c006e3fad3ac5926",
"Interface/AddOns/Ascension_Subclass/SubclassPowerBar.lua": "609819307864810cdc36bb52305ab0525094466e5e2be135d96c878081cf69f6",
"Interface/AddOns/Ascension_Subclass/SubclassRaceBackground.lua": "b63fa918438386a0c1cd861b4655785cd63b1089e721c6e3bd9585e372950b68",
"Interface/AddOns/Ascension_Subclass/SubclassRaceBackground.lua": "d38352928ee3e546eaa25c77e0e961ddfe1bd383020904f84907a4b3f5fce132",
"Interface/AddOns/Ascension_Subclass/Textures/IceFrame.tga": "91cefa31a6f32a847c888651bc3f90a2a91fb07b7a33c74bf8090efc92d22705",
"Interface/AddOns/CoAHideArmor/CoAHideArmor.lua": "8c1c7403524fc9bd56c0809b4101b141da700ba163701209bf1420f2ef106aa7",
"Interface/AddOns/CoAHideArmor/CoAHideArmor.toc": "123580d92fd5ceee258e96296f42c359b7e83cdff151af49c50c6c4e2059677c",
"Interface/AddOns/CoAQuestSafe/CoAQuestSafe.lua": "062de55c91228971553f482fd2c8753f4752993b4e8e49d4ded04fa18b98bde7",
File diff suppressed because it is too large. Load diff
+169 -21
View File
@@ -5,7 +5,7 @@
use std::path::{Path, PathBuf};
use std::time::Duration;
use chrono::{Local, NaiveDateTime, NaiveTime, Timelike};
use chrono::{Datelike, Local, NaiveDateTime, NaiveTime, Timelike};
use serde::{Deserialize, Serialize};
use crate::error::{Error, Result};
@@ -20,14 +20,53 @@ const LATE: Duration = Duration::from_secs(15 * 60);
/// A world that has not come back within this time no longer counts as restarting.
const UNDER_WAY_LIMIT: Duration = Duration::from_secs(45 * 60);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
#[serde(rename_all = "lowercase")]
pub enum Weekday {
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
#[default]
Sunday,
}
impl Weekday {
fn to_chrono(self) -> chrono::Weekday {
match self {
Self::Monday => chrono::Weekday::Mon,
Self::Tuesday => chrono::Weekday::Tue,
Self::Wednesday => chrono::Weekday::Wed,
Self::Thursday => chrono::Weekday::Thu,
Self::Friday => chrono::Weekday::Fri,
Self::Saturday => chrono::Weekday::Sat,
Self::Sunday => chrono::Weekday::Sun,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct DueRestart {
pub moment: NaiveDateTime,
pub warning_minutes: u32,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(rename_all = "camelCase", default)]
pub struct RestartSchedule {
pub enabled: bool,
/// Local time, `HH:MM`.
pub time: String,
/// The in-game countdown before the restart, in minutes (1-60).
pub warning_minutes: u32,
pub weekly_enabled: bool,
pub weekly_day: Weekday,
/// Local time for weekly restart, `HH:MM`.
pub weekly_time: String,
/// The in-game countdown before the weekly restart, in minutes (1-60).
pub weekly_warning_minutes: u32,
}
impl Default for RestartSchedule {
@@ -36,35 +75,72 @@ impl Default for RestartSchedule {
enabled: false,
time: "05:00".into(),
warning_minutes: 5,
weekly_enabled: false,
weekly_day: Weekday::Sunday,
weekly_time: "05:00".into(),
weekly_warning_minutes: 5,
}
}
}
impl RestartSchedule {
fn at(&self) -> Option<NaiveTime> {
NaiveTime::parse_from_str(self.time.trim(), "%H:%M").ok()
fn parse_time(text: &str) -> Option<NaiveTime> {
NaiveTime::parse_from_str(text.trim(), "%H:%M").ok()
}
fn validate(&self) -> Result<()> {
if self.at().is_none() {
fn validate_entry(time: &str, warning_minutes: u32) -> Result<()> {
if Self::parse_time(time).is_none() {
return Err(Error::Invalid("The restart time must be HH:MM, for example 05:00.".into()));
}
if !(1..=60).contains(&self.warning_minutes) {
if !(1..=60).contains(&warning_minutes) {
return Err(Error::Invalid("The restart warning must be 1 to 60 minutes.".into()));
}
Ok(())
}
/// The scheduled moment of `now`'s day, when a restart is due at `now` for a world started at `started`:
/// the moment has passed by less than [`LATE`] and the world was already running before it.
pub fn due(&self, now: NaiveDateTime, started: NaiveDateTime) -> Option<NaiveDateTime> {
if !self.enabled {
return None;
fn validate(&self) -> Result<()> {
if self.enabled {
Self::validate_entry(&self.time, self.warning_minutes)?;
}
let moment = now.date().and_time(self.at()?);
if self.weekly_enabled {
Self::validate_entry(&self.weekly_time, self.weekly_warning_minutes)?;
}
Ok(())
}
fn due_at(time_str: &str, now: NaiveDateTime, started: NaiveDateTime) -> Option<NaiveDateTime> {
let at = Self::parse_time(time_str)?;
let moment = now.date().and_time(at);
let late = now.signed_duration_since(moment).to_std().ok()?;
(late <= LATE && started < moment).then_some(moment)
}
/// The scheduled moment of `now`'s day, when a daily or weekly restart is due at `now` for a world started at `started`:
/// the moment has passed by less than [`LATE`] and the world was already running before it.
pub fn due_restart(&self, now: NaiveDateTime, started: NaiveDateTime) -> Option<DueRestart> {
if self.weekly_enabled && now.weekday() == self.weekly_day.to_chrono() {
if let Some(moment) = Self::due_at(&self.weekly_time, now, started) {
return Some(DueRestart {
moment,
warning_minutes: self.weekly_warning_minutes,
});
}
}
if self.enabled {
if let Some(moment) = Self::due_at(&self.time, now, started) {
return Some(DueRestart {
moment,
warning_minutes: self.warning_minutes,
});
}
}
None
}
/// The scheduled moment of `now`'s day, when a restart is due at `now` for a world started at `started`.
pub fn due(&self, now: NaiveDateTime, started: NaiveDateTime) -> Option<NaiveDateTime> {
self.due_restart(now, started).map(|d| d.moment)
}
}
/// The folder whose schedule a world follows: an extra world (`<server>/.realms/<name>`) follows its server's.
@@ -84,11 +160,14 @@ pub fn load(root: &Path) -> RestartSchedule {
pub fn save(root: &Path, schedule: &RestartSchedule) -> Result<RestartSchedule> {
let mut schedule = schedule.clone();
schedule.time = schedule.time.trim().to_string();
if schedule.enabled {
schedule.validate()?;
} else if schedule.at().is_none() {
schedule.weekly_time = schedule.weekly_time.trim().to_string();
schedule.validate()?;
if !schedule.enabled && RestartSchedule::parse_time(&schedule.time).is_none() {
schedule.time = RestartSchedule::default().time;
}
if !schedule.weekly_enabled && RestartSchedule::parse_time(&schedule.weekly_time).is_none() {
schedule.weekly_time = RestartSchedule::default().weekly_time;
}
crate::fsx::atomic_write_json(&owner(root).join(FILE), &schedule)?;
Ok(schedule)
}
@@ -127,7 +206,7 @@ mod tests {
#[test]
fn a_restart_is_due_once_after_its_time_for_a_world_that_ran_before_it() {
let s = RestartSchedule { enabled: true, time: "05:00".into(), warning_minutes: 5 };
let s = RestartSchedule { enabled: true, time: "05:00".into(), warning_minutes: 5, ..RestartSchedule::default() };
let started = at("2026-11-14 20:00");
assert_eq!(s.due(at("2026-11-15 04:59"), started), None);
assert_eq!(s.due(at("2026-11-15 05:00"), started), Some(at("2026-11-15 05:00")));
@@ -140,19 +219,88 @@ mod tests {
assert_eq!(off.due(at("2026-11-15 05:00"), started), None);
}
#[test]
fn weekly_restart_triggers_only_on_configured_weekday_and_independently_of_daily() {
// 2026-11-15 is Sunday; 2026-11-16 is Monday.
let s = RestartSchedule {
enabled: false,
weekly_enabled: true,
weekly_day: Weekday::Sunday,
weekly_time: "04:00".into(),
weekly_warning_minutes: 15,
..RestartSchedule::default()
};
let started = at("2026-11-14 20:00");
assert_eq!(s.due_restart(at("2026-11-15 03:59"), started), None);
assert_eq!(
s.due_restart(at("2026-11-15 04:05"), started),
Some(DueRestart { moment: at("2026-11-15 04:00"), warning_minutes: 15 })
);
// Monday does not trigger Sunday's weekly restart.
assert_eq!(s.due_restart(at("2026-11-16 04:05"), started), None);
// Both daily and weekly enabled: each triggers on its own schedule.
let both = RestartSchedule { enabled: true, time: "05:00".into(), warning_minutes: 5, ..s };
assert_eq!(
both.due_restart(at("2026-11-15 04:05"), started),
Some(DueRestart { moment: at("2026-11-15 04:00"), warning_minutes: 15 })
);
assert_eq!(
both.due_restart(at("2026-11-15 05:02"), at("2026-11-15 04:16")),
Some(DueRestart { moment: at("2026-11-15 05:00"), warning_minutes: 5 })
);
}
#[test]
fn schedules_are_validated_and_extra_worlds_follow_their_server() {
let d = tempfile::tempdir().unwrap();
assert_eq!(load(d.path()), RestartSchedule::default());
let bad = RestartSchedule { enabled: true, time: "25:00".into(), warning_minutes: 5 };
let bad = RestartSchedule { enabled: true, time: "25:00".into(), warning_minutes: 5, ..RestartSchedule::default() };
assert!(save(d.path(), &bad).is_err());
let quiet = RestartSchedule { enabled: true, time: "05:00".into(), warning_minutes: 0 };
let quiet = RestartSchedule { enabled: true, time: "05:00".into(), warning_minutes: 0, ..RestartSchedule::default() };
assert!(save(d.path(), &quiet).is_err());
let good = RestartSchedule { enabled: true, time: " 04:30 ".into(), warning_minutes: 10 };
assert_eq!(save(d.path(), &good).unwrap().time, "04:30");
let bad_weekly = RestartSchedule {
weekly_enabled: true,
weekly_time: "99:00".into(),
..RestartSchedule::default()
};
assert!(save(d.path(), &bad_weekly).is_err());
let quiet_weekly = RestartSchedule {
weekly_enabled: true,
weekly_warning_minutes: 61,
..RestartSchedule::default()
};
assert!(save(d.path(), &quiet_weekly).is_err());
let good = RestartSchedule {
enabled: true,
time: " 04:30 ".into(),
warning_minutes: 10,
weekly_enabled: true,
weekly_day: Weekday::Wednesday,
weekly_time: " 03:15 ".into(),
weekly_warning_minutes: 20,
};
let saved = save(d.path(), &good).unwrap();
assert_eq!(saved.time, "04:30");
assert_eq!(saved.weekly_time, "03:15");
assert_eq!(saved.weekly_day, Weekday::Wednesday);
let extra = d.path().join(".realms/secondary");
std::fs::create_dir_all(&extra).unwrap();
assert!(load(&extra).enabled);
assert!(load(&extra).weekly_enabled);
// Legacy schedule JSON without weekly fields loads cleanly with defaults.
std::fs::write(
d.path().join(FILE),
r#"{"enabled":true,"time":"06:00","warningMinutes":10}"#,
)
.unwrap();
let legacy = load(d.path());
assert!(legacy.enabled);
assert_eq!(legacy.time, "06:00");
assert!(!legacy.weekly_enabled);
assert_eq!(legacy.weekly_day, Weekday::Sunday);
assert!(!under_way(d.path()));
mark_under_way(d.path()).unwrap();
assert!(under_way(d.path()));
+17 -3
View File
@@ -174,7 +174,13 @@ fn spawn_relay(root: &Path, launcher: Option<&Path>) -> Result<Proc> {
pub fn watch_world(root: &Path, launcher: Option<&Path>, offset: i32, log: Progress) -> Result<()> {
squid::validate_bots(root)?;
let mut relay: Option<Proc> = None;
let mut last_log_clean = Instant::now();
loop {
if let Some(report) = crate::server_logging::auto_clean_if_needed(root) {
if report.freed_bytes > 0 {
log(&format!("Auto-cleaned server logs ({} MB freed).", report.freed_bytes / (1024 * 1024)));
}
}
let world = spawn_child(root, "world", &root.join("Core/worldserver.exe"), &["-c", "configs/worldserver.conf"], &root.join("Core"), &root.join("Core/Logs/world-console.log"))?;
let started = schedule::now();
let mut requested = false;
@@ -204,8 +210,8 @@ pub fn watch_world(root: &Path, launcher: Option<&Path>, offset: i32, log: Progr
}
if !requested {
let plan = schedule::load(root);
if plan.due(schedule::now(), started).is_some() {
let seconds = plan.warning_minutes * 60;
if let Some(due) = plan.due_restart(schedule::now(), started) {
let seconds = due.warning_minutes * 60;
let asked = Settings::load(root, offset).and_then(|cfg| {
crate::ra::Ra::connect_to(cfg.ra_port, &cfg.ra_username, &cfg.ra_password)
.and_then(|mut ra| ra.run(&format!("server restart {seconds}")))
@@ -214,12 +220,20 @@ pub fn watch_world(root: &Path, launcher: Option<&Path>, offset: i32, log: Progr
Ok(_) => {
schedule::mark_under_way(root)?;
requested = true;
log(&format!("Scheduled restart: the world restarts in {} minutes.", plan.warning_minutes));
log(&format!("Scheduled restart: the world restarts in {} minutes.", due.warning_minutes));
}
Err(e) => log(&format!("Scheduled restart could not be requested ({e}); retrying.")),
}
}
}
if last_log_clean.elapsed() >= Duration::from_secs(300) {
last_log_clean = Instant::now();
if let Some(report) = crate::server_logging::auto_clean_if_needed(root) {
if report.freed_bytes > 0 {
log(&format!("Auto-cleaned server logs ({} MB freed).", report.freed_bytes / (1024 * 1024)));
}
}
}
}
std::thread::sleep(Duration::from_secs(2));
};
+265 -1
View File
@@ -1,4 +1,9 @@
use std::{fs, path::Path};
use std::{
fs,
path::{Path, PathBuf},
};
use serde::{Deserialize, Serialize};
use crate::{
config::{parser::ConfFile, Scope},
@@ -6,6 +11,213 @@ use crate::{
fsx,
};
const SETTINGS_FILE: &str = "Settings/log-settings.json";
const DEFAULT_MAX_SIZE_MB: u64 = 500;
const MIN_MAX_SIZE_MB: u64 = 10;
const MAX_MAX_SIZE_MB: u64 = 100_000;
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase", default)]
pub struct LogSettings {
pub auto_cleanup: bool,
pub max_size_mb: u64,
}
impl Default for LogSettings {
fn default() -> Self {
Self {
auto_cleanup: false,
max_size_mb: DEFAULT_MAX_SIZE_MB,
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CleanLogsReport {
pub freed_bytes: u64,
pub remaining_bytes: u64,
pub deleted_files: u64,
pub skipped_files: u64,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ServerLoggingView {
pub preset: Option<String>,
pub log_bytes: u64,
pub settings: LogSettings,
}
fn owner(root: &Path) -> PathBuf {
if crate::launcher::settings::is_extra_world(root) {
if let Some(main) = root.parent().and_then(Path::parent) {
return main.to_path_buf();
}
}
root.to_path_buf()
}
pub fn load_settings(root: &Path) -> LogSettings {
let mut settings: LogSettings =
fsx::read_json(&owner(root).join(SETTINGS_FILE)).unwrap_or_default();
if settings.max_size_mb < MIN_MAX_SIZE_MB || settings.max_size_mb > MAX_MAX_SIZE_MB {
settings.max_size_mb = DEFAULT_MAX_SIZE_MB;
}
settings
}
pub fn save_settings(root: &Path, settings: &LogSettings) -> Result<LogSettings> {
let mut settings = settings.clone();
if settings.auto_cleanup {
if !(MIN_MAX_SIZE_MB..=MAX_MAX_SIZE_MB).contains(&settings.max_size_mb) {
return Err(Error::Invalid(format!(
"Log auto-cleanup threshold must be between {MIN_MAX_SIZE_MB} and {MAX_MAX_SIZE_MB} MB."
)));
}
} else if !(MIN_MAX_SIZE_MB..=MAX_MAX_SIZE_MB).contains(&settings.max_size_mb) {
settings.max_size_mb = DEFAULT_MAX_SIZE_MB;
}
fsx::atomic_write_json(&owner(root).join(SETTINGS_FILE), &settings)?;
Ok(settings)
}
pub fn detect_preset(root: &Path) -> Option<String> {
let candidates = [
root.join("Core/configs/worldserver.conf"),
root.join("Settings/worldserver.conf.template"),
];
for path in candidates {
let Ok(bytes) = fs::read(&path) else {
continue;
};
let Ok(conf) = ConfFile::parse_bytes(&bytes) else {
continue;
};
let found = conf
.entries()
.find(|(k, _)| *k == "Logger.root")
.and_then(|(_, value)| {
value
.split(',')
.next()
.map(str::trim)
.and_then(|s| s.parse::<u32>().ok())
});
if let Some(level) = found {
return match level {
0 => Some("off".into()),
2 => Some("errors".into()),
4 => Some("normal".into()),
_ => None,
};
}
}
None
}
fn log_dirs(root: &Path) -> Vec<PathBuf> {
let base = owner(root);
let mut dirs = Vec::new();
for prefix in ["", ".realms/secondary/", ".realms/reborn/"] {
let candidate = base.join(format!("{prefix}Core/Logs"));
if let Ok(checked) = fsx::ensure_within(&base, &candidate) {
if checked.is_dir() {
dirs.push(checked);
}
}
}
dirs
}
fn measure_dir(dir: &Path) -> u64 {
let Ok(entries) = fs::read_dir(dir) else {
return 0;
};
let mut total = 0u64;
for entry in entries.flatten() {
let path = entry.path();
let Ok(meta) = entry.metadata() else {
continue;
};
if meta.is_dir() {
total = total.saturating_add(measure_dir(&path));
} else if meta.is_file() {
total = total.saturating_add(meta.len());
}
}
total
}
pub fn measure_logs(root: &Path) -> u64 {
log_dirs(root)
.into_iter()
.fold(0u64, |acc, dir| acc.saturating_add(measure_dir(&dir)))
}
fn clean_dir(dir: &Path, report: &mut CleanLogsReport, remove_empty_dir: bool) {
let Ok(entries) = fs::read_dir(dir) else {
return;
};
for entry in entries.flatten() {
let path = entry.path();
let Ok(meta) = entry.metadata() else {
continue;
};
if meta.is_dir() {
clean_dir(&path, report, true);
} else if meta.is_file() {
let size = meta.len();
match fs::remove_file(&path) {
Ok(()) => {
report.freed_bytes = report.freed_bytes.saturating_add(size);
report.deleted_files = report.deleted_files.saturating_add(1);
}
Err(_) => {
report.remaining_bytes = report.remaining_bytes.saturating_add(size);
report.skipped_files = report.skipped_files.saturating_add(1);
}
}
}
}
if remove_empty_dir {
let _ = fs::remove_dir(dir);
}
}
pub fn clean_logs(root: &Path) -> Result<CleanLogsReport> {
let mut report = CleanLogsReport {
freed_bytes: 0,
remaining_bytes: 0,
deleted_files: 0,
skipped_files: 0,
};
for dir in log_dirs(root) {
clean_dir(&dir, &mut report, false);
}
Ok(report)
}
pub fn auto_clean_if_needed(root: &Path) -> Option<CleanLogsReport> {
let settings = load_settings(root);
if !settings.auto_cleanup {
return None;
}
let limit = settings.max_size_mb.saturating_mul(1024 * 1024);
if measure_logs(root) <= limit {
return None;
}
clean_logs(root).ok()
}
pub fn state(root: &Path) -> ServerLoggingView {
ServerLoggingView {
preset: detect_preset(root),
log_bytes: measure_logs(root),
settings: load_settings(root),
}
}
fn transform(bytes: &[u8], preset: &str) -> Result<String> {
let level = match preset {
"normal" => 4,
@@ -162,4 +374,56 @@ mod tests {
assert_eq!(transform(normal.as_bytes(), "normal").unwrap(), normal);
assert!(transform(original, "unsupported").is_err());
}
#[test]
fn detects_preset_measures_and_cleans_logs_across_realms() {
let temp = tempfile::tempdir().unwrap();
let root = temp.path();
fs::create_dir_all(root.join("Core/configs")).unwrap();
fs::write(root.join("Core/configs/worldserver.conf"), "Logger.root=4,Console Server\n").unwrap();
assert_eq!(detect_preset(root).as_deref(), Some("normal"));
fs::write(root.join("Core/configs/worldserver.conf"), "Logger.root=0,Console Server\n").unwrap();
assert_eq!(detect_preset(root).as_deref(), Some("off"));
fs::write(root.join("Core/configs/worldserver.conf"), "Logger.root=2,Console Server\n").unwrap();
assert_eq!(detect_preset(root).as_deref(), Some("errors"));
fs::create_dir_all(root.join("Core/Logs/archive")).unwrap();
fs::create_dir_all(root.join(".realms/secondary/Core/Logs")).unwrap();
fs::write(root.join("Core/Logs/Server.log"), vec![b'a'; 1000]).unwrap();
fs::write(root.join("Core/Logs/archive/old.log"), vec![b'b'; 500]).unwrap();
fs::write(root.join(".realms/secondary/Core/Logs/Server.log"), vec![b'c'; 250]).unwrap();
assert_eq!(measure_logs(root), 1750);
let report = clean_logs(root).unwrap();
assert_eq!(report.freed_bytes, 1750);
assert_eq!(report.remaining_bytes, 0);
assert_eq!(report.deleted_files, 3);
assert_eq!(report.skipped_files, 0);
assert_eq!(measure_logs(root), 0);
assert!(!root.join("Core/Logs/archive").exists());
}
#[test]
fn log_settings_validate_and_auto_clean_only_above_threshold() {
let temp = tempfile::tempdir().unwrap();
let root = temp.path();
assert_eq!(load_settings(root), LogSettings::default());
assert!(save_settings(root, &LogSettings { auto_cleanup: true, max_size_mb: 5 }).is_err());
let saved = save_settings(root, &LogSettings { auto_cleanup: true, max_size_mb: 10 }).unwrap();
assert!(saved.auto_cleanup);
assert_eq!(saved.max_size_mb, 10);
fs::create_dir_all(root.join("Core/Logs")).unwrap();
fs::write(root.join("Core/Logs/Server.log"), vec![b'x'; 1024]).unwrap();
// 1 KB < 10 MB: does not clean.
assert!(auto_clean_if_needed(root).is_none());
assert_eq!(measure_logs(root), 1024);
// Threshold check helper: writing > 10 MB triggers cleanup.
let over = vec![b'y'; 10 * 1024 * 1024 + 1];
fs::write(root.join("Core/Logs/Big.log"), over).unwrap();
let cleaned = auto_clean_if_needed(root).unwrap();
assert!(cleaned.freed_bytes > 10 * 1024 * 1024);
assert_eq!(measure_logs(root), 0);
}
}
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "coa-server-manager",
"version": "0.9.14",
"version": "0.9.15",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "coa-server-manager",
"version": "0.9.14",
"version": "0.9.15",
"dependencies": {
"@tauri-apps/api": "^2.12.0",
"@tauri-apps/plugin-dialog": "^2.8.0",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "coa-server-manager",
"private": true,
"version": "0.9.14",
"version": "0.9.15",
"license": "AGPL-3.0-only",
"type": "module",
"scripts": {
+36
View File
@@ -758,6 +758,15 @@ async fn get_settings(
blocking(move || config::load(&root, scope)).await
}
#[tauri::command]
async fn server_logging_state(
state: State<'_, AppState>,
id: String,
) -> std::result::Result<coa_core::server_logging::ServerLoggingView, UiError> {
let root = path_of(&state, &id)?;
blocking(move || Ok(coa_core::server_logging::state(&root))).await
}
#[tauri::command]
async fn server_logging_preset(
state: State<'_, AppState>,
@@ -772,6 +781,30 @@ async fn server_logging_preset(
}).await
}
#[tauri::command]
async fn server_logging_settings_save(
state: State<'_, AppState>,
id: String,
settings: coa_core::server_logging::LogSettings,
) -> std::result::Result<coa_core::server_logging::ServerLoggingView, UiError> {
let root = path_of(&state, &id)?;
let _guard = BusyGuard::acquire(&state, &id)?;
blocking(move || {
coa_core::server_logging::save_settings(&root, &settings)?;
Ok(coa_core::server_logging::state(&root))
}).await
}
#[tauri::command]
async fn server_logs_clean(
state: State<'_, AppState>,
id: String,
) -> std::result::Result<coa_core::server_logging::CleanLogsReport, UiError> {
let root = path_of(&state, &id)?;
let _guard = BusyGuard::acquire(&state, &id)?;
blocking(move || coa_core::server_logging::clean_logs(&root)).await
}
#[tauri::command]
async fn save_settings(
state: State<'_, AppState>,
@@ -3247,7 +3280,10 @@ pub fn run() {
.plugin(tauri_plugin_updater::Builder::new().build())
.plugin(tauri_plugin_process::init())
.invoke_handler(tauri::generate_handler![
server_logging_state,
server_logging_preset,
server_logging_settings_save,
server_logs_clean,
release_history,
default_install_dir,
game_data_folder,
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "CoA Server Manager",
"version": "0.9.14",
"version": "0.9.15",
"identifier": "com.coa.servermanager",
"build": {
"beforeDevCommand": "npm run dev",
+2 -1
View File
@@ -45,7 +45,8 @@ export {};
if(cmd==="addons_list"||cmd==="addons_install"||cmd==="addons_remove"){const w=window as any;w.__addons=w.__addons??{dragonui:"old"};if(cmd==="addons_install"){await new Promise(r=>setTimeout(r,700));w.__addons[args.addon]="new";}if(cmd==="addons_remove")delete w.__addons[args.addon];return addonCatalog.addons.map((a:any)=>({id:a.id,name:a.name,description:a.description,author:a.author,license:a.license,needs:a.needs??null,repo:a.repo,size:a.files.reduce((s:number,f:any)=>s+f.size,0),installed:a.id in w.__addons,updateAvailable:w.__addons[a.id]==="old",foreignFolders:a.id==="coacombat"&&!(a.id in w.__addons)?["CoACombat"]:[],bundled:null as string|null})).concat([{id:"coa-dev-menu",name:"CoA Dev Menu",description:{en:"The in-game /dev editor for game masters.",ru:"Внутриигровой редактор /dev для гейм-мастеров. Ставится вместе с клиентским патчем Custom Races V2 и включается вместе с ним."},author:"ilusixn",license:"see repository",needs:null,repo:"https://github.com/ilusixn/ilusixn-dev-menu",size:0,installed:true,updateAvailable:false,foreignFolders:[],bundled:"custom-races"}]);}
if(cmd==="custom_race_characters") return {players:2,companionBots:14,squidBots:0};
if(cmd==="purge_custom_race_bots"){await new Promise(r=>setTimeout(r,500));return 14;}
if(cmd==="restart_schedule"||cmd==="restart_schedule_save"){const w=window as any;w.__sched=w.__sched??{enabled:false,time:"05:00",warningMinutes:5};if(cmd==="restart_schedule_save"){const s=args.schedule;if(s.enabled&&!/^([01]\d|2[0-3]):[0-5]\d$/.test(s.time))throw new Error("The restart time must be HH:MM, for example 05:00.");w.__sched={...s};}return {schedule:w.__sched,supported:true};}
if(cmd==="restart_schedule"||cmd==="restart_schedule_save"){const w=window as any;w.__sched=w.__sched??{enabled:false,time:"05:00",warningMinutes:5,weeklyEnabled:false,weeklyDay:"sunday",weeklyTime:"05:00",weeklyWarningMinutes:5};if(cmd==="restart_schedule_save"){const s=args.schedule;if(s.enabled&&!/^([01]\d|2[0-3]):[0-5]\d$/.test(s.time))throw new Error("The restart time must be HH:MM, for example 05:00.");if(s.weeklyEnabled&&!/^([01]\d|2[0-3]):[0-5]\d$/.test(s.weeklyTime))throw new Error("The restart time must be HH:MM, for example 05:00.");w.__sched={...s};}return {schedule:w.__sched,supported:true};}
if(cmd==="server_logging_state"||cmd==="server_logging_preset"||cmd==="server_logging_settings_save"||cmd==="server_logs_clean"){const w=window as any;w.__logs=w.__logs??{preset:"normal",logBytes:148*1024*1024,settings:{autoCleanup:false,maxSizeMb:500}};if(cmd==="server_logging_preset"){w.__logs.preset=args.preset;return;}if(cmd==="server_logging_settings_save"){w.__logs.settings={...args.settings};}if(cmd==="server_logs_clean"){const freed=w.__logs.logBytes;w.__logs.logBytes=0;return {freedBytes:freed,remainingBytes:0,deletedFiles:freed>0?3:0,skippedFiles:0};}return w.__logs;}
if(cmd==="mysql_custom"||cmd==="mysql_custom_save"){const w=window as any;if(cmd==="mysql_custom_save")w.__my=args.text;const text:string=w.__my??"";const applied=text.split("\n").map((l:string)=>l.trim()).filter((l:string)=>l&&!l.startsWith("#")&&!/^(port|datadir|basedir|bind[-_]address)\b/i.test(l)).map((l:string)=>l+"\n").join("");return {text,applied};}
if(cmd==="realm_names"||cmd==="realm_rename"){const w=window as any;w.__rn=w.__rn??{};const defs:[number,string][]=[[1,"Conquest of Azeroth"],[2,"Wildcard"]];if(cmd==="realm_rename"){await new Promise(r=>setTimeout(r,300));const n=(args.name??"").trim();if(n.length>32||n.includes('"'))throw new Error("The realm name can have at most 32 characters.");if(n)w.__rn[args.realmId]=n;else delete w.__rn[args.realmId];}return defs.map(([id,d])=>({id,name:w.__rn[id]??d,defaultName:d,custom:id in w.__rn}));}
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};
+16
View File
@@ -780,6 +780,15 @@ const de: Partial<Record<keyof typeof en, string>> = {
"mysql.applied": "Angewandte Optionen: {count}",
"sched.title": "Geplanter Neustart",
"sched.enable": "Die Welt jeden Tag neu starten",
"sched.weeklyEnable": "Die Welt jede Woche neu starten",
"sched.day": "Tag",
"sched.days.monday": "Montag",
"sched.days.tuesday": "Dienstag",
"sched.days.wednesday": "Mittwoch",
"sched.days.thursday": "Donnerstag",
"sched.days.friday": "Freitag",
"sched.days.saturday": "Samstag",
"sched.days.sunday": "Sonntag",
"sched.time": "Uhrzeit",
"sched.warning": "Vorwarnung (Minuten)",
"sched.hint": "Die Welt startet zu dieser Uhrzeit dieses Computers neu, mit einem Countdown im Spielchat; die Datenbank läuft weiter, Spieler melden sich danach wieder an. Ein laufender Server übernimmt die neue Zeit innerhalb einer Minute.",
@@ -1127,6 +1136,13 @@ const de: Partial<Record<keyof typeof en, string>> = {
"serverLogs.errors": "Nur Fehler",
"serverLogs.off": "Aus",
"serverLogs.saved": "Gespeichert. Zum Anwenden den Server neu starten.",
"serverLogs.autoClean": "Serverlogs nach Größe automatisch bereinigen",
"serverLogs.maxSize": "Max. Größe",
"serverLogs.autoCleanHint": "Löscht alte Logdateien, wenn Core/Logs diese Größe überschreitet (geprüft beim Start der Welt und regelmäßig während des Betriebs).",
"serverLogs.currentSize": "Aktuelle Loggröße: {size}",
"serverLogs.cleanNow": "Logs bereinigen ({size})",
"serverLogs.cleaned": "{freed} an Logs bereinigt.",
"serverLogs.skippedInUse": "{remaining} werden vom laufenden Server verwendet und konnten nicht entfernt werden.",
"mod.requiresSquid": "Aktivieren Sie SQUID-Bots, um Dungeon Clear zu verwenden.",
};
+16
View File
@@ -64,6 +64,15 @@ const en = {
"mysql.applied": "Options applied: {count}",
"sched.title": "Scheduled restart",
"sched.enable": "Restart the world every day",
"sched.weeklyEnable": "Restart the world every week",
"sched.day": "Day",
"sched.days.monday": "Monday",
"sched.days.tuesday": "Tuesday",
"sched.days.wednesday": "Wednesday",
"sched.days.thursday": "Thursday",
"sched.days.friday": "Friday",
"sched.days.saturday": "Saturday",
"sched.days.sunday": "Sunday",
"sched.time": "Time",
"sched.warning": "Warning (minutes)",
"sched.hint": "The world restarts at this time of this computer with a countdown in the game chat; the database keeps running and players log in again after it. A minute after saving, the running server follows the new time.",
@@ -1337,6 +1346,13 @@ const en = {
"serverLogs.errors": "Errors only",
"serverLogs.off": "Off",
"serverLogs.saved": "Saved. Restart the server to apply.",
"serverLogs.autoClean": "Auto-clean server logs by size",
"serverLogs.maxSize": "Max size",
"serverLogs.autoCleanHint": "Clears old log files when Core/Logs exceeds this size (checked on world start and periodically while running).",
"serverLogs.currentSize": "Current log size: {size}",
"serverLogs.cleanNow": "Clean logs ({size})",
"serverLogs.cleaned": "Cleaned {freed} of logs.",
"serverLogs.skippedInUse": "{remaining} in use by the running server could not be removed.",
"mod.requiresSquid": "Enable SQUID bots to use Dungeon Clear.",
} as const;
+16
View File
@@ -780,6 +780,15 @@ const es: Partial<Record<keyof typeof en, string>> = {
"mysql.applied": "Opciones aplicadas: {count}",
"sched.title": "Reinicio programado",
"sched.enable": "Reiniciar el mundo cada día",
"sched.weeklyEnable": "Reiniciar el mundo cada semana",
"sched.day": "Día",
"sched.days.monday": "Lunes",
"sched.days.tuesday": "Martes",
"sched.days.wednesday": "Miércoles",
"sched.days.thursday": "Jueves",
"sched.days.friday": "Viernes",
"sched.days.saturday": "Sábado",
"sched.days.sunday": "Domingo",
"sched.time": "Hora",
"sched.warning": "Aviso (minutos)",
"sched.hint": "El mundo se reinicia a esta hora de este ordenador con una cuenta atrás en el chat del juego; la base de datos sigue en marcha y los jugadores vuelven a entrar después. Un servidor en marcha sigue la nueva hora en menos de un minuto.",
@@ -1127,6 +1136,13 @@ const es: Partial<Record<keyof typeof en, string>> = {
"serverLogs.errors": "Solo errores",
"serverLogs.off": "Desactivados",
"serverLogs.saved": "Guardado. Reinicia el servidor para aplicar los cambios.",
"serverLogs.autoClean": "Limpiar automáticamente los registros del servidor por tamaño",
"serverLogs.maxSize": "Tamaño máx.",
"serverLogs.autoCleanHint": "Borra los archivos de registro antiguos cuando Core/Logs supera este tamaño (se comprueba al iniciar el mundo y periódicamente mientras funciona).",
"serverLogs.currentSize": "Tamaño actual de los registros: {size}",
"serverLogs.cleanNow": "Limpiar registros ({size})",
"serverLogs.cleaned": "Se limpiaron {freed} de registros.",
"serverLogs.skippedInUse": "{remaining} están en uso por el servidor en marcha y no se pudieron eliminar.",
"mod.requiresSquid": "Activa los bots SQUID para usar Dungeon Clear.",
};
+16
View File
@@ -780,6 +780,15 @@ const fr: Partial<Record<keyof typeof en, string>> = {
"mysql.applied": "Options appliquées : {count}",
"sched.title": "Redémarrage planifié",
"sched.enable": "Redémarrer le monde chaque jour",
"sched.weeklyEnable": "Redémarrer le monde chaque semaine",
"sched.day": "Jour",
"sched.days.monday": "Lundi",
"sched.days.tuesday": "Mardi",
"sched.days.wednesday": "Mercredi",
"sched.days.thursday": "Jeudi",
"sched.days.friday": "Vendredi",
"sched.days.saturday": "Samedi",
"sched.days.sunday": "Dimanche",
"sched.time": "Heure",
"sched.warning": "Avertissement (minutes)",
"sched.hint": "Le monde redémarre à cette heure de cet ordinateur avec un compte à rebours dans le chat du jeu ; la base de données continue de tourner et les joueurs se reconnectent ensuite. Un serveur en marche suit la nouvelle heure en moins d'une minute.",
@@ -1127,6 +1136,13 @@ const fr: Partial<Record<keyof typeof en, string>> = {
"serverLogs.errors": "Erreurs uniquement",
"serverLogs.off": "Désactivés",
"serverLogs.saved": "Enregistré. Redémarrez le serveur pour appliquer.",
"serverLogs.autoClean": "Nettoyer automatiquement les journaux du serveur selon leur taille",
"serverLogs.maxSize": "Taille max.",
"serverLogs.autoCleanHint": "Supprime les anciens fichiers journaux quand Core/Logs dépasse cette taille (vérifié au démarrage du monde et périodiquement pendant son fonctionnement).",
"serverLogs.currentSize": "Taille actuelle des journaux : {size}",
"serverLogs.cleanNow": "Nettoyer les journaux ({size})",
"serverLogs.cleaned": "{freed} de journaux nettoyés.",
"serverLogs.skippedInUse": "{remaining} sont utilisés par le serveur en cours et n’ont pas pu être supprimés.",
"mod.requiresSquid": "Activez les bots SQUID pour utiliser Dungeon Clear.",
};
+16
View File
@@ -67,6 +67,15 @@ const ru: Partial<Record<keyof typeof en, string>> = {
"mysql.applied": "Применяется параметров: {count}",
"sched.title": "Перезапуск по расписанию",
"sched.enable": "Перезапускать мир каждый день",
"sched.weeklyEnable": "Перезапускать мир каждую неделю",
"sched.day": "День",
"sched.days.monday": "Понедельник",
"sched.days.tuesday": "Вторник",
"sched.days.wednesday": "Среда",
"sched.days.thursday": "Четверг",
"sched.days.friday": "Пятница",
"sched.days.saturday": "Суббота",
"sched.days.sunday": "Воскресенье",
"sched.time": "Время",
"sched.warning": "Предупреждение (минуты)",
"sched.hint": "Мир перезапускается в это время этого компьютера, с обратным отсчётом в игровом чате; база данных продолжает работать, игроки заходят снова после перезапуска. Работающий сервер подхватывает новое время в течение минуты.",
@@ -1320,6 +1329,13 @@ const ru: Partial<Record<keyof typeof en, string>> = {
"serverLogs.errors": "Только ошибки",
"serverLogs.off": "Выключены",
"serverLogs.saved": "Сохранено. Перезапустите сервер для применения.",
"serverLogs.autoClean": "Автоочистка логов сервера по размеру",
"serverLogs.maxSize": "Макс. размер",
"serverLogs.autoCleanHint": "Очищает старые файлы логов при превышении порога в Core/Logs (проверяется при запуске мира и периодически во время работы).",
"serverLogs.currentSize": "Текущий размер логов: {size}",
"serverLogs.cleanNow": "Очистить логи ({size})",
"serverLogs.cleaned": "Очищено логов: {freed}.",
"serverLogs.skippedInUse": "{remaining} заняты работающим сервером и не были удалены.",
"mod.requiresSquid": "Для Dungeon Clear сначала включите SQUID bots.",
};
+16
View File
@@ -65,6 +65,15 @@ const zh = {
"mysql.applied": "生效的选项:{count}",
"sched.title": "定时重启",
"sched.enable": "每天重启世界",
"sched.weeklyEnable": "每周重启世界",
"sched.day": "星期",
"sched.days.monday": "星期一",
"sched.days.tuesday": "星期二",
"sched.days.wednesday": "星期三",
"sched.days.thursday": "星期四",
"sched.days.friday": "星期五",
"sched.days.saturday": "星期六",
"sched.days.sunday": "星期日",
"sched.time": "时间",
"sched.warning": "提前警告(分钟)",
"sched.hint": "世界会在本机的这个时间重启,并在游戏聊天中倒计时;数据库保持运行,玩家在重启后重新登录。正在运行的服务器会在一分钟内采用新时间。",
@@ -1129,6 +1138,13 @@ const zh = {
"serverLogs.errors": "仅错误",
"serverLogs.off": "关闭",
"serverLogs.saved": "已保存。重启服务器后生效。",
"serverLogs.autoClean": "按大小自动清理服务器日志",
"serverLogs.maxSize": "最大大小",
"serverLogs.autoCleanHint": "当 Core/Logs 超过此大小时清理旧日志文件(在世界启动时和运行期间定期检查)。",
"serverLogs.currentSize": "当前日志大小:{size}",
"serverLogs.cleanNow": "清理日志({size})",
"serverLogs.cleaned": "已清理 {freed} 日志。",
"serverLogs.skippedInUse": "{remaining} 正被运行中的服务器占用,无法删除。",
"mod.requiresSquid": "请先启用 SQUID 机器人,再使用 Dungeon Clear。",
} as const;
+16 -1
View File
@@ -60,8 +60,20 @@ export interface StatusView {
export type RealmMode = "coa" | "wildcard" | "reborn";
export interface CustomRaceCharacters { players: number; companionBots: number; squidBots: number }
export interface AddonView { id: string; name: string; description: Record<string, string>; author: string; license: string; needs: string | null; repo: string; size: number; installed: boolean; updateAvailable: boolean; foreignFolders: string[]; bundled?: string | null }
export interface RestartSchedule { enabled: boolean; time: string; warningMinutes: number }
export type Weekday = "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday";
export interface RestartSchedule {
enabled: boolean;
time: string;
warningMinutes: number;
weeklyEnabled: boolean;
weeklyDay: Weekday;
weeklyTime: string;
weeklyWarningMinutes: number;
}
export interface RestartScheduleView { schedule: RestartSchedule; supported: boolean }
export interface LogSettings { autoCleanup: boolean; maxSizeMb: number }
export interface CleanLogsReport { freedBytes: number; remainingBytes: number; deletedFiles: number; skippedFiles: number }
export interface ServerLoggingView { preset: "normal" | "errors" | "off" | null; logBytes: number; settings: LogSettings }
export interface CustomMysql { text: string; applied: string }
export interface RealmName { id: number; name: string; defaultName: string; custom: boolean }
export interface RealmProfiles { active: RealmMode; wildcard_created: boolean; reborn_created: boolean; reborn_supported: boolean; supported: boolean; recovery_pending: boolean; simultaneous: boolean; secondary_world_port: number | null; secondary_running: boolean; with_reborn: boolean; reborn_world_port: number | null; reborn_running: boolean }
@@ -530,7 +542,10 @@ export const api = {
forceStop: (id: string) => invoke<DriverOutcome>("force_stop_server", { id }),
stop: (id: string) => invoke<DriverOutcome>("stop_server", { id }),
settings: (id: string, scope: Scope) => invoke<SettingsView>("get_settings", { id, scope }),
serverLoggingState: (id: string) => invoke<ServerLoggingView>("server_logging_state", { id }),
serverLoggingPreset: (id: string, preset: "normal" | "errors" | "off") => invoke<void>("server_logging_preset", { id, preset }),
serverLoggingSettingsSave: (id: string, settings: LogSettings) => invoke<ServerLoggingView>("server_logging_settings_save", { id, settings }),
serverLogsClean: (id: string) => invoke<CleanLogsReport>("server_logs_clean", { id }),
save: (id: string, scope: Scope, changes: Record<string, JsonValue>) => invoke<SaveReport>("save_settings", { id, scope, changes }),
presets: (scope: Scope) => invoke<PresetInfo[]>("list_presets", { scope }),
backups: (id: string) => invoke<RecoveryPoint[]>("list_backups", { id }),
+42 -5
View File
@@ -1,14 +1,25 @@
import { useEffect, useState } from "react";
import { api, asUiError, type RestartSchedule } from "@/lib/api";
import { api, asUiError, type RestartSchedule, type Weekday } from "@/lib/api";
import { Card } from "@/components/ui/card";
import { Button } from "@/components/ui/button";
import { useT } from "@/i18n";
/** A daily world restart at a chosen local time, with an in-game countdown (#202). */
const WEEKDAYS: Weekday[] = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"];
const DEFAULT_SCHEDULE: RestartSchedule = {
enabled: false,
time: "05:00",
warningMinutes: 5,
weeklyEnabled: false,
weeklyDay: "sunday",
weeklyTime: "05:00",
weeklyWarningMinutes: 5,
};
/** Daily and weekly world restarts at chosen local times, with an in-game countdown (#202). */
export function RestartScheduleSettings({ serverId }: { serverId: string }) {
const t = useT();
const [saved, setSaved] = useState<RestartSchedule | null>(null);
const [draft, setDraft] = useState<RestartSchedule>({ enabled: false, time: "05:00", warningMinutes: 5 });
const [draft, setDraft] = useState<RestartSchedule>(DEFAULT_SCHEDULE);
const [supported, setSupported] = useState(true);
const [busy, setBusy] = useState(false);
const [done, setDone] = useState(false);
@@ -29,6 +40,8 @@ export function RestartScheduleSettings({ serverId }: { serverId: string }) {
const changed = !!saved && JSON.stringify(saved) !== JSON.stringify(draft);
const minutesOk = Number.isInteger(draft.warningMinutes) && draft.warningMinutes >= 1 && draft.warningMinutes <= 60;
const weeklyMinutesOk = Number.isInteger(draft.weeklyWarningMinutes) && draft.weeklyWarningMinutes >= 1 && draft.weeklyWarningMinutes <= 60;
const valid = (!draft.enabled || minutesOk) && (!draft.weeklyEnabled || weeklyMinutesOk);
const input = "rounded border border-line bg-bg px-2 py-1 text-sm text-ink outline-none focus:border-gold";
return <Card className="mt-6 p-6" aria-busy={busy}>
<h2 className="font-semibold">{t("sched.title")}</h2>
@@ -46,10 +59,34 @@ export function RestartScheduleSettings({ serverId }: { serverId: string }) {
<input type="number" min={1} max={60} step={1} className={`${input} w-20`} value={draft.warningMinutes} disabled={busy || !draft.enabled} onChange={e => { setDraft(d => ({ ...d, warningMinutes: Number(e.target.value) })); setDone(false); }} />
</label>
</div>
<p className="mt-2 text-sm text-muted">{t("sched.hint")}</p>
<div className="mt-4 border-t border-line pt-4">
<label className="flex cursor-pointer items-center gap-3">
<input type="checkbox" className="h-4 w-4 accent-[#c9a24a]" checked={draft.weeklyEnabled} disabled={busy || !saved} onChange={e => { setDraft(d => ({ ...d, weeklyEnabled: e.target.checked })); setDone(false); }} />
<span className="text-sm font-medium">{t("sched.weeklyEnable")}</span>
</label>
<div className="mt-3 flex flex-wrap items-center gap-4 text-sm">
<label className="flex items-center gap-2">
<span>{t("sched.day")}</span>
<select className={input} value={draft.weeklyDay} disabled={busy || !draft.weeklyEnabled} onChange={e => { setDraft(d => ({ ...d, weeklyDay: e.target.value as Weekday })); setDone(false); }}>
{WEEKDAYS.map(day => <option key={day} value={day}>{t(`sched.days.${day}`)}</option>)}
</select>
</label>
<label className="flex items-center gap-2">
<span>{t("sched.time")}</span>
<input type="time" className={input} value={draft.weeklyTime} disabled={busy || !draft.weeklyEnabled} onChange={e => { setDraft(d => ({ ...d, weeklyTime: e.target.value })); setDone(false); }} />
</label>
<label className="flex items-center gap-2">
<span>{t("sched.warning")}</span>
<input type="number" min={1} max={60} step={1} className={`${input} w-20`} value={draft.weeklyWarningMinutes} disabled={busy || !draft.weeklyEnabled} onChange={e => { setDraft(d => ({ ...d, weeklyWarningMinutes: Number(e.target.value) })); setDone(false); }} />
</label>
</div>
</div>
<p className="mt-3 text-sm text-muted">{t("sched.hint")}</p>
{!supported && <p className="mt-2 text-sm text-warn">{t("sched.unsupported")}</p>}
<div className="mt-3 flex items-center gap-3">
<Button size="sm" disabled={busy || !changed || (draft.enabled && !minutesOk)} onClick={() => void save()}>{t("sched.save")}</Button>
<Button size="sm" disabled={busy || !changed || !valid} onClick={() => void save()}>{t("sched.save")}</Button>
{done && <span className="text-xs text-muted">{t("sched.saved")}</span>}
</div>
{error && <p className="mt-3 text-sm text-bad" role="alert">{error}</p>}
+138 -9
View File
@@ -1,26 +1,155 @@
import { useState } from "react";
import { useEffect, useState } from "react";
import { Card } from "@/components/ui/card";
import { api, asUiError } from "@/lib/api";
import { Button } from "@/components/ui/button";
import { api, asUiError, type CleanLogsReport, type LogSettings, type ServerLoggingView } from "@/lib/api";
import { formatBytes } from "@/lib/utils";
import { useT } from "@/i18n";
const DEFAULT_LOG_SETTINGS: LogSettings = { autoCleanup: false, maxSizeMb: 500 };
export function ServerLoggingSettings({ serverId }: { serverId: string }) {
const t = useT();
const [view, setView] = useState<ServerLoggingView | null>(null);
const [draft, setDraft] = useState<LogSettings>(DEFAULT_LOG_SETTINGS);
const [busy, setBusy] = useState(false);
const [saved, setSaved] = useState(false);
const [autoSaved, setAutoSaved] = useState(false);
const [cleanReport, setCleanReport] = useState<CleanLogsReport | null>(null);
const [error, setError] = useState("");
async function apply(preset: "normal" | "errors" | "off") {
setBusy(true); setSaved(false); setError("");
try { await api.serverLoggingPreset(serverId, preset); setSaved(true); }
catch (error) { setError(asUiError(error).technical); }
finally { setBusy(false); }
useEffect(() => {
let alive = true;
void api.serverLoggingState(serverId)
.then(v => {
if (!alive) return;
setView(v);
setDraft(v.settings);
})
.catch(err => {
if (alive) setError(asUiError(err).technical);
});
return () => { alive = false; };
}, [serverId]);
async function refreshState() {
const v = await api.serverLoggingState(serverId);
setView(v);
setDraft(v.settings);
}
return <Card className="mt-6 p-6">
async function apply(preset: "normal" | "errors" | "off") {
setBusy(true); setSaved(false); setAutoSaved(false); setCleanReport(null); setError("");
try {
await api.serverLoggingPreset(serverId, preset);
await refreshState();
setSaved(true);
} catch (err) {
setError(asUiError(err).technical);
} finally {
setBusy(false);
}
}
async function saveAutoCleanup() {
setBusy(true); setSaved(false); setAutoSaved(false); setCleanReport(null); setError("");
try {
const v = await api.serverLoggingSettingsSave(serverId, draft);
setView(v);
setDraft(v.settings);
setAutoSaved(true);
} catch (err) {
setError(asUiError(err).technical);
} finally {
setBusy(false);
}
}
async function cleanNow() {
setBusy(true); setSaved(false); setAutoSaved(false); setCleanReport(null); setError("");
try {
const report = await api.serverLogsClean(serverId);
setCleanReport(report);
await refreshState();
} catch (err) {
setError(asUiError(err).technical);
} finally {
setBusy(false);
}
}
const changed = !!view && JSON.stringify(view.settings) !== JSON.stringify(draft);
const sizeOk = Number.isInteger(draft.maxSizeMb) && draft.maxSizeMb >= 10 && draft.maxSizeMb <= 100000;
const logBytes = view?.logBytes ?? 0;
const input = "rounded border border-line bg-bg px-2 py-1 text-sm text-ink outline-none focus:border-gold";
return <Card className="mt-6 p-6" aria-busy={busy}>
<h2 className="font-semibold">{t("serverLogs.title")}</h2>
<p className="mt-2 text-sm text-muted">{t("serverLogs.description")}</p>
<div className="mt-4 flex flex-wrap gap-2">
{(["normal", "errors", "off"] as const).map(preset => <button key={preset} disabled={busy} onClick={() => apply(preset)} className="rounded-md border border-line px-3 py-2 text-sm hover:bg-white/5 disabled:opacity-50">{t(`serverLogs.${preset}`)}</button>)}
{(["normal", "errors", "off"] as const).map(preset => {
const active = view?.preset === preset;
return <button
key={preset}
disabled={busy}
aria-pressed={active}
onClick={() => void apply(preset)}
className={`rounded-md border px-3 py-2 text-sm disabled:opacity-50 ${active ? "border-gold bg-gold/10 text-gold" : "border-line hover:bg-white/5"}`}
>
{t(`serverLogs.${preset}`)}
</button>;
})}
</div>
{saved && <p role="status" className="mt-3 text-sm text-ok">{t("serverLogs.saved")}</p>}
<div className="mt-5 border-t border-line pt-4">
<label className="flex cursor-pointer items-center gap-3">
<input
type="checkbox"
className="h-4 w-4 accent-[#c9a24a]"
checked={draft.autoCleanup}
disabled={busy || !view}
onChange={e => { setDraft(d => ({ ...d, autoCleanup: e.target.checked })); setAutoSaved(false); }}
/>
<span className="text-sm font-medium">{t("serverLogs.autoClean")}</span>
</label>
<div className="mt-3 flex flex-wrap items-center gap-3 text-sm">
<label className="flex items-center gap-2">
<span>{t("serverLogs.maxSize")}</span>
<input
type="number"
min={10}
max={100000}
step={10}
className={`${input} w-24`}
value={draft.maxSizeMb}
disabled={busy || !draft.autoCleanup}
onChange={e => { setDraft(d => ({ ...d, maxSizeMb: Number(e.target.value) })); setAutoSaved(false); }}
/>
<span className="text-muted">MB</span>
</label>
<Button size="sm" disabled={busy || !changed || (draft.autoCleanup && !sizeOk)} onClick={() => void saveAutoCleanup()}>
{t("sched.save")}
</Button>
{autoSaved && <span role="status" className="text-xs text-ok">{t("sched.saved")}</span>}
</div>
<p className="mt-2 text-xs text-muted">{t("serverLogs.autoCleanHint")}</p>
</div>
<div className="mt-5 flex flex-wrap items-center justify-between gap-3 border-t border-line pt-4">
<span className="text-sm text-muted">
{t("serverLogs.currentSize", { size: formatBytes(logBytes) })}
</span>
<Button size="sm" disabled={busy || !view || logBytes === 0} onClick={() => void cleanNow()}>
{t("serverLogs.cleanNow", { size: formatBytes(logBytes) })}
</Button>
</div>
{cleanReport && (
<p role="status" className="mt-3 text-sm text-ok">
{t("serverLogs.cleaned", { freed: formatBytes(cleanReport.freedBytes) })}
{cleanReport.skippedFiles > 0 && ` ${t("serverLogs.skippedInUse", { remaining: formatBytes(cleanReport.remainingBytes) })}`}
</p>
)}
{error && <p role="alert" className="mt-3 text-sm text-bad">{error}</p>}
</Card>;
}