From 5abb577724bcb9cd7a3f00b8d7428f07e06ef23a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20Gr=C3=A4f?= Date: Sat, 31 Aug 2024 11:35:23 +0200 Subject: [PATCH] consolidating firefox and chrome versions --- .github/workflows/publish-firefox.yml | 65 +++++++++++++++ .gitignore | 1 + package.json | 3 + src-bex/manifest-firefox.json | 92 +++++++++++++++++++++ src-bex/manifest.json | 26 +++--- src/services/IndexedDbPersistenceService.ts | 2 - 6 files changed, 176 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/publish-firefox.yml create mode 100644 src-bex/manifest-firefox.json diff --git a/.github/workflows/publish-firefox.yml b/.github/workflows/publish-firefox.yml new file mode 100644 index 00000000..f8473da8 --- /dev/null +++ b/.github/workflows/publish-firefox.yml @@ -0,0 +1,65 @@ +#run locally: +#carstengraef@Carstens-MBP tabsets % act -W '.github/workflows/publish.yml' -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:js-latest \ +# --secret-file act.secrets.txt --container-architecture linux/amd64 + + +name: Publish +#on: +# push: +# branches: [ firefox-extension ] +on: + push: + tags: + - 'v*.*.*-firefox' + +jobs: + build: + name: Publish webextension + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + submodules: 'true' + - uses: actions/setup-node@v1 + with: + node-version: 18 + - name: 'Create env file' + run: | + touch .env + echo STAGE=PRD >> .env + echo BACKEND_URL="https://tabsets-72089.web.app" >> .env + echo TABSETS_PWA_URL="https://pwa.tabsets.net" >> .env + - name: Build + run: | + yarn install + npm run "build bex (publish)" + - name: "web-ext build" + id: web-ext-build + uses: kewisch/action-web-ext@v1 + with: + cmd: build + source: dist/bex + # filename: "{name}-{version}.xpi" + filename: "{name}.xpi" + ignoreFiles: '[ "package.json","package-lock.json","yarn.lock" ]' + + - uses: trmcnvn/firefox-addon@v1 + with: + # uuid is only necessary when updating an existing addon, + # omitting it will create a new addon + uuid: '{5809ba95-274e-4fd3-a92d-5baf03026290}' + xpi: web-ext-artifacts/tabsets.net.xpi + manifest: dist/bex/manifest.json + api-key: ${{ secrets.FIREFOX_API_KEY }} + api-secret: ${{ secrets.FIREFOX_API_SECRET }} + +# - name: Upload & release +# uses: mnao305/chrome-extension-upload@v4.0.1 +# with: +# file-path: dist/bex/Packaged.tabsets.net.zip +# extension-id: afkknkdbgondbbfjehipnjmojndnjhjg +# client-id: ${{ secrets.CLIENT_ID }} +# client-secret: ${{ secrets.CLIENT_SECRET }} +# refresh-token: ${{ secrets.REFRESH_TOKEN }} +# publish: false diff --git a/.gitignore b/.gitignore index 02bda5cd..8f040fe5 100644 --- a/.gitignore +++ b/.gitignore @@ -78,3 +78,4 @@ docs/.vitepress/cache /.tabsets-backend-prd.env /.env.tmp /docs/submodules/build/ +/src-bex/manifest.tmp diff --git a/package.json b/package.json index 8af01102..6d35e162 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "private": true, "scripts": { "dev": "quasar dev -m bex", + "dev-firefox": "mv src-bex/manifest.json src-bex/manifest.tmp && cp src-bex/manifest-firefox.json src-bex/manifest.json && quasar dev -m bex && mv src-bex/manifest.tmp src-bex/manifest.json", "dev spa (only for testing)": "quasar dev -m spa", "dev pwa": "quasar dev -m pwa", "dev ssr": "quasar dev -m ssr", @@ -14,6 +15,8 @@ "dev electron": "quasar dev -m electron", "dev capacitor": "quasar dev -m capacitor -T ios", "dev cordova": "quasar dev -m cordova -T ios", + "web-ext run": "cd dist/bex && web-ext run --verbose", + "web-ext build": "quasar build -m bex && zip dist/tabset.src.zip -r src/ src-bex/ package.json && cd dist/bex && web-ext build", "build bex (dev)": "mv .env .env.tmp && cp .dev.env .env && quasar build -m bex && mv .env.tmp .env", "build bex (prd)": "mv .env .env.tmp && cp .prd.env .env && quasar build -m bex && mv .env.tmp .env", "build bex (publish)": "quasar build -m bex", diff --git a/src-bex/manifest-firefox.json b/src-bex/manifest-firefox.json new file mode 100644 index 00000000..bd10c8d8 --- /dev/null +++ b/src-bex/manifest-firefox.json @@ -0,0 +1,92 @@ +{ + "manifest_version": 3, + "browser_specific_settings": { + "gecko": { + "id": "{5809ba95-274e-4fd3-a92d-5baf03026290}" + } + }, + "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" + ], + "host_permissions": [ + "", + "*://*/*" + ], + "background": { + "scripts": ["background.js"] + }, + "content_scripts": [ + { + "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" }, + "sidebar_action": { + "default_icon": "icons/icon-48x48.png", + "default_title" : "Tabsets", + "default_panel": "www/index.html#/sidepanel" + }, + "commands": { + "_execute_sidebar_action": { + "suggested_key": { + "default": "Ctrl+Shift+Period" + } + }, + "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" + }, + "tabHistoryForward": { + "suggested_key": { + "default": "Alt+Right", + "mac": "Alt+Right" + }, + "description": "Forward to next tab (if available)" + } + } +} diff --git a/src-bex/manifest.json b/src-bex/manifest.json index 43047327..bd10c8d8 100644 --- a/src-bex/manifest.json +++ b/src-bex/manifest.json @@ -1,5 +1,10 @@ { "manifest_version": 3, + "browser_specific_settings": { + "gecko": { + "id": "{5809ba95-274e-4fd3-a92d-5baf03026290}" + } + }, "icons": { "16": "icons/icon-16x16.png", "48": "icons/icon-48x48.png", @@ -18,18 +23,14 @@ "optional_permissions": [ "pageCapture", "notifications", - "webRequest", - "tabGroups" + "webRequest" ], "host_permissions": [ "", "*://*/*" ], - "side_panel": { - "default_path": "www/sidepanel.html" - }, "background": { - "service_worker": "background.js" + "scripts": ["background.js"] }, "content_scripts": [ { @@ -55,11 +56,15 @@ } ], "omnibox": { "keyword": "ts" }, + "sidebar_action": { + "default_icon": "icons/icon-48x48.png", + "default_title" : "Tabsets", + "default_panel": "www/index.html#/sidepanel" + }, "commands": { - "_execute_action": { + "_execute_sidebar_action": { "suggested_key": { - "default": "Ctrl+B", - "mac": "Command+B" + "default": "Ctrl+Shift+Period" } }, "search": { @@ -83,6 +88,5 @@ }, "description": "Forward to next tab (if available)" } - }, - "options_page": "www/index.html#/mainpanel/settings" + } } diff --git a/src/services/IndexedDbPersistenceService.ts b/src/services/IndexedDbPersistenceService.ts index 0913991c..329dac88 100644 --- a/src/services/IndexedDbPersistenceService.ts +++ b/src/services/IndexedDbPersistenceService.ts @@ -10,8 +10,6 @@ import {Suggestion, SuggestionState, SuggestionType} from "src/suggestions/model import {useUiStore} from "src/ui/stores/uiStore"; import {RequestInfo} from "src/models/RequestInfo"; import {useSuggestionsStore} from "src/suggestions/stores/suggestionsStore"; -import {Message} from "src/models/Message"; -import {Account} from "src/models/Account"; import {useTabsetsStore} from "src/tabsets/stores/tabsetsStore"; class IndexedDbPersistenceService implements PersistenceService {