🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Fix callbacks (#107)
Bill Yang97c29dafac4e
diff --git a/Caddyfile b/Caddyfileindex bc7a5f886..4141123f9 100644--- a/Caddyfile+++ b/Caddyfile@@ -4,21 +4,14 @@# Enable compressionencode zstd gzip- # Proxy API requests to the backend servicehandle_path /api/* {reverse_proxy backend:3001}+# Proxy all other requests to the client servicehandle {reverse_proxy client:3002}- # Optional: Add security headers (example)- # header {- # Strict-Transport-Security max-age=31536000;- # X-Content-Type-Options nosniff- # X-Frame-Options DENY- # Referrer-Policy strict-origin-when-cross-origin- # }}\ No newline at end of filediff --git a/client/src/app/layout.tsx b/client/src/app/layout.tsxindex e68382875..efc0fe006 100644--- a/client/src/app/layout.tsx+++ b/client/src/app/layout.tsx@@ -2,8 +2,7 @@import { BACKEND_URL } from "@/lib/const";import QueryProvider from "@/providers/QueryProvider";-import type { Metadata } from "next";-import { Inter, Manrope } from "next/font/google";+import { Inter } from "next/font/google";import { redirect, usePathname } from "next/navigation";import { useEffect, useState } from "react";import { Toaster } from "../components/ui/sonner";diff --git a/client/src/app/login/page.tsx b/client/src/app/login/page.tsxindex 5165786ac..e9e405b53 100644--- a/client/src/app/login/page.tsx+++ b/client/src/app/login/page.tsx@@ -54,7 +54,6 @@ export default function Page() {try {await authClient.signIn.social({provider,- callbackURL: "/",});} catch (error) {setError(String(error));diff --git a/client/src/app/signup/page.tsx b/client/src/app/signup/page.tsxindex 8eb6f500f..71da01492 100644--- a/client/src/app/signup/page.tsx+++ b/client/src/app/signup/page.tsx@@ -255,7 +255,6 @@ export default function SignupPage() {onClick={() => {authClient.signIn.social({provider: "google",- callbackURL: "/",});}}className="transition-all duration-300 hover:bg-muted bg-neutral-800/50 border-neutral-700"@@ -269,7 +268,6 @@ export default function SignupPage() {onClick={() => {authClient.signIn.social({provider: "github",- callbackURL: "/",});}}className="transition-all duration-300 hover:bg-muted bg-neutral-800/50 border-neutral-700"diff --git a/client/src/middleware.ts b/client/src/middleware.tsindex 38fcfe5e6..caed56049 100644--- a/client/src/middleware.ts+++ b/client/src/middleware.ts@@ -10,6 +10,17 @@ export async function middleware(request: NextRequest) {return NextResponse.next();}+ // Handle GitHub OAuth callback redirect+ if (path === "/auth/callback/github" || path === "/auth/callback/google") {+ const redirectUrl = new URL(+ `/api${path}${request.nextUrl.search}`,+ request.url+ );+ const response = NextResponse.redirect(redirectUrl);+ response.headers.set("Cache-Control", "no-store, max-age=0");+ return response;+ }+// Check if we're on a site route without a specific page// This matches exactly /{siteId} with nothing after itconst siteRoutePattern = /^\/([^/]+)$/;diff --git a/server/src/index.ts b/server/src/index.tsindex 2e43a88f1..78ce28801 100644--- a/server/src/index.ts+++ b/server/src/index.ts@@ -121,6 +121,8 @@ const PUBLIC_ROUTES: string[] = ["/script","/auth","/api/auth",+ "/api/auth/callback/google",+ "/api/auth/callback/github","/api/stripe/webhook", // Add webhook to public routes];diff --git a/server/src/lib/auth.ts b/server/src/lib/auth.tsindex 8ebf81f0e..add3bbf96 100644--- a/server/src/lib/auth.ts+++ b/server/src/lib/auth.ts@@ -6,7 +6,7 @@ import { eq } from "drizzle-orm";import pg from "pg";import { db } from "../db/postgres/postgres.js";import * as schema from "../db/postgres/schema.js";-import { DISABLE_SIGNUP } from "./const.js";+import { DISABLE_SIGNUP, IS_CLOUD } from "./const.js";dotenv.config();