diff --git a/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/action/handlers/FavAddImageMsg.kt b/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/action/handlers/FavAddImageMsg.kt index 14b768b..2de21aa 100644 --- a/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/action/handlers/FavAddImageMsg.kt +++ b/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/action/handlers/FavAddImageMsg.kt @@ -131,6 +131,8 @@ internal object FavAddImageMsg: IActionHandler() { val pb = ProtoUtils.decodeFromByteArray(data) itemId = pb[2, 20009, 1].asUtf8String } + + System.gc() } return ok(PicInfo( diff --git a/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/service/api/WebSocketClientServlet.kt b/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/service/api/WebSocketClientServlet.kt index c39a52a..cf04ea2 100644 --- a/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/service/api/WebSocketClientServlet.kt +++ b/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/service/api/WebSocketClientServlet.kt @@ -37,7 +37,7 @@ import kotlin.concurrent.timer internal abstract class WebSocketClientServlet( url: String, private val heartbeatInterval: Long, - wsHeaders: Map + private val wsHeaders: Map ) : BaseTransmitServlet, WebSocketClient(URI(url), wsHeaders) { private val sendLock = Mutex() @@ -85,6 +85,14 @@ internal abstract class WebSocketClientServlet( } override fun onClose(code: Int, reason: String?, remote: Boolean) { + if (code == 403) { + if (wsHeaders.containsKey("authorization")) { + val token = wsHeaders["authorization"]!!.substring(7) + LogCenter.log("WebSocketClient连接被拒绝, token: $token 失效", Level.WARN) + } else { + LogCenter.log("WebSocketClient连接被拒绝, 未设置token", Level.WARN) + } + } LogCenter.log("WebSocketClient onClose: $code, $reason, $remote") cancelFlowJobs() } diff --git a/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/service/api/WebSocketTransmitServlet.kt b/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/service/api/WebSocketTransmitServlet.kt index 9cee9e7..19a15e7 100644 --- a/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/service/api/WebSocketTransmitServlet.kt +++ b/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/service/api/WebSocketTransmitServlet.kt @@ -89,7 +89,13 @@ internal abstract class WebSocketTransmitServlet( if (path != "/api") { eventReceivers.remove(conn) } - LogCenter.log({ "WSServer断开(${conn.remoteSocketAddress.address.hostAddress}:${conn.remoteSocketAddress.port}$path): $code,$reason,$remote" }, Level.WARN) + runCatching { + conn.remoteSocketAddress.address.hostAddress to conn.remoteSocketAddress.port + }.onSuccess { + LogCenter.log({ "WSServer断开(${it.first}:${it.second}$path): $code,$reason,$remote" }, Level.WARN) + }.onFailure { + LogCenter.log({ "WSServer断开($path): $code,$reason,$remote" }, Level.WARN) + } } override fun onMessage(conn: WebSocket, message: String) { diff --git a/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/service/data/push/NoticeEvent.kt b/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/service/data/push/NoticeEvent.kt index 8d9ec9a..627df75 100644 --- a/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/service/data/push/NoticeEvent.kt +++ b/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/service/data/push/NoticeEvent.kt @@ -67,14 +67,14 @@ internal data class NoticeEvent( @SerialName("post_type") val postType: PostType, @SerialName("notice_type") val type: NoticeType, @SerialName("sub_type") val subType: NoticeSubType = NoticeSubType.None, - @SerialName("group_id") val groupId: Long = 0, - @SerialName("operator_id") val operatorId: Long = 0, - @SerialName("user_id") val userId: Long = 0, - @SerialName("sender_id") val senderId: Long = 0, - @SerialName("duration") val duration: Int = 0, - @SerialName("message_id") val msgId: Int = 0, + @SerialName("group_id") val groupId: Long = -1, + @SerialName("operator_id") val operatorId: Long = -1, + @SerialName("user_id") val userId: Long = -1, + @SerialName("sender_id") val senderId: Long = -1, + @SerialName("duration") val duration: Int = -1, + @SerialName("message_id") val msgId: Int = -1, @SerialName("tip_text") val tip: String = "", - @SerialName("target_id") val target: Long = 0, + @SerialName("target_id") val target: Long = -1, @SerialName("file") val file: GroupFileMsg? = null, @SerialName("private_file") val privateFile: PrivateFileMsg? = null, @SerialName("flag") val flag: String? = null, @@ -104,8 +104,8 @@ internal data class RequestEvent( @SerialName("post_type") val postType: PostType, @SerialName("request_type") val type: RequestType, @SerialName("sub_type") val subType: RequestSubType = RequestSubType.None, - @SerialName("group_id") val groupId: Long = 0, - @SerialName("user_id") val userId: Long = 0, + @SerialName("group_id") val groupId: Long = -1, + @SerialName("user_id") val userId: Long = -1, @SerialName("comment") val comment: String = "", @SerialName("flag") val flag: String? = null, )