The window background now comes from two sources, served to the window over a wto-art:// scheme from the launcher's cache: - Website wallpapers: the newest entries of the public wallpaper gallery on warthunder.com (two pages), list refreshed at most daily, each 1920x1080 picture downloaded when first shown and kept in the cache. No cookies, no sign-in; a setting turns it off. Without a connection the pictures downloaded before stay available. - Game pictures: the nation pictures the game's own launcher keeps in launcherr.dat next to the game, extracted from the installed copy (fflate) once per archive version. Without either, the window keeps its drawn background. The settings choose a random picture per start or a fixed one (thumbnail grid); the home page shows the picture's name with previous / next. Checked: launcher typecheck, electron-vite build. Ran the window from a scratch user data folder with a fake copy holding a copy of the real launcherr.dat: 18 website wallpapers and 9 game pictures listed, both sizes and the game pictures load through wto-art://, an unknown picture is refused, stepping saves the choice, turning wallpapers off leaves the game pictures, no console errors.
19 lines
732 B
TypeScript
19 lines
732 B
TypeScript
import { z } from 'zod';
|
|
|
|
/**
|
|
* A background picture the window may show. `key` is what the settings store for a fixed choice:
|
|
* `official:<gallery id>` for a website wallpaper, `game:<name>` for a picture of the game copy.
|
|
*/
|
|
export const BackgroundPictureSchema = z.object({
|
|
key: z.string(),
|
|
source: z.enum(['official', 'game']),
|
|
/** The nation for game pictures (translated by the window), the picture name for wallpapers. */
|
|
label: z.string(),
|
|
url: z.string(),
|
|
thumbnailUrl: z.string(),
|
|
});
|
|
export type BackgroundPicture = z.output<typeof BackgroundPictureSchema>;
|
|
|
|
export const BACKGROUND_RANDOM = 'random';
|
|
export const BackgroundChoiceSchema = z.string().regex(/^(random|game:[a-z]+|official:[0-9a-f]{24})$/);
|