From 7d3e7394ed21748c060ba8a33f6ba4043df88ec0 Mon Sep 17 00:00:00 2001 From: Jeff Gardner <202880+erskingardner@users.noreply.github.com> Date: Thu, 1 Feb 2024 11:22:10 +0100 Subject: [PATCH 01/12] Replace auth request js method, change prettierrc to handle handlebar templates better --- .prettierrc.json | 18 ++++-- templates/authorizeRequest.handlebar | 87 +++++++++++++++++++++++----- 2 files changed, 84 insertions(+), 21 deletions(-) diff --git a/.prettierrc.json b/.prettierrc.json index 2519bad..f98859f 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,7 +1,15 @@ { - "importOrder": ["^[./]"], - "importOrderSeparation": true, - "tabWidth": 4, - "useTabs": false, - "semi": true + "importOrder": ["^[./]"], + "importOrderSeparation": true, + "tabWidth": 4, + "useTabs": false, + "semi": true, + "overrides": [ + { + "files": "*.handlebar", + "options": { + "tabWidth": 2 + } + } + ] } diff --git a/templates/authorizeRequest.handlebar b/templates/authorizeRequest.handlebar index dcff0ea..4f39dfc 100644 --- a/templates/authorizeRequest.handlebar +++ b/templates/authorizeRequest.handlebar @@ -1,8 +1,8 @@ - - + + Authorize Request @@ -31,10 +31,56 @@ } } } + + function sendPostRequest(permissions) { + const url = '/requests/{{record.id}}'; + const password = document.getElementById('password').value; + let callbackUrl; + {{#if callbackUrl}} + callbackUrl = '{{callbackUrl}}'; + {{/if}} + const data = { + permissions, + password, + }; + + fetch(url, { + method: 'POST', // or 'PUT' + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(data), + }) + .then((response) => response.json()) + .then((data) => { + console.log('Success:', data); + + if (data.error) { + document.getElementById('error').innerText = data.error; + document.getElementById('error').classList.remove('hidden'); + return; + } + + // hide main content and show close message + document.getElementById('main').classList.add('hidden'); + document.getElementById('closeit').classList.remove('hidden'); + + // redirect to callback url + if (callbackUrl) { + const url = new URL(callbackUrl); + url.searchParams.append('pubkey', data.pubkey); + window.location.href = url.toString(); + } + }) + .catch((error) => { + console.error('Error:', error); + }); + }; + class="flex flex-col justify-center items-center min-h-screen bg-gray-100 dark:bg-neutral-800 text-neutrla-950 dark:text-neutral-50" + >

+ class="text-neutral-950 dark:text-neutral-50 text-lg font-semibold w-full" + > Do you want to allow this client to use account
- {{record.keyName}}? + {{ record.keyName }}?

- + {{#unless authenticated}}
@@ -79,12 +132,14 @@
@@ -101,10 +156,10 @@ - \ No newline at end of file + From e796307f303bde3ed3aa6e280f6058da55511d9a Mon Sep 17 00:00:00 2001 From: Jeff Gardner <202880+erskingardner@users.noreply.github.com> Date: Thu, 1 Feb 2024 11:48:06 +0100 Subject: [PATCH 02/12] Add required id attribute --- templates/authorizeRequest.handlebar | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/authorizeRequest.handlebar b/templates/authorizeRequest.handlebar index 4f39dfc..3f9f0d4 100644 --- a/templates/authorizeRequest.handlebar +++ b/templates/authorizeRequest.handlebar @@ -121,6 +121,7 @@ From 109cb5d9721541bb92c7e50df1809a56a9b1f753 Mon Sep 17 00:00:00 2001 From: hzrd149 Date: Sun, 4 Feb 2024 11:52:56 +0000 Subject: [PATCH 03/12] add github action for docker image --- .github/workflows/docker-image.yml | 61 ++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..b2d8719 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,61 @@ +name: Docker image + +on: + push: + branches: + - '**' + tags: + - 'v*.*.*' + pull_request: + branches: + - 'main' + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=ref,event=branch + type=ref,event=pr + type=sha + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From 5b37032ec13ad8f4bc5ba0dd582802bfcb70f793 Mon Sep 17 00:00:00 2001 From: hzrd149 Date: Sun, 4 Feb 2024 12:50:39 +0000 Subject: [PATCH 04/12] update main branch --- .github/workflows/docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index b2d8719..6462033 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -8,7 +8,7 @@ on: - 'v*.*.*' pull_request: branches: - - 'main' + - 'master' env: REGISTRY: ghcr.io From dcb9b6695ce24b7e8c3aa84ca4cb1572b9e7ab44 Mon Sep 17 00:00:00 2001 From: Pablo Fernandez Date: Thu, 15 Feb 2024 13:18:17 +0000 Subject: [PATCH 05/12] remove stupid email example --- templates/createAccount.handlebar | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/templates/createAccount.handlebar b/templates/createAccount.handlebar index 52a727c..bae0eb5 100644 --- a/templates/createAccount.handlebar +++ b/templates/createAccount.handlebar @@ -36,7 +36,6 @@