From 74c7e4d3da718741729e743c74cc2338a10ddf8e Mon Sep 17 00:00:00 2001 From: Sven Sauleau Date: Wed, 11 Jan 2023 17:48:06 +0000 Subject: [PATCH 1/4] send JSON to initialize the db --- frontend/mock-db/init.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/mock-db/init.ts b/frontend/mock-db/init.ts index 92c9504..07b1653 100644 --- a/frontend/mock-db/init.ts +++ b/frontend/mock-db/init.ts @@ -23,8 +23,12 @@ async function createStatus(db: D1Database, actor: Person, status: string, visib status, visibility, } + const headers = { + 'content-type': 'application/json', + } const req = new Request('https://example.com', { method: 'POST', + headers, body: JSON.stringify(body), }) await statusesAPI.handleRequest(req, db, actor, kek) From a9e0dc214711f53624016e710da4350d535c8d0e Mon Sep 17 00:00:00 2001 From: Sven Sauleau Date: Wed, 11 Jan 2023 17:52:43 +0000 Subject: [PATCH 2/4] don't try to download VAPID keys if KV doesn't exists --- .github/workflows/deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4eda22f..6f6564c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -125,6 +125,7 @@ jobs: env: CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }} continue-on-error: true + if: ${{ env.tfstate_kv != '' }} - name: generate VAPID keys if needed run: | From a4a022b89a7a2041bca4bbe24c7fcebede9d612d Mon Sep 17 00:00:00 2001 From: Sven Sauleau Date: Wed, 11 Jan 2023 17:57:05 +0000 Subject: [PATCH 3/4] fix lint --- frontend/src/routes/(frontend)/layout.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/routes/(frontend)/layout.tsx b/frontend/src/routes/(frontend)/layout.tsx index 7920d59..46be532 100644 --- a/frontend/src/routes/(frontend)/layout.tsx +++ b/frontend/src/routes/(frontend)/layout.tsx @@ -12,7 +12,7 @@ import { InstanceConfigContext } from '~/utils/instanceConfig' export const instanceLoader = loader$< { DATABASE: D1Database; INSTANCE_TITLE: string; INSTANCE_DESCR: string; ADMIN_EMAIL: string }, Promise ->(async ({ platform, redirect }) => { +>(async ({ platform }) => { const env = { INSTANCE_DESCR: platform.INSTANCE_DESCR, INSTANCE_TITLE: platform.INSTANCE_TITLE, From fe23e4a68918fef667aa37006a490ec6f469016b Mon Sep 17 00:00:00 2001 From: Sven Sauleau Date: Wed, 11 Jan 2023 18:00:10 +0000 Subject: [PATCH 4/4] ci: handle permission error --- .github/workflows/deploy.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6f6564c..b2184b3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -118,10 +118,6 @@ jobs: echo "*** pre commands ***" apt-get update && apt-get -y install jq echo "******" - postCommands: | - echo "*** post commands ***" - chmod 777 ./tf/vapid_jwk - echo "******" env: CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }} continue-on-error: true @@ -129,6 +125,8 @@ jobs: - name: generate VAPID keys if needed run: | + sudo chmod 777 ./tf/vapid_jwk || true + if [ ! -s ./tf/vapid_jwk ] then node ./scripts/generate-vapid-keys.mjs > ./tf/vapid_jwk