diff --git a/pkg/extension/src/manifest.json b/pkg/extension/src/manifest.json
index 03dfcbc79..24dd13fe3 100644
--- a/pkg/extension/src/manifest.json
+++ b/pkg/extension/src/manifest.json
@@ -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"
]
-}
+}
\ No newline at end of file
diff --git a/pkg/extension/src/scripts/background.js b/pkg/extension/src/scripts/background.js
index 0fccd47c8..2a2833781 100644
--- a/pkg/extension/src/scripts/background.js
+++ b/pkg/extension/src/scripts/background.js
@@ -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()
diff --git a/pkg/extension/src/views/cta-popup.html b/pkg/extension/src/views/cta-popup.html
index 94fe55621..682799154 100644
--- a/pkg/extension/src/views/cta-popup.html
+++ b/pkg/extension/src/views/cta-popup.html
@@ -7,6 +7,7 @@
+