feat(launcher): support registering existing offline clients without copying

This commit is contained in:
N0VAN0M4LY committed 2026-11-30 19:32:24 +08:00
1 parent 7cb1011f0d
commit cae69a6446
11 files changed
+107 -30

No files matched your search

+10 -3
View File
@@ -12,6 +12,8 @@ export const GameFolderInspectionSchema = z.object({
verifiedVersions: z.array(z.string()),
/** The folder lies in a Steam library: installing into it needs the player's confirmation. */
inSteamLibrary: z.boolean(),
/** True when the folder already holds a complete wtoffline/stock backup from an offline setup. */
hasOfflineBackup: z.boolean(),
});
export type GameFolderInspection = z.output<typeof GameFolderInspectionSchema>;
@@ -74,10 +76,10 @@ export type PatchCheck = z.output<typeof PatchCheckSchema>;
/**
* copy: the stock installation is copied to a new folder and only read.
* in-place: the player's own prepared folder is used as the copy; its stock files are kept in
* the backup folder inside it.
* in-place: the player's own prepared folder is used directly; its stock files are backed up inside it.
* existing: an already prepared offline client folder is registered directly without copying.
*/
export const INSTALL_METHODS = ['copy', 'in-place'] as const;
export const INSTALL_METHODS = ['copy', 'in-place', 'existing'] as const;
export type InstallMethod = (typeof INSTALL_METHODS)[number];
export const CopyIdSchema = z.uuid();
@@ -110,6 +112,11 @@ export const InstallRequestSchema = z.discriminatedUnion('method', [
/** The player's prepared game folder, used as the game copy. */
gamePath: z.string().min(1),
}),
InstallChoicesSchema.extend({
method: z.literal('existing'),
/** An already prepared offline client folder registered directly without copying. */
gamePath: z.string().min(1),
}),
]);
export type InstallRequest = z.output<typeof InstallRequestSchema>;