Skip to content

Commit c7fd0df

Browse files
fix modifying immutable headers
1 parent 71a19e8 commit c7fd0df

File tree

8 files changed

+7118
-6189
lines changed

8 files changed

+7118
-6189
lines changed

.vscode/extensions.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
2-
"recommendations": [
3-
"astro-build.astro-vscode",
4-
"biomejs.biome"
5-
],
6-
"unwantedRecommendations": [],
2+
"recommendations": ["astro-build.astro-vscode", "biomejs.biome"],
3+
"unwantedRecommendations": []
74
}

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"[jsonc]": {
99
"editor.defaultFormatter": "biomejs.biome"
1010
},
11-
"[typescript]": {
11+
"[typescript]": {
1212
"editor.defaultFormatter": "biomejs.biome"
13-
},
13+
}
1414
}

astro.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ export default defineConfig({
8787
platformProxy: {
8888
enabled: true,
8989
experimental: {
90-
remoteBindings: true
91-
}
90+
remoteBindings: true,
91+
},
9292
},
9393
}),
9494
// env: {

biome.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"ignoreUnknown": true,
1111
"includes": [
1212
"**",
13+
"!**/worker-configuration.d.ts",
1314
"!**/.prettierrc.mjs",
1415
"!**/.prettierignore",
1516
"!**/*.astro",

src/components/Auth.astro

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
import Icon from "~/components/Icon.astro";
23
import { auth as betterAuth } from "~/lib/auth";
34
45
const auth = betterAuth(
@@ -20,7 +21,9 @@ const session = await auth.api.getSession({
2021
src={session.user.image}
2122
/>
2223
) : (
23-
<button id="login"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><!-- Icon from Solar by 480 Design - https://creativecommons.org/licenses/by/4.0/ --><g fill="none" stroke="currentColor" stroke-width="1.5"><path stroke-linecap="round" d="M8 16c0 2.828 0 4.243.879 5.121C9.757 22 11.172 22 14 22h1c2.828 0 4.243 0 5.121-.879C21 20.243 21 18.828 21 16V8c0-2.828 0-4.243-.879-5.121C19.243 2 17.828 2 15 2h-1c-2.828 0-4.243 0-5.121.879C8 3.757 8 5.172 8 8"/><path d="M8 19.5c-2.357 0-3.536 0-4.268-.732C3 18.035 3 16.857 3 14.5v-5c0-2.357 0-3.536.732-4.268S5.643 4.5 8 4.5" opacity=".5"/><path stroke-linecap="round" stroke-linejoin="round" d="M6 12h9m0 0l-2.5 2.5M15 12l-2.5-2.5"/></g></svg></button>
24+
<button id="login">
25+
<Icon />
26+
</button>
2427
)
2528
}
2629

@@ -38,37 +41,37 @@ const session = await auth.api.getSession({
3841
</script>
3942

4043
<style>
41-
#login {
42-
width: 2rem;
43-
height: 2rem;
44-
border-radius: 50%;
45-
display: flex;
46-
align-items: center;
47-
justify-content: center;
48-
padding: 0;
49-
background: linear-gradient(135deg, #e6e6e6 0%, #ffffff 50%, #e6e6e6 100%);
50-
border: none;
51-
color: #666;
52-
cursor: pointer;
53-
}
54-
55-
@media (prefers-color-scheme: dark) {
5644
#login {
57-
background: linear-gradient(
58-
135deg,
59-
rgba(255,255,255,0.10) 0%,
60-
rgba(255,255,255,0.18) 50%,
61-
rgba(255,255,255,0.10) 100%
62-
);
63-
color: #eee;
45+
width: 2rem;
46+
height: 2rem;
47+
border-radius: 50%;
48+
display: flex;
49+
align-items: center;
50+
justify-content: center;
51+
padding: 0;
52+
background: linear-gradient(135deg, #e6e6e6 0%, #ffffff 50%, #e6e6e6 100%);
53+
border: none;
54+
color: #666;
55+
cursor: pointer;
6456
}
65-
}
6657

67-
#login svg {
68-
width: 1.25rem;
69-
height: 1.25rem;
70-
display: block;
71-
}
58+
@media (prefers-color-scheme: dark) {
59+
#login {
60+
background: linear-gradient(
61+
135deg,
62+
rgba(255, 255, 255, 0.1) 0%,
63+
rgba(255, 255, 255, 0.18) 50%,
64+
rgba(255, 255, 255, 0.1) 100%
65+
);
66+
color: #eee;
67+
}
68+
}
69+
70+
#login svg {
71+
width: 1.25rem;
72+
height: 1.25rem;
73+
display: block;
74+
}
7275
#logout {
7376
cursor: pointer;
7477
}

src/components/Icon.astro

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
const props = Astro.props;
3+
---
4+
5+
<svg
6+
xmlns="http://www.w3.org/2000/svg"
7+
width="1em"
8+
height="1em"
9+
viewBox="0 0 24 24"
10+
{...props}
11+
><!-- Icon from Solar by 480 Design - https://creativecommons.org/licenses/by/4.0/ -->
12+
<g fill="none" stroke="currentColor" stroke-width="1.5"
13+
><path
14+
stroke-linecap="round"
15+
d="M8 16c0 2.828 0 4.243.879 5.121C9.757 22 11.172 22 14 22h1c2.828 0 4.243 0 5.121-.879C21 20.243 21 18.828 21 16V8c0-2.828 0-4.243-.879-5.121C19.243 2 17.828 2 15 2h-1c-2.828 0-4.243 0-5.121.879C8 3.757 8 5.172 8 8"
16+
></path><path
17+
d="M8 19.5c-2.357 0-3.536 0-4.268-.732C3 18.035 3 16.857 3 14.5v-5c0-2.357 0-3.536.732-4.268S5.643 4.5 8 4.5"
18+
opacity=".5"></path><path
19+
stroke-linecap="round"
20+
stroke-linejoin="round"
21+
d="M6 12h9m0 0l-2.5 2.5M15 12l-2.5-2.5"></path></g
22+
></svg
23+
>

src/pages/api/auth/[...all].ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ export const prerender = false;
55

66
export const ALL: APIRoute = async (ctx) => {
77
const auth = betterAuth(new URL(ctx.request.url).origin, ctx.locals.runtime.env);
8-
ctx.request.headers.set('x-forwarded-for', ctx.clientAddress);
98
return auth.handler(ctx.request);
109
};

0 commit comments

Comments
 (0)