mirror of
https://github.com/rybbit-io/rybbit.git
synced 2025-05-10 20:05:38 +02:00
Fix callbacks (#107)
* Fix callbacks * fix layout * Remove callbacks * Disable redirects * fix caddy * test disable basepath * wip * test caddy fix * remove basepath * fml * pray * kms * pray * wip * Test
This commit is contained in:
parent
dd3739a716
commit
97c29dafac
7 changed files with 16 additions and 14 deletions
|
@ -4,21 +4,14 @@
|
||||||
# Enable compression
|
# Enable compression
|
||||||
encode zstd gzip
|
encode zstd gzip
|
||||||
|
|
||||||
# Proxy API requests to the backend service
|
|
||||||
handle_path /api/* {
|
handle_path /api/* {
|
||||||
reverse_proxy backend:3001
|
reverse_proxy backend:3001
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Proxy all other requests to the client service
|
# Proxy all other requests to the client service
|
||||||
handle {
|
handle {
|
||||||
reverse_proxy client:3002
|
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
|
|
||||||
# }
|
|
||||||
}
|
}
|
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
import { BACKEND_URL } from "@/lib/const";
|
import { BACKEND_URL } from "@/lib/const";
|
||||||
import QueryProvider from "@/providers/QueryProvider";
|
import QueryProvider from "@/providers/QueryProvider";
|
||||||
import type { Metadata } from "next";
|
import { Inter } from "next/font/google";
|
||||||
import { Inter, Manrope } from "next/font/google";
|
|
||||||
import { redirect, usePathname } from "next/navigation";
|
import { redirect, usePathname } from "next/navigation";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Toaster } from "../components/ui/sonner";
|
import { Toaster } from "../components/ui/sonner";
|
||||||
|
|
|
@ -54,7 +54,6 @@ export default function Page() {
|
||||||
try {
|
try {
|
||||||
await authClient.signIn.social({
|
await authClient.signIn.social({
|
||||||
provider,
|
provider,
|
||||||
callbackURL: "/",
|
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setError(String(error));
|
setError(String(error));
|
||||||
|
|
|
@ -255,7 +255,6 @@ export default function SignupPage() {
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
authClient.signIn.social({
|
authClient.signIn.social({
|
||||||
provider: "google",
|
provider: "google",
|
||||||
callbackURL: "/",
|
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
className="transition-all duration-300 hover:bg-muted bg-neutral-800/50 border-neutral-700"
|
className="transition-all duration-300 hover:bg-muted bg-neutral-800/50 border-neutral-700"
|
||||||
|
@ -269,7 +268,6 @@ export default function SignupPage() {
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
authClient.signIn.social({
|
authClient.signIn.social({
|
||||||
provider: "github",
|
provider: "github",
|
||||||
callbackURL: "/",
|
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
className="transition-all duration-300 hover:bg-muted bg-neutral-800/50 border-neutral-700"
|
className="transition-all duration-300 hover:bg-muted bg-neutral-800/50 border-neutral-700"
|
||||||
|
|
|
@ -10,6 +10,17 @@ export async function middleware(request: NextRequest) {
|
||||||
return NextResponse.next();
|
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
|
// Check if we're on a site route without a specific page
|
||||||
// This matches exactly /{siteId} with nothing after it
|
// This matches exactly /{siteId} with nothing after it
|
||||||
const siteRoutePattern = /^\/([^/]+)$/;
|
const siteRoutePattern = /^\/([^/]+)$/;
|
||||||
|
|
|
@ -121,6 +121,8 @@ const PUBLIC_ROUTES: string[] = [
|
||||||
"/script",
|
"/script",
|
||||||
"/auth",
|
"/auth",
|
||||||
"/api/auth",
|
"/api/auth",
|
||||||
|
"/api/auth/callback/google",
|
||||||
|
"/api/auth/callback/github",
|
||||||
"/api/stripe/webhook", // Add webhook to public routes
|
"/api/stripe/webhook", // Add webhook to public routes
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { eq } from "drizzle-orm";
|
||||||
import pg from "pg";
|
import pg from "pg";
|
||||||
import { db } from "../db/postgres/postgres.js";
|
import { db } from "../db/postgres/postgres.js";
|
||||||
import * as schema from "../db/postgres/schema.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();
|
dotenv.config();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue