Add auto-config import to clickbait extension, move more funcs to shared lib

Also fix a isSafari call
This commit is contained in:
Ajay
2023-05-08 17:02:49 -04:00
parent 71dd4a97bf
commit f2482ee973
14 changed files with 51 additions and 93 deletions

View File

@@ -79,6 +79,20 @@ chrome.runtime.onMessage.addListener(function (request, sender, callback) {
}
});
chrome.runtime.onMessageExternal.addListener((request, sender, callback) => {
if (CompileConfig.extensionCommunicationAllowList.includes(sender.id)) {
if (request.message === "requestConfig") {
callback({
userID: Config.config.userID,
allowExpirements: Config.config.allowExpirements,
showDonationLink: Config.config.showDonationLink,
showUpsells: Config.config.showUpsells,
darkMode: Config.config.darkMode,
})
}
}
});
chrome.runtime.onConnect.addListener((port) => {
if (port.name === "popup") {
chrome.tabs.query({