Files
WT-Offline/apps/launcher/src/shared/schemas/patch-pack.ts
T
N0VAN0M4LY 3e2acc5a17 Release adaptation packs and let the launcher install them
An adaptation pack is the patch set (exe, GUI, native definitions and
version records) released on its own, so a new game build can be adapted
without a new offline version. It is a zip with a manifest, signed with
Ed25519, published as a GitHub release tagged patches-<YYYY.MM.DD[.N]>.

- packages/patcher/src/patch-pack: manifest and version numbers, zip
  writing and reading with path and size checks, signatures, a check that
  a patch set reads as a whole; tuning/patch-pack.jsonc holds the
  repository and the limits.
- scripts/generate-patch-signing-key.ts writes the public key for the
  repository and the private key outside it; scripts/build-patch-pack.ts
  packs only committed files and signs with PATCH_SIGNING_KEY.
- .github/workflows/patch-pack.yml packs, signs and publishes on a
  patches-* tag or a manual run.
- Launcher main process: find the newest pack release, download, verify,
  unpack into user data and make it active; resource paths use the
  active pack when it is usable (a repository checkout only with
  WTO_USE_PATCH_PACK=1). The pages that show and start this come later.
2026-11-29 16:08:37 +08:00

57 lines
1.9 KiB
TypeScript

/**
* What the launcher reports about adaptation packs (main/services/patch-pack/): which patch set
* the builds use, and whether a newer pack is released.
*/
/** The patch set that ships with the launcher, or a downloaded adaptation pack. */
export type PatchSetSource = 'bundled' | 'downloaded';
export interface ActivePatchSet {
readonly source: PatchSetSource;
/** Pack version; null for a bundled set without one (a repository checkout). */
readonly version: string | null;
/** Game versions with a version record in the set. */
readonly gameVersions: readonly string[];
}
export interface PackRelease {
readonly version: string;
readonly gameVersions: readonly string[];
readonly minAppVersion: string;
readonly publishedAt: string | null;
}
export type PackCheckStatus =
/** No release is newer than the active set. */
| 'up_to_date'
/** A newer pack this launcher can use. */
| 'available'
/** A newer pack needs a newer offline version (launcher) first. */
| 'needs_app_update'
/** The check could not be made; see `problem`. */
| 'failed';
export type PackProblem =
/** This build of the launcher carries no signing key, so it accepts no pack. */
| 'no_signing_key'
/** GitHub could not be reached or answered with an error. */
| 'network'
/** The release or the pack is malformed. */
| 'contents'
/** The signature does not match. */
| 'signature'
/** The pack is larger than allowed. */
| 'size';
export interface PackCheck {
readonly status: PackCheckStatus;
readonly active: ActivePatchSet;
/** The newest released pack; null when none is released or the check failed. */
readonly latest: PackRelease | null;
readonly problem: PackProblem | null;
}
export type PackApplyResult =
| { readonly ok: true; readonly active: ActivePatchSet }
| { readonly ok: false; readonly problem: PackProblem | 'needs_app_update' | 'up_to_date' };