a fork of iceshrimp.net but a tweaked frontend to my personal liking. waow
fediverse social-media social iceshrimp fedi
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[backend/api] Terminate associated mastodon session when revoking a linked web session

+5 -1
+5 -1
Iceshrimp.Backend/Controllers/Web/SessionController.cs
··· 50 50 public async Task TerminateSession(string id) 51 51 { 52 52 var user = HttpContext.GetUserOrFail(); 53 - var session = await db.Sessions.FirstOrDefaultAsync(p => p.Id == id && p.User == user) 53 + var session = await db.Sessions.Include(p => p.MastodonToken) 54 + .FirstOrDefaultAsync(p => p.Id == id && p.User == user) 54 55 ?? throw GracefulException.NotFound("Session not found"); 55 56 56 57 if (session.Id == HttpContext.GetSessionOrFail().Id) 57 58 throw GracefulException.BadRequest("Refusing to terminate current session"); 58 59 60 + if (session.MastodonToken != null) 61 + db.Remove(session.MastodonToken); 59 62 db.Remove(session); 63 + 60 64 await db.SaveChangesAsync(); 61 65 } 62 66