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:
2025-03-24 21:50:22 -04:00
parent 31f9cfdc1a
commit 616f5dd619
12 changed files with 298 additions and 42 deletions

25
src/data/live/base.ts Normal file
View 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;