Shamrock: Määritetty tunnus ei vaadi suuraakkosia

This commit is contained in:
WhiteChi 2023-12-19 01:21:08 +08:00
parent 741d2c7a84
commit 34eccda233
4 changed files with 8 additions and 3 deletions

View File

@ -15,7 +15,7 @@ private suspend fun ApplicationCall.checkToken() {
?: fetchOrNull("ticket")
?: fetchOrNull("access_token")
?: throw ErrorTokenException
if (accessToken.startsWith("Bearer ")) {
if (accessToken.startsWith("Bearer ", ignoreCase = true)) {
accessToken = accessToken.substring(7)
}
if (token != accessToken) {

View File

@ -66,7 +66,7 @@ internal class WebSocketService(
.ifNullOrEmpty(handshake.getFieldValue("ticket"))
.ifNullOrEmpty(handshake.getFieldValue("Authorization"))
?: throw ErrorTokenException
if (accessToken.startsWith("Bearer ")) {
if (accessToken.startsWith("Bearer ", ignoreCase = true)) {
accessToken = accessToken.substring(7)
}
val tokenList = token.split(",", "|", "")

View File

@ -106,7 +106,10 @@ internal abstract class WebSocketClientServlet(
}
private fun startHeartbeatTimer() {
if (heartbeatInterval <= 0) return
if (heartbeatInterval <= 0) {
LogCenter.log("被动WebSocket心跳间隔为0不启动心跳", Level.WARN)
return
}
timer(
name = "heartbeat",
initialDelay = 0,

View File

@ -78,6 +78,8 @@ internal abstract class WebSocketTransmitServlet(
)
)
}
} else {
LogCenter.log("主动WebSocket心跳间隔为0不启动心跳", Level.WARN)
}
}