Skip to content

Commit

Permalink
opera build 0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
evandor committed Dec 31, 2024
1 parent 6bdd670 commit 8c889df
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 87 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ docs/.vitepress/cache
/playwright-report/index.html
/playwright-report/data/5d4853c068e16f8f2bfce4a4c55e11ce76176f22.zip
/coverage/
/.env.opera
7 changes: 4 additions & 3 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ elif [ "$1" = "edge" ]; then
envfile=".edge.env"
elif [ "$1" = "opera" ]; then
manifest="manifest-opera.json"
envfile=".opera.dev"
envfile=".env.opera"
fi

echo "using manifest src-bex/$manifest and $envfile"
Expand All @@ -27,10 +27,11 @@ mv .env .env.tmp
cp src-bex/$manifest src-bex/manifest.json
cp $envfile .env

quasar build -m bex
quasar build -m bex -T chrome

echo "output folder dist/bex-$1"
cp -R dist/bex/ "dist/bex-$1/"
mkdir "dist/bex-$1"
cp -R dist/bex-chrome/ "dist/bex-$1/"

mv src-bex/manifest.tmp src-bex/manifest.json
mv .env.tmp .env
28 changes: 15 additions & 13 deletions src-bex/background.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
/**
* Importing the file below initializes the extension background.
*
* Warnings:
* 1. Do NOT remove the import statement below. It is required for the extension to work.
* If you don't need createBridge(), leave it as "import '#q-app/bex/background'".
* 2. Do NOT import this file in multiple background scripts. Only in one!
* 3. Import it in your background service worker (if available for your target browser).
*/
import { createBridge } from '#q-app/bex/background'

// https://stackoverflow.com/questions/49739438/when-and-how-does-a-pwa-update-itself
Expand Down Expand Up @@ -52,14 +43,25 @@ if (chrome.sidePanel && chrome.sidePanel.setPanelBehavior) {
chrome.sidePanel.setPanelBehavior({ openPanelOnActionClick: true }).catch((error: any) => console.error(error))
}

/* Firefox specific */
// if (useQuasar().platform.is.firefox) {
chrome.action.onClicked.addListener((t: chrome.tabs.Tab) => {
// @ts-expect-error unknown
if (browser && browser.sidebarAction) {
try {
// @ts-expect-error unknown
browser.sidebarAction.toggle()
if (browser && browser.sidebarAction) {
// @ts-expect-error unknown
browser.sidebarAction.toggle()
}
} catch (e: any) {
console.log('e', e)
// opera maybe?
// @ts-expect-error unknown
if (opr && opr.sidebarAction) {
// @ts-expect-error unknown
opr.sidebarAction.setPanel({ panel: 'www/index.html' })
}
}
})
// }

chrome.runtime.onInstalled.addListener((details) => {
console.debug('adding onInstalled listener in background.ts', details)
Expand Down
158 changes: 87 additions & 71 deletions src-bex/manifest-opera.json
Original file line number Diff line number Diff line change
@@ -1,78 +1,94 @@
{
"manifest_version": 3,
"icons": {
"16": "icons/icon-16x16.png",
"48": "icons/icon-48x48.png",
"128": "icons/icon-128x128.png"
},
"permissions": [
"storage",
"tabs",
"activeTab",
"alarms",
"scripting",
"sidePanel",
"contextMenus",
"bookmarks"
],
"optional_permissions": ["pageCapture", "notifications", "webRequest", "tabGroups"],
"host_permissions": ["<all_urls>", "*://*/*"],
"sidebar_action": {
"default_icon": "icons/icon-48x48.png",
"default_title": "tabsets.bet - Better Bookmarks",
"default_panel": "www/index.html"
},
"background": {
"service_worker": "background.js"
},
"content_scripts": [
{
"matches": ["https://excalidraw.com/*"],
"js": ["tabsets-excalidraw-script.js"]
"all": {
"manifest_version": 3,
"icons": {
"16": "icons/icon-16x16.png",
"48": "icons/icon-48x48.png",
"128": "icons/icon-128x128.png"
},
{
"matches": ["*://*/*"],
"js": ["tabsets-content-script.js"]
}
],
"content_security_policy": {
"extension_pages": "script-src 'self'; object-src 'self';"
},
"web_accessible_resources": [
{
"resources": ["*"],
"matches": ["*://*/*"]
}
],
"omnibox": { "keyword": "ts" },
"commands": {
"_execute_action": {
"suggested_key": {
"default": "Ctrl+B",
"mac": "Command+B"
"permissions": [
"storage",
"tabs",
"activeTab",
"alarms",
"scripting",
"sidePanel",
"contextMenus",
"bookmarks"
],
"optional_permissions": [
"pageCapture",
"notifications",
"webRequest",
"tabGroups"
],
"host_permissions": [
"<all_urls>",
"*://*/*"
],
"sidebar_action": {
"default_icon": "icons/icon-48x48.png",
"default_title": "tabsets.bet - Better Bookmarks",
"default_panel": "www/index.html"
},
"background": {
"service_worker": "background.js"
},
"content_scripts": [
{
"matches": [
"*://*/*"
],
"js": [
"tabsets-content-script.ts"
]
}
],
"content_security_policy": {
"extension_pages": "script-src 'self'; object-src 'self';"
},
"search": {
"suggested_key": {
"default": "Ctrl+K",
"mac": "Command+K"
},
"description": "Open Search Box"
"web_accessible_resources": [
{
"resources": [
"*"
],
"matches": [
"*://*/*"
]
}
],
"omnibox": {
"keyword": "ts"
},
"tabHistoryBack": {
"suggested_key": {
"default": "Alt+Left",
"mac": "Alt+Left"
"commands": {
"_execute_action": {
"suggested_key": {
"default": "Ctrl+B",
"mac": "Command+B"
}
},
"description": "Open last open tab"
},
"tabHistoryForward": {
"suggested_key": {
"default": "Alt+Right",
"mac": "Alt+Right"
"search": {
"suggested_key": {
"default": "Ctrl+K",
"mac": "Command+K"
},
"description": "Open Search Box"
},
"tabHistoryBack": {
"suggested_key": {
"default": "Alt+Left",
"mac": "Alt+Left"
},
"description": "Open last open tab"
},
"description": "Forward to next tab (if available)"
}
},
"options_page": "www/index.html#/mainpanel/settings"
}
"tabHistoryForward": {
"suggested_key": {
"default": "Alt+Right",
"mac": "Alt+Right"
},
"description": "Forward to next tab (if available)"
}
},
"options_page": "www/index.html#/mainpanel/settings"
}
}

0 comments on commit 8c889df

Please sign in to comment.