Skip to content

Commit

Permalink
fix Chrome manifest v3
Browse files Browse the repository at this point in the history
  • Loading branch information
nemanjam committed Apr 17, 2024
1 parent a777d30 commit d0d3ff8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
2 changes: 2 additions & 0 deletions docs/work-notes/todo2.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ db wrapper
add version label
nested comments, check that only comments content is in viewport

fix chrome manifest errors

// ovde na pocetku nove sesije oznacava prethodnu kao procitanu
const { threadId, updatedAt } = existingThread;
const updatedComments = await updateCommentsSessionCreatedAtForThread(
Expand Down
7 changes: 7 additions & 0 deletions source/Background/service-worker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import 'emoji-log';
import browser from 'webextension-polyfill';

// for Chrome manifest v3
browser.runtime.onInstalled.addListener((): void => {
console.emoji('🦄', 'extension installed');
});
13 changes: 5 additions & 8 deletions source/manifest-v3-chrome.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"homepage_url": "https://github.com/nemanjam/reddit-unread-comments",
"short_name": "Reddit Unread Comments",

"permissions": ["activeTab", "http://*.reddit.com/*", "https://*.reddit.com/*"],
"permissions": ["activeTab"],

"host_permissions": ["http://*.reddit.com/*", "https://*.reddit.com/*"],

"content_security_policy": {
"extension_pages": "script-src 'self'; object-src 'self'"
Expand All @@ -24,12 +26,6 @@
"name": "Nemanja Mitic"
},

"browser_specific_settings": {
"gecko": {
"id": "{754FB1AD-CC3B-4756-B6A0-7776F7CA9D17}"
}
},

"__chrome__minimum_chrome_version": "88",
"__opera__minimum_opera_version": "36",

Expand All @@ -53,7 +49,8 @@
},

"background": {
"service_worker": "js/background.bundle.js"
"__firefox__scripts": ["js/background.bundle.js"],
"__chrome|opera|edge__service_worker": "js/bgServiceWorker.bundle.js"
},

"content_scripts": [
Expand Down
1 change: 1 addition & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ module.exports = {
entry: {
manifest: path.join(sourcePath, 'manifest.json'),
background: path.join(sourcePath, 'Background', 'index.ts'),
bgServiceWorker: path.join(sourcePath, 'Background', 'service-worker.ts'),
contentScript: path.join(sourcePath, 'ContentScript', 'index.ts'),
popup: path.join(sourcePath, 'Popup', 'index.tsx'),
options: path.join(sourcePath, 'Options', 'index.tsx'),
Expand Down

0 comments on commit d0d3ff8

Please sign in to comment.