fix(saves): keep imported presets intact, cap crews to preset units and drop used-unit scan

This commit is contained in:
N0VAN0M4LY committed 2026-11-30 19:21:47 +08:00
1 parent 388dc9d9d7
commit e6e75d92c6
10 files changed
+109 -114

No files matched your search

@@ -13,13 +13,13 @@ export type SaveTask = Location & (
| { readonly operation: 'avatarPreview'; readonly avatar: string }
| { readonly operation: 'editAccount'; readonly userId: string; readonly edits: AccountEdits }
| { readonly operation: 'edit'; readonly userId: string; readonly values: CurrencyEdits }
| { readonly operation: 'previewOfficial'; readonly paths: readonly string[]; readonly includeUsedVehicles: boolean }
| { readonly operation: 'previewOfficial'; readonly paths: readonly string[] }
| {
readonly operation: 'importOfficial';
readonly paths: readonly string[];
readonly userId: string;
readonly options: OfficialImportOptions;
readonly offlineClientCacheFolder?: string;
readonly offlineClientCacheFolders?: readonly string[];
}
| { readonly operation: 'readResearch'; readonly userId: string; readonly branch?: ResearchBranch }
| { readonly operation: 'editResearch'; readonly userId: string; readonly branch: ResearchBranch; readonly action: ResearchOperation }
@@ -26,9 +26,9 @@ function execute(task: SaveTask): SaveReply {
return editSaveCurrencies(task, task.userId, task.values)
? { ok: true, result: null } : { ok: false, error: 'save_not_found' };
case 'previewOfficial':
return { ok: true, result: previewOfficialBackup(task, task.paths, task.includeUsedVehicles) };
return { ok: true, result: previewOfficialBackup(task, task.paths) };
case 'importOfficial':
return { ok: true, result: importOfficialBackup(task, task.userId, task.paths, task.options, task.offlineClientCacheFolder) };
return { ok: true, result: importOfficialBackup(task, task.userId, task.paths, task.options, task.offlineClientCacheFolders) };
case 'readResearch': {
const result = readSaveResearch(task, task.userId, task.branch);
return result ? { ok: true, result } : { ok: false, error: 'save_not_found' };