Check user token in love service (#9464)

Signed-off-by: Anton Alexeyev <alexeyev.anton@gmail.com>
This commit is contained in:
Anton Alexeyev
2025-07-04 19:17:03 +05:00
committed by GitHub
parent 582bfdf26e
commit f92bcb37f0
2 changed files with 70 additions and 37 deletions
+3 -1
View File
@@ -113,9 +113,11 @@ export async function getToken (
if (endpoint === undefined) {
throw new Error('Love service endpoint not found')
}
const token = getPlatformToken()
const res = await fetch(concatLink(endpoint, '/getToken'), {
method: 'POST',
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ roomName: getTokenRoomName(roomName, roomId), _id: userId, participantName })
@@ -553,7 +555,7 @@ async function withRetries (fn: () => Promise<void>, retries: number, delay: num
async function connect (name: string, room: Room, _id: string): Promise<void> {
const wsURL = getMetadata(love.metadata.WebSocketURL)
if (wsURL === undefined) {
if (wsURL === undefined || getCurrentAccount().role === AccountRole.ReadOnlyGuest) {
return
}