From 3664352f23fce499fccdb9e5b08540b181a5b1f2 Mon Sep 17 00:00:00 2001 From: tuuz Date: Mon, 18 Mar 2024 03:05:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Eget=5Ffile=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=8C=E4=B8=BB=E8=A6=81=E8=A7=A3=E5=86=B3=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E5=8F=8D=E5=90=91websocket=E7=9A=84=E6=97=B6=E5=80=99=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=96=87=E4=BB=B6=E9=BA=BB=E7=83=A6=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E7=9B=AE=E5=89=8D=E4=BB=85=E6=94=AF=E6=8C=81?= =?UTF-8?q?base64=E7=9A=84type=E8=BF=94=E5=9B=9E=EF=BC=8C=E6=9C=AA?= =?UTF-8?q?=E6=9D=A5=E5=B0=86=E6=94=AF=E6=8C=81=E6=9B=B4=E5=A4=9A=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=EF=BC=8C=E6=B5=8B=E8=AF=95=E5=90=8E=E5=B0=86=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E8=87=B3=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../moe/fuqiuluo/shamrock/remote/action/handlers/GetFile.kt | 4 +--- .../java/moe/fuqiuluo/shamrock/remote/api/ResourceAction.kt | 6 ++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/action/handlers/GetFile.kt b/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/action/handlers/GetFile.kt index b8cc36a..a2e2a4f 100644 --- a/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/action/handlers/GetFile.kt +++ b/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/action/handlers/GetFile.kt @@ -3,10 +3,8 @@ package moe.fuqiuluo.shamrock.remote.action.handlers import kotlinx.serialization.json.JsonElement import moe.fuqiuluo.shamrock.remote.action.ActionSession import moe.fuqiuluo.shamrock.remote.action.IActionHandler -import moe.fuqiuluo.shamrock.remote.service.data.OutResource import moe.fuqiuluo.shamrock.remote.service.data.OutResourceByBase64 import moe.fuqiuluo.shamrock.tools.EmptyJsonString -import moe.fuqiuluo.shamrock.utils.AudioUtils import moe.fuqiuluo.shamrock.utils.FileUtils import moe.fuqiuluo.symbols.OneBotHandler import java.util.Base64 @@ -17,7 +15,7 @@ import java.util.Base64 .replace(regex = "[{}\\-]".toRegex(), replacement = "") .replace(" ", "") .split(".")[0].lowercase() - val fileType = session.getString("file_type") + val fileType = session.getString("type") return invoke(file, fileType, session.echo) } diff --git a/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/api/ResourceAction.kt b/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/api/ResourceAction.kt index 5e6629f..f553edb 100644 --- a/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/api/ResourceAction.kt +++ b/xposed/src/main/java/moe/fuqiuluo/shamrock/remote/api/ResourceAction.kt @@ -26,6 +26,12 @@ fun Routing.fetchRes() { call.respondText(GetRecord(file, format), ContentType.Application.Json) } + getOrPost("/get_file") { + val file = formatFileName( fetchGetOrThrow("file") ) + val fileType = fetchOrThrow("file_type") + call.respondText(GetFile(file, fileType), ContentType.Application.Json) + } + getOrPost("/get_image") { val file = formatFileName( fetchGetOrThrow("file") ) call.respondText(GetImage(file), ContentType.Application.Json)