feat: 加密地址串

Signed-off-by: 502647092 <admin@yumc.pw>
merge/1/MERGE
502647092 2016-09-05 13:41:15 +08:00
parent c96c1d8426
commit 20f306288f
1 changed files with 38 additions and 9 deletions

View File

@ -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œ¤–š¢ —¥c®hjbcjmpekcc©hZ¥`›¢­’«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¥©`¤¥®œ›Ÿž¥¡¤­¨§«`™¯ž§«¥œ¢§œ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);