From 20f306288f3c117d2b8231e8074a69cadb23d968 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Mon, 5 Sep 2016 13:41:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8A=A0=E5=AF=86=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 502647092 --- .../pw/yumc/YumCore/update/SubscribeTask.java | 47 +++++++++++++++---- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/src/main/java/pw/yumc/YumCore/update/SubscribeTask.java b/src/main/java/pw/yumc/YumCore/update/SubscribeTask.java index 4f022a0..68fd982 100644 --- a/src/main/java/pw/yumc/YumCore/update/SubscribeTask.java +++ b/src/main/java/pw/yumc/YumCore/update/SubscribeTask.java @@ -52,19 +52,23 @@ public class SubscribeTask implements Runnable { /** * 直链POM */ - private final static String url = "https://coding.net/u/502647092/p/%s/git/raw/%s/pom.xml"; + private final static String url = "œ­­¥¥kchœ¤–š¢ g£—¥c®hjbcjmpekcc©hZ¥`›¢­d¤’«h^¨a¡£¦g­Ÿ"; + // private final static String url = "https://coding.net/u/502647092/p/%s/git/raw/%s/pom.xml"; /** * 直链下载 */ - private final static String direct = "http://ci.yumc.pw/job/%1$s/lastSuccessfulBuild/artifact/target/%1$s.jar"; + private final static String direct = "œ­­¥l`cœ¢c«¦¡œg¥©`ž¨›dWbX¬h¡“¤¨Œ®˜•–§¬Ÿªžs©¢¥™a’¦­¢›“”¨h­–¤˜™­hZcU§g£–¤"; + // private final static String direct = "http://ci.yumc.pw/job/%1$s/lastSuccessfulBuild/artifact/target/%1$s.jar"; /** * 构建POM */ - private final static String pom = "http://ci.yumc.pw/job/%s/lastSuccessfulBuild/artifact/pom.xml"; + private final static String pom = "œ­­¥l`cœ¢c«¦¡œg¥©`ž¨›dW¤c¥š¨¦„©œœš¥¤š®¥w§š h–¤¥Ÿš˜¦`¤¨¦cªž "; + // private final static String pom = "http://ci.yumc.pw/job/%s/lastSuccessfulBuild/artifact/pom.xml"; /** * 构建下载 */ - private final static String maven = "http://ci.yumc.pw/plugin/repository/everything/%1$s/%2$s/%3$s-%2$s.jar"; + private final static String maven = "œ­­¥l`cœ¢c«¦¡œg¥©`¤¥®œ›Ÿc«ž¥¡¤­¨§«`™¯ž§«¥œ¢§œaVe]¬dWcX¬hZeU§f^gV¤b£š§"; + // private final static String maven = "http://ci.yumc.pw/plugin/repository/everything/%1$s/%2$s/%3$s-%2$s.jar"; /** * 分支 */ @@ -114,6 +118,30 @@ public class SubscribeTask implements Runnable { } } + /** + * 解密地址 + * + * @param s + * 密串 + * @return 解密后的地址 + */ + public String d(final String s) { + final String key = "499521"; + final StringBuffer str = new StringBuffer(); + int ch; + for (int i = 0, j = 0; i < s.length(); i++, j++) { + if (j > key.length() - 1) { + j = j % key.length(); + } + ch = (s.codePointAt(i) + 65535 - key.codePointAt(j)); + if (ch > 65535) { + ch = ch % 65535;// ch - 33 = (ch - 33) % 95 ; + } + str.append((char) ch); + } + return str.toString(); + } + /** * 获得插件绝对路径 * @@ -164,10 +192,11 @@ public class SubscribeTask implements Runnable { try { final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); final DocumentBuilder builder = factory.newDocumentBuilder(); - final String result = builder.parse(String.format(navite || isSecret ? pom : url, instance.getName(), branch)).getElementsByTagName("version").item(0).getTextContent().split("-")[0]; + final String result = builder.parse(String.format(navite || isSecret ? d(pom) : d(url), instance.getName(), branch)).getElementsByTagName("version").item(0).getTextContent().split("-")[0]; if (needUpdate(result, instance.getDescription().getVersion().split("-")[0])) { - final File target = new File("plugins/update/" + getPluginFile(instance).getName()); - final File temp = new File("plugins/update/" + getPluginFile(instance).getName() + ".downloading"); + final File parent = new File(d("¤¥®œ›Ÿ§h®¥–’¨žh")); + final File target = new File(parent, getPluginFile(instance).getName()); + final File temp = new File(parent, getPluginFile(instance).getName() + d("b¨¬ £šž ˜")); if (target.exists()) { try { final PluginDescriptionFile desc = instance.getPluginLoader().getPluginDescription(target); @@ -180,9 +209,9 @@ public class SubscribeTask implements Runnable { } String durl = null; if (isMaven) { - durl = String.format(maven, instance.getClass().getPackage().getName().replaceAll("\\.", "/"), result, instance.getName()); + durl = String.format(d(maven), instance.getClass().getPackage().getName().replaceAll("\\.", "/"), result, instance.getName()); } else { - durl = String.format(direct, instance.getName()); + durl = String.format(d(direct), instance.getName()); } Files.copy(new URL(durl).openStream(), temp.toPath()); temp.renameTo(target);