feat(saves): import official game backups

This commit is contained in:
N0VAN0M4LY committed 2026-11-29 16:03:31 +08:00
1 parent 2e3cc0aaec
commit 597df6b4f5
15 files changed
+661 -16

No files matched your search

+18 -2
View File
@@ -46,11 +46,27 @@ export const SaveTransferSchema = SaveRegistrationSchema.extend({
z.object({ kind: z.literal('file'), path: z.string().min(1) }),
]),
});
export const SaveBackupNameSchema = z.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}-\d{3}Z\.(manual|launch|restore)\.[0-9a-f-]{36}\.zip$/);
export const SaveBackupNameSchema = z.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}-\d{3}Z\.(manual|launch|restore|import)\.[0-9a-f-]{36}\.zip$/);
export const SaveBackupSchema = z.object({
name: SaveBackupNameSchema, createdAt: z.string(), type: z.enum(['manual', 'launch', 'restore']), size: z.number().int().nonnegative(),
name: SaveBackupNameSchema, createdAt: z.string(), type: z.enum(['manual', 'launch', 'restore', 'import']), size: z.number().int().nonnegative(),
});
export const SaveOfficialRequestSchema = SaveKeysSchema.extend({
paths: z.array(z.string().min(1)).min(1).max(3),
});
export const OfficialImportOptionsSchema = z.object({
importSettings: z.boolean(), unlockVehicles: z.boolean(), includeUsedVehicles: z.boolean(),
equipment: z.enum(['full', 'basic', 'stock']),
});
export const OfficialPreviewSchema = z.object({
files: z.array(z.object({ name: z.string(), version: z.number().int() })),
presets: z.array(z.object({ country: z.string(), title: z.string(), vehicles: z.array(z.string()) })),
vehicles: z.array(z.string()),
omitted: z.array(z.string()),
});
export type OfficialPreview = z.output<typeof OfficialPreviewSchema>;
export type OfficialImportOptions = z.output<typeof OfficialImportOptionsSchema>;
export type SaveTransfer = z.output<typeof SaveTransferSchema>;
export type SaveBackup = z.output<typeof SaveBackupSchema>;