frontend added and socket io

This commit is contained in:
2026-03-16 18:07:23 -05:00
parent 81dc575b4f
commit 5db2a7fe75
45 changed files with 11947 additions and 5546 deletions

View File

@@ -2,8 +2,8 @@ import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import {
admin,
apiKey,
createAuthMiddleware,
// apiKey,
// createAuthMiddleware,
//customSession,
jwt,
lastLoginMethod,
@@ -31,6 +31,7 @@ export const auth = betterAuth({
provider: "pg",
schema,
}),
trustedOrigins: allowedOrigins,
// user: {
// additionalFields: {
// role: {
@@ -42,7 +43,7 @@ export const auth = betterAuth({
// },
plugins: [
jwt({ jwt: { expirationTime: "1h" } }),
apiKey(),
//apiKey(),
admin(),
lastLoginMethod(),
username({
@@ -70,7 +71,6 @@ export const auth = betterAuth({
// };
// }),
],
trustedOrigins: allowedOrigins,
emailAndPassword: {
enabled: true,
@@ -118,16 +118,16 @@ export const auth = betterAuth({
secure: false,
httpOnly: true,
},
hooks: {
after: createAuthMiddleware(async (ctx) => {
if (ctx.path.startsWith("/login")) {
const newSession = ctx.context.newSession;
if (newSession) {
// something here later
}
}
}),
},
// hooks: {
// after: createAuthMiddleware(async (ctx) => {
// if (ctx.path.startsWith("/login")) {
// const newSession = ctx.context.newSession;
// if (newSession) {
// // something here later
// }
// }
// }),
// },
events: {
// async onSignInSuccess({ user }: { user: User }) {
// await db