Skip to content

Commit

Permalink
checking firefox build
Browse files Browse the repository at this point in the history
  • Loading branch information
evandor committed Dec 30, 2024
1 parent a00b6e4 commit 6bdd670
Show file tree
Hide file tree
Showing 7 changed files with 202 additions and 178 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 11 additions & 7 deletions src-bex/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
86 changes: 70 additions & 16 deletions src-bex/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,32 @@
"48": "icons/icon-48x48.png",
"128": "icons/icon-128x128.png"
},
"permissions": [
"storage",
"tabs",
"activeTab",
"alarms",
"scripting",
"sidePanel",
"contextMenus",
"bookmarks"
"host_permissions": [
"<all_urls>",
"*://*/*"
],
"optional_permissions": ["pageCapture", "notifications", "webRequest", "tabGroups"],
"host_permissions": ["<all_urls>", "*://*/*"],
"content_scripts": [
{
"matches": ["*://*/*"],
"js": ["tabsets-content-script.ts"]
"matches": [
"<all_urls>",
"*://*/*"
],
"js": [
"tabsets-content-script.ts"
]
}
],
"content_security_policy": {
"extension_pages": "script-src 'self'; object-src 'self';"
},
"web_accessible_resources": [
{
"resources": ["*"],
"matches": ["*://*/*"]
"resources": [
"*"
],
"matches": [
"*://*/*"
]
}
],
"omnibox": {
Expand Down Expand Up @@ -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": [
"<all_urls>",
"*://*/*"
],
"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"
}
}
}
}
}
12 changes: 4 additions & 8 deletions src-bex/tabsets-content-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 || ''
Expand Down Expand Up @@ -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)
Expand Down
76 changes: 12 additions & 64 deletions src/pages/SettingsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,11 @@
<q-tab
name="archived"
label="Archived Tabsets"
v-if="useFeaturesStore().hasFeature(FeatureIdent.ARCHIVE_TABSET)"
/>
<q-tab
name="search"
label="Search Engine"
v-if="useFeaturesStore().hasFeature(FeatureIdent.DEV_MODE)"
/>
v-if="useFeaturesStore().hasFeature(FeatureIdent.ARCHIVE_TABSET)" />
<q-tab name="search" label="Search Engine" v-if="useFeaturesStore().hasFeature(FeatureIdent.DEV_MODE)" />
<q-tab name="importExport" label="Import/Export" />
<q-tab name="backup" label="Backup" />
<q-tab
name="internals"
label="Internals"
v-if="useFeaturesStore().hasFeature(FeatureIdent.DEV_MODE)"
/>
<q-tab name="internals" label="Internals" v-if="useFeaturesStore().hasFeature(FeatureIdent.DEV_MODE)" />
<!-- <q-tab name="featureToggles" label="Feature Toggles"-->
<!-- :class="useAuthStore().userMayAccess(AccessItem.FEATURE_TOGGLES) ? 'text-primary':'text-grey'"/>-->
<q-tab name="featureToggles" label="Feature Toggles" />
Expand All @@ -45,45 +36,7 @@
</div>

<div v-if="tab === 'internals'">
<div class="q-pa-md q-gutter-sm">
<div class="text-h6">Permissions</div>

<q-banner rounded>The active permissions for the Tabset Extension</q-banner>

<div class="row items-baseline q-ma-md">
<div class="col-3">Active Permissions</div>
<div class="col-9">
{{ permissionsList.join(', ') }}
</div>
</div>

<div class="row items-baseline q-ma-md">
<div class="col-3">Allowed Origins</div>
<div class="col-9">
{{ usePermissionsStore().permissions?.origins }}
</div>
</div>

<div class="text-h6">Groups</div>

<q-banner rounded>All Chrome Groups, active and non-active</q-banner>

<div class="row items-baseline q-ma-md">
<div class="col-3">All Groups</div>
<div class="col-9">
{{ useGroupsStore().tabGroups }}
</div>
</div>

<q-banner rounded>All active Chrome Groups</q-banner>

<div class="row items-baseline q-ma-md">
<div class="col-3">Active Groups</div>
<div class="col-9">
{{ useGroupsStore().currentTabGroups }}
</div>
</div>
</div>
<InternalSettings />
</div>

<div v-if="tab === 'ignored'">
Expand All @@ -106,8 +59,8 @@
<div v-if="tab === 'archived'">
<div class="q-pa-md q-gutter-sm">
<q-banner rounded style="border: 1px solid orange"
>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.
</q-banner>

<div class="row q-pa-md" v-for="tabset in archivedTabsets()">
Expand All @@ -126,8 +79,7 @@
<div v-if="tab === 'search'">
<div class="q-pa-md q-gutter-sm">
<q-banner rounded style="border: 1px solid orange"
>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.
</q-banner>

<div class="row q-pa-md">
Expand All @@ -145,8 +97,7 @@
:show-length="true"
:deep="2"
v-model:data="state.data"
:show-double-quotes="true"
/>
:show-double-quotes="true" />
</div>
</div>
</div>
Expand All @@ -158,10 +109,9 @@
<div class="row q-pa-md">
<div class="col-3"><b>DuckDuckGo FavIcon Service</b></div>
<div class="col-5">
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.
</div>
<div class="col-1"></div>
<div class="col-3">
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -240,7 +191,6 @@ const state = reactive({
const ddgEnabled = ref<boolean>(!settingsStore.isEnabled('noDDG'))
const ignoreExtensionsEnabled = ref<boolean>(!settingsStore.isEnabled('extensionsAsTabs'))
const permissionsList = ref<string[]>([])
const tab = ref<string>(route.query['tab'] ? (route.query['tab'] as string) : 'appearance')
Expand All @@ -259,8 +209,6 @@ watchEffect(() => {
ignoreExtensionsEnabled.value = settingsStore.isEnabled('extensionsAsTabs')
})
watchEffect(() => (permissionsList.value = usePermissionsStore().permissions?.permissions || []))
watchEffect(() => {
localStorage.set('layout', view.value)
})
Expand Down
Loading

0 comments on commit 6bdd670

Please sign in to comment.