Move WebSocket auth in framework

This commit is contained in:
jeffcheasey88 2023-09-23 12:13:23 +02:00
parent a0d7848109
commit 93b048ed7d
3 changed files with 2 additions and 5 deletions

Binary file not shown.

View file

@ -42,7 +42,6 @@ import dev.peerat.framework.Response;
import dev.peerat.framework.Route;
import dev.peerat.framework.Router;
import dev.peerat.framework.Locker.Key;
import dev.peerat.framework.utils.json.JsonMap;
public class Main{
public static void main(String[] args) throws Exception{
@ -101,6 +100,7 @@ public class Main{
}catch(Exception e){
e.printStackTrace();
}
locker.remove(key);
}
}).start();

View file

@ -33,10 +33,7 @@ public class DynamicLogs implements Response{
@Route(path = "^/admin/logs$", websocket = true)
public void exec(Matcher matcher, Context context, HttpReader reader, HttpWriter writer) throws Exception{
JsonMap auth = reader.readJson();
PeerAtUser user = this.router.getUser(auth.get("token"));
Group group = this.repo.getPlayerGroup(user.getId(), 1);
Group group = this.repo.getPlayerGroup(context.<PeerAtUser>getUser().getId(), 1);
if(!group.getName().equalsIgnoreCase("Quarter-Master - Battles PAC x CEI")) return;
Key key = new Key();