mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-18 19:25:56 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65df660484 | ||
|
|
2defb7b002 | ||
|
|
e3fbb2e4b6 |
No files matched your search
@@ -6,6 +6,11 @@ on:
|
||||
push:
|
||||
tags: ['v*']
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
publish_release:
|
||||
description: Publish the GitHub release (leave off to prepare signed artifacts)
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -16,23 +21,72 @@ jobs:
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- name: Validate release version
|
||||
shell: pwsh
|
||||
run: |
|
||||
$version = (Get-Content package.json -Raw | ConvertFrom-Json).version
|
||||
if ($env:GITHUB_EVENT_NAME -eq 'push' -and $env:GITHUB_REF_NAME -ne "v$version") {
|
||||
throw 'The release tag does not match the application version.'
|
||||
}
|
||||
- name: Cache Rust dependencies and compiled targets
|
||||
uses: actions/cache@v6
|
||||
continue-on-error: true
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: manager-installer-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-${{ github.run_id }}
|
||||
restore-keys: manager-installer-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}-
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
- run: npm ci
|
||||
- name: Tests
|
||||
run: cargo test --workspace -- --test-threads=1
|
||||
- name: Build, sign and publish
|
||||
- name: Build and sign (publish only when requested)
|
||||
id: tauri
|
||||
uses: tauri-apps/tauri-action@v0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
GITHUB_TOKEN: ${{ (github.event_name == 'push' || inputs.publish_release) && github.token || '' }}
|
||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
|
||||
with:
|
||||
tagName: ${{ github.ref_name }}
|
||||
releaseName: CoA Server Manager ${{ github.ref_name }}
|
||||
tagName: ${{ (github.event_name == 'push' || inputs.publish_release) && 'v__VERSION__' || '' }}
|
||||
releaseName: CoA Server Manager v__VERSION__
|
||||
releaseBody: See the assets to download the installer. Existing installations update themselves.
|
||||
releaseDraft: false
|
||||
prerelease: false
|
||||
args: --bundles nsis
|
||||
includeUpdaterJson: true
|
||||
- name: Preserve the exact signed installer and updater metadata
|
||||
shell: pwsh
|
||||
env:
|
||||
MANAGER_ARTIFACTS: ${{ steps.tauri.outputs.artifactPaths }}
|
||||
run: |
|
||||
$paths = @($env:MANAGER_ARTIFACTS | ConvertFrom-Json)
|
||||
$installers = @($paths | Where-Object { $_ -like '*-setup.exe' })
|
||||
if ($installers.Count -ne 1) { throw 'Expected exactly one Windows NSIS installer.' }
|
||||
$installer = [IO.Path]::GetFullPath($installers[0])
|
||||
$workspace = [IO.Path]::GetFullPath((Get-Location).Path).TrimEnd('\') + '\'
|
||||
if (-not $installer.StartsWith($workspace, [StringComparison]::OrdinalIgnoreCase)) { throw 'Installer escaped the workspace.' }
|
||||
if (-not (Test-Path -LiteralPath "$installer.sig")) { throw 'The installer has no updater signature.' }
|
||||
$version = (Get-Content package.json -Raw | ConvertFrom-Json).version
|
||||
$name = [IO.Path]::GetFileName($installer).Replace(' ', '.')
|
||||
New-Item -ItemType Directory -Force _prepared-manager | Out-Null
|
||||
Copy-Item -LiteralPath $installer -Destination "_prepared-manager/$name"
|
||||
Copy-Item -LiteralPath "$installer.sig" -Destination "_prepared-manager/$name.sig"
|
||||
$platform = @{
|
||||
signature = (Get-Content -LiteralPath "$installer.sig" -Raw).Trim()
|
||||
url = "https://github.com/$env:GITHUB_REPOSITORY/releases/download/v$version/$([Uri]::EscapeDataString($name))"
|
||||
}
|
||||
@{ version = $version; notes = 'See the release notes.'; pub_date = [DateTime]::UtcNow.ToString('yyyy-MM-ddTHH:mm:ssZ'); platforms = @{ 'windows-x86_64' = $platform } } |
|
||||
ConvertTo-Json -Depth 8 | Set-Content _prepared-manager/latest.json -Encoding utf8NoBOM
|
||||
@{ schema = 1; version = $version; source = $env:GITHUB_SHA; run = $env:GITHUB_RUN_ID; installer = $name; sha256 = (Get-FileHash -LiteralPath $installer -Algorithm SHA256).Hash.ToLowerInvariant() } |
|
||||
ConvertTo-Json | Set-Content _prepared-manager/prepared-source.json -Encoding utf8NoBOM
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: prepared-manager-windows
|
||||
path: _prepared-manager/*
|
||||
if-no-files-found: error
|
||||
retention-days: 14
|
||||
Generated
+3
-3
@@ -491,7 +491,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "coa-core"
|
||||
version = "0.6.20"
|
||||
version = "0.6.22"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"chrono",
|
||||
@@ -520,7 +520,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "coa-release"
|
||||
version = "0.6.20"
|
||||
version = "0.6.22"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"coa-core",
|
||||
@@ -529,7 +529,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "coa-server-manager"
|
||||
version = "0.6.20"
|
||||
version = "0.6.22"
|
||||
dependencies = [
|
||||
"coa-core",
|
||||
"serde",
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ resolver = "2"
|
||||
members = ["crates/coa-core", "crates/coa-release", "src-tauri"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.6.20"
|
||||
version = "0.6.22"
|
||||
edition = "2021"
|
||||
license = "AGPL-3.0-only"
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: manager
|
||||
type: changed
|
||||
audience: admins
|
||||
title: Older server versions update directly without installing intermediate packages
|
||||
---
|
||||
The Manager checks database history and applies missing SQL from the latest signed package. A version missing from the release test list no longer blocks the update. Unknown versions, interrupted migrations and downgrades remain blocked.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
area: client
|
||||
type: added
|
||||
audience: players
|
||||
title: New dragon races and updated racial abilities are available
|
||||
---
|
||||
The custom race client includes Drakkin, Drakonid, updated appearances and cursor addons. Existing client files are preserved when installing or removing the patches.
|
||||
@@ -14,7 +14,7 @@ use crate::download::Cancel;
|
||||
use crate::error::{Error, Result};
|
||||
use crate::fsx;
|
||||
|
||||
pub const CLIENT_VERSION: &str = "1.7";
|
||||
pub const CLIENT_VERSION: &str = "1.8";
|
||||
pub const MANIFEST_FILENAME: &str = "custom_races_patch_manifest.txt";
|
||||
pub const ARCHIVES: &[(&str, &str)] = &[
|
||||
(
|
||||
@@ -30,8 +30,8 @@ pub const ARCHIVES: &[(&str, &str)] = &[
|
||||
"https://github.com/ilusixn/azerothcore-wotlk-coa/releases/download/coa-custom-1.6/CoA-Custom-1.6-client-part2.zip",
|
||||
),
|
||||
(
|
||||
"CoA-Custom-1.7-client.zip",
|
||||
"https://github.com/ilusixn/azerothcore-wotlk-coa/releases/download/coa-custom-1.7/CoA-Custom-1.7-client.zip",
|
||||
"CoA-Custom-1.8-Client.zip",
|
||||
"https://github.com/ilusixn/azerothcore-wotlk-coa/releases/download/coa-custom-1.8/CoA-Custom-1.8-Client.zip",
|
||||
),
|
||||
];
|
||||
|
||||
@@ -61,6 +61,12 @@ pub const RACE_MPQS: &[&str] = &[
|
||||
"patch-ZZU.MPQ",
|
||||
"patch-ZZV.MPQ",
|
||||
"patch-ZZW.MPQ",
|
||||
"patch-ZZZ.MPQ",
|
||||
];
|
||||
|
||||
pub const RACE_ADDONS: &[&str] = &[
|
||||
"CoAWC2Cursor/CoAWC2Cursor.lua",
|
||||
"CoAWC2Cursor/CoAWC2Cursor.toc",
|
||||
];
|
||||
|
||||
pub const EXCLUDED_BOT_RACES_RECOMMENDED: &str =
|
||||
@@ -171,7 +177,7 @@ struct PatchFile {
|
||||
|
||||
fn patch_files(client: &Path) -> Result<Vec<PatchFile>> {
|
||||
let manifest = fs::read_to_string(client.join(MANIFEST_FILENAME)).unwrap_or_default();
|
||||
let hashes = if manifest.lines().any(|line| line == "# CoA Custom 1.5") { include_str!("custom_races_hashes_1_5.json") } else if manifest.lines().any(|line| line == "# CoA Custom 1.6") { include_str!("custom_races_hashes_1_6.json") } else { include_str!("custom_races_hashes.json") };
|
||||
let hashes = if manifest.lines().any(|line| line == "# CoA Custom 1.5") { include_str!("custom_races_hashes_1_5.json") } else if manifest.lines().any(|line| line == "# CoA Custom 1.6") { include_str!("custom_races_hashes_1_6.json") } else if manifest.lines().any(|line| line == "# CoA Custom 1.7") { include_str!("custom_races_hashes_1_7.json") } else { include_str!("custom_races_hashes.json") };
|
||||
let bundled: std::collections::BTreeMap<String, String> = serde_json::from_str(hashes)?;
|
||||
let mut files = std::collections::BTreeMap::new();
|
||||
for line in manifest.lines() {
|
||||
@@ -181,6 +187,8 @@ fn patch_files(client: &Path) -> Result<Vec<PatchFile>> {
|
||||
} else if let Some(name) = line.strip_prefix("ROOT:") {
|
||||
if name.contains(['/', '\\']) { return Err(Error::Invalid("Invalid custom races patch manifest.".into())); }
|
||||
Some(name.to_string())
|
||||
} else if let Some(name) = line.strip_prefix("ADDON:") {
|
||||
Some(format!("Interface/AddOns/{name}"))
|
||||
} else { None };
|
||||
if let Some(path) = path {
|
||||
fsx::safe_join(client, &path)?;
|
||||
@@ -374,7 +382,7 @@ fn verify_archive(path: &Path, filename: &str) -> Result<()> {
|
||||
"CoA-Custom-1.6-main-20261012-4dd3a4ec.zip" => "dfe802ea70047c129ac2e0aaa557bab3110e3cc6926d36403b8c880a0e310ee4",
|
||||
"CoA-Custom-1.6-client-part1.zip" => "1dbf1901ad5be61eba66973609df90712ffc78ef9e9b2c8549a5f3e36332bf12",
|
||||
"CoA-Custom-1.6-client-part2.zip" => "689f7f946b4180fe977dabedc7cfe642e3e7f27431600c64c4dd5b7960b1bc66",
|
||||
"CoA-Custom-1.7-client.zip" => "ad389ef486f44f269445f80807b25b214c39fc5d21272b5708bfeac8b1efefa0",
|
||||
"CoA-Custom-1.8-Client.zip" => "b0ee9275a373e4024dda7744321d02b686fb1c703603ad635b32bfb6ed9b48aa",
|
||||
_ => return Err(Error::Invalid("Unknown custom races archive.".into())),
|
||||
};
|
||||
if fsx::sha256_file(path)? != expected {
|
||||
@@ -582,6 +590,14 @@ pub fn install_client_patches(
|
||||
if disabled.is_file() { fs::remove_file(disabled)?; }
|
||||
installed_roots.push(base);
|
||||
}
|
||||
} else if let Some(relative) = zname_norm.split("files/addons/").nth(1) {
|
||||
if !RACE_ADDONS.contains(&relative) { continue; }
|
||||
let relative = format!("Interface/AddOns/{relative}");
|
||||
let dest = fsx::safe_join(staging.path(), &relative)?;
|
||||
fs::create_dir_all(dest.parent().ok_or_else(|| Error::Invalid("Addon file has no directory.".into()))?)?;
|
||||
let mut out = File::create(&dest)?;
|
||||
io::copy(&mut zfile, &mut out)?;
|
||||
installed_roots.push(relative);
|
||||
} else if zname_norm.contains("files/client_root/") {
|
||||
let base = Path::new(&zname_norm)
|
||||
.file_name()
|
||||
@@ -618,7 +634,11 @@ pub fn install_client_patches(
|
||||
}
|
||||
manifest_body.push_str("# Custom Race root files\n");
|
||||
for r in &installed_roots {
|
||||
manifest_body.push_str(&format!("ROOT:{r}\n"));
|
||||
if let Some(relative) = r.strip_prefix("Interface/AddOns/") {
|
||||
manifest_body.push_str(&format!("ADDON:{relative}\n"));
|
||||
} else {
|
||||
manifest_body.push_str(&format!("ROOT:{r}\n"));
|
||||
}
|
||||
}
|
||||
|
||||
let bundled: std::collections::BTreeMap<String, String> = serde_json::from_str(include_str!("custom_races_hashes.json"))?;
|
||||
@@ -690,6 +710,7 @@ mod tests {
|
||||
if entry.is_dir() { continue; }
|
||||
let relative = if let Some(name) = name.split("files/client_root/").nth(1) { name.to_string() }
|
||||
else if let Some(name) = name.split("files/client/").nth(1) { if name == "dinput8.dll" { name.to_string() } else { format!("Data/{name}") } }
|
||||
else if let Some(name) = name.split("files/addons/").nth(1) { if !RACE_ADDONS.contains(&name) { continue; } format!("Interface/AddOns/{name}") }
|
||||
else { continue };
|
||||
let mut hash = Sha256::new();
|
||||
let mut buffer = vec![0; 1024 * 1024];
|
||||
@@ -727,6 +748,21 @@ mod tests {
|
||||
assert!(legacy.keys().all(|key| current.contains_key(key)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn previous_racial_release_keeps_its_hashes_and_addon_paths_stay_inside_client() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
fs::write(temp.path().join(MANIFEST_FILENAME), "# CoA Custom 1.7\n").unwrap();
|
||||
let legacy: std::collections::BTreeMap<String, String> = serde_json::from_str(include_str!("custom_races_hashes_1_7.json")).unwrap();
|
||||
let files = patch_files(temp.path()).unwrap();
|
||||
assert_eq!(files.len(), legacy.len());
|
||||
assert_eq!(files.iter().find(|file| file.path == "Data/patch-ZZW.MPQ").unwrap().sha256, legacy["Data/patch-ZZW.MPQ"]);
|
||||
assert!(!files.iter().any(|file| file.path == "Data/patch-ZZZ.MPQ"));
|
||||
fs::write(temp.path().join(MANIFEST_FILENAME), "# CoA Custom 1.8\nADDON:CoAWC2Cursor/CoAWC2Cursor.lua\n").unwrap();
|
||||
assert_eq!(patch_files(temp.path()).unwrap()[0].path, "Interface/AddOns/CoAWC2Cursor/CoAWC2Cursor.lua");
|
||||
fs::write(temp.path().join(MANIFEST_FILENAME), "ADDON:../../../outside\n").unwrap();
|
||||
assert!(patch_files(temp.path()).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn another_patch_operation_cannot_enter_the_same_client() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
|
||||
@@ -1,10 +1,39 @@
|
||||
{
|
||||
"Ascension.exe": "e2c347019d554a59639e5978fd68e50e906973ab313c6573cc56ca82e8e3c547",
|
||||
"EsteriaAppearance.bin": "b3fb7c69b7600c39f888ea1925701be5667097dcb02bb6ddd830e5489306bb50",
|
||||
"EsteriaAppearance.dll": "392c5a2a25f9a69d705bdf841bb899aab768d4a3ee62734d576286c7198710d8",
|
||||
"EsteriaAppearanceGeometry.bin": "c95c53ca19c53c3434e12b99c1966f9c015ec3944c46dff7784d5e4ffc472d5d",
|
||||
"Data/patch-T.MPQ": "fe597138ab7f56881b5f4f27d6dc9d81bb278b483ca0d91b7207ffd4a5ae7bfd",
|
||||
"Data/patch-ZE1.MPQ": "69d79dbbea54ec0312c37770debc79c7bc9ce2e21eedef99c03cd8d911955283",
|
||||
"Data/patch-ZE2.MPQ": "1a41cae77ad730e9cf69e8d63fd12ae3a579418bb550d351fff469573a97ac3c",
|
||||
"Data/patch-ZE3.MPQ": "b587202c21b6f580682b601b7c2e905fbfa766276e74733db55c1bddbffb7f87",
|
||||
"Data/patch-ZE5.MPQ": "476b5a1fcf69f64fdb281e3b445362b936d016066ccd12f897acfcf200d6c0cf",
|
||||
"Data/patch-ZE6.MPQ": "762592c9ed950b4a7b6c7d85d45050b30fa3f35d53e348ee1e1516fdbb7e5484",
|
||||
"Data/patch-ZE7.MPQ": "de54b0189d242763d2872223419a259b6b8a4b380c24b50a2ef9c6fa44466248",
|
||||
"Data/patch-ZE8.MPQ": "1bc5691fb84a84f3e7a0a70baaa9192a97b4ec5906ee37c85838ffe08adef934",
|
||||
"Data/patch-ZE9.MPQ": "d49c94463e9548e76378ce2c0454d8f204f0745c8c0de32b6dce7f0b0fd67c4a",
|
||||
"Data/patch-ZEA.MPQ": "78fd10ec5262ae2417eba9700d2172553bbc1e5cfb0b597aada8f1753ca46d9d",
|
||||
"Data/patch-ZES.MPQ": "a2d9348f917f745c7aa25b2eed96efa312f7b2d2f62cb86a4f2eaabc2dfa895f",
|
||||
"Data/patch-ZG.MPQ": "48979e1fda775f8deb47bffa48e0a468595d4c71286fee518f51dc5801c5ca39",
|
||||
"Data/patch-ZH.MPQ": "5e1d2fe287053abba703d7af381e10096c6525ba477ffed3971c2fc4f93e919c",
|
||||
"Data/patch-ZHA.MPQ": "0fc6ebeafe1d14192dc64bafc90bde3c49230df1297f98bf65900a3bcf953617",
|
||||
"Data/patch-ZHM.MPQ": "317d3ae00f0bd674b358af07544976acb7804aa6d8b19d1788ad96030e8c9bf0",
|
||||
"Data/patch-ZJ.MPQ": "f821e99add86ef68d108c5ec466328c97677d3ed52f7944e200f3fe38c13b4de",
|
||||
"Data/patch-ZM.MPQ": "424ab1978986e854551633983a94bd15beba6328aabea8c02f98eaa32f6f0b61",
|
||||
"Data/patch-ZVU.MPQ": "c679b85a2e97344395756b54d2cf6abefe4e80e74944cb55b6e573ad17b7d020",
|
||||
"Data/patch-ZZE.MPQ": "4b1e289e12c82644cb78f50170e6b5fd53918eb2de834f9e0cebddd81873a8bb",
|
||||
"Data/patch-ZZR.MPQ": "5a7575e592dc0c8a6913e0d946bbe06fa0ca2e4d817ef1f8548d3d13142bcbd3",
|
||||
"Data/patch-ZZS.MPQ": "533fd69d5784d83e872a5a28d27301dc9ab5d0cb925f8b2116926854e4a0a5b8",
|
||||
"Data/patch-ZZT.MPQ": "aef3bbe4951333d62fb55224484724fbaa9c35773a19944ffb9935e250cfb59c",
|
||||
"Data/patch-ZZU.MPQ": "8ee1839415b56d46c6eff7eb4dfbaf6fbafc4c6b29b39380d69f4d827d02a99e",
|
||||
"Data/patch-ZZV.MPQ": "8d5e61d37008abf70478e5d5f46ec7afb0490b9a643323bd75a1c70cadd63290",
|
||||
"Data/patch-ZZW.MPQ": "3689c485f8ee8fccaa6dbae1d073bc9231229f9a040f79a272d80a87486d0c33",
|
||||
"Data/patch-ZZZ.MPQ": "566aaadf501af42e29a828b1bc2edbd36d436288fb309fe423bd74b9619bf593",
|
||||
"EsteriaAppearance.bin": "90d9cfaeaf6de10f014f1d1610ea10453ec9b240255759aea99513cac488a3ec",
|
||||
"EsteriaAppearance.dll": "64564aceac38b26faefbd51dba779fa338ab5e70a2a2509f6c8f3a991ac98518",
|
||||
"EsteriaAppearanceGeometry.bin": "fdc1cbba90b66c4533a66365d6d555c2d32ab01acb014fff042b4a6a9c6b6ddc",
|
||||
"EsteriaAppearanceMaterials.bin": "f72f027f54a55c05aa0f76b457b97b484fe0e1aedc0e068cc0e0ca53e1878cba",
|
||||
"EsteriaCosmeticWings.bin": "57352c28459d073a29b3014d33b70f3b3756afa37fa9583ef6b30d503422ac3f",
|
||||
"EsteriaDrakonid.bin": "95440ee9c065ef20bb7fed6158d20623d68745291cedc2726fc746ff54601f95",
|
||||
"EsteriaDrakonidCoverage.bin": "9cdc227f08329e1245d2b864a996e7a772c96ecdbe5d81925f4d60cdbe4fa11e",
|
||||
"EsteriaDrakonidTextures.bin": "1ba9133a75dad291d98a068b2dcde01f31a897a1764cd7f3e2c316c288a8f605",
|
||||
"EsteriaEarthen.bin": "8a0db93ba2d5c756b44ed84f2f7bc7c15eef13be6a7d87baf1383c6c0c624e02",
|
||||
"EsteriaGnoll.bin": "cfacc8e681bb8e54a4f01ee9c12a91bf0bd23a23527bb548d4dc21ec1b33eea2",
|
||||
"EsteriaGnollTextures.bin": "1ba9133a75dad291d98a068b2dcde01f31a897a1764cd7f3e2c316c288a8f605",
|
||||
@@ -18,6 +47,8 @@
|
||||
"EsteriaSaberonTextures.bin": "1ba9133a75dad291d98a068b2dcde01f31a897a1764cd7f3e2c316c288a8f605",
|
||||
"EsteriaSethrak.bin": "bd14857a8c11fdf8027128763293701586b2102f9a6539d33a727014789fd606",
|
||||
"EsteriaSethrakTextures.bin": "d2b2cf58087a391f00198008fe871edd400ddf28d54a3a05674df74c5198528a",
|
||||
"EsteriaTarasek.bin": "f718444d5ec36f7aff018883486ae1981151fe6e01f5b7781d68d74e9fadfa47",
|
||||
"EsteriaTarasekTextures.bin": "1ba9133a75dad291d98a068b2dcde01f31a897a1764cd7f3e2c316c288a8f605",
|
||||
"EsteriaThinHuman.bin": "75794d192ea0c228b3da7bf7d0bdff1119f79d3f9bfef6650cd5e1a2b5d106eb",
|
||||
"EsteriaThinHumanTextures.bin": "02aeb4c05893d06125b8b58fdb7c2a56fe3d66a7d094706a44b43cb503d1731e",
|
||||
"EsteriaTuskarr.bin": "ecbe7ef490ba67eca029a57639192db61238522618491549766fe38529914387",
|
||||
@@ -26,30 +57,9 @@
|
||||
"EsteriaVrykulTextures.bin": "46098750a0e235724c6e9cc8d9d4e26550aa47bef95fd5f0f82efe5e945bf296",
|
||||
"EsteriaVulpera.bin": "c5434993b9af4a17d881965e4735cd2ac379e39c7142aac9844adff9528562d4",
|
||||
"EsteriaVulperaTextures.bin": "1ab844e74684aced2b069f1b91cd563aade45e05bd5e23f866a6c0c301cb098e",
|
||||
"Interface/AddOns/CoAWC2Cursor/CoAWC2Cursor.lua": "1cf9537ff5f10b77250fea4407aea1008da690afe102ed6ed2dac21f79638cfa",
|
||||
"Interface/AddOns/CoAWC2Cursor/CoAWC2Cursor.toc": "48ce695dce712b3643ebe13a77e318d623c964acc69479b8fc8cc675099801bf",
|
||||
"dinput8.dll": "f8de78606c241fb3911dce22faf68f5b9f9885b142b183c1e2c09ddc8f7e380c",
|
||||
"Data/patch-T.MPQ": "fe597138ab7f56881b5f4f27d6dc9d81bb278b483ca0d91b7207ffd4a5ae7bfd",
|
||||
"Data/patch-ZE5.MPQ": "476b5a1fcf69f64fdb281e3b445362b936d016066ccd12f897acfcf200d6c0cf",
|
||||
"Data/patch-ZE6.MPQ": "762592c9ed950b4a7b6c7d85d45050b30fa3f35d53e348ee1e1516fdbb7e5484",
|
||||
"Data/patch-ZE7.MPQ": "de54b0189d242763d2872223419a259b6b8a4b380c24b50a2ef9c6fa44466248",
|
||||
"Data/patch-ZE8.MPQ": "1bc5691fb84a84f3e7a0a70baaa9192a97b4ec5906ee37c85838ffe08adef934",
|
||||
"Data/patch-ZE9.MPQ": "d49c94463e9548e76378ce2c0454d8f204f0745c8c0de32b6dce7f0b0fd67c4a",
|
||||
"Data/patch-ZES.MPQ": "a2d9348f917f745c7aa25b2eed96efa312f7b2d2f62cb86a4f2eaabc2dfa895f",
|
||||
"Data/patch-ZG.MPQ": "48979e1fda775f8deb47bffa48e0a468595d4c71286fee518f51dc5801c5ca39",
|
||||
"Data/patch-ZH.MPQ": "5e1d2fe287053abba703d7af381e10096c6525ba477ffed3971c2fc4f93e919c",
|
||||
"Data/patch-ZHM.MPQ": "317d3ae00f0bd674b358af07544976acb7804aa6d8b19d1788ad96030e8c9bf0",
|
||||
"Data/patch-ZJ.MPQ": "f821e99add86ef68d108c5ec466328c97677d3ed52f7944e200f3fe38c13b4de",
|
||||
"Data/patch-ZM.MPQ": "424ab1978986e854551633983a94bd15beba6328aabea8c02f98eaa32f6f0b61",
|
||||
"Data/patch-ZVU.MPQ": "c679b85a2e97344395756b54d2cf6abefe4e80e74944cb55b6e573ad17b7d020",
|
||||
"Data/patch-ZE1.MPQ": "69d79dbbea54ec0312c37770debc79c7bc9ce2e21eedef99c03cd8d911955283",
|
||||
"Data/patch-ZE2.MPQ": "1a41cae77ad730e9cf69e8d63fd12ae3a579418bb550d351fff469573a97ac3c",
|
||||
"Data/patch-ZE3.MPQ": "b587202c21b6f580682b601b7c2e905fbfa766276e74733db55c1bddbffb7f87",
|
||||
"Data/patch-ZEA.MPQ": "78fd10ec5262ae2417eba9700d2172553bbc1e5cfb0b597aada8f1753ca46d9d",
|
||||
"Data/patch-ZHA.MPQ": "0fc6ebeafe1d14192dc64bafc90bde3c49230df1297f98bf65900a3bcf953617",
|
||||
"Data/patch-ZZE.MPQ": "4b1e289e12c82644cb78f50170e6b5fd53918eb2de834f9e0cebddd81873a8bb",
|
||||
"Data/patch-ZZR.MPQ": "5a7575e592dc0c8a6913e0d946bbe06fa0ca2e4d817ef1f8548d3d13142bcbd3",
|
||||
"Data/patch-ZZS.MPQ": "533fd69d5784d83e872a5a28d27301dc9ab5d0cb925f8b2116926854e4a0a5b8",
|
||||
"Data/patch-ZZT.MPQ": "aef3bbe4951333d62fb55224484724fbaa9c35773a19944ffb9935e250cfb59c",
|
||||
"Data/patch-ZZU.MPQ": "8ee1839415b56d46c6eff7eb4dfbaf6fbafc4c6b29b39380d69f4d827d02a99e",
|
||||
"Data/patch-ZZV.MPQ": "8d5e61d37008abf70478e5d5f46ec7afb0490b9a643323bd75a1c70cadd63290",
|
||||
"Data/patch-ZZW.MPQ": "ed452a0a0118c9f4deaf02db753064ac95b6e4a84022bdabd39a7e70d775223f"
|
||||
"wc2_human.cur": "f609736e29596bb386ef1597b157d211e01a86d32c2a929e256c581c37d71791",
|
||||
"wc2_orc.cur": "baa512c9b9045762ba35b6e0d35b8f79c54b7649f35cc9c0e0cc8c168a1e5a97"
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"Ascension.exe": "e2c347019d554a59639e5978fd68e50e906973ab313c6573cc56ca82e8e3c547",
|
||||
"EsteriaAppearance.bin": "b3fb7c69b7600c39f888ea1925701be5667097dcb02bb6ddd830e5489306bb50",
|
||||
"EsteriaAppearance.dll": "392c5a2a25f9a69d705bdf841bb899aab768d4a3ee62734d576286c7198710d8",
|
||||
"EsteriaAppearanceGeometry.bin": "c95c53ca19c53c3434e12b99c1966f9c015ec3944c46dff7784d5e4ffc472d5d",
|
||||
"EsteriaAppearanceMaterials.bin": "f72f027f54a55c05aa0f76b457b97b484fe0e1aedc0e068cc0e0ca53e1878cba",
|
||||
"EsteriaCosmeticWings.bin": "57352c28459d073a29b3014d33b70f3b3756afa37fa9583ef6b30d503422ac3f",
|
||||
"EsteriaEarthen.bin": "8a0db93ba2d5c756b44ed84f2f7bc7c15eef13be6a7d87baf1383c6c0c624e02",
|
||||
"EsteriaGnoll.bin": "cfacc8e681bb8e54a4f01ee9c12a91bf0bd23a23527bb548d4dc21ec1b33eea2",
|
||||
"EsteriaGnollTextures.bin": "1ba9133a75dad291d98a068b2dcde01f31a897a1764cd7f3e2c316c288a8f605",
|
||||
"EsteriaHaranir.bin": "59f31d00e372fd2646e1cf0d9d3d5d671b31edd60ff7b862f8d1ce7e53ba1f2f",
|
||||
"EsteriaHaranirTextures.bin": "99948ca570be2d376f0c67e3b8088739b6fa9f9d2c73985e19f68df77689a229",
|
||||
"EsteriaHighmountain.bin": "e83349252ad2687ac23fcfc5623db7401cf32e5faf47a5a7be20c2f94b014938",
|
||||
"EsteriaNaga.bin": "e87547cff5d09500c294f8b06935d134cdd0bbb962e294a72de09404505bd8b3",
|
||||
"EsteriaNagaTextures.bin": "57ec560f99c1d48ac1e8f6a797c156513b99e7d349e3071afe405f812d159ae3",
|
||||
"EsteriaSaberon.bin": "7735c9325c807c5125760d87f323d6b7d4162fb542c1d8b5f435ea2d6b9a4daa",
|
||||
"EsteriaSaberonCoverage.bin": "9cdc227f08329e1245d2b864a996e7a772c96ecdbe5d81925f4d60cdbe4fa11e",
|
||||
"EsteriaSaberonTextures.bin": "1ba9133a75dad291d98a068b2dcde01f31a897a1764cd7f3e2c316c288a8f605",
|
||||
"EsteriaSethrak.bin": "bd14857a8c11fdf8027128763293701586b2102f9a6539d33a727014789fd606",
|
||||
"EsteriaSethrakTextures.bin": "d2b2cf58087a391f00198008fe871edd400ddf28d54a3a05674df74c5198528a",
|
||||
"EsteriaThinHuman.bin": "75794d192ea0c228b3da7bf7d0bdff1119f79d3f9bfef6650cd5e1a2b5d106eb",
|
||||
"EsteriaThinHumanTextures.bin": "02aeb4c05893d06125b8b58fdb7c2a56fe3d66a7d094706a44b43cb503d1731e",
|
||||
"EsteriaTuskarr.bin": "ecbe7ef490ba67eca029a57639192db61238522618491549766fe38529914387",
|
||||
"EsteriaTuskarrTextures.bin": "e2116c2c83adea079126fd5da765d20da24f044d4f161c4124e4368cb3d6bc71",
|
||||
"EsteriaVrykul.bin": "39e2b7b4c67997dbbd34bae840bd606a59290f7f2fc82565a0ba00090335415c",
|
||||
"EsteriaVrykulTextures.bin": "46098750a0e235724c6e9cc8d9d4e26550aa47bef95fd5f0f82efe5e945bf296",
|
||||
"EsteriaVulpera.bin": "c5434993b9af4a17d881965e4735cd2ac379e39c7142aac9844adff9528562d4",
|
||||
"EsteriaVulperaTextures.bin": "1ab844e74684aced2b069f1b91cd563aade45e05bd5e23f866a6c0c301cb098e",
|
||||
"dinput8.dll": "f8de78606c241fb3911dce22faf68f5b9f9885b142b183c1e2c09ddc8f7e380c",
|
||||
"Data/patch-T.MPQ": "fe597138ab7f56881b5f4f27d6dc9d81bb278b483ca0d91b7207ffd4a5ae7bfd",
|
||||
"Data/patch-ZE5.MPQ": "476b5a1fcf69f64fdb281e3b445362b936d016066ccd12f897acfcf200d6c0cf",
|
||||
"Data/patch-ZE6.MPQ": "762592c9ed950b4a7b6c7d85d45050b30fa3f35d53e348ee1e1516fdbb7e5484",
|
||||
"Data/patch-ZE7.MPQ": "de54b0189d242763d2872223419a259b6b8a4b380c24b50a2ef9c6fa44466248",
|
||||
"Data/patch-ZE8.MPQ": "1bc5691fb84a84f3e7a0a70baaa9192a97b4ec5906ee37c85838ffe08adef934",
|
||||
"Data/patch-ZE9.MPQ": "d49c94463e9548e76378ce2c0454d8f204f0745c8c0de32b6dce7f0b0fd67c4a",
|
||||
"Data/patch-ZES.MPQ": "a2d9348f917f745c7aa25b2eed96efa312f7b2d2f62cb86a4f2eaabc2dfa895f",
|
||||
"Data/patch-ZG.MPQ": "48979e1fda775f8deb47bffa48e0a468595d4c71286fee518f51dc5801c5ca39",
|
||||
"Data/patch-ZH.MPQ": "5e1d2fe287053abba703d7af381e10096c6525ba477ffed3971c2fc4f93e919c",
|
||||
"Data/patch-ZHM.MPQ": "317d3ae00f0bd674b358af07544976acb7804aa6d8b19d1788ad96030e8c9bf0",
|
||||
"Data/patch-ZJ.MPQ": "f821e99add86ef68d108c5ec466328c97677d3ed52f7944e200f3fe38c13b4de",
|
||||
"Data/patch-ZM.MPQ": "424ab1978986e854551633983a94bd15beba6328aabea8c02f98eaa32f6f0b61",
|
||||
"Data/patch-ZVU.MPQ": "c679b85a2e97344395756b54d2cf6abefe4e80e74944cb55b6e573ad17b7d020",
|
||||
"Data/patch-ZE1.MPQ": "69d79dbbea54ec0312c37770debc79c7bc9ce2e21eedef99c03cd8d911955283",
|
||||
"Data/patch-ZE2.MPQ": "1a41cae77ad730e9cf69e8d63fd12ae3a579418bb550d351fff469573a97ac3c",
|
||||
"Data/patch-ZE3.MPQ": "b587202c21b6f580682b601b7c2e905fbfa766276e74733db55c1bddbffb7f87",
|
||||
"Data/patch-ZEA.MPQ": "78fd10ec5262ae2417eba9700d2172553bbc1e5cfb0b597aada8f1753ca46d9d",
|
||||
"Data/patch-ZHA.MPQ": "0fc6ebeafe1d14192dc64bafc90bde3c49230df1297f98bf65900a3bcf953617",
|
||||
"Data/patch-ZZE.MPQ": "4b1e289e12c82644cb78f50170e6b5fd53918eb2de834f9e0cebddd81873a8bb",
|
||||
"Data/patch-ZZR.MPQ": "5a7575e592dc0c8a6913e0d946bbe06fa0ca2e4d817ef1f8548d3d13142bcbd3",
|
||||
"Data/patch-ZZS.MPQ": "533fd69d5784d83e872a5a28d27301dc9ab5d0cb925f8b2116926854e4a0a5b8",
|
||||
"Data/patch-ZZT.MPQ": "aef3bbe4951333d62fb55224484724fbaa9c35773a19944ffb9935e250cfb59c",
|
||||
"Data/patch-ZZU.MPQ": "8ee1839415b56d46c6eff7eb4dfbaf6fbafc4c6b29b39380d69f4d827d02a99e",
|
||||
"Data/patch-ZZV.MPQ": "8d5e61d37008abf70478e5d5f46ec7afb0490b9a643323bd75a1c70cadd63290",
|
||||
"Data/patch-ZZW.MPQ": "ed452a0a0118c9f4deaf02db753064ac95b6e4a84022bdabd39a7e70d775223f"
|
||||
}
|
||||
@@ -93,6 +93,7 @@ pub struct Compatibility {
|
||||
pub core_commit: String,
|
||||
pub module_commits: std::collections::BTreeMap<String, String>,
|
||||
pub client_patch_version: String,
|
||||
/// Sources exercised during release qualification, not an exclusive updater allowlist.
|
||||
pub source_versions: Vec<String>,
|
||||
#[serde(default, skip_serializing_if = "std::collections::BTreeMap::is_empty")]
|
||||
pub source_databases: std::collections::BTreeMap<String, SourceDatabase>,
|
||||
|
||||
@@ -387,8 +387,10 @@ fn reject_downgrade(meta: &InstallMeta, manifest: &Manifest) -> Result<()> {
|
||||
if c.platform != platform {
|
||||
return Err(Error::Invalid(format!("This package targets {} rather than {platform}.", c.platform)));
|
||||
}
|
||||
if meta.core.version.as_ref().is_none_or(|version| version != &manifest.version && !c.source_versions.contains(version)) {
|
||||
return Err(Error::Invalid(format!("Installed server {} is outside the compatibility matrix for {}. Tested source versions: {}.", meta.core.version.as_deref().unwrap_or("unknown"), manifest.version, c.source_versions.join(", "))));
|
||||
// The source list records release qualification, not an exclusive upgrade route.
|
||||
// Database history and target validation decide whether the update can complete.
|
||||
if meta.core.version.as_deref().and_then(crate::manifest::parse_version).is_none() {
|
||||
return Err(Error::Invalid("The installed server version is unknown. An imported repack needs a verified starting state before updating.".into()));
|
||||
}
|
||||
}
|
||||
if let Some(installed) = meta.core.version.as_deref() {
|
||||
@@ -1630,7 +1632,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn incompatible_source_or_platform_is_rejected_without_touching_installation() {
|
||||
fn unlisted_source_is_allowed_but_unknown_versions_and_other_platforms_are_rejected() {
|
||||
let w = world(&[], false);
|
||||
let (_, meta) = MetaDir::open(&w.meta).unwrap();
|
||||
let mut manifest = Manifest::parse(&fs::read(w.pkg.join("manifest.json")).unwrap()).unwrap();
|
||||
@@ -1643,7 +1645,12 @@ mod tests {
|
||||
manifest.validate().unwrap();
|
||||
validate_candidate(&meta, &manifest).unwrap();
|
||||
manifest.compatibility.as_mut().unwrap().source_versions = vec!["0.9.0".into()];
|
||||
assert!(validate_candidate(&meta, &manifest).unwrap_err().to_string().contains("compatibility matrix"));
|
||||
validate_candidate(&meta, &manifest).unwrap();
|
||||
let mut unknown = meta.clone();
|
||||
unknown.core.version = None;
|
||||
assert!(validate_candidate(&unknown, &manifest).unwrap_err().to_string().contains("unknown"));
|
||||
unknown.core.version = Some("unverified-repack".into());
|
||||
assert!(validate_candidate(&unknown, &manifest).is_err());
|
||||
let mut already_updated = meta.clone();
|
||||
already_updated.core.version = Some(manifest.version.clone());
|
||||
validate_candidate(&already_updated, &manifest).unwrap();
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
use std::collections::BTreeSet;
|
||||
|
||||
use crate::{fsx, manifest::Manifest, pkgsource::{self, Source}, registry::InstallMeta, update, Error, Result};
|
||||
|
||||
const RELEASES: &str = "https://github.com/Corfirean/coa-server-build/releases/download/server-";
|
||||
use crate::{manifest::Manifest, pkgsource::{self, Source}, registry::InstallMeta, update, Result};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Selection {
|
||||
pub source: Source,
|
||||
// Retained for the frontend response shape; direct updates never offer a bridge.
|
||||
pub latest_version: Option<String>,
|
||||
}
|
||||
|
||||
@@ -16,48 +13,8 @@ pub fn select(meta: &InstallMeta, source: Source, key: &str) -> Result<Selection
|
||||
|
||||
fn select_with(meta: &InstallMeta, source: Source, fetch: &mut impl FnMut(&Source) -> Result<(Manifest, Vec<u8>)>) -> Result<Selection> {
|
||||
let (manifest, _) = fetch(&source)?;
|
||||
if update::validate_candidate(meta, &manifest).is_ok() {
|
||||
return Ok(Selection { source, latest_version: None });
|
||||
}
|
||||
let original = update::validate_candidate(meta, &manifest).unwrap_err();
|
||||
if !matches!(&source, Source::Url(url) if url.trim_end_matches('/') == format!("{RELEASES}{}", manifest.version)) {
|
||||
return Err(original);
|
||||
}
|
||||
let Some(installed) = meta.core.version.as_deref().and_then(crate::manifest::parse_version) else { return Err(original); };
|
||||
if manifest.kind != crate::manifest::Kind::Update
|
||||
|| manifest.compatibility.as_ref().is_none_or(|c| c.platform != if cfg!(windows) { "windows-x86_64" } else { "linux-x86_64" })
|
||||
|| !manifest.compatible_with_manager(crate::MANAGER_VERSION)
|
||||
|| crate::manifest::parse_version(&manifest.version).is_none_or(|version| version <= installed) {
|
||||
return Err(original);
|
||||
}
|
||||
let mut visited = BTreeSet::new();
|
||||
let Some(source) = find(meta, &manifest, fetch, &mut visited, 0)? else { return Err(original); };
|
||||
Ok(Selection { source, latest_version: Some(manifest.version) })
|
||||
}
|
||||
|
||||
fn find(meta: &InstallMeta, manifest: &Manifest, fetch: &mut impl FnMut(&Source) -> Result<(Manifest, Vec<u8>)>, visited: &mut BTreeSet<String>, depth: usize) -> Result<Option<Source>> {
|
||||
if depth >= 8 || visited.len() >= 32 { return Ok(None); }
|
||||
let Some(compatibility) = &manifest.compatibility else { return Ok(None); };
|
||||
let Some(installed) = meta.core.version.as_deref().and_then(crate::manifest::parse_version) else { return Ok(None); };
|
||||
let target = crate::manifest::parse_version(&manifest.version).unwrap();
|
||||
let mut versions: Vec<_> = compatibility.source_versions.iter().filter_map(|version| {
|
||||
crate::manifest::parse_version(version).filter(|number| *number > installed && *number < target).map(|number| (number, version))
|
||||
}).collect();
|
||||
versions.sort_by(|left, right| right.0.cmp(&left.0));
|
||||
for (_, version) in versions {
|
||||
let Some(database) = compatibility.source_databases.get(version) else { continue; };
|
||||
if !visited.insert(version.clone()) || visited.len() > 32 { continue; }
|
||||
let source = Source::Url(format!("{RELEASES}{version}"));
|
||||
let (bridge, bytes) = fetch(&source)?;
|
||||
if bridge.version != *version || fsx::sha256_bytes(&bytes) != database.manifest_sha256 {
|
||||
return Err(Error::InvalidManifest("The intermediate update differs from the signed compatibility matrix.".into()));
|
||||
}
|
||||
if update::validate_candidate(meta, &bridge).is_ok() { return Ok(Some(source)); }
|
||||
if bridge.kind != crate::manifest::Kind::Update || !bridge.compatible_with_manager(crate::MANAGER_VERSION)
|
||||
|| bridge.compatibility.as_ref().is_none_or(|c| c.platform != compatibility.platform) { continue; }
|
||||
if let Some(source) = find(meta, &bridge, fetch, visited, depth + 1)? { return Ok(Some(source)); }
|
||||
}
|
||||
Ok(None)
|
||||
update::validate_candidate(meta, &manifest)?;
|
||||
Ok(Selection { source, latest_version: None })
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -67,12 +24,12 @@ mod tests {
|
||||
use ed25519_dalek::{Signer, SigningKey};
|
||||
use std::{fs, path::Path};
|
||||
|
||||
fn package(version: &str, from: &str, digest: &str) -> serde_json::Value {
|
||||
serde_json::json!({"schema":1,"kind":"update","version":version,"core":{"commit":"a".repeat(40)},
|
||||
fn package() -> serde_json::Value {
|
||||
serde_json::json!({"schema":1,"kind":"update","version":"0.261015.58","core":{"commit":"a".repeat(40)},
|
||||
"builtAt":"test","minManagerVersion":"0.6.16","files":[],"migrations":[],"archive":null,
|
||||
"compatibility":{"schema":1,"platform":if cfg!(windows) {"windows-x86_64"} else {"linux-x86_64"},
|
||||
"coreCommit":"a".repeat(40),"moduleCommits":{"squid":"b".repeat(40)},"clientPatchVersion":"1.7",
|
||||
"sourceVersions":[from],"sourceDatabases":{from:{"manifestSha256":digest,"schemaSha256":null}}}})
|
||||
"sourceVersions":["0.261013.54"],"sourceDatabases":{"0.261013.54":{"manifestSha256":"c".repeat(64),"schemaSha256":null}}}})
|
||||
}
|
||||
|
||||
fn meta(version: &str) -> InstallMeta {
|
||||
@@ -81,100 +38,56 @@ mod tests {
|
||||
meta
|
||||
}
|
||||
|
||||
fn signed_fixture(values: &[serde_json::Value], tamper: Option<&str>) -> (tempfile::TempDir, String) {
|
||||
fn fixture(value: &serde_json::Value, tamper: bool) -> (tempfile::TempDir, String) {
|
||||
let folder = tempfile::tempdir().unwrap();
|
||||
let signing = SigningKey::from_bytes(&[37; 32]);
|
||||
for value in values {
|
||||
let version = value["version"].as_str().unwrap();
|
||||
let dir = folder.path().join(version);
|
||||
fs::create_dir(&dir).unwrap();
|
||||
let bytes = serde_json::to_vec(value).unwrap();
|
||||
fs::write(dir.join("manifest.json.sig"), STANDARD.encode(signing.sign(&bytes).to_bytes())).unwrap();
|
||||
fs::write(dir.join("manifest.json"), &bytes).unwrap();
|
||||
if tamper == Some(version) { fs::write(dir.join("manifest.json"), b"tampered").unwrap(); }
|
||||
}
|
||||
let bytes = serde_json::to_vec(value).unwrap();
|
||||
fs::write(folder.path().join("manifest.json.sig"), STANDARD.encode(signing.sign(&bytes).to_bytes())).unwrap();
|
||||
fs::write(folder.path().join("manifest.json"), if tamper { b"tampered".as_slice() } else { &bytes }).unwrap();
|
||||
(folder, STANDARD.encode(signing.verifying_key().to_bytes()))
|
||||
}
|
||||
|
||||
fn select_fixture(values: &[serde_json::Value], installed: &str, tamper: Option<&str>) -> Result<Selection> {
|
||||
let (folder, key) = signed_fixture(values, tamper);
|
||||
let latest = values.last().unwrap()["version"].as_str().unwrap();
|
||||
select_with(&meta(installed), Source::Url(format!("{RELEASES}{latest}")), &mut |source| {
|
||||
let Source::Url(url) = source else { unreachable!() };
|
||||
let version = url.strip_prefix(RELEASES).unwrap();
|
||||
pkgsource::fetch_manifest(&Source::Dir(folder.path().join(version)), &key)
|
||||
})
|
||||
}
|
||||
|
||||
fn pair() -> Vec<serde_json::Value> {
|
||||
let bridge = package("1.1.0", "1.0.0", &"c".repeat(64));
|
||||
let digest = fsx::sha256_bytes(&serde_json::to_vec(&bridge).unwrap());
|
||||
vec![bridge, package("1.2.0", "1.1.0", &digest)]
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn finds_a_signed_intermediate_without_relaxing_candidate_validation() {
|
||||
let selection = select_fixture(&pair(), "1.0.0", None).unwrap();
|
||||
assert!(matches!(selection.source, Source::Url(url) if url.ends_with("1.1.0")));
|
||||
assert_eq!(selection.latest_version.as_deref(), Some("1.2.0"));
|
||||
let latest = Manifest::parse(&serde_json::to_vec(pair().last().unwrap()).unwrap()).unwrap();
|
||||
assert!(update::validate_candidate(&meta("1.0.0"), &latest).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn direct_updates_and_current_versions_do_not_request_an_intermediate() {
|
||||
for installed in ["1.1.0", "1.2.0"] {
|
||||
let selection = select_fixture(&pair(), installed, None).unwrap();
|
||||
assert!(selection.latest_version.is_none());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_tampered_or_replaced_intermediate_manifests() {
|
||||
assert!(select_fixture(&pair(), "1.0.0", Some("1.1.0")).is_err());
|
||||
let mut values = pair();
|
||||
values[0]["builtAt"] = "replaced".into();
|
||||
assert!(select_fixture(&values, "1.0.0", None).unwrap_err().to_string().contains("differs"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn follows_multiple_tested_edges_and_rejects_missing_paths() {
|
||||
let mut values = pair();
|
||||
let digest = fsx::sha256_bytes(&serde_json::to_vec(values.last().unwrap()).unwrap());
|
||||
values.push(package("1.3.0", "1.2.0", &digest));
|
||||
let selection = select_fixture(&values, "1.0.0", None).unwrap();
|
||||
assert!(matches!(selection.source, Source::Url(url) if url.ends_with("1.1.0")));
|
||||
assert!(select_fixture(&values, "0.9.0", None).is_err());
|
||||
assert!(select_fixture(&values, "2.0.0", None).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn never_routes_custom_sources_or_unknown_installations() {
|
||||
let values = pair();
|
||||
let (folder, key) = signed_fixture(&values, None);
|
||||
let mut calls = 0;
|
||||
let result = select_with(&meta("1.0.0"), Source::Dir(folder.path().join("1.2.0")), &mut |source| {
|
||||
calls += 1;
|
||||
pkgsource::fetch_manifest(source, &key)
|
||||
});
|
||||
assert!(result.is_err());
|
||||
assert_eq!(calls, 1);
|
||||
assert!(select_fixture(&values, "unknown", None).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_incompatible_platforms_and_manager_versions() {
|
||||
for index in [0, 1] {
|
||||
for (field, value) in [("minManagerVersion", "99.0.0"), ("platform", "other-platform")] {
|
||||
let mut values = pair();
|
||||
if field == "platform" { values[index]["compatibility"][field] = value.into(); }
|
||||
else { values[index][field] = value.into(); }
|
||||
if index == 0 {
|
||||
let digest = fsx::sha256_bytes(&serde_json::to_vec(&values[0]).unwrap());
|
||||
values[1]["compatibility"]["sourceDatabases"]["1.1.0"]["manifestSha256"] = digest.into();
|
||||
}
|
||||
assert!(select_fixture(&values, "1.0.0", None).is_err());
|
||||
fn every_known_older_version_selects_the_latest_signed_package_once() {
|
||||
for installed in ["0.2.0", "0.261004.20", "0.261005.0", "0.261007.24", "0.261011.800006", "0.261013.54", "0.261015.58"] {
|
||||
let (folder, key) = fixture(&package(), false);
|
||||
for kind in [crate::registry::InstallKind::New, crate::registry::InstallKind::Imported] {
|
||||
let mut installation = meta(installed);
|
||||
installation.kind = kind;
|
||||
let mut calls = 0;
|
||||
let selected = select_with(&installation, Source::Dir(folder.path().into()), &mut |source| {
|
||||
calls += 1;
|
||||
pkgsource::fetch_manifest(source, &key)
|
||||
}).unwrap();
|
||||
assert!(matches!(selected.source, Source::Dir(path) if path == folder.path()));
|
||||
assert!(selected.latest_version.is_none());
|
||||
assert_eq!(calls, 1, "no intermediate package fetches for {installed}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unknown_versions_and_downgrades_remain_blocked() {
|
||||
let (folder, key) = fixture(&package(), false);
|
||||
for installed in ["unknown", "a65be06ec62f4", "0.261016.59"] {
|
||||
assert!(select(&meta(installed), Source::Dir(folder.path().into()), &key).is_err());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn signed_target_is_required_even_for_unlisted_old_versions() {
|
||||
let (folder, key) = fixture(&package(), true);
|
||||
assert!(select(&meta("0.261004.20"), Source::Dir(folder.path().into()), &key).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn platform_and_manager_requirements_are_still_enforced() {
|
||||
for (field, value) in [("minManagerVersion", "99.0.0"), ("platform", "other-platform")] {
|
||||
let mut target = package();
|
||||
if field == "platform" { target["compatibility"][field] = value.into(); }
|
||||
else { target[field] = value.into(); }
|
||||
let (folder, key) = fixture(&target, false);
|
||||
assert!(select(&meta("0.261004.20"), Source::Dir(folder.path().into()), &key).is_err());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
# Update workflow
|
||||
|
||||
Version compatibility selects a package; it does not prove that a particular installed database can apply it.
|
||||
The Manager selects the latest signed package directly for any known older server version. The source-version list records release qualification; it is not an exclusive allowlist and does not prove that a particular installed database can apply the package. Unknown imported versions, downgrades, incompatible platforms and newer Manager requirements remain blocked.
|
||||
|
||||
The updater verifies the signed manifest and archive, checks file changes and database history, stops the server, and saves one complete recovery point. It then replaces files, applies pending SQL once, verifies the target schema and starts the updated server once for validation. Shared authentication migrations run once; both realm histories are checked before changing either. Account and character identities are compared before and after migration and startup.
|
||||
|
||||
@@ -8,7 +8,7 @@ Account migration history is stored in the shared account database. Read-only ch
|
||||
|
||||
Applied migrations are skipped; changed checksums and interrupted/failed records stop the update. Duplicate SQL identifiers for the same schema are rejected before execution. SQL or startup failure restores files and databases together. If recovery fails, startup remains blocked and the recovery artifacts remain available.
|
||||
|
||||
The per-update nested server rehearsal has been removed. Full-copy upgrade/startup testing belongs to release qualification, on independent disposable installations. Cleanup of interrupted rehearsals from older Manager versions remains for compatibility. Signed packages, recovery verification, configuration merge and startup validation stay enabled. No migration guard is bypassed, no unexecuted SQL is marked applied, and the package compatibility matrix is unchanged.
|
||||
The per-update nested server rehearsal and intermediate-package routing have been removed. Full-copy upgrade/startup testing belongs to release qualification, on independent disposable installations. Cleanup of interrupted rehearsals from older Manager versions remains for compatibility. Signed packages, recovery verification, configuration merge and startup validation stay enabled. No migration guard is bypassed and no unexecuted SQL is marked applied. Retired source archives do not prevent a direct update, but the database history must still be consistent and target checks must pass.
|
||||
|
||||
## Verify with an actual installation copy
|
||||
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "coa-server-manager",
|
||||
"version": "0.6.20",
|
||||
"version": "0.6.22",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "coa-server-manager",
|
||||
"version": "0.6.20",
|
||||
"version": "0.6.22",
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^2.12.0",
|
||||
"@tauri-apps/plugin-dialog": "^2.8.0",
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "coa-server-manager",
|
||||
"private": true,
|
||||
"version": "0.6.20",
|
||||
"version": "0.6.22",
|
||||
"license": "AGPL-3.0-only",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "CoA Server Manager",
|
||||
"version": "0.6.20",
|
||||
"version": "0.6.22",
|
||||
"identifier": "com.coa.servermanager",
|
||||
"build": {
|
||||
"beforeDevCommand": "npm run dev",
|
||||
|
||||
Reference in new issue
Block a user