From 99f7f77a276ae82963647aa08797e6c282e446a3 Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Wed, 17 Apr 2024 10:50:50 -0400 Subject: [PATCH 01/29] Add publish-firefox-extension to CI workflow --- .github/workflows/ci.yaml | 56 ++++++++++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 87ff23f..75b1c40 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install npm modules @@ -33,12 +33,50 @@ jobs: name: extensions path: dist/*.zip + publish-firefox-extension: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + cache: 'npm' + - name: Install npm modules + run: npm ci + - name: Build + run: npm run build-firefox + # - name: Download zip archive + # uses: actions/download-artifact@v4 + # with: + # name: firefox.zip + - name: Sign + env: + WEB_EXT_API_KEY: ${{ secrets.FIREFOX_API_KEY }} + WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }} + run: npx web-ext sign --source-dir=./dist/firefox + - name: Publish + uses: trmcnvn/firefox-addon@v1 + with: + # uuid is only necessary when updating an existing addon, + # omitting it will create a new addon + uuid: TBD + xpi: web-ext-artifacts/my-addon.xpi + manifest: dist/firefox/manifest.json + api-key: ${{ secrets.FIREFOX_API_KEY }} + api-secret: ${{ secrets.FIREFOX_API_SECRET }} + + + + build-safari-app: needs: [build-extensions] runs-on: macos-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Download extensions artifact @@ -90,7 +128,7 @@ jobs: runs-on: ubuntu-18.04 steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: CMake configure @@ -109,7 +147,7 @@ jobs: runs-on: macos-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: CMake configure @@ -128,7 +166,7 @@ jobs: runs-on: macos-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: CMake configure @@ -147,7 +185,7 @@ jobs: runs-on: windows-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: CMake configure @@ -166,7 +204,7 @@ jobs: runs-on: windows-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: CMake configure @@ -185,7 +223,7 @@ jobs: runs-on: windows-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: CMake configure @@ -213,7 +251,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Download extensions artifact From b3a3fd3f338d3490289f5ccb85433390fa947a7c Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Wed, 17 Apr 2024 15:13:04 -0400 Subject: [PATCH 02/29] Update ci workflow --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 75b1c40..3c71d90 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -54,7 +54,7 @@ jobs: # name: firefox.zip - name: Sign env: - WEB_EXT_API_KEY: ${{ secrets.FIREFOX_API_KEY }} + WEB_EXT_API_KEY: ${{ vars.FIREFOX_API_KEY }} WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }} run: npx web-ext sign --source-dir=./dist/firefox - name: Publish @@ -65,7 +65,7 @@ jobs: uuid: TBD xpi: web-ext-artifacts/my-addon.xpi manifest: dist/firefox/manifest.json - api-key: ${{ secrets.FIREFOX_API_KEY }} + api-key: ${{ vars.FIREFOX_API_KEY }} api-secret: ${{ secrets.FIREFOX_API_SECRET }} From 9c9bce25ac60eb20010b2923edb0d972d5b7e54c Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Sat, 27 Apr 2024 08:22:57 -0400 Subject: [PATCH 03/29] Update manifest.firefox.json --- manifest.firefox.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.firefox.json b/manifest.firefox.json index 79999c9..2729175 100644 --- a/manifest.firefox.json +++ b/manifest.firefox.json @@ -1,7 +1,7 @@ { "browser_specific_settings": { "gecko": { - "id": "keeweb-connect@keeweb.info" + "id": "keeweb-connect-addon@keeweb.info" } }, "commands": { From 855e5e287391670014dd1c3ce66791a92882b761 Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Sat, 27 Apr 2024 08:26:53 -0400 Subject: [PATCH 04/29] Create publish-test.yml --- .github/workflows/publish-test.yml | 42 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/publish-test.yml diff --git a/.github/workflows/publish-test.yml b/.github/workflows/publish-test.yml new file mode 100644 index 0000000..c42e736 --- /dev/null +++ b/.github/workflows/publish-test.yml @@ -0,0 +1,42 @@ +name: Publish Firefox Test + +on: + push: + branches: + - ci-publish-firefox + +jobs: + publish-firefox-extension: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + cache: 'npm' + - name: Install npm modules + run: npm ci + - name: Build + run: npm run build-firefox + # - name: Download zip archive + # uses: actions/download-artifact@v4 + # with: + # name: firefox.zip + - name: Sign + env: + WEB_EXT_API_KEY: ${{ vars.FIREFOX_API_KEY }} + WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }} + run: npx web-ext sign --source-dir=./dist/firefox + - name: Publish + uses: trmcnvn/firefox-addon@v1 + with: + # uuid is only necessary when updating an existing addon, + # omitting it will create a new addon + uuid: TBD + xpi: web-ext-artifacts/my-addon.xpi + manifest: dist/firefox/manifest.json + api-key: ${{ vars.FIREFOX_API_KEY }} + api-secret: ${{ secrets.FIREFOX_API_SECRET }} From e2553ed5423f90773e34d2a193e117c87c359fd8 Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Sat, 27 Apr 2024 08:28:55 -0400 Subject: [PATCH 05/29] Add nvmrc --- .nvmrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 .nvmrc diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..2ab3d4b --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v16.20.2 From 3b43ff653b8c05ecae44dd810ceaef51bedf3661 Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Sat, 27 Apr 2024 08:31:30 -0400 Subject: [PATCH 06/29] Update publish test --- .github/workflows/publish-test.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-test.yml b/.github/workflows/publish-test.yml index c42e736..fe0bcf4 100644 --- a/.github/workflows/publish-test.yml +++ b/.github/workflows/publish-test.yml @@ -1,9 +1,10 @@ name: Publish Firefox Test on: - push: - branches: - - ci-publish-firefox + pull: + branches: + - master + workflow_dispatch: jobs: publish-firefox-extension: From 4bfac91cd9900cfcd75dc436d20ae139cd6fb763 Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Sat, 27 Apr 2024 08:33:53 -0400 Subject: [PATCH 07/29] Update publish test --- .github/workflows/publish-test.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/publish-test.yml b/.github/workflows/publish-test.yml index fe0bcf4..9259182 100644 --- a/.github/workflows/publish-test.yml +++ b/.github/workflows/publish-test.yml @@ -1,9 +1,7 @@ name: Publish Firefox Test on: - pull: - branches: - - master + pull_request: workflow_dispatch: jobs: From 3a82548e5524dd545dcae1b139d300fd094468a6 Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Sat, 27 Apr 2024 08:38:15 -0400 Subject: [PATCH 08/29] Update publish test --- .github/workflows/publish-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-test.yml b/.github/workflows/publish-test.yml index 9259182..d02ef33 100644 --- a/.github/workflows/publish-test.yml +++ b/.github/workflows/publish-test.yml @@ -28,7 +28,7 @@ jobs: env: WEB_EXT_API_KEY: ${{ vars.FIREFOX_API_KEY }} WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }} - run: npx web-ext sign --source-dir=./dist/firefox + run: npx web-ext sign --source-dir=./dist/firefox --apiSecret= WEB_EXT_API_SECRET - name: Publish uses: trmcnvn/firefox-addon@v1 with: From 204e71a3e7484b1aa4303fc2a41d81a8d8fd84bf Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Sat, 27 Apr 2024 13:55:01 -0400 Subject: [PATCH 09/29] Update publish test --- .github/workflows/publish-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-test.yml b/.github/workflows/publish-test.yml index d02ef33..80a335a 100644 --- a/.github/workflows/publish-test.yml +++ b/.github/workflows/publish-test.yml @@ -28,7 +28,7 @@ jobs: env: WEB_EXT_API_KEY: ${{ vars.FIREFOX_API_KEY }} WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }} - run: npx web-ext sign --source-dir=./dist/firefox --apiSecret= WEB_EXT_API_SECRET + run: npx web-ext sign --source-dir=./dist/firefox --api-secret=$WEB_EXT_API_SECRET - name: Publish uses: trmcnvn/firefox-addon@v1 with: From 611778dee15b9202a1f0e0e443e4bce7a8ae2f40 Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Sat, 27 Apr 2024 14:01:11 -0400 Subject: [PATCH 10/29] Update publish test --- .github/workflows/publish-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-test.yml b/.github/workflows/publish-test.yml index 80a335a..ac50cbb 100644 --- a/.github/workflows/publish-test.yml +++ b/.github/workflows/publish-test.yml @@ -28,7 +28,7 @@ jobs: env: WEB_EXT_API_KEY: ${{ vars.FIREFOX_API_KEY }} WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }} - run: npx web-ext sign --source-dir=./dist/firefox --api-secret=$WEB_EXT_API_SECRET + run: npx web-ext sign --source-dir=./dist/firefox --api-secret=${{ secrets.FIREFOX_API_SECRET }} - name: Publish uses: trmcnvn/firefox-addon@v1 with: From 87a24abb2ee3ef3086235ea37e394777d945c3c1 Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Sat, 27 Apr 2024 14:31:12 -0400 Subject: [PATCH 11/29] Update publish test --- .github/workflows/publish-test.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-test.yml b/.github/workflows/publish-test.yml index ac50cbb..a11a117 100644 --- a/.github/workflows/publish-test.yml +++ b/.github/workflows/publish-test.yml @@ -7,6 +7,8 @@ on: jobs: publish-firefox-extension: runs-on: ubuntu-latest + outputs: + xpi_filepath: ${{ steps.sign.outputs.xpi_filepath }} steps: - name: Checkout uses: actions/checkout@v4 @@ -25,17 +27,17 @@ jobs: # with: # name: firefox.zip - name: Sign - env: - WEB_EXT_API_KEY: ${{ vars.FIREFOX_API_KEY }} - WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }} - run: npx web-ext sign --source-dir=./dist/firefox --api-secret=${{ secrets.FIREFOX_API_SECRET }} + id: sign + run: | + npx web-ext sign --source-dir=./dist/firefox --api-key="${{ vars.FIREFOX_API_KEY }}" + echo "xpi_filepath=$(ls web-ext-artifacts/*.xpi)" >> "$GITHUB_OUTPUT" - name: Publish uses: trmcnvn/firefox-addon@v1 with: # uuid is only necessary when updating an existing addon, # omitting it will create a new addon uuid: TBD - xpi: web-ext-artifacts/my-addon.xpi + xpi: ${{ steps.sign.outputs.xpi_filepath }} manifest: dist/firefox/manifest.json api-key: ${{ vars.FIREFOX_API_KEY }} api-secret: ${{ secrets.FIREFOX_API_SECRET }} From b2ff7859d5a0ad44bceaaf339b5164c0bead4fc1 Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Sat, 27 Apr 2024 14:33:40 -0400 Subject: [PATCH 12/29] Update publish test --- .github/workflows/publish-test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-test.yml b/.github/workflows/publish-test.yml index a11a117..1df9708 100644 --- a/.github/workflows/publish-test.yml +++ b/.github/workflows/publish-test.yml @@ -28,9 +28,11 @@ jobs: # name: firefox.zip - name: Sign id: sign + env: + WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }} run: | - npx web-ext sign --source-dir=./dist/firefox --api-key="${{ vars.FIREFOX_API_KEY }}" - echo "xpi_filepath=$(ls web-ext-artifacts/*.xpi)" >> "$GITHUB_OUTPUT" + npx web-ext sign --source-dir=./dist/firefox --api-key="${{ vars.FIREFOX_API_KEY }}" + echo "xpi_filepath=$(ls web-ext-artifacts/*.xpi)" >> "$GITHUB_OUTPUT" - name: Publish uses: trmcnvn/firefox-addon@v1 with: From a9b8aab1c1906aa582bd13a65c9f06674954aba9 Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Thu, 2 May 2024 16:35:08 -0400 Subject: [PATCH 13/29] Update publish-test --- .github/workflows/publish-test.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/publish-test.yml b/.github/workflows/publish-test.yml index 1df9708..09899b3 100644 --- a/.github/workflows/publish-test.yml +++ b/.github/workflows/publish-test.yml @@ -28,10 +28,8 @@ jobs: # name: firefox.zip - name: Sign id: sign - env: - WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }} run: | - npx web-ext sign --source-dir=./dist/firefox --api-key="${{ vars.FIREFOX_API_KEY }}" + npx web-ext sign --source-dir=./dist/firefox --api-key="${{ vars.FIREFOX_API_KEY }}" --api-secret="${{ secrets.FIREFOX_API_SECRET }}" echo "xpi_filepath=$(ls web-ext-artifacts/*.xpi)" >> "$GITHUB_OUTPUT" - name: Publish uses: trmcnvn/firefox-addon@v1 From 065034546eeded71995fb90230ded01e57c647fa Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Thu, 2 May 2024 16:39:46 -0400 Subject: [PATCH 14/29] Update publish-test --- .github/workflows/publish-test.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-test.yml b/.github/workflows/publish-test.yml index 09899b3..3d5376b 100644 --- a/.github/workflows/publish-test.yml +++ b/.github/workflows/publish-test.yml @@ -28,15 +28,18 @@ jobs: # name: firefox.zip - name: Sign id: sign + env: + WEB_EXT_API_KEY: ${{ vars.FIREFOX_API_KEY }} + WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }} run: | - npx web-ext sign --source-dir=./dist/firefox --api-key="${{ vars.FIREFOX_API_KEY }}" --api-secret="${{ secrets.FIREFOX_API_SECRET }}" + npx web-ext sign --source-dir=./dist/firefox echo "xpi_filepath=$(ls web-ext-artifacts/*.xpi)" >> "$GITHUB_OUTPUT" - name: Publish uses: trmcnvn/firefox-addon@v1 with: # uuid is only necessary when updating an existing addon, # omitting it will create a new addon - uuid: TBD + uuid: keeweb-connect-addon@keeweb.info xpi: ${{ steps.sign.outputs.xpi_filepath }} manifest: dist/firefox/manifest.json api-key: ${{ vars.FIREFOX_API_KEY }} From 2305b1482c5a13f1c294d037d0ab1f18dfa0dfc0 Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Thu, 2 May 2024 16:43:36 -0400 Subject: [PATCH 15/29] Update workflows --- .github/workflows/ci.yaml | 56 +++---------------- .../{publish-test.yml => publish-firefox.yml} | 13 ++--- .gitignore | 3 + 3 files changed, 18 insertions(+), 54 deletions(-) rename .github/workflows/{publish-test.yml => publish-firefox.yml} (86%) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3c71d90..87ff23f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 - name: Install npm modules @@ -33,50 +33,12 @@ jobs: name: extensions path: dist/*.zip - publish-firefox-extension: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: actions/setup-node@v3 - with: - node-version-file: '.nvmrc' - cache: 'npm' - - name: Install npm modules - run: npm ci - - name: Build - run: npm run build-firefox - # - name: Download zip archive - # uses: actions/download-artifact@v4 - # with: - # name: firefox.zip - - name: Sign - env: - WEB_EXT_API_KEY: ${{ vars.FIREFOX_API_KEY }} - WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }} - run: npx web-ext sign --source-dir=./dist/firefox - - name: Publish - uses: trmcnvn/firefox-addon@v1 - with: - # uuid is only necessary when updating an existing addon, - # omitting it will create a new addon - uuid: TBD - xpi: web-ext-artifacts/my-addon.xpi - manifest: dist/firefox/manifest.json - api-key: ${{ vars.FIREFOX_API_KEY }} - api-secret: ${{ secrets.FIREFOX_API_SECRET }} - - - - build-safari-app: needs: [build-extensions] runs-on: macos-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 - name: Download extensions artifact @@ -128,7 +90,7 @@ jobs: runs-on: ubuntu-18.04 steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 - name: CMake configure @@ -147,7 +109,7 @@ jobs: runs-on: macos-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 - name: CMake configure @@ -166,7 +128,7 @@ jobs: runs-on: macos-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 - name: CMake configure @@ -185,7 +147,7 @@ jobs: runs-on: windows-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 - name: CMake configure @@ -204,7 +166,7 @@ jobs: runs-on: windows-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 - name: CMake configure @@ -223,7 +185,7 @@ jobs: runs-on: windows-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 - name: CMake configure @@ -251,7 +213,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: fetch-depth: 0 - name: Download extensions artifact diff --git a/.github/workflows/publish-test.yml b/.github/workflows/publish-firefox.yml similarity index 86% rename from .github/workflows/publish-test.yml rename to .github/workflows/publish-firefox.yml index 3d5376b..0e812ea 100644 --- a/.github/workflows/publish-test.yml +++ b/.github/workflows/publish-firefox.yml @@ -1,8 +1,11 @@ -name: Publish Firefox Test +name: Publish Firefox Addon on: - pull_request: - workflow_dispatch: + pull_request: # TEMPORARY + workflow_dispatch: # TEMPORARY + push: + tags: + - '*' jobs: publish-firefox-extension: @@ -22,10 +25,6 @@ jobs: run: npm ci - name: Build run: npm run build-firefox - # - name: Download zip archive - # uses: actions/download-artifact@v4 - # with: - # name: firefox.zip - name: Sign id: sign env: diff --git a/.gitignore b/.gitignore index e1a8624..64aa27a 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ xcuserdata/ **/xcshareddata/WorkspaceSettings.xcsettings native-messaging-host/build/ + +# Artifacts from signing the addon for Firefox +web-ext-artifacts From 1bd20ede1094a5b7c1743599cc067a67e3e9661c Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Thu, 2 May 2024 16:48:03 -0400 Subject: [PATCH 16/29] Change version to test publishing --- manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 2f62eed..e89236f 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "KeeWeb Connect", - "version": "0.3.7", + "version": "0.3.7.1", "manifest_version": 2, "description": "__MSG_description__", "icons": { @@ -64,4 +64,4 @@ "description": "__MSG_cmdInsertOther__" } } -} \ No newline at end of file +} From 00cef9610b344c681708d744f0647bab2c1c860b Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Thu, 2 May 2024 17:12:56 -0400 Subject: [PATCH 17/29] Update publish firefox and id for testing --- .github/workflows/publish-firefox.yml | 2 +- manifest.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-firefox.yml b/.github/workflows/publish-firefox.yml index 0e812ea..62effb0 100644 --- a/.github/workflows/publish-firefox.yml +++ b/.github/workflows/publish-firefox.yml @@ -38,7 +38,7 @@ jobs: with: # uuid is only necessary when updating an existing addon, # omitting it will create a new addon - uuid: keeweb-connect-addon@keeweb.info + # uuid: keeweb-connect-addon@keeweb.info xpi: ${{ steps.sign.outputs.xpi_filepath }} manifest: dist/firefox/manifest.json api-key: ${{ vars.FIREFOX_API_KEY }} diff --git a/manifest.json b/manifest.json index e89236f..0970b5f 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "KeeWeb Connect", - "version": "0.3.7.1", + "version": "0.3.7.3", "manifest_version": 2, "description": "__MSG_description__", "icons": { From 199e38d60705820a1b7c39a6250d6b5b81794408 Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Thu, 2 May 2024 18:02:08 -0400 Subject: [PATCH 18/29] Update publish firefox workflow --- .github/gen_ff_jwt.js | 71 +++++++++ .github/workflows/publish-firefox.yml | 21 +-- manifest.json | 2 +- package-lock.json | 214 +++++++++++++++++++++++++- package.json | 6 +- 5 files changed, 294 insertions(+), 20 deletions(-) create mode 100644 .github/gen_ff_jwt.js diff --git a/.github/gen_ff_jwt.js b/.github/gen_ff_jwt.js new file mode 100644 index 0000000..2857f42 --- /dev/null +++ b/.github/gen_ff_jwt.js @@ -0,0 +1,71 @@ +var jwt = require('jsonwebtoken'); + +var issuedAt = Math.floor(Date.now() / 1000); +var payload = { + iss: process.env.WEB_EXT_API_KEY, + jti: Math.random().toString(), + iat: issuedAt, + exp: issuedAt + 60, +}; + +var secret = process.env.WEB_EXT_API_SECRET; // store this securely. +var token = jwt.sign(payload, secret, { + algorithm: 'HS256', // HMAC-SHA256 signing algorithm +}); + +console.log(token); + +// process.env.WEB_EXT_JWT = token; + +// const https = require('https'); + +// const options = { +// hostname: 'addons.mozilla.org', +// port: 443, +// path: '/api/v5/addons/upload/', +// method: 'POST' +// } + +// function httpsPost({body, ...options}) { +// return new Promise((resolve,reject) => { +// const req = https.request({ +// method: 'POST', +// ...options, +// }, res => { +// const chunks = []; +// res.on('data', data => chunks.push(data)) +// res.on('end', () => { +// let resBody = Buffer.concat(chunks); +// switch(res.headers['content-type']) { +// case 'application/json': +// resBody = JSON.parse(resBody); +// break; +// } +// resolve(resBody) +// }) +// }) +// req.on('error',reject); +// if(body) { +// req.write(body); +// } +// req.end(); +// }) +// } + +// async function main() { +// const res = await httpsPost({ +// hostname: 'addons.mozilla.org', +// path: '/api/v5/addons/upload/', +// headers: { +// 'Authorization': `JWT ${token}`, +// 'Content-Type': 'multipart/form-data', +// }, +// body: JSON.stringify({ +// channel: listed, +// }) +// }) +// } + +// main().catch(err => { +// console.log(err) +// }) diff --git a/.github/workflows/publish-firefox.yml b/.github/workflows/publish-firefox.yml index 62effb0..e0dbc7e 100644 --- a/.github/workflows/publish-firefox.yml +++ b/.github/workflows/publish-firefox.yml @@ -34,12 +34,15 @@ jobs: npx web-ext sign --source-dir=./dist/firefox echo "xpi_filepath=$(ls web-ext-artifacts/*.xpi)" >> "$GITHUB_OUTPUT" - name: Publish - uses: trmcnvn/firefox-addon@v1 - with: - # uuid is only necessary when updating an existing addon, - # omitting it will create a new addon - # uuid: keeweb-connect-addon@keeweb.info - xpi: ${{ steps.sign.outputs.xpi_filepath }} - manifest: dist/firefox/manifest.json - api-key: ${{ vars.FIREFOX_API_KEY }} - api-secret: ${{ secrets.FIREFOX_API_SECRET }} + env: + WEB_EXT_API_KEY: ${{ vars.FIREFOX_API_KEY }} + WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }} + # https://mozilla.github.io/addons-server/topics/api/addons.html#upload-create + run: | + addon_version=$(jq -r '.version' manifest.json) + file_path="web-ext-artifacts/keeweb_connect-$addon_version.zip" + jwt=$(npm run --silent gen-ff-jwt) + curl -X POST --header Authorization: JWT $jwt" \ + --form "channel=listed" \ + --form upload=@$file_path \ + https://addons.mozilla.org/api/v5/addons/upload/ diff --git a/manifest.json b/manifest.json index 0970b5f..ac1613b 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "KeeWeb Connect", - "version": "0.3.7.3", + "version": "0.3.7.4", "manifest_version": 2, "description": "__MSG_description__", "icons": { diff --git a/package-lock.json b/package-lock.json index 3e6890e..200bcd8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,7 +5,8 @@ "requires": true, "packages": { "": { - "version": "1.0.0", + "name": "keeweb-connect", + "version": "0.3.7", "license": "MIT", "dependencies": { "preact": "^10.5.13", @@ -25,6 +26,7 @@ "eslint-config-prettier": "^8.1.0", "eslint-plugin-import": "^2.22.1", "eslint-plugin-prettier": "^3.3.1", + "jsonwebtoken": "^9.0.2", "merge": "^2.1.1", "prettier": "^2.2.1", "tiny-typed-emitter": "^2.0.3", @@ -1059,6 +1061,12 @@ "url": "https://opencollective.com/browserslist" } }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", + "dev": true + }, "node_modules/buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", @@ -1337,6 +1345,15 @@ "node": ">=6.0.0" } }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, "node_modules/electron-to-chromium": { "version": "1.3.707", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.707.tgz", @@ -2878,6 +2895,28 @@ "json5": "lib/cli.js" } }, + "node_modules/jsonwebtoken": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", + "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==", + "dev": true, + "dependencies": { + "jws": "^3.2.2", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=12", + "npm": ">=6" + } + }, "node_modules/jsx-ast-utils": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.2.0.tgz", @@ -2891,6 +2930,27 @@ "node": ">=4.0" } }, + "node_modules/jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "dev": true, + "dependencies": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "dev": true, + "dependencies": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, "node_modules/kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", @@ -2997,12 +3057,54 @@ "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=", "dev": true }, + "node_modules/lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==", + "dev": true + }, + "node_modules/lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==", + "dev": true + }, + "node_modules/lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==", + "dev": true + }, + "node_modules/lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==", + "dev": true + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "dev": true + }, + "node_modules/lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", + "dev": true + }, "node_modules/lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", "dev": true }, + "node_modules/lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", + "dev": true + }, "node_modules/lodash.truncate": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", @@ -3832,9 +3934,9 @@ } }, "node_modules/semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -5502,6 +5604,12 @@ "node-releases": "^1.1.70" } }, + "buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", + "dev": true + }, "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", @@ -5708,6 +5816,15 @@ "esutils": "^2.0.2" } }, + "ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, "electron-to-chromium": { "version": "1.3.707", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.707.tgz", @@ -6856,6 +6973,24 @@ "minimist": "^1.2.0" } }, + "jsonwebtoken": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", + "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==", + "dev": true, + "requires": { + "jws": "^3.2.2", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^7.5.4" + } + }, "jsx-ast-utils": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.2.0.tgz", @@ -6866,6 +7001,27 @@ "object.assign": "^4.1.2" } }, + "jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "dev": true, + "requires": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "dev": true, + "requires": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, "kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", @@ -6950,12 +7106,54 @@ "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=", "dev": true }, + "lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==", + "dev": true + }, + "lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==", + "dev": true + }, + "lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==", + "dev": true + }, + "lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==", + "dev": true + }, + "lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "dev": true + }, + "lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", + "dev": true + }, "lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", "dev": true }, + "lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", + "dev": true + }, "lodash.truncate": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", @@ -7556,9 +7754,9 @@ } }, "semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -8193,4 +8391,4 @@ "dev": true } } -} \ No newline at end of file +} diff --git a/package.json b/package.json index cb25031..aaff56b 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,8 @@ "eslint": "eslint webpack.config.ts src scripts", "prettier": "prettier --write src/**/*.ts src/**/*.tsx *.js pages/*.html styles/*.css", "download-translations": "ts-node scripts/download-translations", - "bump-version": "ts-node scripts/bump-version" + "bump-version": "ts-node scripts/bump-version", + "gen-ff-jwt": "node .github/gen_ff_jwt.js" }, "repository": { "type": "git", @@ -43,6 +44,7 @@ "eslint-config-prettier": "^8.1.0", "eslint-plugin-import": "^2.22.1", "eslint-plugin-prettier": "^3.3.1", + "jsonwebtoken": "^9.0.2", "merge": "^2.1.1", "prettier": "^2.2.1", "tiny-typed-emitter": "^2.0.3", @@ -56,4 +58,4 @@ "preact": "^10.5.13", "tweetnacl": "^1.0.3" } -} \ No newline at end of file +} From 0f8c1a28dba34b5c2a61866547d69ed973879054 Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Fri, 3 May 2024 09:09:51 -0400 Subject: [PATCH 19/29] Update publish-firefox --- .github/workflows/publish-firefox.yml | 11 ++--------- manifest.json | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publish-firefox.yml b/.github/workflows/publish-firefox.yml index e0dbc7e..edafaf4 100644 --- a/.github/workflows/publish-firefox.yml +++ b/.github/workflows/publish-firefox.yml @@ -37,12 +37,5 @@ jobs: env: WEB_EXT_API_KEY: ${{ vars.FIREFOX_API_KEY }} WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }} - # https://mozilla.github.io/addons-server/topics/api/addons.html#upload-create - run: | - addon_version=$(jq -r '.version' manifest.json) - file_path="web-ext-artifacts/keeweb_connect-$addon_version.zip" - jwt=$(npm run --silent gen-ff-jwt) - curl -X POST --header Authorization: JWT $jwt" \ - --form "channel=listed" \ - --form upload=@$file_path \ - https://addons.mozilla.org/api/v5/addons/upload/ + + run: .github/publish-firefox diff --git a/manifest.json b/manifest.json index ac1613b..3f678ae 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "KeeWeb Connect", - "version": "0.3.7.4", + "version": "0.3.7.5", "manifest_version": 2, "description": "__MSG_description__", "icons": { From 0b66e5852a362952c05e639bed836fbf534a1e83 Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Mon, 6 May 2024 10:19:11 -0400 Subject: [PATCH 20/29] Bump node to 18.20.2 --- .nvmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.nvmrc b/.nvmrc index 2ab3d4b..fb3e660 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v16.20.2 +v18.20.2 From 4dc6fdcf939a5e82eecfbedef2d88b4d65c223ce Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Fri, 17 May 2024 15:58:46 -0400 Subject: [PATCH 21/29] wip --- .github/gen_ff_jwt.js | 71 ---------------------- .github/publish-firefox | 12 ++++ .github/publish-firefox-addon.js | 85 +++++++++++++++++++++++++++ .github/workflows/publish-firefox.yml | 6 +- manifest.json | 2 +- package.json | 2 +- 6 files changed, 103 insertions(+), 75 deletions(-) delete mode 100644 .github/gen_ff_jwt.js create mode 100755 .github/publish-firefox create mode 100644 .github/publish-firefox-addon.js diff --git a/.github/gen_ff_jwt.js b/.github/gen_ff_jwt.js deleted file mode 100644 index 2857f42..0000000 --- a/.github/gen_ff_jwt.js +++ /dev/null @@ -1,71 +0,0 @@ -var jwt = require('jsonwebtoken'); - -var issuedAt = Math.floor(Date.now() / 1000); -var payload = { - iss: process.env.WEB_EXT_API_KEY, - jti: Math.random().toString(), - iat: issuedAt, - exp: issuedAt + 60, -}; - -var secret = process.env.WEB_EXT_API_SECRET; // store this securely. -var token = jwt.sign(payload, secret, { - algorithm: 'HS256', // HMAC-SHA256 signing algorithm -}); - -console.log(token); - -// process.env.WEB_EXT_JWT = token; - -// const https = require('https'); - -// const options = { -// hostname: 'addons.mozilla.org', -// port: 443, -// path: '/api/v5/addons/upload/', -// method: 'POST' -// } - -// function httpsPost({body, ...options}) { -// return new Promise((resolve,reject) => { -// const req = https.request({ -// method: 'POST', -// ...options, -// }, res => { -// const chunks = []; -// res.on('data', data => chunks.push(data)) -// res.on('end', () => { -// let resBody = Buffer.concat(chunks); -// switch(res.headers['content-type']) { -// case 'application/json': -// resBody = JSON.parse(resBody); -// break; -// } -// resolve(resBody) -// }) -// }) -// req.on('error',reject); -// if(body) { -// req.write(body); -// } -// req.end(); -// }) -// } - -// async function main() { -// const res = await httpsPost({ -// hostname: 'addons.mozilla.org', -// path: '/api/v5/addons/upload/', -// headers: { -// 'Authorization': `JWT ${token}`, -// 'Content-Type': 'multipart/form-data', -// }, -// body: JSON.stringify({ -// channel: listed, -// }) -// }) -// } - -// main().catch(err => { -// console.log(err) -// }) diff --git a/.github/publish-firefox b/.github/publish-firefox new file mode 100755 index 0000000..d6d6ee8 --- /dev/null +++ b/.github/publish-firefox @@ -0,0 +1,12 @@ +#!/bin/bash + +# https://mozilla.github.io/addons-server/topics/api/addons.html#upload-create + +addon_version=$(jq -r '.version' manifest.json) +file_path="web-ext-artifacts/keeweb_connect-$addon_version.zip" +jwt=$(npm run --silent gen-ff-jwt) + +curl -X POST --header "Authorization: JWT $jwt" \ + --form "channel=listed" \ + --form upload=@$file_path \ + https://addons.mozilla.org/api/v5/addons/upload/ diff --git a/.github/publish-firefox-addon.js b/.github/publish-firefox-addon.js new file mode 100644 index 0000000..eb05879 --- /dev/null +++ b/.github/publish-firefox-addon.js @@ -0,0 +1,85 @@ +/* + * Publish Firefox addon + * https://blog.mozilla.org/addons/2022/03/17/new-api-for-submitting-and-updating-add-ons/ + */ + +const jwt = require('jsonwebtoken'); +const fs = require('fs'); + +var issuedAt = Math.floor(Date.now() / 1000); +var payload = { + iss: process.env.WEB_EXT_API_KEY, + jti: Math.random().toString(), + iat: issuedAt, + exp: issuedAt + 60, +}; + +var secret = process.env.WEB_EXT_API_SECRET; // store this securely. +var token = jwt.sign(payload, secret, { + algorithm: 'HS256', // HMAC-SHA256 signing algorithm +}); + +const https = require('https'); + +const options = { + hostname: 'addons.mozilla.org', + port: 443, + path: '/api/v5/addons/upload/', + method: 'POST' +} + +async function main() { + const manifest = require('../manifest.json'); + const fileName = `keeweb_connect-${manifest.version}.zip` + const filePath = `web-ext-artifacts/${fileName}` + const fileBuffer = fs.createReadStream(filePath); + const fileBlob = new Blob([fileBuffer]); + + // Upload the zipped add-on file to the upload create endpoint + // https://addons-server.readthedocs.io/en/latest/topics/api/addons.html#upload-create + const form = new FormData(); + form.set('upload', fileBlob, fileName); + form.set('channel', 'listed'); + + const uploadCreateURL = 'https://addons.mozilla.org/api/v5/addons/upload/' + const req = new Request(uploadCreateURL, { + method: 'POST', + body: form, + }) + req.headers.append('Authorization', `JWT ${token}`); + req.headers.append('Accept', 'application/json'); + + + fetch(req).then(async (res) => { + const resData = await res.json(); + + if (!res.ok) + throw new Error(`HTTP error! status: ${res.status}, body: `, resData); + + console.log('response.status:', res.status); + console.log('response.body:', resData); + const uuid = resData.uuid; + + // TODO: send patch to add-ons edit endpoint OR version edit endpoint + // https://addons-server.readthedocs.io/en/latest/topics/api/addons.html#edit + // https://mozilla.github.io/addons-server/topics/api/addons.html#version-edit + const addonPatchURL = `https://addons.mozilla.org/api/v5/addons/addon/${uuid}/`; + const addonPatchPayload = { + slug: "new-slug", // what? + tags: [] // what tags? + } + const req = new Request(addonPatchURL, { + method: 'PATCH', + body: addonPatchPayload, + }) + + //TODO do we need to submit source code? + }) + .catch(err => { + console.error(err); + }); +} + +main().catch(err => { + console.log(err) +}) diff --git a/.github/workflows/publish-firefox.yml b/.github/workflows/publish-firefox.yml index edafaf4..4353c60 100644 --- a/.github/workflows/publish-firefox.yml +++ b/.github/workflows/publish-firefox.yml @@ -24,7 +24,9 @@ jobs: - name: Install npm modules run: npm ci - name: Build - run: npm run build-firefox + run: | + npm run build-firefox + npx web-ext build -s dist/firefox - name: Sign id: sign env: @@ -38,4 +40,4 @@ jobs: WEB_EXT_API_KEY: ${{ vars.FIREFOX_API_KEY }} WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }} - run: .github/publish-firefox + run: npm run publish-firefox-addon diff --git a/manifest.json b/manifest.json index 3f678ae..12c801b 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "KeeWeb Connect", - "version": "0.3.7.5", + "version": "0.3.7.6", "manifest_version": 2, "description": "__MSG_description__", "icons": { diff --git a/package.json b/package.json index 3cb8943..0a2e454 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "prettier": "prettier --write src/**/*.ts src/**/*.tsx pages/*.html styles/*.css", "download-translations": "ts-node scripts/download-translations", "bump-version": "ts-node scripts/bump-version", - "gen-ff-jwt": "node .github/gen_ff_jwt.js" + "publish-firefox-addon": "node .github/publish-firefox-addon.js" }, "repository": { "type": "git", From efb82134ba05911684516c60ddab67fb795f5046 Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Fri, 17 May 2024 16:31:54 -0400 Subject: [PATCH 22/29] Bump version --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 12c801b..61f6532 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "KeeWeb Connect", - "version": "0.3.7.6", + "version": "0.3.7.11", "manifest_version": 2, "description": "__MSG_description__", "icons": { From 7e0dd536ddee9e2443415a33af7f44b06a04d4c1 Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Fri, 17 May 2024 17:45:34 -0400 Subject: [PATCH 23/29] WIP --- .github/publish-firefox-addon.js | 60 +++++++++++++++++++++------ .github/workflows/publish-firefox.yml | 16 +++---- manifest.json | 2 +- 3 files changed, 57 insertions(+), 21 deletions(-) diff --git a/.github/publish-firefox-addon.js b/.github/publish-firefox-addon.js index eb05879..c11821b 100644 --- a/.github/publish-firefox-addon.js +++ b/.github/publish-firefox-addon.js @@ -30,6 +30,8 @@ const options = { async function main() { const manifest = require('../manifest.json'); + const manifestFirefox = require('../manifest.firefox.json'); + const addonUUID = manifestFirefox.browser_specific_settings.gecko.id; const fileName = `keeweb_connect-${manifest.version}.zip` const filePath = `web-ext-artifacts/${fileName}` const fileBuffer = fs.createReadStream(filePath); @@ -58,19 +60,53 @@ async function main() { console.log('response.status:', res.status); console.log('response.body:', resData); - const uuid = resData.uuid; - - // TODO: send patch to add-ons edit endpoint OR version edit endpoint - // https://addons-server.readthedocs.io/en/latest/topics/api/addons.html#edit - // https://mozilla.github.io/addons-server/topics/api/addons.html#version-edit - const addonPatchURL = `https://addons.mozilla.org/api/v5/addons/addon/${uuid}/`; - const addonPatchPayload = { - slug: "new-slug", // what? - tags: [] // what tags? + const uploadUUID = resData.uuid; + + // Poll the upload detail endpoint until we are validated + // https://mozilla.github.io/addons-server/topics/api/addons.html#upload-detail + var validationRes; + var validationData; + var validationTries = 0; + const validationReq = new Request(`https://addons.mozilla.org/api/v5/addons/upload/${uploadUUID}/`, { + method: 'GET' + }) + validationReq.headers.append('Authorization', `JWT ${token}`); + validationReq.headers.append('Accept', 'application/json'); + + while (validationTries < 3 && !validationData?.valid) { + // Increasingly wait before checking the validation status + await new Promise(resolve => setTimeout(resolve, 60_000 * (validationTries + 1))); + + validationTries += 1; + var validationRes = await fetch(validationReq); + validationData = await validationRes.json(); + + console.log('validationData', validationData); + console.log('validationData.validation.messages', validationData.validation?.messages); } - const req = new Request(addonPatchURL, { - method: 'PATCH', - body: addonPatchPayload, + + if (!validationData?.valid) + throw new Error('Extension did not validate in time.'); + + // Send POST to add-on version create endpoint + // https://mozilla.github.io/addons-server/topics/api/addons.html#version-create + const addonVersionCreateURL = `https://addons.mozilla.org/api/v5/addons/addon/${addonUUID}/versions/`; + const addonVersionCreatePayload = { + license: 'MIT', + upload: uploadUUID + } + const addonVersionCreateReq = new Request(addonVersionCreateURL, { + method: 'POST', + body: addonVersionCreatePayload, + }) + addonVersionCreateReq.headers.append('Authorization', `JWT ${token}`); + addonVersionCreateReq.headers.append('Accept', 'application/json'); + fetch(addonVersionCreateReq).then(async (res) => { + if (!res.ok) + throw new Error(`HTTP error! status: ${res.status}, body: `, resData); + + console.log('response.status:', res.status); + console.log('response.body:', resData); }) //TODO do we need to submit source code? diff --git a/.github/workflows/publish-firefox.yml b/.github/workflows/publish-firefox.yml index 4353c60..af478bb 100644 --- a/.github/workflows/publish-firefox.yml +++ b/.github/workflows/publish-firefox.yml @@ -27,14 +27,14 @@ jobs: run: | npm run build-firefox npx web-ext build -s dist/firefox - - name: Sign - id: sign - env: - WEB_EXT_API_KEY: ${{ vars.FIREFOX_API_KEY }} - WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }} - run: | - npx web-ext sign --source-dir=./dist/firefox - echo "xpi_filepath=$(ls web-ext-artifacts/*.xpi)" >> "$GITHUB_OUTPUT" + # - name: Sign + # id: sign + # env: + # WEB_EXT_API_KEY: ${{ vars.FIREFOX_API_KEY }} + # WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }} + # run: | + # npx web-ext sign --source-dir=./dist/firefox + # echo "xpi_filepath=$(ls web-ext-artifacts/*.xpi)" >> "$GITHUB_OUTPUT" - name: Publish env: WEB_EXT_API_KEY: ${{ vars.FIREFOX_API_KEY }} diff --git a/manifest.json b/manifest.json index 61f6532..b3f6234 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "KeeWeb Connect", - "version": "0.3.7.11", + "version": "0.3.7.13", "manifest_version": 2, "description": "__MSG_description__", "icons": { From 10bbeae44632b884f6207c08983d01442e8ffa6b Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Mon, 20 May 2024 13:55:57 -0400 Subject: [PATCH 24/29] Update publish-firefix-addon.js --- .github/publish-firefox-addon.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/publish-firefox-addon.js b/.github/publish-firefox-addon.js index c11821b..0de9dca 100644 --- a/.github/publish-firefox-addon.js +++ b/.github/publish-firefox-addon.js @@ -51,6 +51,8 @@ async function main() { req.headers.append('Authorization', `JWT ${token}`); req.headers.append('Accept', 'application/json'); + const fileSizeInKB = (await fs.promises.stat(filePath)).size / (1000); + console.log(`Uploading ${fileSizeInKB.toFixed(2)}KB file ${filePath}`); fetch(req).then(async (res) => { const resData = await res.json(); @@ -73,9 +75,11 @@ async function main() { validationReq.headers.append('Authorization', `JWT ${token}`); validationReq.headers.append('Accept', 'application/json'); - while (validationTries < 3 && !validationData?.valid) { + while (!validationData?.processed && validationTries < 3) { // Increasingly wait before checking the validation status - await new Promise(resolve => setTimeout(resolve, 60_000 * (validationTries + 1))); + const waitMS = 60_000 * (validationTries + 1); + console.log(`Will check validation status in a ${waitMS / 1000}s...`); + await new Promise(resolve => setTimeout(resolve, waitMS)); validationTries += 1; var validationRes = await fetch(validationReq); @@ -110,12 +114,11 @@ async function main() { }) //TODO do we need to submit source code? - }) - .catch(err => { - console.error(err); }); } -main().catch(err => { - console.log(err) -}) +main() + .catch(err => { + console.log(err); + exit(1); + }); From 9869aedfba9b80755523444918805f965b198392 Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Tue, 21 May 2024 18:38:16 -0400 Subject: [PATCH 25/29] Update publish-firefox workflow --- .github/workflows/publish-firefox.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-firefox.yml b/.github/workflows/publish-firefox.yml index af478bb..b72b802 100644 --- a/.github/workflows/publish-firefox.yml +++ b/.github/workflows/publish-firefox.yml @@ -27,13 +27,14 @@ jobs: run: | npm run build-firefox npx web-ext build -s dist/firefox + zip -r dist/source.zip docs icons img native-messaging-host packages pages src styles .nvmrc jsconfig.json LICENSE manifest.* native-manifest.json package* README.md tsconfig.json webpack.config.ts # - name: Sign # id: sign # env: # WEB_EXT_API_KEY: ${{ vars.FIREFOX_API_KEY }} # WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }} # run: | - # npx web-ext sign --source-dir=./dist/firefox + # npx web-ext sign --use-submission-api --source-dir=./dist/firefox # echo "xpi_filepath=$(ls web-ext-artifacts/*.xpi)" >> "$GITHUB_OUTPUT" - name: Publish env: From 422b5594e697d8528ea140516c38ae0c6cab44e4 Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Tue, 21 May 2024 18:38:25 -0400 Subject: [PATCH 26/29] Update maniftest --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index b3f6234..5cc1398 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "KeeWeb Connect", - "version": "0.3.7.13", + "version": "0.3.7.15", "manifest_version": 2, "description": "__MSG_description__", "icons": { From 2176c42dab2b1a7fb73a7fb9ff2ff5bc91cda923 Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Tue, 21 May 2024 19:00:40 -0400 Subject: [PATCH 27/29] Remove jsonwebtoken --- package-lock.json | 147 ++++------------------------------------------ package.json | 1 - 2 files changed, 10 insertions(+), 138 deletions(-) diff --git a/package-lock.json b/package-lock.json index 60d1f92..144f63d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,6 @@ "eslint-plugin-import": "^2.22.1", "eslint-plugin-jest": "^28.5.0", "eslint-plugin-prettier": "^3.3.1", - "jsonwebtoken": "^9.0.2", "merge": "^2.1.1", "prettier": "^2.8.8", "tiny-typed-emitter": "^2.1.0", @@ -6803,21 +6802,15 @@ } }, "node_modules/jsonwebtoken": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", - "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz", + "integrity": "sha512-tuGfYXxkQGDPnLJ7SibiQgVgeDgfbPq2k2ICcbgqW8WxWLBAxKQM/ZCu/IT8SOSwmaYl4dpTFCW5xZv7YbbWUw==", "dev": true, "dependencies": { "jws": "^3.2.2", - "lodash.includes": "^4.3.0", - "lodash.isboolean": "^3.0.3", - "lodash.isinteger": "^4.0.4", - "lodash.isnumber": "^3.0.3", - "lodash.isplainobject": "^4.0.6", - "lodash.isstring": "^4.0.1", - "lodash.once": "^4.0.0", + "lodash": "^4.17.21", "ms": "^2.1.1", - "semver": "^7.5.4" + "semver": "^7.3.8" }, "engines": { "node": ">=12", @@ -7043,42 +7036,6 @@ "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=", "dev": true }, - "node_modules/lodash.includes": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", - "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==", - "dev": true - }, - "node_modules/lodash.isboolean": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", - "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==", - "dev": true - }, - "node_modules/lodash.isinteger": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", - "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==", - "dev": true - }, - "node_modules/lodash.isnumber": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", - "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==", - "dev": true - }, - "node_modules/lodash.isplainobject": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", - "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", - "dev": true - }, - "node_modules/lodash.isstring": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", - "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", - "dev": true - }, "node_modules/lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", @@ -7091,12 +7048,6 @@ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, - "node_modules/lodash.once": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", - "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", - "dev": true - }, "node_modules/lodash.truncate": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", @@ -9153,22 +9104,6 @@ "stream-to-promise": "3.0.0" } }, - "node_modules/sign-addon/node_modules/jsonwebtoken": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz", - "integrity": "sha512-tuGfYXxkQGDPnLJ7SibiQgVgeDgfbPq2k2ICcbgqW8WxWLBAxKQM/ZCu/IT8SOSwmaYl4dpTFCW5xZv7YbbWUw==", - "dev": true, - "dependencies": { - "jws": "^3.2.2", - "lodash": "^4.17.21", - "ms": "^2.1.1", - "semver": "^7.3.8" - }, - "engines": { - "node": ">=12", - "npm": ">=6" - } - }, "node_modules/signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", @@ -15941,21 +15876,15 @@ } }, "jsonwebtoken": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", - "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz", + "integrity": "sha512-tuGfYXxkQGDPnLJ7SibiQgVgeDgfbPq2k2ICcbgqW8WxWLBAxKQM/ZCu/IT8SOSwmaYl4dpTFCW5xZv7YbbWUw==", "dev": true, "requires": { "jws": "^3.2.2", - "lodash.includes": "^4.3.0", - "lodash.isboolean": "^3.0.3", - "lodash.isinteger": "^4.0.4", - "lodash.isnumber": "^3.0.3", - "lodash.isplainobject": "^4.0.6", - "lodash.isstring": "^4.0.1", - "lodash.once": "^4.0.0", + "lodash": "^4.17.21", "ms": "^2.1.1", - "semver": "^7.5.4" + "semver": "^7.3.8" } }, "jsprim": { @@ -16146,42 +16075,6 @@ "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=", "dev": true }, - "lodash.includes": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", - "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==", - "dev": true - }, - "lodash.isboolean": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", - "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==", - "dev": true - }, - "lodash.isinteger": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", - "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==", - "dev": true - }, - "lodash.isnumber": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", - "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==", - "dev": true - }, - "lodash.isplainobject": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", - "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", - "dev": true - }, - "lodash.isstring": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", - "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", - "dev": true - }, "lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", @@ -16194,12 +16087,6 @@ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, - "lodash.once": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", - "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", - "dev": true - }, "lodash.truncate": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", @@ -17709,20 +17596,6 @@ "request": "2.88.2", "source-map-support": "0.5.21", "stream-to-promise": "3.0.0" - }, - "dependencies": { - "jsonwebtoken": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz", - "integrity": "sha512-tuGfYXxkQGDPnLJ7SibiQgVgeDgfbPq2k2ICcbgqW8WxWLBAxKQM/ZCu/IT8SOSwmaYl4dpTFCW5xZv7YbbWUw==", - "dev": true, - "requires": { - "jws": "^3.2.2", - "lodash": "^4.17.21", - "ms": "^2.1.1", - "semver": "^7.3.8" - } - } } }, "signal-exit": { diff --git a/package.json b/package.json index 0a2e454..e534704 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,6 @@ "eslint-plugin-import": "^2.22.1", "eslint-plugin-jest": "^28.5.0", "eslint-plugin-prettier": "^3.3.1", - "jsonwebtoken": "^9.0.2", "merge": "^2.1.1", "prettier": "^2.8.8", "tiny-typed-emitter": "^2.1.0", From 7aa08cfefb491982f4a9111e9109d06b328a801e Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Tue, 21 May 2024 19:03:37 -0400 Subject: [PATCH 28/29] Cleanups --- manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 5cc1398..2f62eed 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "KeeWeb Connect", - "version": "0.3.7.15", + "version": "0.3.7", "manifest_version": 2, "description": "__MSG_description__", "icons": { @@ -64,4 +64,4 @@ "description": "__MSG_cmdInsertOther__" } } -} +} \ No newline at end of file From 3a0cc526447d32acee8fd226726e7fa0e63986e8 Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Tue, 21 May 2024 19:03:42 -0400 Subject: [PATCH 29/29] Cleanups --- .github/publish-firefox | 12 --- .github/publish-firefox-addon.js | 124 -------------------------- .github/workflows/publish-firefox.yml | 16 +--- 3 files changed, 2 insertions(+), 150 deletions(-) delete mode 100755 .github/publish-firefox delete mode 100644 .github/publish-firefox-addon.js diff --git a/.github/publish-firefox b/.github/publish-firefox deleted file mode 100755 index d6d6ee8..0000000 --- a/.github/publish-firefox +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# https://mozilla.github.io/addons-server/topics/api/addons.html#upload-create - -addon_version=$(jq -r '.version' manifest.json) -file_path="web-ext-artifacts/keeweb_connect-$addon_version.zip" -jwt=$(npm run --silent gen-ff-jwt) - -curl -X POST --header "Authorization: JWT $jwt" \ - --form "channel=listed" \ - --form upload=@$file_path \ - https://addons.mozilla.org/api/v5/addons/upload/ diff --git a/.github/publish-firefox-addon.js b/.github/publish-firefox-addon.js deleted file mode 100644 index 0de9dca..0000000 --- a/.github/publish-firefox-addon.js +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Publish Firefox addon - * https://blog.mozilla.org/addons/2022/03/17/new-api-for-submitting-and-updating-add-ons/ - */ - -const jwt = require('jsonwebtoken'); -const fs = require('fs'); - -var issuedAt = Math.floor(Date.now() / 1000); -var payload = { - iss: process.env.WEB_EXT_API_KEY, - jti: Math.random().toString(), - iat: issuedAt, - exp: issuedAt + 60, -}; - -var secret = process.env.WEB_EXT_API_SECRET; // store this securely. -var token = jwt.sign(payload, secret, { - algorithm: 'HS256', // HMAC-SHA256 signing algorithm -}); - -const https = require('https'); - -const options = { - hostname: 'addons.mozilla.org', - port: 443, - path: '/api/v5/addons/upload/', - method: 'POST' -} - -async function main() { - const manifest = require('../manifest.json'); - const manifestFirefox = require('../manifest.firefox.json'); - const addonUUID = manifestFirefox.browser_specific_settings.gecko.id; - const fileName = `keeweb_connect-${manifest.version}.zip` - const filePath = `web-ext-artifacts/${fileName}` - const fileBuffer = fs.createReadStream(filePath); - const fileBlob = new Blob([fileBuffer]); - - // Upload the zipped add-on file to the upload create endpoint - // https://addons-server.readthedocs.io/en/latest/topics/api/addons.html#upload-create - const form = new FormData(); - form.set('upload', fileBlob, fileName); - form.set('channel', 'listed'); - - const uploadCreateURL = 'https://addons.mozilla.org/api/v5/addons/upload/' - const req = new Request(uploadCreateURL, { - method: 'POST', - body: form, - }) - req.headers.append('Authorization', `JWT ${token}`); - req.headers.append('Accept', 'application/json'); - - const fileSizeInKB = (await fs.promises.stat(filePath)).size / (1000); - console.log(`Uploading ${fileSizeInKB.toFixed(2)}KB file ${filePath}`); - - fetch(req).then(async (res) => { - const resData = await res.json(); - - if (!res.ok) - throw new Error(`HTTP error! status: ${res.status}, body: `, resData); - - console.log('response.status:', res.status); - console.log('response.body:', resData); - const uploadUUID = resData.uuid; - - // Poll the upload detail endpoint until we are validated - // https://mozilla.github.io/addons-server/topics/api/addons.html#upload-detail - var validationRes; - var validationData; - var validationTries = 0; - const validationReq = new Request(`https://addons.mozilla.org/api/v5/addons/upload/${uploadUUID}/`, { - method: 'GET' - }) - validationReq.headers.append('Authorization', `JWT ${token}`); - validationReq.headers.append('Accept', 'application/json'); - - while (!validationData?.processed && validationTries < 3) { - // Increasingly wait before checking the validation status - const waitMS = 60_000 * (validationTries + 1); - console.log(`Will check validation status in a ${waitMS / 1000}s...`); - await new Promise(resolve => setTimeout(resolve, waitMS)); - - validationTries += 1; - var validationRes = await fetch(validationReq); - validationData = await validationRes.json(); - - console.log('validationData', validationData); - console.log('validationData.validation.messages', validationData.validation?.messages); - } - - if (!validationData?.valid) - throw new Error('Extension did not validate in time.'); - - // Send POST to add-on version create endpoint - // https://mozilla.github.io/addons-server/topics/api/addons.html#version-create - const addonVersionCreateURL = `https://addons.mozilla.org/api/v5/addons/addon/${addonUUID}/versions/`; - const addonVersionCreatePayload = { - license: 'MIT', - upload: uploadUUID - } - const addonVersionCreateReq = new Request(addonVersionCreateURL, { - method: 'POST', - body: addonVersionCreatePayload, - }) - addonVersionCreateReq.headers.append('Authorization', `JWT ${token}`); - addonVersionCreateReq.headers.append('Accept', 'application/json'); - fetch(addonVersionCreateReq).then(async (res) => { - if (!res.ok) - throw new Error(`HTTP error! status: ${res.status}, body: `, resData); - - console.log('response.status:', res.status); - console.log('response.body:', resData); - }) - - //TODO do we need to submit source code? - }); -} - -main() - .catch(err => { - console.log(err); - exit(1); - }); diff --git a/.github/workflows/publish-firefox.yml b/.github/workflows/publish-firefox.yml index b72b802..cde378c 100644 --- a/.github/workflows/publish-firefox.yml +++ b/.github/workflows/publish-firefox.yml @@ -1,8 +1,6 @@ name: Publish Firefox Addon on: - pull_request: # TEMPORARY - workflow_dispatch: # TEMPORARY push: tags: - '*' @@ -26,19 +24,9 @@ jobs: - name: Build run: | npm run build-firefox - npx web-ext build -s dist/firefox - zip -r dist/source.zip docs icons img native-messaging-host packages pages src styles .nvmrc jsconfig.json LICENSE manifest.* native-manifest.json package* README.md tsconfig.json webpack.config.ts - # - name: Sign - # id: sign - # env: - # WEB_EXT_API_KEY: ${{ vars.FIREFOX_API_KEY }} - # WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }} - # run: | - # npx web-ext sign --use-submission-api --source-dir=./dist/firefox - # echo "xpi_filepath=$(ls web-ext-artifacts/*.xpi)" >> "$GITHUB_OUTPUT" - name: Publish env: WEB_EXT_API_KEY: ${{ vars.FIREFOX_API_KEY }} WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }} - - run: npm run publish-firefox-addon + # https://extensionworkshop.com/documentation/develop/web-ext-command-reference/#use-submission-api + run: npx web-ext sign --use-submission-api --channel=listed --source-dir=./dist/firefox