Fix: JWT session strategy + image optimalisatie uit voor ARM
All checks were successful
Build & Deploy / build (push) Successful in 1m41s

This commit is contained in:
2026-05-15 09:39:08 +02:00
parent 3789b16562
commit cfd9ed4eae
2 changed files with 18 additions and 3 deletions

View File

@@ -2,6 +2,9 @@
const nextConfig = {
output: "standalone",
images: {
// Sharp is moeilijk te installeren op ARM Alpine,
// voor Discord avatars is optimalisatie niet nodig
unoptimized: true,
remotePatterns: [
{
protocol: "https",

View File

@@ -5,6 +5,11 @@ import { prisma } from "./prisma";
export const authOptions: NextAuthOptions = {
adapter: PrismaAdapter(prisma),
// JWT strategy zodat de middleware de sessie kan verifieren
// zonder een database call te doen bij elk request
session: {
strategy: "jwt",
},
providers: [
DiscordProvider({
clientId: process.env.DISCORD_CLIENT_ID!,
@@ -12,9 +17,16 @@ export const authOptions: NextAuthOptions = {
}),
],
callbacks: {
session({ session, user }) {
jwt({ token, user }) {
// user is alleen aanwezig bij eerste login
if (user) {
token.id = user.id;
}
return token;
},
session({ session, token }) {
if (session.user) {
session.user.id = user.id;
session.user.id = token.id as string;
}
return session;
},
@@ -22,4 +34,4 @@ export const authOptions: NextAuthOptions = {
pages: {
signIn: "/login",
},
};
};