Skip to content
Draft
Show file tree
Hide file tree
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
16 changes: 9 additions & 7 deletions app/manifest.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
{
"name": "__MSG_appName__",
"version": "3.0.1",
"manifest_version": 2,
"manifest_version": 3,
"description": "__MSG_appDescription__",
"icons": {
"16": "images/icon2-16.png",
"128": "images/icon2-128.png"
},
"permissions": [
"storage",
"storage"
],
"host_permissions": [
"https://github.com/*/*/pull/*"
],
"default_locale": "en",
"background": {
"scripts": [
"scripts/background.js"
],
"persistent": true
"service_worker": "scripts/background.js"
},
"options_ui": {
"page": "options.html",
"open_in_tab": true
},
"options_page": "options.html",
"content_scripts": [
{
"matches": [
Expand Down
25 changes: 0 additions & 25 deletions app/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,13 @@
// Define browser for cross-browser compatibility
var browser = (typeof browser !== 'undefined') ? browser : chrome;

function migrateLocalStorageToBrowserStorage() {
// Check if localStorage is not null and contains any keys
if (!localStorage || Object.keys(localStorage).length === 0) {
console.log('No localStorage data to migrate.');
return;
}

// Get all localStorage keys
const localStorageKeys = Object.keys(localStorage);
const dataToMigrate = {};

localStorageKeys.forEach((key) => {
dataToMigrate[key] = localStorage.getItem(key);
});

// Store data in broswer.storage
browser.storage.local.set(dataToMigrate, () => {
console.log('Data migrated to browser.storage', dataToMigrate);

// Clear localStorage after migration
localStorage.clear();
});
}

browser.runtime.onInstalled.addListener(function (details) {
if (details.reason === 'install') {
// Handle installation logic
console.log('Extension installed');
} else if (details.reason === 'update') {
console.log('previousVersion', details.previousVersion);
// Handle update logic
migrateLocalStorageToBrowserStorage();
}
});

Expand Down