Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep site/global tracker settings from v8 for future use #1492

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions extension-manifest-v3/src/store/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,40 @@ async function migrateFromMV2() {

options.installDate = storage.install_date || '';

// Clear the storage
await chrome.storage.local.clear();

try {
// Keep for the future use global and site specific tracker block/unblock lists
const trackers = storage.bugs.apps;
const optionsFromV8 = {
selectedTrackers: Object.keys(storage.selected_app_ids).map(
(id) => trackers[id].trackerID,
),
siteSpecificBlocks: Object.entries(storage.site_specific_blocks).map(
([domain, ids]) => {
return {
domain,
trackers: ids.map((id) => trackers[id].trackerID),
};
},
),
siteSpecificUnblocks: Object.entries(
storage.site_specific_unblocks,
).map(([domain, ids]) => {
return {
domain,
trackers: ids.map((id) => trackers[id].trackerID),
};
}),
};

// Save options for the future use
await chrome.storage.local.set({ optionsFromV8 });
} catch (e) {
console.error(`Error while migrating site specific tracker lists: `, e);
}

// Delete indexedDBs
// Notice: Doesn't wait to avoid blocking the migrated options
[
Expand Down
Loading