Firefox fixes

This commit is contained in:
Corbin Davenport 2023-02-20 02:27:17 -05:00
parent 45ccbd64bf
commit 06193f2315
2 changed files with 57 additions and 9 deletions

View File

@ -34,6 +34,10 @@ chrome.runtime.onInstalled.addListener(function (details) {
})
})
}
// Initialize context menu
createContextMenu()
// Migrate data if needed
migrateOldData()
})
// Function for migrating data from version 1.0
@ -44,7 +48,7 @@ async function migrateOldData() {
var oldServer = data.userServer
console.log('Migrating server selection ' + oldServer + ' to new format...')
// Move data
await chrome.storage.sync.set({serverList: [oldServer]})
await chrome.storage.sync.set({ serverList: [oldServer] })
// Delete old data
await chrome.storage.sync.remove('userServer')
console.log('Migration complete!')
@ -113,7 +117,7 @@ chrome.contextMenus.onClicked.addListener(async function (info, tab) {
})
// Reload context menu options on storage change (e.g. when added or removed on settings page)
chrome.storage.onChanged.addListener(function() {
chrome.storage.onChanged.addListener(function () {
createContextMenu()
})
@ -138,10 +142,4 @@ function createPopup(serverUrl, shareLink, shareText, tab) {
// Function for action button
chrome.action.onClicked.addListener(async function (tab) {
createPopup('generic', tab.url, tab.title, tab)
})
// Initialize context menu
createContextMenu()
// Migrate data if needed
migrateOldData()
})

50
manifest-firefox.json Normal file
View File

@ -0,0 +1,50 @@
{
"manifest_version": 3,
"name": "Share to Mastodon",
"version": "2.0",
"author": "Corbin Davenport",
"homepage_url": "https://github.com/corbindavenport/share-to-mastodon",
"description": "Share links to Mastodon in one click!",
"options_ui": {
"page": "settings.html",
"open_in_tab": false
},
"action": {
"default_icon": {
"32": "img/icon_x32.png",
"48": "img/icon_action_x48.png",
"128": "img/icon_action_x128.png"
},
"default_title": "Share this page to Mastodon"
},
"commands": {
"_execute_action": {
"suggested_key": {
"default": "Ctrl+Shift+Y"
},
"description": "Share current page on Mastodon"
}
},
"permissions": [
"contextMenus",
"storage",
"notifications",
"activeTab"
],
"browser_specific_settings": {
"gecko": {
"id": "{4f049aab-274c-4a9b-8813-84b40b7d5ec4}",
"strict_min_version": "106.0"
}
},
"background": {
"scripts": [
"js/background.js"
]
},
"icons": {
"32": "img/icon_x32.png",
"48": "img/icon_x48.png",
"128": "img/icon_x128.png"
}
}