Remote access: purge websockets tickets when expired

This commit is contained in:
Nicolas Pomepuy 2024-11-14 10:31:23 +01:00
parent 5d76c6f532
commit 6cabd96456

View File

@ -316,7 +316,8 @@ object RemoteAccessWebSockets {
* @return true if the websocket message is allowed
*/
private fun verifyWebsocketAuth(incomingMessage: WSIncomingMessage?): Boolean {
return incomingMessage?.authTicket != null && tickets.firstOrNull { incomingMessage.authTicket == it.id && System.currentTimeMillis() < it.expiration } != null
tickets.removeIf { it.expiration < System.currentTimeMillis() }
return incomingMessage?.authTicket != null && tickets.firstOrNull { incomingMessage.authTicket == it.id } != null
}
private fun playbackControlAllowedOrSend(settings: SharedPreferences): Boolean {