fix(settings): restore archive password list

Load the stored archive password list through a dedicated trusted IPC channel when extraction settings are opened. Preserve write-only drafts across settings and account updates, guard unsaved edits against late responses, and invalidate stale loads during backup imports. Prepare version 2.0.46 with public release notes.
This commit is contained in:
Sucukdeluxe
2026-08-20 00:45:46 +02:00
parent 09ea7803f3
commit 08f017e8c4
16 changed files with 164 additions and 14 deletions
+32
View File
@@ -1124,6 +1124,38 @@ describe("account workspace", () => {
});
describe("settings App integration", () => {
it("loads and preserves the stored archive password list in the extraction section", () => {
const revealBlock = sourceBlock(appSource, "const showToast", "const clearImportQueueFocusListener");
const applyBlock = sourceBlock(appSource, "const applyPersistedSettings", "const syncLiveProviderUsageSettings");
const mainSource = readFileSync(new URL("../src/main/main.ts", import.meta.url), "utf8");
expect(revealBlock).toContain("window.rd.getArchivePasswordList()");
expect(revealBlock).toContain('settingsSubTab !== "extract"');
expect(appSource).toContain("setSettingsDraft((current) => createSettingsDraft(state.settings, current))");
expect(appSource).toContain("setSettingsDraft((current) => createSettingsDraft(next.settings, current))");
expect(applyBlock).toContain("setSettingsDraft((current) => createSettingsDraft(result, preserveWriteOnlyValues ? current : undefined))");
expect(mainSource).toContain("handleTrusted(IPC_CHANNELS.GET_ARCHIVE_PASSWORD_LIST");
});
it("persists an edited archive password list before unrelated account mutations", () => {
const editBlock = sourceBlock(appSource, "const onSaveAccountEditDialog", "const onSaveAccountDialog");
const createBlock = sourceBlock(appSource, "const onSaveAccountDialog", "const onResetAccountDailyUsage");
const deleteKeyBlock = sourceBlock(appSource, "const onRemoveDebridLinkKey", "const onToggleAccountEnabled");
const deleteRowsBlock = sourceBlock(appSource, "const removeAccountTableRows", "const checkAccountsActive");
expect(editBlock.indexOf("await persistDraftSettings()")).toBeLessThan(editBlock.indexOf("window.rd.replaceAccount"));
expect(createBlock.indexOf("await persistDraftSettings()")).toBeLessThan(createBlock.indexOf("window.rd.createAccount"));
expect(deleteKeyBlock.indexOf("await persistDraftSettings()")).toBeLessThan(deleteKeyBlock.indexOf("window.rd.deleteAccount"));
expect(deleteRowsBlock.indexOf("await persistDraftSettings()")).toBeLessThan(deleteRowsBlock.indexOf("window.rd.deleteAccount"));
});
it("invalidates an archive password reveal before applying imported settings", () => {
const applyBlock = sourceBlock(appSource, "const applyPersistedSettings", "const syncLiveProviderUsageSettings");
expect(applyBlock).toContain("archivePasswordLoadGenerationRef.current += 1");
expect(applyBlock.indexOf("archivePasswordLoadGenerationRef.current += 1")).toBeLessThan(applyBlock.indexOf("setSettingsDraft"));
});
it("enables an account by clearing both its row-level and provider-level locks", () => {
expect(buildScopedAccountEnabledState(
["debridlink", "linksnappy"],