Skip to content

Commit 93ab575

Browse files
Merge branch 'main' into rss-blog
2 parents 00f0380 + dc3ae56 commit 93ab575

File tree

87 files changed

+3515
-2489
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+3515
-2489
lines changed

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
"@radix-ui/react-dialog": "^1.1.15",
3434
"@radix-ui/react-dropdown-menu": "^2.1.12",
3535
"@radix-ui/react-toast": "^1.2.2",
36+
"@react-three/drei": "^10.7.7",
37+
"@react-three/fiber": "^9.5.0",
3638
"@sentry/react": "^8.35.0",
3739
"@sentry/vite-plugin": "^2.22.6",
3840
"@tailwindcss/typography": "^0.5.13",
@@ -84,6 +86,7 @@
8486
"resend": "^6.6.0",
8587
"shiki": "^1.4.0",
8688
"tailwind-merge": "^1.14.0",
89+
"three": "^0.182.0",
8790
"unified": "^11.0.5",
8891
"unist-util-visit": "^5.0.0",
8992
"uploadthing": "^7.7.4",
@@ -103,6 +106,7 @@
103106
"@types/react": "^19.2.0",
104107
"@types/react-dom": "^19.2.0",
105108
"@types/remove-markdown": "^0.3.4",
109+
"@types/three": "^0.182.0",
106110
"autoprefixer": "^10.4.18",
107111
"dotenv-cli": "^8.0.0",
108112
"drizzle-kit": "^0.31.7",

pnpm-lock.yaml

Lines changed: 467 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/auth/client.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,26 @@ import type { OAuthProvider } from './types'
1717
export const authClient = {
1818
signIn: {
1919
/**
20-
* Initiate OAuth sign-in with a social provider
20+
* Initiate OAuth sign-in with a social provider (full page redirect)
2121
*/
2222
social: ({ provider }: { provider: OAuthProvider }) => {
2323
window.location.href = `/auth/${provider}/start`
2424
},
25+
26+
/**
27+
* Initiate OAuth sign-in in a popup window (for modal-based login)
28+
*/
29+
socialPopup: ({ provider }: { provider: OAuthProvider }) => {
30+
const width = 500
31+
const height = 600
32+
const left = window.screenX + (window.outerWidth - width) / 2
33+
const top = window.screenY + (window.outerHeight - height) / 2
34+
window.open(
35+
`/auth/${provider}/start?popup=true`,
36+
'tanstack-oauth',
37+
`width=${width},height=${height},left=${left},top=${top},popup=yes`,
38+
)
39+
},
2540
},
2641

2742
/**

src/auth/index.server.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ export {
6464
createOAuthStateCookie,
6565
clearOAuthStateCookie,
6666
getOAuthStateCookie,
67+
createOAuthPopupCookie,
68+
clearOAuthPopupCookie,
69+
isOAuthPopupMode,
6770
SESSION_DURATION_MS,
6871
SESSION_MAX_AGE_SECONDS,
6972
} from './session.server'

src/auth/oauth.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export function buildGitHubAuthUrl(
186186
clientId,
187187
)}&redirect_uri=${encodeURIComponent(
188188
redirectUri,
189-
)}&scope=user:email&state=${state}`
189+
)}&scope=user:email&state=${encodeURIComponent(state)}`
190190
}
191191

192192
/**
@@ -201,7 +201,7 @@ export function buildGoogleAuthUrl(
201201
clientId,
202202
)}&redirect_uri=${encodeURIComponent(
203203
redirectUri,
204-
)}&response_type=code&scope=openid email profile&state=${state}`
204+
)}&response_type=code&scope=openid email profile&state=${encodeURIComponent(state)}`
205205
}
206206

207207
/**

src/auth/session.server.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,19 @@ export function getOAuthStateCookie(request: Request): string | null {
264264
return decodeURIComponent(stateCookie.split('=').slice(1).join('=').trim())
265265
}
266266

267+
export function createOAuthPopupCookie(isProduction: boolean): string {
268+
return `oauth_popup=1; HttpOnly; Path=/; Max-Age=${10 * 60}; SameSite=Lax${isProduction ? '; Secure' : ''}`
269+
}
270+
271+
export function clearOAuthPopupCookie(isProduction: boolean): string {
272+
return `oauth_popup=; HttpOnly; Path=/; Max-Age=0; SameSite=Lax${isProduction ? '; Secure' : ''}`
273+
}
274+
275+
export function isOAuthPopupMode(request: Request): boolean {
276+
const cookies = request.headers.get('cookie') || ''
277+
return cookies.split(';').some((c) => c.trim().startsWith('oauth_popup=1'))
278+
}
279+
267280
// ============================================================================
268281
// Session Constants
269282
// ============================================================================

0 commit comments

Comments
 (0)