edit SourceDebugWebSocket.kt

pull/832/head
gedoor 4 years ago
parent 35ac0948ff
commit e867cbd2bd
  1. 6
      app/src/main/java/io/legado/app/web/SourceDebugWebSocket.kt

@ -42,9 +42,13 @@ class SourceDebugWebSocket(handshakeRequest: NanoHTTPD.IHTTPSession) :
}
override fun onMessage(message: NanoWSD.WebSocketFrame) {
if (!message.textPayload.isJson()) return
launch(IO) {
kotlin.runCatching {
if (!message.textPayload.isJson()) {
send("数据必须为Json格式")
close(NanoWSD.WebSocketFrame.CloseCode.NormalClosure, "调试结束", false)
return@launch
}
val debugBean = GSON.fromJsonObject<Map<String, String>>(message.textPayload)
if (debugBean != null) {
val tag = debugBean["tag"]

Loading…
Cancel
Save