From dc5660fa63a0e09b177ff034ecd8ee0d0438efc2 Mon Sep 17 00:00:00 2001 From: Kloping <3474006766@qq.com> Date: Thu, 21 Mar 2024 20:39:33 +0800 Subject: [PATCH] =?UTF-8?q?update=203.3=20=E5=BC=83=E7=94=A8hml=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=AD=98=E5=82=A8,=E6=94=B9=E7=94=A8sqlite=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E5=BC=80=E5=85=B3=E6=95=B0=E6=8D=AE=20=E7=BD=91?= =?UTF-8?q?=E9=A1=B5=E6=93=8D=E4=BD=9C`=E4=BF=AE=E6=94=B9`=E6=93=8D?= =?UTF-8?q?=E4=BD=9C.=20=E4=BD=BF=E7=94=A8=E7=8B=AC=E7=AB=8B=E6=8F=92?= =?UTF-8?q?=E4=BB=B6(=E4=B8=8D=E8=A6=81=E4=BE=9D=E8=B5=96jar=E4=BD=86?= =?UTF-8?q?=E5=90=8C=E6=97=B6=E4=B8=8D=E8=83=BD=E4=B8=8E=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8F=92=E4=BB=B6=E5=85=B1=E5=90=8C=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E5=A6=82AutoReply=20=E4=BC=98=E5=8C=96json?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E7=AE=97=E6=B3=95=20=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E7=9B=B8=E5=85=B3issue=20#1=20#8=20#6=20#2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 2 +- .../gdpl2112/mirai/p1/CallApiPlugin.java | 3 +-- .../github/gdpl2112/mirai/p1/Converter.java | 15 ++++++++++----- .../mirai/p1/rest/RestController0.java | 2 +- src/main/resources/static/index.html | 19 +++++++++++++++---- 5 files changed, 28 insertions(+), 13 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index ea6acd2..2c91dd4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ plugins { } group = "io.github.gdpl2112" -version = "3.2" +version = "3.3" repositories { maven("https://repo1.maven.org/maven2/") diff --git a/src/main/java/io/github/gdpl2112/mirai/p1/CallApiPlugin.java b/src/main/java/io/github/gdpl2112/mirai/p1/CallApiPlugin.java index 24fa171..8d104fa 100644 --- a/src/main/java/io/github/gdpl2112/mirai/p1/CallApiPlugin.java +++ b/src/main/java/io/github/gdpl2112/mirai/p1/CallApiPlugin.java @@ -27,8 +27,7 @@ public class CallApiPlugin extends JavaPlugin { public static Conf conf = null; public CallApiPlugin() { - super(new JvmPluginDescriptionBuilder("io.github.Kloping.mirai.p1.CallApiPlugin", "3.2") - .dependsOn("io.github.gdpl2112.lib-tts", true) + super(new JvmPluginDescriptionBuilder("io.github.Kloping.mirai.p1.CallApiPlugin", "3.3") .info("调用自定义API插件").build()); } diff --git a/src/main/java/io/github/gdpl2112/mirai/p1/Converter.java b/src/main/java/io/github/gdpl2112/mirai/p1/Converter.java index b5b8ca4..4d20ff6 100644 --- a/src/main/java/io/github/gdpl2112/mirai/p1/Converter.java +++ b/src/main/java/io/github/gdpl2112/mirai/p1/Converter.java @@ -104,7 +104,13 @@ public static Object get(Connection t1, String t0, AtomicReference doc public static Object get0(String t1, String t0) throws Exception { JSON j0 = (JSON) JSON.parse(t1); t0 = t0.trim(); - String s0 = t0.trim().split("\\.")[0].trim(); + String s0 = null; + for (String s : t0.trim().split("\\.")) { + if (!s.isEmpty()) { + s0 = s; + break; + } + } Object o = null; if (s0.matches("\\[\\d*]")) { JSONArray arr = (JSONArray) j0; @@ -126,9 +132,8 @@ public static Object get0(String t1, String t0) throws Exception { Integer st = Integer.parseInt(s0.substring(i + 1, s0.length() - 1)); JSONObject jo = (JSONObject) j0; o = jo.getJSONArray(st0).get(st); - int len = 4 + st0.length(); - if (t0.length() >= len) t0 = t0.substring(len); - else t0 = t0.substring(len - 1); + if (t0.length() > s0.length()) t0 = t0.substring(s0.length()); + else t0 = null; } else { JSONObject jo = (JSONObject) j0; o = jo.get(s0); @@ -136,7 +141,7 @@ public static Object get0(String t1, String t0) throws Exception { if (t0.length() >= len) t0 = t0.substring(len); else t0 = t0.substring(len - 1); } - if (t0.length() > 0) { + if (t0 != null && t0.length() > 0) { return get0(JSON.toJSONString(o), t0); } else { return o; diff --git a/src/main/java/io/github/gdpl2112/mirai/p1/rest/RestController0.java b/src/main/java/io/github/gdpl2112/mirai/p1/rest/RestController0.java index 9b63d52..398b7dd 100644 --- a/src/main/java/io/github/gdpl2112/mirai/p1/rest/RestController0.java +++ b/src/main/java/io/github/gdpl2112/mirai/p1/rest/RestController0.java @@ -89,7 +89,7 @@ public Object append( template.setTouch(touch); } template.setOut(out); - template.setOutArgs(outArgs.split(",")); + template.setOutArgs(outArgs.split(",|;")); template.setUrl(url); if (proxy != null && !proxy.isEmpty()) { template.setProxyIp(proxy.split(":")[0]); diff --git a/src/main/resources/static/index.html b/src/main/resources/static/index.html index 364bb5e..a34319b 100644 --- a/src/main/resources/static/index.html +++ b/src/main/resources/static/index.html @@ -35,7 +35,7 @@
输出参数 -
@@ -142,7 +142,19 @@ }, getStrs: function (es) { let s0 = ""; for (e0 of es) { - s0 = s0 + "\n" + e0; + s0 = s0 + "\r\n" + e0; + } + return s0.trim(); + }, getStrs1: function (es) { + let s0 = ""; + let k = true + for (e0 of es) { + if (k) { + s0 = e0; + k = false + } else { + s0 = s0 + "," + e0; + } } return s0.trim(); }, delete0: function (touch) { @@ -153,12 +165,11 @@ }) }, ope: function (e) { e_out.val(e.out) - e_outArgs.val(this.getStrs(e.outArgs)) + e_outArgs.val(this.getStrs1(e.outArgs)) e_proxy.val(e.proxyIp + ':' + e.proxyPort) e_touch.val(e.touch) e_url.val(e.url) $('#appendModal').modal('show') - } } });