Skip to content

Commit

Permalink
hotfix: update auth (#17)
Browse files Browse the repository at this point in the history
* fix: use `happy-headers` auth

* fix: update `fresh`

* fix: remove headers from `readme`

* fix: changelog `width`

* fix: remove `search` icon

* fix: update`google` api keys

* fix: remove `red` background
  • Loading branch information
Jabolol authored May 1, 2024
1 parent 44dd8e4 commit 3deec26
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 41 deletions.
15 changes: 0 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,8 @@ GITHUB_TOKEN=

# Google Analytics tracking ID (Optional)
GA4_MEASUREMENT_ID=

# BeReal Signature
BEREAL_SIGNATURE=

# BeReal Device ID
BEREAL_DEVICE_ID=

# BeReal Timezone
BEREAL_TIMEZONE=
```

> [!WARNING]\
> The `BEREAL_SIGNATURE` and `BEREAL_DEVICE_ID` are required for the app to
> function. You can find them by inspecting the network requests made by the
> BeReal app in a rooted Android device using
> [Burp Suite](https://portswigger.net/burp) and [Frida](https://frida.re/).
Run the development server:

```sh
Expand Down
12 changes: 2 additions & 10 deletions client.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
import { z } from "zod";
import getHeaders from "happy-headers";
import { type ApiFunction, type APIMap, type ApiValidators } from "~/types.ts";

export const headers = (_templates: TemplateStringsArray, token: string) => ({
"Bereal-Platform": "android",
"Bereal-App-Language": "en-US",
"Bereal-Device-Language": "en-US",
"Bereal-App-Version": "1.19.6",
"Bereal-Os-Version": "10",
"Bereal-Device-Id": Deno.env.get("BEREAL_DEVICE_ID")!,
"Bereal-Timezone": Deno.env.get("BEREAL_TIMEZONE")!,
"Bereal-App-Version-Code": "1631",
"Bereal-Signature": Deno.env.get("BEREAL_SIGNATURE")!,
"User-Agent": "okhttp/4.12.0",
"Authorization": `Bearer ${token}`,
...getHeaders(),
});

const refresh = () => ({
Expand Down
5 changes: 3 additions & 2 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"lint": { "rules": { "tags": ["fresh", "recommended"] } },
"imports": {
"$fresh/": "https://deno.land/x/fresh@1.6.5/",
"$fresh/": "https://deno.land/x/fresh@1.6.8/",
"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",
Expand All @@ -28,7 +28,8 @@
"~/": "./",
"@twind/core": "https://esm.sh/@twind/core@1.1.3",
"@twind/preset-tailwind": "https://esm.sh/@twind/preset-tailwind@1.1.4/",
"@twind/preset-autoprefix": "https://esm.sh/@twind/preset-autoprefix@1.0.7/"
"@twind/preset-autoprefix": "https://esm.sh/@twind/preset-autoprefix@1.0.7/",
"happy-headers": "npm:happy-headers"
},
"compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "preact" },
"exclude": ["**/_fresh/*"],
Expand Down
6 changes: 3 additions & 3 deletions islands/Changelog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export default function Changelog() {
}, []);

return (
<>
<div className="w-90vw mt-10">
<div className="max-w-[50%] flex items-center flex-col">
<div className="mt-10">
<h1 className="text-2xl font-semibold text-center dark:text-white">
Changelog
</h1>
Expand Down Expand Up @@ -64,6 +64,6 @@ export default function Changelog() {
</div>
</>
)}
</>
</div>
);
}
6 changes: 0 additions & 6 deletions islands/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import IconReload from "icons/reload.tsx";
import IconArrowBigLeft from "icons/arrow-big-left.tsx";
import IconUser from "icons/user.tsx";
import IconChartBar from "icons/chart-bar.tsx";
import IconSearch from "icons/search.tsx";
import { isLoggedIn, logout, store } from "~/state/auth.ts";

export default function Navbar() {
Expand Down Expand Up @@ -53,11 +52,6 @@ export default function Navbar() {
<IconChartBar className="w-6 h-6 rounded-full cursor-pointer" />
</a>
)}
{isLogged && (
<a href="/search">
<IconSearch className="w-6 h-6 rounded-full cursor-pointer" />
</a>
)}
{isDarkMode
? <IconSun onClick={toggleDarkMode} className="cursor-pointer" />
: <IconMoon onClick={toggleDarkMode} className="cursor-pointer" />}
Expand Down
4 changes: 2 additions & 2 deletions routes/api/send.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const handler = async (
}

const receiptResponse = await fetch(
"https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyClient?key=AIzaSyDwjfEeparokD7sXPVQli9NsTuhT6fJ6iA",
"https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyClient?key=AIzaSyCgNTZt6gzPMh-2voYXOvrt_UR_gpGl83Q",
{
method: "POST",
headers: {
Expand Down Expand Up @@ -103,7 +103,7 @@ export const handler = async (
};

const otpResponse = await fetch(
"https://www.googleapis.com/identitytoolkit/v3/relyingparty/sendVerificationCode?key=AIzaSyDwjfEeparokD7sXPVQli9NsTuhT6fJ6iA",
"https://www.googleapis.com/identitytoolkit/v3/relyingparty/sendVerificationCode?key=AIzaSyCgNTZt6gzPMh-2voYXOvrt_UR_gpGl83Q",
{
method: "POST",
headers: {
Expand Down
6 changes: 3 additions & 3 deletions routes/api/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const handler = async (
};

const googleResponse = await fetch(
"https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyCustomToken?key=AIzaSyDwjfEeparokD7sXPVQli9NsTuhT6fJ6iA",
"https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyCustomToken?key=AIzaSyCgNTZt6gzPMh-2voYXOvrt_UR_gpGl83Q",
{
method: "POST",
body: JSON.stringify({
Expand Down Expand Up @@ -113,7 +113,7 @@ export const handler = async (
}

const fireResponse = await fetch(
"https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyPhoneNumber?key=AIzaSyDwjfEeparokD7sXPVQli9NsTuhT6fJ6iA",
"https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyPhoneNumber?key=AIzaSyCgNTZt6gzPMh-2voYXOvrt_UR_gpGl83Q",
{
method: "POST",
headers: {
Expand Down Expand Up @@ -165,7 +165,7 @@ export const handler = async (
}

const tokenResponse = await fetch(
"https://securetoken.googleapis.com/v1/token?key=AIzaSyDwjfEeparokD7sXPVQli9NsTuhT6fJ6iA",
"https://securetoken.googleapis.com/v1/token?key=AIzaSyCgNTZt6gzPMh-2voYXOvrt_UR_gpGl83Q",
{
method: "POST",
headers: {
Expand Down

0 comments on commit 3deec26

Please sign in to comment.