Loading backend/src/controllers/AuthSession.ts +12 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ export class AuthSession { return sessions.map((d) => new AuthSession(d)); } static async getActive( handle: `${string}@${string}` handle: `${string}@${string}`, ): Promise<AuthSession | null> { const session = await prisma.authSession.findFirst({ where: { Loading @@ -49,6 +49,17 @@ export class AuthSession { return new AuthSession(session); } static async deleteAllForInstance( instance: string, ): Promise<{ count: number }> { const sessions = await prisma.authSession.deleteMany({ where: { user_sub: { endsWith: "@" + instance }, }, }); return sessions; } private _id: string; private _user_sub: `${string}@${string}`; Loading backend/src/lib/api_admin.ts +13 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,19 @@ app.use((req, res, next) => { next(); }); app.post("/dump-all-sessions", async (req, res) => { if (!req.query.forInstance || typeof req.query.forInstance !== "string") { res.status(400).send("?forInstance is not specified"); return; } const sessions = await AuthSession.deleteAllForInstance( req.query.forInstance, ); res.json({ sessions }); }); /** * Create AuthSession for specified handle and send verification code to user * The created session is returned as a response Loading Loading
backend/src/controllers/AuthSession.ts +12 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ export class AuthSession { return sessions.map((d) => new AuthSession(d)); } static async getActive( handle: `${string}@${string}` handle: `${string}@${string}`, ): Promise<AuthSession | null> { const session = await prisma.authSession.findFirst({ where: { Loading @@ -49,6 +49,17 @@ export class AuthSession { return new AuthSession(session); } static async deleteAllForInstance( instance: string, ): Promise<{ count: number }> { const sessions = await prisma.authSession.deleteMany({ where: { user_sub: { endsWith: "@" + instance }, }, }); return sessions; } private _id: string; private _user_sub: `${string}@${string}`; Loading
backend/src/lib/api_admin.ts +13 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,19 @@ app.use((req, res, next) => { next(); }); app.post("/dump-all-sessions", async (req, res) => { if (!req.query.forInstance || typeof req.query.forInstance !== "string") { res.status(400).send("?forInstance is not specified"); return; } const sessions = await AuthSession.deleteAllForInstance( req.query.forInstance, ); res.json({ sessions }); }); /** * Create AuthSession for specified handle and send verification code to user * The created session is returned as a response Loading