15m36 成书链接补来源区分工单平台: 读 插件设置.txt 的 web通信-地址, url命中该host->'插件PHP工单'(插件自己的工单系统), 否则按平台特征 github->GitHub issue/gitee->Gitee issue/gitcode->GitCode issue/mailto->邮箱, 防纯去壳成text丢来源歧义
Auto Release / build (push) Successful in 5m7s
Auto Release / build (push) Successful in 5m7s
This commit is contained in:
@@ -586,18 +586,40 @@ public class CustomScreenManager implements Listener {
|
|||||||
s = s.replaceAll("(?<!\\*)\\*(?!\\*)", "");
|
s = s.replaceAll("(?<!\\*)\\*(?!\\*)", "");
|
||||||
// 去代码反引号
|
// 去代码反引号
|
||||||
s = s.replace("`", "");
|
s = s.replace("`", "");
|
||||||
// 15m35 去 markdown 链接/图片壳并补来源: [text](url) -> text(来源),  整删
|
// 15m36 去 markdown 链接/图片壳并补来源: [text](url) -> text(来源),  整删
|
||||||
// 防成书渲染出 [工单系统](https://...) 带方括号怪文本; 纯去壳成 text 会丢来源(工单系统是
|
// 防成书渲染出 [工单系统](https://...) 带方括号怪文本; 纯去壳成 text 会丢来源(工单系统是
|
||||||
// GitHub 的? 游戏里的? 后台的?), 故按 url 特征补来源短标识: github.com->GitHub, mailto:->邮箱,
|
// GitHub 的? Gitee 的? 插件后台 PHP 的?), 故按 url 特征补来源短标识:
|
||||||
// 其它 http(s)->网页链接。来源短标识 4-6 字, 不会导致页超 115。
|
// ★ 读 插件设置.txt 的 web通信-地址(插件自己的 PHP 工单系统地址), url 命中它 -> "插件PHP工单"
|
||||||
|
// 其余按平台特征: gitee.com->Gitee issue, gitcode.com->GitCode issue, github.com->GitHub issue, mailto:->邮箱
|
||||||
s = s.replaceAll("!\\[[^\\]]*\\]\\([^)]*\\)", ""); // 图片  整删
|
s = s.replaceAll("!\\[[^\\]]*\\]\\([^)]*\\)", ""); // 图片  整删
|
||||||
{
|
{
|
||||||
|
// 读 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);
|
java.util.regex.Matcher lm = java.util.regex.Pattern.compile("\\[([^\\]]+)\\]\\(([^)]*)\\)").matcher(s);
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
while (lm.find()) {
|
while (lm.find()) {
|
||||||
String text = lm.group(1), url = lm.group(2);
|
String text = lm.group(1), url = lm.group(2);
|
||||||
String src;
|
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("mailto:")) src = "邮箱";
|
||||||
else if (url.startsWith("http://") || url.startsWith("https://")) src = "网页链接";
|
else if (url.startsWith("http://") || url.startsWith("https://")) src = "网页链接";
|
||||||
else src = "";
|
else src = "";
|
||||||
|
|||||||
Reference in New Issue
Block a user