Skip to content

Commit

Permalink
Merge pull request #824 from ninoseki/use-valibot-before-sync
Browse files Browse the repository at this point in the history
refactor: use valibot to convert Proxy object into vanilla object
  • Loading branch information
ninoseki authored Jul 28, 2024
2 parents 541b172 + d7c1c55 commit 0a107f6
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions src/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,7 @@ export async function getOptions(): Promise<OptionsType> {
}

export async function setOptions(options: OptionsType): Promise<void> {
await chrome.storage.sync.set({
options: {
debug: options.debug,
strict: options.strict,
punycode: options.punycode,
refang: options.refang,
href: options.href,
disabledSearcherNames: options.disabledSearcherNames.map((n) => n),
disabledScannerNames: options.disabledScannerNames.map((n) => n),
hybridAnalysisAPIKey: options.hybridAnalysisAPIKey,
urlscanAPIKey: options.urlscanAPIKey,
urlscanVisibility: options.urlscanVisibility,
virusTotalAPIKey: options.virusTotalAPIKey,
},
});
// NOTE: use valibot to convert Proxy object into vanilla JS/TS object
const parsed = v.parse(OptionsSchema, options);
await chrome.storage.sync.set({ options: parsed });
}

0 comments on commit 0a107f6

Please sign in to comment.