feat(saves): add save archives and copy transfers
This commit is contained in:
1 parent
073a907617
commit
d0a767e692
19 files changed
+660
-25
No files matched your search
@@ -40,6 +40,20 @@ export const SaveRegistrationSchema = z.object({
|
||||
copyId: CopyIdSchema, login: z.string(), password: z.string(), nick: z.string(),
|
||||
});
|
||||
|
||||
export const SaveTransferSchema = SaveRegistrationSchema.extend({
|
||||
source: z.discriminatedUnion('kind', [
|
||||
z.object({ kind: z.literal('save'), copyId: CopyIdSchema, userId: LocalUserIdSchema }),
|
||||
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 SaveBackupSchema = z.object({
|
||||
name: SaveBackupNameSchema, createdAt: z.string(), type: z.enum(['manual', 'launch', 'restore']), size: z.number().int().nonnegative(),
|
||||
});
|
||||
|
||||
export type SaveTransfer = z.output<typeof SaveTransferSchema>;
|
||||
export type SaveBackup = z.output<typeof SaveBackupSchema>;
|
||||
|
||||
export type SaveList = z.output<typeof SaveListSchema>;
|
||||
export type SaveDetails = z.output<typeof SaveDetailsSchema>;
|
||||
export type CurrencyEdits = z.output<typeof CurrencyEditsSchema>;
|
||||
|
||||
@@ -16,6 +16,7 @@ export const SettingsSchema = z.object({
|
||||
officialWallpapers: z.boolean().default(true),
|
||||
windowClose: WindowCloseSchema.default('quit'),
|
||||
afterGameStarts: AfterGameStartsSchema.default('minimize'),
|
||||
autoSaveBackups: z.boolean().default(true),
|
||||
developerMode: z.boolean().default(true),
|
||||
labStockPath: LabPathSchema.default(null),
|
||||
labDataPath: LabPathSchema.default(null),
|
||||
@@ -30,6 +31,7 @@ export const SettingsPatchSchema = z.object({
|
||||
officialWallpapers: z.boolean().optional(),
|
||||
windowClose: WindowCloseSchema.optional(),
|
||||
afterGameStarts: AfterGameStartsSchema.optional(),
|
||||
autoSaveBackups: z.boolean().optional(),
|
||||
developerMode: z.boolean().optional(),
|
||||
labStockPath: LabPathSchema.optional(),
|
||||
labDataPath: LabPathSchema.optional(),
|
||||
|
||||
Reference in new issue
Block a user