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 = "";