Ready for 1.1.3-rc.3 release.

This commit is contained in:
charlesgauthereau
2025-11-04 09:20:24 +01:00
parent a435a92d41
commit c4ebc876bf
4 changed files with 20 additions and 29 deletions
+5 -5
View File
@@ -3,11 +3,11 @@ name: portabase-prod
services:
app:
# build:
# context: .
# dockerfile: docker/dockerfile/Dockerfile
# target: prod
image: solucetechnologies/portabase:1.1.3-rc.2
# build:
# context: .
# dockerfile: docker/dockerfile/Dockerfile
# target: prod
image: solucetechnologies/portabase:1.1.3-rc.3
ports:
- '8887:80'
env_file:
+9 -15
View File
@@ -1,9 +1,8 @@
import { NextRequest, NextResponse } from "next/server";
import { loggingMiddleware } from "@/middleware/loggingMiddleware";
import { errorHandler } from "@/middleware/errorHandler";
import { auth } from "@/lib/auth/auth";
import { headers } from "next/headers";
import { signOut } from "@/lib/auth/auth-client";
import {NextRequest, NextResponse} from "next/server";
import {loggingMiddleware} from "@/middleware/loggingMiddleware";
import {errorHandler} from "@/middleware/errorHandler";
import {auth} from "@/lib/auth/auth";
import {headers} from "next/headers";
export async function proxy(request: NextRequest) {
const url = request.nextUrl.clone();
@@ -13,25 +12,20 @@ export async function proxy(request: NextRequest) {
const session = await auth.api.getSession({
headers: await headers(),
});
if (!session) {
return NextResponse.redirect(new URL(`/login?redirect=${redirectUrl}`, request.url));
}
if (session.user.banned) {
signOut();
await auth.api.signOut({headers: await headers()});
return NextResponse.redirect(new URL("/login?error=banned", request.url));
}
if (session.user.role === "pending") {
signOut();
await auth.api.signOut({headers: await headers()});
return NextResponse.redirect(new URL(`/login?error=pending?redirect=${redirectUrl}`, request.url));
}
if (url.pathname === "/dashboard") {
return NextResponse.redirect(new URL(`/dashboard/home`, request.url));
}
return NextResponse.next();
}
@@ -42,9 +36,9 @@ export async function proxy(request: NextRequest) {
if (url.pathname.startsWith("/api")) {
const routeExists = checkRouteExists(url.pathname);
if (!routeExists) {
return new NextResponse(JSON.stringify({ message: "This API route does not exist.", status: 404 }), {
return new NextResponse(JSON.stringify({message: "This API route does not exist.", status: 404}), {
status: 404,
headers: { "Content-Type": "application/json" },
headers: {"Content-Type": "application/json"},
});
}
}
+4 -7
View File
@@ -4,14 +4,11 @@ import {createAuthClient} from "better-auth/react";
import {adminClient, inferAdditionalFields, organizationClient} from "better-auth/client/plugins";
import {ac, user, admin as adminRole, pending, superadmin, orgAdmin, orgMember, orgOwner} from "./permissions";
import {auth} from "@/lib/auth/auth";
import {getServerUrl} from "@/utils/get-server-url";
const baseURL =
typeof window === "undefined"
? process.env.PROJECT_URL // server side
: "";
const res = await fetch(`${baseURL}/api/config`);
const { PROJECT_URL } = await res.json();
const res = await fetch(`${getServerUrl()}/api/config`);
const {PROJECT_URL} = await res.json();
console.log(PROJECT_URL);
export const authClient = createAuthClient({
baseURL: PROJECT_URL,
+2 -2
View File
@@ -5,7 +5,7 @@ export const getServerUrl = () => {
return window.location.origin;
}
if (env.NODE_ENV === "development") {
return `${env.NEXT_PUBLIC_PROJECT_URL}`;
return `${env.PROJECT_URL}`;
}
return `${env.NEXT_PUBLIC_PROJECT_URL}`;
return `${env.PROJECT_URL}`;
};