Skip to content

Commit

Permalink
Add externally_connectable for Chrome (#17)
Browse files Browse the repository at this point in the history
* Add externally_connectable for Chrome Users on Website

* Formatting

* Remove Optional Permissions from Chrome

* Update

* Streamline Chrome Permissions

* Revert Permissions Change in This Branch
  • Loading branch information
smashedr authored Apr 29, 2024
1 parent 65b9c3f commit 9390015
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 62 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"sourceType": "module"
},
"rules": {
"no-empty": "off",
"no-extra-semi": "off",
"no-undef": "off"
"no-undef": "off",
"no-unused-vars": "off"
}
}
3 changes: 3 additions & 0 deletions manifest-chrome.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
"type": "module"
},
"optional_host_permissions": ["*://*.playdrift.com/*"],
"externally_connectable": {
"matches": ["*://playdrift-extension.cssnr.com/*"]
},
"minimum_chrome_version": "88"
}
2 changes: 1 addition & 1 deletion manifest-firefox.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"browser_specific_settings": {
"gecko": {
"id": "playdrift@cssnr.com",
"strict_min_version": "109.0"
"strict_min_version": "112.0"
}
}
}
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "PlayDrift Web Extension.",
"homepage_url": "https://github.com/cssnr/playdrift-extension",
"author": "Shane",
"version": "0.4.6",
"version": "0.4.7",
"manifest_version": 3,
"commands": {
"_execute_action": {
Expand Down
95 changes: 43 additions & 52 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@
"build": "npm run build:chrome && npm run build:firefox"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^6.5.1",
"@fortawesome/fontawesome-free": "^6.5.2",
"@popperjs/core": "^2.11.8",
"bootstrap": "^5.3.2",
"emoji-mart": "^5.5.2",
"emoji-picker-element": "^1.21.2",
"bootstrap": "^5.3.3",
"emoji-mart": "^5.6.0",
"emoji-picker-element": "^1.21.3",
"jquery": "^3.7.1"
},
"devDependencies": {
"eslint": "^8.51.0",
"eslint": "^8.57.0",
"gulp": "^4.0.2",
"json-merger": "^1.1.10",
"prettier": "^3.0.3",
"web-ext": "^7.8.0"
"prettier": "^3.2.5",
"web-ext": "^7.11.0"
}
}
7 changes: 7 additions & 0 deletions src/js/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ chrome.runtime.onInstalled.addListener(onInstalled)
chrome.contextMenus.onClicked.addListener(onClicked)
chrome.commands.onCommand.addListener(onCommand)
chrome.runtime.onMessage.addListener(onMessage)
chrome.runtime.onMessageExternal.addListener(onMessageExternal)
chrome.tabs.onUpdated.addListener(onUpdate)
// chrome.alarms.onAlarm.addListener(onAlarm)
chrome.storage.onChanged.addListener(onChanged)
Expand Down Expand Up @@ -187,6 +188,12 @@ async function onMessage(message, sender, sendResponse) {
// }
}

async function onMessageExternal(message, sender, sendResponse) {
console.debug('onMessageExternal: message, sender:', message, sender)
const { profile } = await chrome.storage.sync.get(['profile'])
sendResponse(profile)
}

/**
* On Changed Callback
* TODO: This fires on ALL Tabs and not just the ones in optional host permissions
Expand Down

0 comments on commit 9390015

Please sign in to comment.