Skip to content

Commit

Permalink
hotifx: add missing required headers (#8)
Browse files Browse the repository at this point in the history
* chore: bump fresh to `v1.6.3`

* add: headers for app version code, signature, and device ID
  • Loading branch information
Jabolol authored Jan 18, 2024
1 parent dea6a9f commit 266e0b2
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 28 deletions.
28 changes: 7 additions & 21 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
}
Expand Down
3 changes: 3 additions & 0 deletions routes/api/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
20 changes: 14 additions & 6 deletions routes/api/changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
);
}
Expand Down Expand Up @@ -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 },
);
}
Expand Down
3 changes: 3 additions & 0 deletions routes/api/discovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
);
Expand Down
3 changes: 3 additions & 0 deletions routes/api/feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
);
Expand Down
3 changes: 3 additions & 0 deletions routes/api/friends.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
);
Expand Down
3 changes: 3 additions & 0 deletions routes/api/me.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
);
Expand Down
3 changes: 3 additions & 0 deletions routes/api/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
6 changes: 6 additions & 0 deletions routes/api/reactAll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
);
Expand Down Expand Up @@ -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",
},
Expand Down
2 changes: 1 addition & 1 deletion routes/api/refresh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions routes/api/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
);
Expand Down

0 comments on commit 266e0b2

Please sign in to comment.