Add privacy opt-in for firefox extension
This commit is contained in:
@ -11,7 +11,7 @@
|
||||
"url": "https://omnivore.app/"
|
||||
},
|
||||
"homepage_url": "https://omnivore.app/",
|
||||
"content_security_policy": "default-src 'none'; child-src 'none'; manifest-src 'none'; media-src 'none'; object-src 'none'; worker-src 'none'; connect-src https://storage.googleapis.com/ process.env.OMNIVORE_GRAPHQL_URL blob:; frame-src 'none'; font-src 'none'; img-src data:; script-src 'self'; script-src-elem 'self'; script-src-attr 'none'; style-src 'self'; style-src-elem 'self'; style-src-attr 'none'; base-uri 'none'; form-action 'none'; block-all-mixed-content; upgrade-insecure-requests; report-uri https://api.jeurissen.co/reports/csp/webext/omnivore/",
|
||||
"content_security_policy": "default-src 'none'; child-src 'none'; manifest-src 'none'; media-src 'none'; object-src 'none'; worker-src 'none'; connect-src https://storage.googleapis.com/ process.env.OMNIVORE_GRAPHQL_URL blob:; frame-src 'none'; font-src 'none'; img-src data:; script-src 'self'; script-src-elem 'self' 'unsafe-inline'; script-src-attr 'unsafe-inline'; style-src 'self' 'unsafe-inline'; style-src-elem 'self' 'unsafe-inline'; style-src-attr 'none'; base-uri 'none'; form-action 'none'; block-all-mixed-content; upgrade-insecure-requests; report-uri https://api.jeurissen.co/reports/csp/webext/omnivore/",
|
||||
"icons": {
|
||||
"16": "/images/extension/icon-16.png",
|
||||
"24": "/images/extension/icon-24.png",
|
||||
@ -95,4 +95,4 @@
|
||||
"web_accessible_resources": [
|
||||
"views/toast.html"
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -643,9 +643,16 @@ function checkAuthOnFirstClickPostInstall(tabId) {
|
||||
}
|
||||
|
||||
function handleActionClick() {
|
||||
executeAction(function (currentTab) {
|
||||
extensionSaveCurrentPage(currentTab.id)
|
||||
})
|
||||
getStorageItem('consentGranted')
|
||||
.then((consentGranted) => {
|
||||
console.log('consentGranted: ', consentGranted)
|
||||
executeAction(function (currentTab) {
|
||||
extensionSaveCurrentPage(currentTab.id)
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
console.log('extension consent not granted')
|
||||
})
|
||||
}
|
||||
|
||||
function executeAction(action) {
|
||||
@ -684,24 +691,6 @@ function executeAction(action) {
|
||||
})
|
||||
}
|
||||
|
||||
function getActionableState(tab) {
|
||||
if (tab.status !== 'complete') return false
|
||||
|
||||
const tabUrl = tab.pendingUrl || tab.url
|
||||
if (!tabUrl) return false
|
||||
|
||||
if (!tabUrl.startsWith('https://') && !tabUrl.startsWith('http://'))
|
||||
return false
|
||||
|
||||
if (
|
||||
tabUrl.startsWith('https://omnivore.app/') &&
|
||||
tabUrl.startsWith('https://dev.omnivore.app/')
|
||||
)
|
||||
return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
function init() {
|
||||
browserApi.tabs.onActivated.addListener(({ tabId }) => {
|
||||
// Due to a chrome bug, chrome.tabs.* may run into an error because onActivated is triggered too fast.
|
||||
@ -820,6 +809,22 @@ function init() {
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
browser.runtime.onInstalled.addListener(async ({ reason, temporary }) => {
|
||||
// if (temporary) return // skip during development
|
||||
console.log('onInstalled: ', reason, temporary)
|
||||
switch (reason) {
|
||||
case 'update':
|
||||
case 'install':
|
||||
{
|
||||
const url = browser.runtime.getURL('views/installed.html')
|
||||
await browser.tabs.create({ url })
|
||||
// or: await browser.windows.create({ url, type: "popup", height: 600, width: 600, });
|
||||
}
|
||||
break
|
||||
// see below
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
init()
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
|
||||
<style>
|
||||
|
||||
html,
|
||||
body {
|
||||
@ -28,7 +29,7 @@ body {
|
||||
background: linear-gradient(150deg, #fff 55%, #ffde8c 55%);
|
||||
background-color: #fff;
|
||||
color: #3d3d3d;
|
||||
font-family: sans-serif;
|
||||
font-family: Inter, sans-serif;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user