From e89590c0dbeed616df3b0ac3831b2d628dc3fb55 Mon Sep 17 00:00:00 2001 From: youpaishidifu <1@ypshidifu.cn> Date: Tue, 24 Nov 2026 10:43:18 +0800 Subject: [PATCH] =?UTF-8?q?15m36=20=E6=88=90=E4=B9=A6=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E8=A1=A5=E6=9D=A5=E6=BA=90=E5=8C=BA=E5=88=86=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0:=20=E8=AF=BB=20=E6=8F=92=E4=BB=B6=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE.txt=20=E7=9A=84=20web=E9=80=9A=E4=BF=A1-=E5=9C=B0?= =?UTF-8?q?=E5=9D=80,=20url=E5=91=BD=E4=B8=AD=E8=AF=A5host->'=E6=8F=92?= =?UTF-8?q?=E4=BB=B6PHP=E5=B7=A5=E5=8D=95'(=E6=8F=92=E4=BB=B6=E8=87=AA?= =?UTF-8?q?=E5=B7=B1=E7=9A=84=E5=B7=A5=E5=8D=95=E7=B3=BB=E7=BB=9F),=20?= =?UTF-8?q?=E5=90=A6=E5=88=99=E6=8C=89=E5=B9=B3=E5=8F=B0=E7=89=B9=E5=BE=81?= =?UTF-8?q?=20github->GitHub=20issue/gitee->Gitee=20issue/gitcode->GitCode?= =?UTF-8?q?=20issue/mailto->=E9=82=AE=E7=AE=B1,=20=E9=98=B2=E7=BA=AF?= =?UTF-8?q?=E5=8E=BB=E5=A3=B3=E6=88=90text=E4=B8=A2=E6=9D=A5=E6=BA=90?= =?UTF-8?q?=E6=AD=A7=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/Sdf1_login/CustomScreenManager.java | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/main/java/Sdf1_login/CustomScreenManager.java b/src/main/java/Sdf1_login/CustomScreenManager.java index 40c4e9e..7944363 100644 --- a/src/main/java/Sdf1_login/CustomScreenManager.java +++ b/src/main/java/Sdf1_login/CustomScreenManager.java @@ -586,18 +586,40 @@ public class CustomScreenManager implements Listener { s = s.replaceAll("(? text(来源), ![alt](url) 整删 + // 15m36 去 markdown 链接/图片壳并补来源: [text](url) -> text(来源), ![alt](url) 整删 // 防成书渲染出 [工单系统](https://...) 带方括号怪文本; 纯去壳成 text 会丢来源(工单系统是 - // GitHub 的? 游戏里的? 后台的?), 故按 url 特征补来源短标识: github.com->GitHub, mailto:->邮箱, - // 其它 http(s)->网页链接。来源短标识 4-6 字, 不会导致页超 115。 + // GitHub 的? Gitee 的? 插件后台 PHP 的?), 故按 url 特征补来源短标识: + // ★ 读 插件设置.txt 的 web通信-地址(插件自己的 PHP 工单系统地址), url 命中它 -> "插件PHP工单" + // 其余按平台特征: gitee.com->Gitee issue, gitcode.com->GitCode issue, github.com->GitHub issue, mailto:->邮箱 s = s.replaceAll("!\\[[^\\]]*\\]\\([^)]*\\)", ""); // 图片 ![](url) 整删 { + // 读 web通信-地址(插件自己的 PHP 工单系统) + String webHost = ""; + try { + File f = new File(plugin.getDataFolder(), "插件设置.txt"); + if (f.exists()) { + for (String line : java.nio.file.Files.readAllLines(f.toPath(), java.nio.charset.StandardCharsets.UTF_8)) { + line = line.trim(); + if (line.startsWith("web通信-地址=")) { + String webAddr = line.substring("web通信-地址=".length()).trim(); + if (webAddr.startsWith("https://")) webHost = webAddr.substring(8); + else if (webAddr.startsWith("http://")) webHost = webAddr.substring(7); + else webHost = webAddr; + webHost = webHost.replaceAll("/.*$", "").trim(); // 取 host + break; + } + } + } + } catch (Exception ignored) {} java.util.regex.Matcher lm = java.util.regex.Pattern.compile("\\[([^\\]]+)\\]\\(([^)]*)\\)").matcher(s); StringBuffer buf = new StringBuffer(); while (lm.find()) { String text = lm.group(1), url = lm.group(2); String src; - if (url.contains("github.com")) src = "GitHub"; + if (!webHost.isEmpty() && url.contains(webHost)) src = "插件PHP工单"; // 命中插件自己的工单地址 + else if (url.contains("gitee.com")) src = "Gitee issue"; + else if (url.contains("gitcode.com")) src = "GitCode issue"; + else if (url.contains("github.com")) src = "GitHub issue"; else if (url.startsWith("mailto:")) src = "邮箱"; else if (url.startsWith("http://") || url.startsWith("https://")) src = "网页链接"; else src = "";