From 6bdd6709a296f0d329b2c00cd3a80526b65a2781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20Gr=C3=A4f?= Date: Mon, 30 Dec 2024 12:16:38 +0100 Subject: [PATCH] checking firefox build --- package.json | 3 +- src-bex/background.ts | 18 ++-- src-bex/manifest.json | 86 +++++++++++++--- src-bex/tabsets-content-script.ts | 12 +-- src/pages/SettingsPage.vue | 76 +++----------- src/pages/helper/AppearanceSettings.vue | 130 +++++++++--------------- src/pages/helper/InternalSettings.vue | 55 ++++++++++ 7 files changed, 202 insertions(+), 178 deletions(-) create mode 100644 src/pages/helper/InternalSettings.vue diff --git a/package.json b/package.json index 8a483e65..28761303 100644 --- a/package.json +++ b/package.json @@ -8,11 +8,12 @@ "private": true, "scripts": { "dev": "quasar dev -m bex -T chrome", + "dev firefox": "quasar dev -m bex -T firefox", "lint": "eslint -c ./eslint.config.js \"./src*/**/*.{ts,js,cjs,mjs,vue}\"", "format": "prettier --write \"**/*.{js,ts,vue,scss,html,md,json}\" --ignore-path .gitignore", "build": "quasar build -m bex -T chrome", "build bex (publish)": "quasar build -m bex -T chrome", - "build bex firefox": "scripts/build.sh firefox", + "build bex firefox": "quasar build -m bex -T firefox", "build bex edge": "scripts/build.sh edge", "build bex opera": "scripts/build.sh opera", "icon": "icongenie generate -i src/assets/icon.png", diff --git a/src-bex/background.ts b/src-bex/background.ts index a742da6e..f1b61fa1 100644 --- a/src-bex/background.ts +++ b/src-bex/background.ts @@ -7,7 +7,6 @@ * 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 { PortName } from '#q-app' import { createBridge } from '#q-app/bex/background' // https://stackoverflow.com/questions/49739438/when-and-how-does-a-pwa-update-itself @@ -45,18 +44,23 @@ addEventListener('unhandledrejection', async (event) => { // }); chrome.omnibox.onInputEntered.addListener((text) => { - const newURL = chrome.runtime.getURL( - '/www/index.html#/searchresult?t=' + encodeURIComponent(text), - ) + const newURL = chrome.runtime.getURL('/www/index.html#/searchresult?t=' + encodeURIComponent(text)) chrome.tabs.create({ url: newURL }).catch((err) => console.log('[BEX] background.js error', err)) }) if (chrome.sidePanel && chrome.sidePanel.setPanelBehavior) { - chrome.sidePanel - .setPanelBehavior({ openPanelOnActionClick: true }) - .catch((error: any) => console.error(error)) + chrome.sidePanel.setPanelBehavior({ openPanelOnActionClick: true }).catch((error: any) => console.error(error)) } +/* Firefox specific */ +chrome.action.onClicked.addListener((t: chrome.tabs.Tab) => { + // @ts-expect-error unknown + if (browser && browser.sidebarAction) { + // @ts-expect-error unknown + browser.sidebarAction.toggle() + } +}) + chrome.runtime.onInstalled.addListener((details) => { console.debug('adding onInstalled listener in background.ts', details) if (chrome.runtime.lastError) { diff --git a/src-bex/manifest.json b/src-bex/manifest.json index 7f41a06b..02f6739e 100644 --- a/src-bex/manifest.json +++ b/src-bex/manifest.json @@ -6,22 +6,19 @@ "48": "icons/icon-48x48.png", "128": "icons/icon-128x128.png" }, - "permissions": [ - "storage", - "tabs", - "activeTab", - "alarms", - "scripting", - "sidePanel", - "contextMenus", - "bookmarks" + "host_permissions": [ + "", + "*://*/*" ], - "optional_permissions": ["pageCapture", "notifications", "webRequest", "tabGroups"], - "host_permissions": ["", "*://*/*"], "content_scripts": [ { - "matches": ["*://*/*"], - "js": ["tabsets-content-script.ts"] + "matches": [ + "", + "*://*/*" + ], + "js": [ + "tabsets-content-script.ts" + ] } ], "content_security_policy": { @@ -29,8 +26,12 @@ }, "web_accessible_resources": [ { - "resources": ["*"], - "matches": ["*://*/*"] + "resources": [ + "*" + ], + "matches": [ + "*://*/*" + ] } ], "omnibox": { @@ -71,13 +72,66 @@ "side_panel": { "default_path": "www/index.html" }, + "permissions": [ + "storage", + "tabs", + "activeTab", + "alarms", + "scripting", + "sidePanel", + "contextMenus", + "bookmarks" + ], + "optional_permissions": [ + "pageCapture", + "notifications", + "webRequest", + "tabGroups" + ], "background": { "service_worker": "background.ts" } }, "firefox": { + "browser_specific_settings": { + "gecko": { + "id": "{5809ba95-274e-4fd3-a92d-5baf03026290}" + } + }, + "permissions": [ + "storage", + "tabs", + "activeTab", + "alarms", + "scripting", + "contextMenus", + "webRequest", + "bookmarks" + ], + "optional_permissions": [ + "notifications" + ], + "optional_host_permissions": [ + "", + "*://*/*" + ], "background": { - "scripts": ["background.ts"] + "scripts": [ + "background.ts" + ] + }, + "sidebar_action": { + "default_icon": "icons/icon-48x48.png", + "default_title": "Tabsets", + "default_panel": "www/index.html#/sidepanel", + "open_at_install": true + }, + "commands": { + "_execute_sidebar_action": { + "suggested_key": { + "default": "Ctrl+Shift+Period" + } + } } } } diff --git a/src-bex/tabsets-content-script.ts b/src-bex/tabsets-content-script.ts index a7ac5fa3..2f55ec3b 100644 --- a/src-bex/tabsets-content-script.ts +++ b/src-bex/tabsets-content-script.ts @@ -48,9 +48,7 @@ function getMetas(document: Document) { const nameAttr = element.attributes.getNamedItem('name') const propAttr = element.attributes.getNamedItem('property') const contAttr = element.attributes.getNamedItem('content') - const key: string = nameAttr - ? nameAttr.value.trim().toLowerCase() || 'undefName' - : propAttr?.value || 'undefProp' + const key: string = nameAttr ? nameAttr.value.trim().toLowerCase() || 'undefName' : propAttr?.value || 'undefProp' //console.debug("tabsets: key", key, contAttr?.value || 'x') if (key) { result[key] = contAttr?.value || '' @@ -84,11 +82,9 @@ bridge tabsetsTimestamp: LocalStorage.getItem('tabsets_ts'), }, } - bridge - .send({ event: 'tabsets.bex.tab.excerpt', to: 'app', payload: responseMessage }) - .catch((err: any) => { - console.log('[BEX-CT] Failed to send message to app', err) - }) + bridge.send({ event: 'tabsets.bex.tab.excerpt', to: 'app', payload: responseMessage }).catch((err: any) => { + console.log('[BEX-CT] Failed to send message to app', err) + }) }) .catch((err) => { console.error('[BEX-CT] Failed to connect to background:', err) diff --git a/src/pages/SettingsPage.vue b/src/pages/SettingsPage.vue index 7a575cde..735318ca 100644 --- a/src/pages/SettingsPage.vue +++ b/src/pages/SettingsPage.vue @@ -20,20 +20,11 @@ - + v-if="useFeaturesStore().hasFeature(FeatureIdent.ARCHIVE_TABSET)" /> + - + @@ -45,45 +36,7 @@
-
-
Permissions
- - The active permissions for the Tabset Extension - -
-
Active Permissions
-
- {{ permissionsList.join(', ') }} -
-
- -
-
Allowed Origins
-
- {{ usePermissionsStore().permissions?.origins }} -
-
- -
Groups
- - All Chrome Groups, active and non-active - -
-
All Groups
-
- {{ useGroupsStore().tabGroups }} -
-
- - All active Chrome Groups - -
-
Active Groups
-
- {{ useGroupsStore().currentTabGroups }} -
-
-
+
@@ -106,8 +59,8 @@
Tabsets can be archived to remove them from direct view. Here's the list of archived - tabsets so that they can be restored if needed. + >Tabsets can be archived to remove them from direct view. Here's the list of archived tabsets so that they can + be restored if needed.
@@ -126,8 +79,7 @@
This Browser Extension tracks your tabsets and provides a search bar to search for - keywords. + >This Browser Extension tracks your tabsets and provides a search bar to search for keywords.
@@ -145,8 +97,7 @@ :show-length="true" :deep="2" v-model:data="state.data" - :show-double-quotes="true" - /> + :show-double-quotes="true" />
@@ -158,10 +109,9 @@
DuckDuckGo FavIcon Service
- Usually, the favicon (the little icon displayed next to a tab url) is provided by the page - you are visiting. Sometimes, Tabsets does not have the information (yet) and might defer - to a third party service, here duckduckgo. Switch this off if you do not want to use this - service. + Usually, the favicon (the little icon displayed next to a tab url) is provided by the page you are visiting. + Sometimes, Tabsets does not have the information (yet) and might defer to a third party service, here + duckduckgo. Switch this off if you do not want to use this service.
@@ -212,6 +162,7 @@ import { useRoute } from 'vue-router' import 'vue-json-pretty/lib/styles.css' import AppearanceSettings from 'pages/helper/AppearanceSettings.vue' import ImportExportSettings from 'pages/helper/ImportExportSettings.vue' +import InternalSettings from 'pages/helper/InternalSettings.vue' import { usePermissionsStore } from 'src/core/stores/usePermissionsStore' import BackupSettings from 'src/tabsets/pages/settings/BackupSettings.vue' import OpenRightDrawerWidget from 'src/ui/widgets/OpenRightDrawerWidget.vue' @@ -240,7 +191,6 @@ const state = reactive({ const ddgEnabled = ref(!settingsStore.isEnabled('noDDG')) const ignoreExtensionsEnabled = ref(!settingsStore.isEnabled('extensionsAsTabs')) -const permissionsList = ref([]) const tab = ref(route.query['tab'] ? (route.query['tab'] as string) : 'appearance') @@ -259,8 +209,6 @@ watchEffect(() => { ignoreExtensionsEnabled.value = settingsStore.isEnabled('extensionsAsTabs') }) -watchEffect(() => (permissionsList.value = usePermissionsStore().permissions?.permissions || [])) - watchEffect(() => { localStorage.set('layout', view.value) }) diff --git a/src/pages/helper/AppearanceSettings.vue b/src/pages/helper/AppearanceSettings.vue index 1de9a75e..09f593a8 100644 --- a/src/pages/helper/AppearanceSettings.vue +++ b/src/pages/helper/AppearanceSettings.vue @@ -1,38 +1,36 @@