Basic live service:
- Matchmaking
- Instance
- Presence (albeit empty atm)
Authentication fixes; differentiate between user and profile
Default auth timeout is now 3 hours
Add "operators" database key ("all users with operator permissions", or "developer" role set in token), add check in `Profile`
Fix default profile image filename reference when not set
account/me
Log hile reporting, do stuff with the report later ("Server" user for commands, operators can check reports)
Refresh login done by client automatically when token expires, requires extra work
This commit is contained in:
25
src/data/live/base.ts
Normal file
25
src/data/live/base.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import Profile from "../profiles.ts";
|
||||
|
||||
const loginLocks: Map<number, string> = new Map();
|
||||
|
||||
class MatchmakingBase {
|
||||
|
||||
createLoginLock(prof: Profile, lock: string) {
|
||||
if (loginLocks.has(prof.getId())) return;
|
||||
else loginLocks.set(prof.getId(), lock);
|
||||
}
|
||||
|
||||
lockMatches(prof: Profile, lock: string) {
|
||||
const maybeLock = loginLocks.get(prof.getId());
|
||||
if (maybeLock) return maybeLock == lock;
|
||||
else return false;
|
||||
}
|
||||
|
||||
deleteLoginLock(prof: Profile) {
|
||||
loginLocks.delete(prof.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const Matchmaking = new MatchmakingBase();
|
||||
export default Matchmaking;
|
||||
Reference in New Issue
Block a user