Organisator kann im selben Browser selbst mitspielen
Ein Aufrufer darf Organisator- und Spieler-Zugang kombinieren (Authorization + X-Player-Token). Berechtigungen prüfen jetzt einzelne Merkmale statt einer Rangstufe. In der Lobby gibt es „Selbst mitspielen?“, Teamlinks funktionieren auch im Organisator-Browser. Online-Status wird direkt nach dem Beitritt aktualisiert. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
470b12f232
commit
4152f9c0a6
15 files changed
+248
-59
No files matched your search
@@ -6,7 +6,7 @@ export class ApiError extends Error {
|
||||
}
|
||||
}
|
||||
|
||||
export async function api(path, { method = 'GET', body, token } = {}) {
|
||||
export async function api(path, { method = 'GET', body, token, playerToken } = {}) {
|
||||
let res;
|
||||
try {
|
||||
res = await fetch(`/api${path}`, {
|
||||
@@ -14,6 +14,8 @@ export async function api(path, { method = 'GET', body, token } = {}) {
|
||||
headers: {
|
||||
...(body ? { 'content-type': 'application/json' } : {}),
|
||||
...(token ? { authorization: `Bearer ${token}` } : {}),
|
||||
// Zweiter Zugang: Spieler-Token des Organisators, wenn er selbst mitspielt
|
||||
...(playerToken ? { 'x-player-token': playerToken } : {}),
|
||||
},
|
||||
body: body ? JSON.stringify(body) : undefined,
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user