mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
new selfhosted version
This commit is contained in:
16
dashboard/server/plugins/session.ts
Normal file
16
dashboard/server/plugins/session.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { UserModel } from "~/shared/schema/UserSchema";
|
||||
|
||||
export default defineNitroPlugin(() => {
|
||||
|
||||
sessionHooks.hook('fetch', async (session, event) => {
|
||||
const user_id = session.secure?.user_id;
|
||||
if (!user_id) throw createError({ status: 401, message: 'Session expired' });
|
||||
const user = await UserModel.findById({ _id: user_id });
|
||||
if (!user) throw createError({ status: 401, message: 'Session expired' });
|
||||
});
|
||||
|
||||
sessionHooks.hook('clear', async (session, event) => {
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user