From 266e0b28887124ed8ebfd51f738062de1d4f1f6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20R=C3=ADos?= Date: Thu, 18 Jan 2024 18:48:03 +0100 Subject: [PATCH] hotifx: add missing required headers (#8) * chore: bump fresh to `v1.6.3` * add: headers for app version code, signature, and device ID --- deno.json | 28 +++++++--------------------- routes/api/add.ts | 3 +++ routes/api/changelog.ts | 20 ++++++++++++++------ routes/api/discovery.ts | 3 +++ routes/api/feed.ts | 3 +++ routes/api/friends.ts | 3 +++ routes/api/me.ts | 3 +++ routes/api/react.ts | 3 +++ routes/api/reactAll.ts | 6 ++++++ routes/api/refresh.ts | 2 +- routes/api/user.ts | 3 +++ 11 files changed, 49 insertions(+), 28 deletions(-) diff --git a/deno.json b/deno.json index 5bd2d0b..9200c60 100644 --- a/deno.json +++ b/deno.json @@ -6,18 +6,11 @@ "build": "deno run -A --unstable dev.ts build", "preview": "deno run --env -A --unstable main.ts" }, - "lint": { - "rules": { - "tags": [ - "fresh", - "recommended" - ] - } - }, + "lint": { "rules": { "tags": ["fresh", "recommended"] } }, "imports": { - "$fresh/": "https://deno.land/x/fresh@1.6.1/", - "preact": "https://esm.sh/preact@10.15.1", - "preact/": "https://esm.sh/preact@10.15.1/", + "$fresh/": "https://deno.land/x/fresh@1.6.3/", + "preact": "https://esm.sh/preact@10.19.2", + "preact/": "https://esm.sh/preact@10.19.2/", "preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.2.1", "@preact/signals": "https://esm.sh/*@preact/signals@1.1.3", "@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.2.3", @@ -33,18 +26,11 @@ "tailwindcss/plugin": "npm:tailwindcss@3.4.1/plugin.js", "~/": "./" }, - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "preact" - }, - "exclude": [ - "**/_fresh/*" - ], + "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "preact" }, + "exclude": ["**/_fresh/*"], "deploy": { "project": "9ab14b2a-b0d9-4e55-83ec-7f25f7ad1d52", - "exclude": [ - "**/node_modules" - ], + "exclude": ["**/node_modules"], "include": [], "entrypoint": "main.ts" } diff --git a/routes/api/add.ts b/routes/api/add.ts index 60233b2..d74f09d 100644 --- a/routes/api/add.ts +++ b/routes/api/add.ts @@ -22,6 +22,9 @@ export const handler = async ( { headers: { authorization: `Bearer ${access_token}`, + "bereal-app-version-code": "14549", + "bereal-signature": "berealsignature", + "bereal-device-id": "berealdeviceid", }, method: "POST", body: JSON.stringify({ diff --git a/routes/api/changelog.ts b/routes/api/changelog.ts index c14962f..b401b95 100644 --- a/routes/api/changelog.ts +++ b/routes/api/changelog.ts @@ -49,9 +49,13 @@ export const handler = async ( if (!deploymentRequest.ok) { kv.close(); return new Response( - JSON.stringify({ - error: await deploymentRequest.json(), - }, null, 2), + JSON.stringify( + { + error: await deploymentRequest.json(), + }, + null, + 2, + ), { status: 500 }, ); } @@ -98,9 +102,13 @@ export const handler = async ( if (!commitsRequest.ok) { kv.close(); return new Response( - JSON.stringify({ - error: await commitsRequest.json(), - }, null, 2), + JSON.stringify( + { + error: await commitsRequest.json(), + }, + null, + 2, + ), { status: 500 }, ); } diff --git a/routes/api/discovery.ts b/routes/api/discovery.ts index 30d73cf..6fa5c65 100644 --- a/routes/api/discovery.ts +++ b/routes/api/discovery.ts @@ -21,6 +21,9 @@ export const handler = async ( { headers: { authorization: `Bearer ${access_token}`, + "bereal-app-version-code": "14549", + "bereal-signature": "berealsignature", + "bereal-device-id": "berealdeviceid", }, }, ); diff --git a/routes/api/feed.ts b/routes/api/feed.ts index 9b86f60..84f72c5 100644 --- a/routes/api/feed.ts +++ b/routes/api/feed.ts @@ -21,6 +21,9 @@ export const handler = async ( { headers: { authorization: `Bearer ${access_token}`, + "bereal-app-version-code": "14549", + "bereal-signature": "berealsignature", + "bereal-device-id": "berealdeviceid", }, }, ); diff --git a/routes/api/friends.ts b/routes/api/friends.ts index 4e3cd79..b5b630a 100644 --- a/routes/api/friends.ts +++ b/routes/api/friends.ts @@ -21,6 +21,9 @@ export const handler = async ( { headers: { authorization: `Bearer ${access_token}`, + "bereal-app-version-code": "14549", + "bereal-signature": "berealsignature", + "bereal-device-id": "berealdeviceid", }, }, ); diff --git a/routes/api/me.ts b/routes/api/me.ts index ce41340..70e83da 100644 --- a/routes/api/me.ts +++ b/routes/api/me.ts @@ -21,6 +21,9 @@ export const handler = async ( { headers: { authorization: `Bearer ${access_token}`, + "bereal-app-version-code": "14549", + "bereal-signature": "berealsignature", + "bereal-device-id": "berealdeviceid", }, }, ); diff --git a/routes/api/react.ts b/routes/api/react.ts index 106b852..989fc05 100644 --- a/routes/api/react.ts +++ b/routes/api/react.ts @@ -24,6 +24,9 @@ export const handler = async ( { headers: { authorization: `Bearer ${access_token}`, + "bereal-app-version-code": "14549", + "bereal-signature": "berealsignature", + "bereal-device-id": "berealdeviceid", }, method: "POST", body: JSON.stringify({ diff --git a/routes/api/reactAll.ts b/routes/api/reactAll.ts index 0f8dcfa..3e5d996 100644 --- a/routes/api/reactAll.ts +++ b/routes/api/reactAll.ts @@ -24,6 +24,9 @@ export const handler = async ( { headers: { authorization: `Bearer ${access_token}`, + "bereal-app-version-code": "14549", + "bereal-signature": "berealsignature", + "bereal-device-id": "berealdeviceid", }, }, ); @@ -55,6 +58,9 @@ export const handler = async ( { headers: { authorization: `Bearer ${access_token}`, + "bereal-app-version-code": "14549", + "bereal-signature": "berealsignature", + "bereal-device-id": "berealdeviceid", "content-type": "application/json", "accept": "application/json", }, diff --git a/routes/api/refresh.ts b/routes/api/refresh.ts index 936b9a5..5c93d59 100644 --- a/routes/api/refresh.ts +++ b/routes/api/refresh.ts @@ -16,7 +16,7 @@ export const handler = async ( return new Response(null, { status: 400 }); } - const refreshResponse = await fetch( + const refreshResponse = await fetch( "https://auth.bereal.team/token?grant_type=refresh_token", { method: "POST", diff --git a/routes/api/user.ts b/routes/api/user.ts index 002521b..de8b7ca 100644 --- a/routes/api/user.ts +++ b/routes/api/user.ts @@ -22,6 +22,9 @@ export const handler = async ( { headers: { authorization: `Bearer ${access_token}`, + "bereal-app-version-code": "14549", + "bereal-signature": "berealsignature", + "bereal-device-id": "berealdeviceid", }, }, );