From 6808381292aa92be011804bdb08da3165a3f6acf Mon Sep 17 00:00:00 2001 From: qaiu <736226400@qq.com> Date: Thu, 10 Aug 2023 00:59:09 +0800 Subject: [PATCH] fixed 123pan /b/api/share/download/info->/a/api/share/download/info --- .../src/main/java/cn/qaiu/vx/core/Deploy.java | 3 +- .../qaiu/vx/core/interceptor/Interceptor.java | 6 +- .../cn/qaiu/vx/core/util/ReflectionUtil.java | 6 +- .../interceptorImpl/DefaultInterceptor.java | 12 +-- .../cn/qaiu/lz/common/parser/IPanTool.java | 38 ++++----- .../cn/qaiu/lz/common/parser/PanBase.java | 57 ------------- .../qaiu/lz/common/parser/impl/CowTool.java | 36 ++++---- .../cn/qaiu/lz/common/parser/impl/EcTool.java | 26 +++--- .../cn/qaiu/lz/common/parser/impl/FcTool.java | 49 ++++++----- .../cn/qaiu/lz/common/parser/impl/FjTool.java | 24 +++--- .../cn/qaiu/lz/common/parser/impl/LzTool.java | 40 ++++----- .../cn/qaiu/lz/common/parser/impl/QkTool.java | 2 +- .../cn/qaiu/lz/common/parser/impl/UcTool.java | 33 ++++---- .../cn/qaiu/lz/common/parser/impl/YeTool.java | 83 ++++++++++++------- .../cn/qaiu/lz/common/util/JsExecUtils.java | 27 +++--- .../java/cn/qaiu/lz/web/http/ServerApi.java | 12 +-- web-service/src/main/resources/app.yml | 3 +- .../src/main/resources/http-tools/pan-uc.http | 27 +----- .../src/main/resources/http-tools/pan-ye.http | 5 ++ .../src/main/resources/http-tools/test.http | 4 +- web-service/src/main/resources/js/ye123.js | 15 +++- .../java/cn/qaiu/web/test/TestAESUtil.java | 4 +- 22 files changed, 238 insertions(+), 274 deletions(-) delete mode 100644 web-service/src/main/java/cn/qaiu/lz/common/parser/PanBase.java diff --git a/core/src/main/java/cn/qaiu/vx/core/Deploy.java b/core/src/main/java/cn/qaiu/vx/core/Deploy.java index aea3e0e..ec32c1a 100644 --- a/core/src/main/java/cn/qaiu/vx/core/Deploy.java +++ b/core/src/main/java/cn/qaiu/vx/core/Deploy.java @@ -7,7 +7,6 @@ import cn.qaiu.vx.core.verticle.ReverseProxyVerticle; import cn.qaiu.vx.core.verticle.RouterVerticle; import cn.qaiu.vx.core.verticle.ServiceVerticle; import io.vertx.core.*; -import io.vertx.core.impl.launcher.commands.VersionCommand; import io.vertx.core.json.JsonObject; import io.vertx.core.shareddata.LocalMap; import org.slf4j.Logger; @@ -96,7 +95,7 @@ public final class Deploy { System.out.printf(logoTemplete, conf.getString("version_app"), - VersionCommand.getVersion(), + conf.getString("version_vertx"), conf.getString("copyright"), year ); diff --git a/core/src/main/java/cn/qaiu/vx/core/interceptor/Interceptor.java b/core/src/main/java/cn/qaiu/vx/core/interceptor/Interceptor.java index 4f8d563..626f1b2 100644 --- a/core/src/main/java/cn/qaiu/vx/core/interceptor/Interceptor.java +++ b/core/src/main/java/cn/qaiu/vx/core/interceptor/Interceptor.java @@ -12,10 +12,8 @@ import io.vertx.ext.web.RoutingContext; public interface Interceptor { default Handler doHandle() { - return this::beforeHandle; + return this::handle; } - void beforeHandle(RoutingContext context); - - void afterHandle(RoutingContext context); + void handle(RoutingContext context); } diff --git a/core/src/main/java/cn/qaiu/vx/core/util/ReflectionUtil.java b/core/src/main/java/cn/qaiu/vx/core/util/ReflectionUtil.java index ff6a872..43b3e6d 100644 --- a/core/src/main/java/cn/qaiu/vx/core/util/ReflectionUtil.java +++ b/core/src/main/java/cn/qaiu/vx/core/util/ReflectionUtil.java @@ -70,11 +70,11 @@ public final class ReflectionUtil { // 发现注解api层 没有继承父类时 这里反射一直有问题(Scanner SubTypesScanner was not configured) // 因此这里需要手动配置各种Scanner扫描器 -- https://blog.csdn.net/qq_29499107/article/details/106889781 configurationBuilder.setScanners( - Scanners.SubTypes.filterResultsBy(s -> true), //允许getAllTypes获取所有Object的子类, 不设置为false则 getAllTypes 会报错.默认为true. + new SubTypesScanner(false), //允许getAllTypes获取所有Object的子类, 不设置为false则 getAllTypes 会报错.默认为true. new MethodParameterNamesScanner(), //设置方法参数名称 扫描器,否则调用getConstructorParamNames 会报错 - Scanners.MethodsAnnotated, //设置方法注解 扫描器, 否则getConstructorsAnnotatedWith,getMethodsAnnotatedWith 会报错 + new MethodAnnotationsScanner(), //设置方法注解 扫描器, 否则getConstructorsAnnotatedWith,getMethodsAnnotatedWith 会报错 new MemberUsageScanner(), //设置 member 扫描器,否则 getMethodUsage 会报错, 不推荐使用,有可能会报错 Caused by: java.lang.ClassCastException: javassist.bytecode.InterfaceMethodrefInfo cannot be cast to javassist.bytecode.MethodrefInfo - Scanners.TypesAnnotated //设置类注解 扫描器 ,否则 getTypesAnnotatedWith 会报错 + new TypeAnnotationsScanner() //设置类注解 扫描器 ,否则 getTypesAnnotatedWith 会报错 ); configurationBuilder.filterInputsBy(filterBuilder); diff --git a/web-service/src/main/java/cn/qaiu/lz/common/interceptorImpl/DefaultInterceptor.java b/web-service/src/main/java/cn/qaiu/lz/common/interceptorImpl/DefaultInterceptor.java index 545f92e..6065941 100644 --- a/web-service/src/main/java/cn/qaiu/lz/common/interceptorImpl/DefaultInterceptor.java +++ b/web-service/src/main/java/cn/qaiu/lz/common/interceptorImpl/DefaultInterceptor.java @@ -2,10 +2,15 @@ package cn.qaiu.lz.common.interceptorImpl; import cn.qaiu.vx.core.base.BaseHttpApi; import cn.qaiu.vx.core.interceptor.Interceptor; +import cn.qaiu.vx.core.model.JsonResult; +import cn.qaiu.vx.core.util.CommonUtil; import cn.qaiu.vx.core.util.SharedDataUtil; +import cn.qaiu.vx.core.util.VertxHolder; import io.vertx.core.json.JsonArray; +import io.vertx.core.shareddata.LocalMap; import io.vertx.ext.web.RoutingContext; import lombok.extern.slf4j.Slf4j; +import lombok.val; /** * 默认拦截器实现 @@ -18,12 +23,7 @@ public class DefaultInterceptor implements Interceptor, BaseHttpApi { private final JsonArray ignores = SharedDataUtil.getJsonArrayForCustomConfig("ignoresReg"); @Override - public void beforeHandle(RoutingContext ctx) { + public void handle(RoutingContext ctx) { ctx.next(); } - - @Override - public void afterHandle(RoutingContext context) { - - } } diff --git a/web-service/src/main/java/cn/qaiu/lz/common/parser/IPanTool.java b/web-service/src/main/java/cn/qaiu/lz/common/parser/IPanTool.java index aed5452..39d1c16 100644 --- a/web-service/src/main/java/cn/qaiu/lz/common/parser/IPanTool.java +++ b/web-service/src/main/java/cn/qaiu/lz/common/parser/IPanTool.java @@ -4,42 +4,42 @@ import cn.qaiu.lz.common.parser.impl.*; import io.vertx.core.Future; public interface IPanTool { - Future parse(); + Future parse(String data, String code); - static IPanTool typeMatching(String type, String key, String pwd) { + static IPanTool typeMatching(String type) { return switch (type) { - case "lz" -> new LzTool(key, pwd); - case "cow" -> new CowTool(key, pwd); - case "ec" -> new EcTool(key, pwd); - case "fc" -> new FcTool(key, pwd); - case "uc" -> new UcTool(key, pwd); - case "ye" -> new YeTool(key, pwd); - case "fj" -> new FjTool(key, pwd); + case "lz" -> new LzTool(); + case "cow" -> new CowTool(); + case "ec" -> new EcTool(); + case "fc" -> new FcTool(); + case "uc" -> new UcTool(); + case "ye" -> new YeTool(); + case "fj" -> new FjTool(); default -> { - throw new UnsupportedOperationException("未知分享类型"); + throw new IllegalArgumentException("未知分享类型"); } }; } - static IPanTool shareURLPrefixMatching(String url, String pwd) { + static IPanTool shareURLPrefixMatching(String url) { if (url.startsWith(CowTool.SHARE_URL_PREFIX)) { - return new CowTool(url, pwd); + return new CowTool(); } else if (url.startsWith(EcTool.SHARE_URL_PREFIX)) { - return new EcTool(url, pwd); + return new EcTool(); } else if (url.startsWith(FcTool.SHARE_URL_PREFIX0)) { - return new FcTool(url, pwd); + return new FcTool(); } else if (url.startsWith(UcTool.SHARE_URL_PREFIX)) { - return new UcTool(url, pwd); + return new UcTool(); } else if (url.startsWith(YeTool.SHARE_URL_PREFIX)) { - return new YeTool(url, pwd); + return new YeTool(); } else if (url.startsWith(FjTool.SHARE_URL_PREFIX)) { - return new FjTool(url, pwd); + return new FjTool(); } else if (url.contains("lanzou")) { - return new LzTool(url, pwd); + return new LzTool(); } - throw new UnsupportedOperationException("未知分享类型"); + throw new IllegalArgumentException("未知分享类型"); } } diff --git a/web-service/src/main/java/cn/qaiu/lz/common/parser/PanBase.java b/web-service/src/main/java/cn/qaiu/lz/common/parser/PanBase.java deleted file mode 100644 index 2948120..0000000 --- a/web-service/src/main/java/cn/qaiu/lz/common/parser/PanBase.java +++ /dev/null @@ -1,57 +0,0 @@ -package cn.qaiu.lz.common.parser; - -import cn.qaiu.vx.core.util.VertxHolder; -import io.vertx.core.Handler; -import io.vertx.core.Promise; -import io.vertx.ext.web.client.WebClient; -import io.vertx.ext.web.client.WebClientOptions; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public abstract class PanBase { - protected Logger log = LoggerFactory.getLogger(this.getClass()); - - protected Promise promise = Promise.promise(); - - protected WebClient client = WebClient.create(VertxHolder.getVertxInstance()); - protected WebClient clientNoRedirects = WebClient.create(VertxHolder.getVertxInstance(), OPTIONS); - private static final WebClientOptions OPTIONS = new WebClientOptions().setFollowRedirects(false); - - - protected String key; - protected String pwd; - - protected PanBase(String key, String pwd) { - this.key = key; - this.pwd = pwd; - } - - protected void fail(Throwable t, String errorMsg, Object... args) { - try { - String s = String.format(errorMsg.replaceAll("\\{}", "%s"), args); - log.error("解析异常: " + s, t.fillInStackTrace()); - promise.fail(this.getClass().getSimpleName() + ": 解析异常: " + s + " -> " + t); - } catch (Exception e) { - log.error("ErrorMsg format fail. The parameter has been discarded", e); - log.error("解析异常: " + errorMsg, t.fillInStackTrace()); - promise.fail(this.getClass().getSimpleName() + ": 解析异常: " + errorMsg + " -> " + t); - } - } - - protected void fail(String errorMsg, Object... args) { - try { - String s = String.format(errorMsg.replaceAll("\\{}", "%s"), args); - log.error("解析异常: " + s); - promise.fail(this.getClass().getSimpleName() + " - 解析异常: " + s); - } catch (Exception e) { - log.error("ErrorMsg format fail. The parameter has been discarded", e); - log.error("解析异常: " + errorMsg); - promise.fail(this.getClass().getSimpleName() + " - 解析异常: " + errorMsg); - } - } - - protected Handler handleFail(String errorMsg) { - return t -> fail(this.getClass().getSimpleName() + " - 请求异常 {}: -> {}", errorMsg, t.fillInStackTrace()); - } - -} diff --git a/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/CowTool.java b/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/CowTool.java index 313b795..9bed3f5 100644 --- a/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/CowTool.java +++ b/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/CowTool.java @@ -1,10 +1,14 @@ package cn.qaiu.lz.common.parser.impl; import cn.qaiu.lz.common.parser.IPanTool; -import cn.qaiu.lz.common.parser.PanBase; import cn.qaiu.lz.common.util.CommonUtils; +import cn.qaiu.lz.common.util.PanExceptionUtils; +import cn.qaiu.vx.core.util.VertxHolder; import io.vertx.core.Future; +import io.vertx.core.Promise; import io.vertx.core.json.JsonObject; +import io.vertx.ext.web.client.WebClient; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; /** @@ -13,19 +17,17 @@ import org.apache.commons.lang3.StringUtils; * @author QAIU * @date 2023/4/21 21:19 */ -public class CowTool extends PanBase implements IPanTool { +@Slf4j +public class CowTool implements IPanTool { private static final String API_REQUEST_URL = "https://cowtransfer.com/core/api/transfer/share"; public static final String SHARE_URL_PREFIX = "https://cowtransfer.com/s/"; - public CowTool(String key, String pwd) { - super(key, pwd); - } - - public Future parse() { - key = CommonUtils.adaptShortPaths(SHARE_URL_PREFIX, key); - String url = API_REQUEST_URL + "?uniqueUrl=" + key; - client.getAbs(url).send().onSuccess(res -> { + public Future parse(String data, String code) { + Promise promise = Promise.promise(); + WebClient client = WebClient.create(VertxHolder.getVertxInstance()); + String key = CommonUtils.adaptShortPaths(SHARE_URL_PREFIX, data); + client.getAbs(API_REQUEST_URL + "?uniqueUrl=" + key).send().onSuccess(res -> { JsonObject resJson = res.bodyAsJsonObject(); if ("success".equals(resJson.getString("message")) && resJson.containsKey("data")) { JsonObject dataJson = resJson.getJsonObject("data"); @@ -42,15 +44,19 @@ public class CowTool extends PanBase implements IPanTool { promise.complete(downloadUrl); return; } - fail("cow parse fail: {}; downloadUrl is empty", url2); + + log.error("cow parse fail: {}; downloadUrl is empty", url2); + promise.fail("cow parse fail: " + url2 + "; downloadUrl is empty"); return; } - fail("cow parse fail: {}; json: {}", url2, res2Json); - }).onFailure(handleFail(url2)); + log.error("cow parse fail: {}; json: {}", url2, res2Json); + promise.fail("cow parse fail: " + url2 + "; json:" + res2Json); + }); return; } - fail("cow parse fail: {}; json: {}", key, resJson); - }).onFailure(handleFail(url)); + log.error("cow parse fail: {}; json: {}", key, resJson); + promise.fail("cow parse fail: " + key + "; json:" + resJson); + }).onFailure(t -> promise.fail(PanExceptionUtils.fillRunTimeException("Cow", key, t))); return promise.future(); } diff --git a/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/EcTool.java b/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/EcTool.java index 2f156ba..077bfc3 100644 --- a/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/EcTool.java +++ b/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/EcTool.java @@ -1,17 +1,22 @@ package cn.qaiu.lz.common.parser.impl; import cn.qaiu.lz.common.parser.IPanTool; -import cn.qaiu.lz.common.parser.PanBase; import cn.qaiu.lz.common.util.CommonUtils; +import cn.qaiu.lz.common.util.PanExceptionUtils; +import cn.qaiu.vx.core.util.VertxHolder; import io.vertx.core.Future; +import io.vertx.core.Promise; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; +import io.vertx.ext.web.client.WebClient; import io.vertx.uritemplate.UriTemplate; +import lombok.extern.slf4j.Slf4j; /** * 移动云空间解析 */ -public class EcTool extends PanBase implements IPanTool { +@Slf4j +public class EcTool implements IPanTool { private static final String FIRST_REQUEST_URL = "https://www.ecpan.cn/drive/fileextoverrid" + ".do?chainUrlTemplate=https:%2F%2Fwww.ecpan" + ".cn%2Fweb%2F%23%2FyunpanProxy%3Fpath%3D%252F%2523%252Fdrive%252Foutside&parentId=-1&data={dataKey}"; @@ -20,12 +25,10 @@ public class EcTool extends PanBase implements IPanTool { public static final String SHARE_URL_PREFIX = "www.ecpan.cn/"; - public EcTool(String key, String pwd) { - super(key, pwd); - } - - public Future parse() { - String dataKey = CommonUtils.adaptShortPaths(SHARE_URL_PREFIX, key); + public Future parse(String data, String code) { + String dataKey = CommonUtils.adaptShortPaths(SHARE_URL_PREFIX, data); + Promise promise = Promise.promise(); + WebClient client = WebClient.create(VertxHolder.getVertxInstance()); // 第一次请求 获取文件信息 client.getAbs(UriTemplate.of(FIRST_REQUEST_URL)).setTemplateParam("dataKey", dataKey).send().onSuccess(res -> { JsonObject jsonObject = res.bodyAsJsonObject(); @@ -34,7 +37,8 @@ public class EcTool extends PanBase implements IPanTool { .getJsonObject("var") .getJsonObject("chainFileInfo"); if (fileInfo.containsKey("errMesg")) { - fail("{} 解析失败:{} key = {}", FIRST_REQUEST_URL, fileInfo.getString("errMesg"), dataKey); + promise.fail(new RuntimeException(DOWNLOAD_REQUEST_URL + " 解析失败: " + + fileInfo.getString("errMesg")) + " key = " + dataKey); return; } JsonObject cloudpFile = fileInfo.getJsonObject("cloudpFile"); @@ -51,9 +55,9 @@ public class EcTool extends PanBase implements IPanTool { JsonObject jsonRes = res2.bodyAsJsonObject(); log.debug("ecPan get download url -> {}", res2.body().toString()); promise.complete(jsonRes.getJsonObject("var").getString("downloadUrl")); - }).onFailure(handleFail("")); + }).onFailure(t -> promise.fail(PanExceptionUtils.fillRunTimeException("Ec", dataKey, t))); } - ).onFailure(handleFail(FIRST_REQUEST_URL)); + ).onFailure(t -> promise.fail(PanExceptionUtils.fillRunTimeException("Ec", dataKey, t)));; return promise.future(); } } diff --git a/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/FcTool.java b/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/FcTool.java index e0e9aa7..2776f1b 100644 --- a/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/FcTool.java +++ b/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/FcTool.java @@ -1,14 +1,18 @@ package cn.qaiu.lz.common.parser.impl; import cn.qaiu.lz.common.parser.IPanTool; -import cn.qaiu.lz.common.parser.PanBase; import cn.qaiu.lz.common.util.CommonUtils; +import cn.qaiu.lz.common.util.PanExceptionUtils; +import cn.qaiu.vx.core.util.VertxHolder; import io.vertx.core.Future; import io.vertx.core.MultiMap; import io.vertx.core.Promise; +import io.vertx.core.Vertx; import io.vertx.core.buffer.Buffer; import io.vertx.core.json.JsonObject; import io.vertx.ext.web.client.HttpResponse; +import io.vertx.ext.web.client.WebClient; +import io.vertx.ext.web.client.WebClientOptions; import io.vertx.ext.web.client.WebClientSession; import io.vertx.uritemplate.UriTemplate; import org.apache.commons.lang3.StringUtils; @@ -19,7 +23,7 @@ import java.util.regex.Pattern; /** * 360亿方云 */ -public class FcTool extends PanBase implements IPanTool { +public class FcTool implements IPanTool { public static final String SHARE_URL_PREFIX0 = "https://v2.fangcloud.com/s"; public static final String SHARE_URL_PREFIX = "https://v2.fangcloud.com/sharing/"; @@ -27,44 +31,45 @@ public class FcTool extends PanBase implements IPanTool { private static final String DOWN_REQUEST_URL = "https://v2.fangcloud.cn/apps/files/download?file_id={fid}" + "&scenario=share&unique_name={uname}"; - public FcTool(String key, String pwd) { - super(key, pwd); - } - - public Future parse() { - String data = key.replace("share","sharing"); + public Future parse(String data, String code) { + data = data.replace("share","sharing"); String dataKey = CommonUtils.adaptShortPaths(SHARE_URL_PREFIX, data); + + Promise promise = Promise.promise(); + + Vertx vertx = VertxHolder.getVertxInstance(); + WebClient client = WebClient.create(vertx); WebClientSession sClient = WebClientSession.create(client); // 第一次请求 自动重定向 sClient.getAbs(SHARE_URL_PREFIX + dataKey).send().onSuccess(res -> { // 判断是否是加密分享 - if (StringUtils.isNotEmpty(pwd)) { + if (StringUtils.isNotEmpty(code)) { // 获取requesttoken String html = res.bodyAsString(); Pattern compile = Pattern.compile("name=\"requesttoken\"\\s+value=\"([a-zA-Z0-9_+=]+)\""); Matcher matcher = compile.matcher(html); if (!matcher.find()) { - fail(SHARE_URL_PREFIX + " 未匹配到加密分享的密码输入页面的requesttoken"); + promise.fail(SHARE_URL_PREFIX + " 未匹配到加密分享的密码输入页面的requesttoken: \n" + html); return; } String token = matcher.group(1); sClient.postAbs(SHARE_URL_PREFIX2 + dataKey).sendForm(MultiMap.caseInsensitiveMultiMap() .set("requesttoken", token) - .set("password", pwd)).onSuccess(res2 -> { + .set("password", code)).onSuccess(res2 -> { if (res2.statusCode() == 302) { - sClient.getAbs(res2.getHeader("Location")).send() - .onSuccess(res3 -> getDownURL(dataKey, promise, res3, sClient)) - .onFailure(handleFail(res2.getHeader("Location"))); + sClient.getAbs(res2.getHeader("Location")).send().onSuccess(res3 -> + getDownURL(dataKey, promise, res3, sClient)) + .onFailure(t -> promise.fail(PanExceptionUtils.fillRunTimeException("Fc", dataKey, t))); return; } - fail(SHARE_URL_PREFIX + " 密码跳转后获取重定向失败"); - }).onFailure(handleFail(SHARE_URL_PREFIX2)); + promise.fail(SHARE_URL_PREFIX + " 密码跳转后获取重定向失败 \n" + html); + }).onFailure(t -> promise.fail(PanExceptionUtils.fillRunTimeException("Fc", dataKey, t))); return; } getDownURL(dataKey, promise, res, sClient); - }).onFailure(handleFail(SHARE_URL_PREFIX + dataKey)); + }).onFailure(t -> promise.fail(PanExceptionUtils.fillRunTimeException("Fc", dataKey, t))); return promise.future(); } @@ -75,12 +80,14 @@ public class FcTool extends PanBase implements IPanTool { Pattern compile = Pattern.compile("id=\"typed_id\"\\s+value=\"file_(\\d+)\""); Matcher matcher = compile.matcher(html); if (!matcher.find()) { - fail(SHARE_URL_PREFIX + " 未匹配到文件id(typed_id)"); + promise.fail(SHARE_URL_PREFIX + " 未匹配到文件id(typed_id): \n" + html); return; } String fid = matcher.group(1); // 创建一个不自动重定向的WebClientSession + WebClient clientNoRedirects = WebClient.create(VertxHolder.getVertxInstance(), + new WebClientOptions().setFollowRedirects(false)); WebClientSession sClientNoRedirects = WebClientSession.create(clientNoRedirects, sClient.cookieStore()); // 第二次请求 sClientNoRedirects.getAbs(UriTemplate.of(DOWN_REQUEST_URL)) @@ -90,14 +97,14 @@ public class FcTool extends PanBase implements IPanTool { try { resJson = res2.bodyAsJsonObject(); } catch (Exception e) { - fail(e, DOWN_REQUEST_URL + " 第二次请求没有返回JSON, 可能下载受限"); + promise.fail(DOWN_REQUEST_URL + " 第二次请求没有返回JSON, 可能下载受限: " + res2.bodyAsString()); return; } if (!resJson.getBoolean("success")) { - fail(DOWN_REQUEST_URL + " 第二次请求未得到正确相应: " + resJson); + promise.fail(DOWN_REQUEST_URL + " 第二次请求未得到正确相应: " + resJson); return; } promise.complete(resJson.getString("download_url")); - }).onFailure(handleFail(DOWN_REQUEST_URL)); + }).onFailure(t -> promise.fail(PanExceptionUtils.fillRunTimeException("Fc", dataKey, t))); } } diff --git a/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/FjTool.java b/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/FjTool.java index 9d0d4b4..70500bf 100644 --- a/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/FjTool.java +++ b/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/FjTool.java @@ -1,12 +1,13 @@ package cn.qaiu.lz.common.parser.impl; import cn.qaiu.lz.common.parser.IPanTool; -import cn.qaiu.lz.common.parser.PanBase; import cn.qaiu.lz.common.util.AESUtils; import cn.qaiu.lz.common.util.CommonUtils; +import cn.qaiu.lz.common.util.PanExceptionUtils; import cn.qaiu.vx.core.util.VertxHolder; import io.vertx.core.Future; import io.vertx.core.MultiMap; +import io.vertx.core.Promise; import io.vertx.core.json.JsonObject; import io.vertx.ext.web.client.WebClient; import io.vertx.ext.web.client.WebClientOptions; @@ -19,7 +20,7 @@ import java.util.UUID; * * @version V016_230609 */ -public class FjTool extends PanBase implements IPanTool { +public class FjTool implements IPanTool { public static final String SHARE_URL_PREFIX = "https://www.feijix.com/s/"; private static final String API_URL_PREFIX = "https://api.feijipan.com/ws/"; @@ -30,13 +31,10 @@ public class FjTool extends PanBase implements IPanTool { private static final String SECOND_REQUEST_URL = API_URL_PREFIX + "file/redirect?downloadId={fidEncode}&enable=1" + "&devType=6&uuid={uuid}×tamp={ts}&auth={auth}"; - public FjTool(String key, String pwd) { - super(key, pwd); - } - - public Future parse() { - String dataKey = CommonUtils.adaptShortPaths(SHARE_URL_PREFIX, key); + public Future parse(String data, String code) { + String dataKey = CommonUtils.adaptShortPaths(SHARE_URL_PREFIX, data); + Promise promise = Promise.promise(); WebClient client = WebClient.create(VertxHolder.getVertxInstance(), new WebClientOptions().setFollowRedirects(false)); String shareId = String.valueOf(AESUtils.idEncrypt(dataKey)); @@ -46,11 +44,11 @@ public class FjTool extends PanBase implements IPanTool { client.postAbs(UriTemplate.of(FIRST_REQUEST_URL)).setTemplateParam("shareId", shareId).send().onSuccess(res -> { JsonObject resJson = res.bodyAsJsonObject(); if (resJson.getInteger("code") != 200) { - fail(FIRST_REQUEST_URL + " 返回异常: " + resJson); + promise.fail(FIRST_REQUEST_URL + " 返回异常: " + resJson); return; } if (resJson.getJsonArray("list").size() == 0) { - fail(FIRST_REQUEST_URL + " 解析文件列表为空: " + resJson); + promise.fail(FIRST_REQUEST_URL + " 解析文件列表为空: " + resJson); return; } // 文件Id @@ -69,12 +67,12 @@ public class FjTool extends PanBase implements IPanTool { .setTemplateParam("auth", auth).send().onSuccess(res2 -> { MultiMap headers = res2.headers(); if (!headers.contains("Location")) { - fail(SECOND_REQUEST_URL + " 未找到重定向URL: \n" + res.headers()); + promise.fail(SECOND_REQUEST_URL + " 未找到重定向URL: \n" + res.headers()); return; } promise.complete(headers.get("Location")); - }).onFailure(handleFail(SECOND_REQUEST_URL)); - }).onFailure(handleFail(FIRST_REQUEST_URL)); + }).onFailure(t -> promise.fail(PanExceptionUtils.fillRunTimeException("Fj", dataKey, t))); + }).onFailure(t -> promise.fail(PanExceptionUtils.fillRunTimeException("Fj", dataKey, t))); return promise.future(); } diff --git a/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/LzTool.java b/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/LzTool.java index e5b999f..d4ba8fe 100644 --- a/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/LzTool.java +++ b/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/LzTool.java @@ -1,7 +1,7 @@ package cn.qaiu.lz.common.parser.impl; import cn.qaiu.lz.common.parser.IPanTool; -import cn.qaiu.lz.common.parser.PanBase; +import cn.qaiu.lz.common.util.PanExceptionUtils; import cn.qaiu.vx.core.util.VertxHolder; import io.vertx.core.Future; import io.vertx.core.MultiMap; @@ -19,20 +19,17 @@ import java.util.regex.Pattern; * @author QAIU * @version 1.0 update 2021/5/16 10:39 */ -public class LzTool extends PanBase implements IPanTool { +public class LzTool implements IPanTool { public static final String SHARE_URL_PREFIX = "https://wwwa.lanzoui.com"; - public LzTool(String key, String pwd) { - super(key, pwd); - } - - public Future parse() { - String sUrl = key.startsWith("https://") ? key : SHARE_URL_PREFIX + "/" + key; + public Future parse(String data, String code) { + Promise promise = Promise.promise(); + String key = data.indexOf('/') > 0 ? data : SHARE_URL_PREFIX + "/" + data; WebClient client = WebClient.create(VertxHolder.getVertxInstance(), new WebClientOptions().setFollowRedirects(false)); - client.getAbs(sUrl).send().onSuccess(res -> { + client.getAbs(key).send().onSuccess(res -> { String html = res.bodyAsString(); // 匹配iframe Pattern compile = Pattern.compile("src=\"(/fn\\?[a-zA-Z\\d_+/=]{16,})\""); @@ -42,11 +39,11 @@ public class LzTool extends PanBase implements IPanTool { Pattern compile2 = Pattern.compile("sign=(\\w{16,})"); Matcher matcher2 = compile2.matcher(html); if (!matcher2.find()) { - fail(sUrl + ": sign正则匹配失败, 可能分享已失效"); + promise.fail(key + ": sign正则匹配失败, 可能分享已失效: " + html); return; } String sign = matcher2.group(1); - getDownURL(promise, sUrl, client, sign); + getDownURL(promise, code, key, client, sign); return; } String iframePath = matcher.group(1); @@ -55,17 +52,17 @@ public class LzTool extends PanBase implements IPanTool { System.out.println(html); Matcher matcher2 = Pattern.compile("'sign'\s*:\s*'(\\w+)'").matcher(html2); if (!matcher2.find()) { - fail(SHARE_URL_PREFIX + iframePath + " -> " + sUrl + ": sign正则匹配失败, 可能分享已失效"); + promise.fail(SHARE_URL_PREFIX + iframePath + " -> " + key + ": sign正则匹配失败, 可能分享已失效: " + html2); return; } String sign = matcher2.group(1); - getDownURL(promise, sUrl, client, sign); - }).onFailure(handleFail(SHARE_URL_PREFIX)); - }).onFailure(handleFail(sUrl)); + getDownURL(promise, code, key, client, sign); + }).onFailure(t -> promise.fail(PanExceptionUtils.fillRunTimeException("Lz", key, t))); + }).onFailure(t -> promise.fail(PanExceptionUtils.fillRunTimeException("Lz", key, t))); return promise.future(); } - private void getDownURL(Promise promise, String key, WebClient client, String sign) { + private void getDownURL(Promise promise, String code, String key, WebClient client, String sign) { MultiMap headers = MultiMap.caseInsensitiveMultiMap(); var userAgent2 = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, " + "like " + @@ -76,20 +73,19 @@ public class LzTool extends PanBase implements IPanTool { headers.set("Accept-Language", "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2"); headers.set("sec-ch-ua-mobile", "sec-ch-ua-mobile"); - String url = SHARE_URL_PREFIX + "/ajaxm.php"; - client.postAbs(url).putHeaders(headers).sendForm(MultiMap + client.postAbs(SHARE_URL_PREFIX + "/ajaxm.php").putHeaders(headers).sendForm(MultiMap .caseInsensitiveMultiMap() .set("action", "downprocess") - .set("sign", sign).set("p", pwd)).onSuccess(res2 -> { + .set("sign", sign).set("p", code)).onSuccess(res2 -> { JsonObject urlJson = res2.bodyAsJsonObject(); if (urlJson.getInteger("zt") != 1) { - fail(urlJson.getString("inf")); + promise.fail(urlJson.getString("inf")); return; } String downUrl = urlJson.getString("dom") + "/file/" + urlJson.getString("url"); client.getAbs(downUrl).putHeaders(headers).send() .onSuccess(res3 -> promise.complete(res3.headers().get("Location"))) - .onFailure(handleFail(downUrl)); - }).onFailure(handleFail(url)); + .onFailure(t -> promise.fail(PanExceptionUtils.fillRunTimeException("Lz", key, t))); + }).onFailure(t -> promise.fail(PanExceptionUtils.fillRunTimeException("Lz", key, t))); } } diff --git a/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/QkTool.java b/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/QkTool.java index bb6dd59..d0a6cc3 100644 --- a/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/QkTool.java +++ b/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/QkTool.java @@ -4,7 +4,7 @@ import io.vertx.core.Future; import io.vertx.core.Promise; public class QkTool { - public static Future parse() { + public static Future parse(String data, String code) { Promise promise = Promise.promise(); return promise.future(); diff --git a/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/UcTool.java b/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/UcTool.java index dd90d62..7926c93 100644 --- a/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/UcTool.java +++ b/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/UcTool.java @@ -1,17 +1,22 @@ package cn.qaiu.lz.common.parser.impl; import cn.qaiu.lz.common.parser.IPanTool; -import cn.qaiu.lz.common.parser.PanBase; import cn.qaiu.lz.common.util.CommonUtils; +import cn.qaiu.lz.common.util.PanExceptionUtils; +import cn.qaiu.vx.core.util.VertxHolder; import io.vertx.core.Future; +import io.vertx.core.Promise; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; +import io.vertx.ext.web.client.WebClient; import io.vertx.uritemplate.UriTemplate; +import lombok.extern.slf4j.Slf4j; /** * UC网盘解析 */ -public class UcTool extends PanBase implements IPanTool { +@Slf4j +public class UcTool implements IPanTool { private static final String API_URL_PREFIX = "https://pc-api.uc.cn/1/clouddrive/"; public static final String SHARE_URL_PREFIX = "https://fast.uc.cn/s/"; @@ -24,13 +29,11 @@ public class UcTool extends PanBase implements IPanTool { private static final String THIRD_REQUEST_URL = API_URL_PREFIX + "file/download?entry=ft&fr=pc&pr=UCBrowser"; - public UcTool(String key, String pwd) { - super(key, pwd); - } - - public Future parse() { - var dataKey = CommonUtils.adaptShortPaths(SHARE_URL_PREFIX, key); - var passcode = (pwd == null) ? "" : pwd; + public Future parse(String data, String code) { + var dataKey = CommonUtils.adaptShortPaths(SHARE_URL_PREFIX, data); + var passcode = (code == null) ? "" : code; + Promise promise = Promise.promise(); + var client = WebClient.create(VertxHolder.getVertxInstance()); var jsonObject = JsonObject.of("share_for_transfer", true); jsonObject.put("pwd_id", dataKey); jsonObject.put("passcode", passcode); @@ -39,7 +42,7 @@ public class UcTool extends PanBase implements IPanTool { log.debug("第一阶段 {}", res.body()); var resJson = res.bodyAsJsonObject(); if (resJson.getInteger("code") != 0) { - fail(FIRST_REQUEST_URL + " 返回异常: " + resJson); + promise.fail(FIRST_REQUEST_URL + " 返回异常: " + resJson); return; } var stoken = resJson.getJsonObject("data").getString("stoken"); @@ -52,7 +55,7 @@ public class UcTool extends PanBase implements IPanTool { log.debug("第二阶段 {}", res2.body()); JsonObject resJson2 = res2.bodyAsJsonObject(); if (resJson2.getInteger("code") != 0) { - fail(FIRST_REQUEST_URL + " 返回异常: " + resJson2); + promise.fail(FIRST_REQUEST_URL + " 返回异常: " + resJson2); return; } // 文件信息 @@ -68,15 +71,15 @@ public class UcTool extends PanBase implements IPanTool { log.debug("第三阶段 {}", res3.body()); var resJson3 = res3.bodyAsJsonObject(); if (resJson3.getInteger("code") != 0) { - fail(FIRST_REQUEST_URL + " 返回异常: " + resJson2); + promise.fail(FIRST_REQUEST_URL + " 返回异常: " + resJson2); return; } promise.complete(resJson3.getJsonArray("data").getJsonObject(0).getString("download_url")); - }).onFailure(handleFail(THIRD_REQUEST_URL)); + }).onFailure(t -> promise.fail(PanExceptionUtils.fillRunTimeException("Uc", dataKey, t))); - }).onFailure(handleFail(SECOND_REQUEST_URL)); + }).onFailure(t -> promise.fail(new RuntimeException("解析异常: ", t.fillInStackTrace()))); } - ).onFailure(handleFail(FIRST_REQUEST_URL)); + ).onFailure(t -> promise.fail(PanExceptionUtils.fillRunTimeException("Uc", dataKey, t))); return promise.future(); } } diff --git a/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/YeTool.java b/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/YeTool.java index c8b6527..201049c 100644 --- a/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/YeTool.java +++ b/web-service/src/main/java/cn/qaiu/lz/common/parser/impl/YeTool.java @@ -1,16 +1,22 @@ package cn.qaiu.lz.common.parser.impl; import cn.qaiu.lz.common.parser.IPanTool; -import cn.qaiu.lz.common.parser.PanBase; import cn.qaiu.lz.common.util.CommonUtils; import cn.qaiu.lz.common.util.JsExecUtils; +import cn.qaiu.lz.common.util.PanExceptionUtils; +import cn.qaiu.vx.core.util.VertxHolder; import io.vertx.core.Future; +import io.vertx.core.Promise; import io.vertx.core.json.JsonObject; import io.vertx.ext.web.client.WebClient; import io.vertx.uritemplate.UriTemplate; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.openjdk.nashorn.api.scripting.ScriptObjectMirror; +import javax.script.ScriptException; +import java.io.IOException; import java.net.MalformedURLException; import java.util.Base64; import java.util.Map; @@ -20,23 +26,30 @@ import java.util.regex.Pattern; /** * 123网盘 */ -public class YeTool extends PanBase implements IPanTool { - +@Slf4j +public class YeTool implements IPanTool { public static final String SHARE_URL_PREFIX = "https://www.123pan.com/s/"; public static final String FIRST_REQUEST_URL = SHARE_URL_PREFIX + "{key}.html"; +/* + private static final String GET_FILE_INFO_URL = "https://www.123pan.com/a/api/share/get?limit=100&next=1&orderBy" + + "=file_name&orderDirection=asc&shareKey={shareKey}&SharePwd={pwd}&ParentFileId=0&Page=1&event" + + "=homeListFile&operateType=1"; + private static final String GET_FILE_INFO_URL="https://www.123pan + .com/b/api/share/get?limit=100&next=1&orderBy=file_name&orderDirection=asc" + + "&shareKey={shareKey}&SharePwd={pwd}&ParentFileId=0&Page=1&event=homeListFile&operateType=1&auth-key + ={authKey}"; +*/ - private static final String GET_FILE_INFO_URL = "https://www.123pan.com/b/api/share/get?limit=100&next=1&orderBy" + + private static final String GET_FILE_INFO_URL = "https://www.123pan.com/a/api/share/get?limit=100&next=1&orderBy" + "=file_name&orderDirection=asc" + "&shareKey={shareKey}&SharePwd={pwd}&ParentFileId=0&Page=1&event=homeListFile&operateType=1"; - private static final String DOWNLOAD_API_URL = "https://www.123pan.com/b/api/share/download/info?{authK}={authV}"; + private static final String DOWNLOAD_API_URL = "https://www.123pan.com/a/api/share/download/info?{authK}={authV}"; - public YeTool(String key, String pwd) { - super(key, pwd); - } + public Future parse(String data, String code) { - public Future parse() { - - String dataKey = CommonUtils.adaptShortPaths(SHARE_URL_PREFIX, key); + String dataKey = CommonUtils.adaptShortPaths(SHARE_URL_PREFIX, data); + Promise promise = Promise.promise(); + WebClient client = WebClient.create(VertxHolder.getVertxInstance()); client.getAbs(UriTemplate.of(FIRST_REQUEST_URL)).setTemplateParam("key", dataKey).send().onSuccess(res -> { @@ -45,7 +58,7 @@ public class YeTool extends PanBase implements IPanTool { Matcher matcher = compile.matcher(html); if (!matcher.find()) { - fail(html + "\n Ye: " + dataKey + " 正则匹配失败"); + promise.fail(html + "\n Ye: " + dataKey + " 正则匹配失败"); return; } String fileInfoString = matcher.group(1); @@ -54,45 +67,45 @@ public class YeTool extends PanBase implements IPanTool { JsonObject resListJson = fileInfoJson.getJsonObject("reslist"); if (resJson == null || resJson.getInteger("code") != 0) { - fail(dataKey + " 解析到异常JSON: " + resJson); + promise.fail(dataKey + " 解析到异常JSON: " + resJson); return; } String shareKey = resJson.getJsonObject("data").getString("ShareKey"); if (resListJson == null || resListJson.getInteger("code") != 0) { // 加密分享 - if (StringUtils.isNotEmpty(pwd)) { + if (StringUtils.isNotEmpty(code)) { client.getAbs(UriTemplate.of(GET_FILE_INFO_URL)) .setTemplateParam("shareKey", shareKey) - .setTemplateParam("pwd", pwd) + .setTemplateParam("pwd", code) // .setTemplateParam("authKey", AESUtils.getAuthKey("/b/api/share/get")) .putHeader("Platform", "web") .putHeader("App-Version", "3") .send().onSuccess(res2 -> { JsonObject infoJson = res2.bodyAsJsonObject(); if (infoJson.getInteger("code") != 0) { - fail("{} 状态码异常 {}", dataKey, infoJson); + promise.fail("Ye: " + dataKey + " 状态码异常" + infoJson); return; } JsonObject getFileInfoJson = infoJson.getJsonObject("data").getJsonArray("InfoList").getJsonObject(0); getFileInfoJson.put("ShareKey", shareKey); - getDownUrl(client, getFileInfoJson); - }).onFailure(this.handleFail(GET_FILE_INFO_URL)); + getDownUrl(promise, client, getFileInfoJson); + }).onFailure(t -> promise.fail(PanExceptionUtils.fillRunTimeException("Ye", dataKey, t))); } else { - fail("该分享[{}]需要密码",dataKey); + promise.fail(dataKey + " 该分享需要密码"); } return; } JsonObject reqBodyJson = resListJson.getJsonObject("data").getJsonArray("InfoList").getJsonObject(0); reqBodyJson.put("ShareKey", shareKey); - getDownUrl(client, reqBodyJson); - }).onFailure(this.handleFail(FIRST_REQUEST_URL)); + getDownUrl(promise, client, reqBodyJson); + }).onFailure(t -> promise.fail(PanExceptionUtils.fillRunTimeException("Ye", dataKey, t))); return promise.future(); } - private void getDownUrl(WebClient client, JsonObject reqBodyJson) { + private static void getDownUrl(Promise promise, WebClient client, JsonObject reqBodyJson) { log.info(reqBodyJson.encodePrettily()); JsonObject jsonObject = new JsonObject(); // {"ShareKey":"iaKtVv-6OECd","FileID":2193732,"S3keyFlag":"1811834632-0","Size":4203111, @@ -106,9 +119,13 @@ public class YeTool extends PanBase implements IPanTool { // 调用JS文件获取签名 ScriptObjectMirror getSign; try { - getSign = JsExecUtils.executeJs("getSign", "/b/api/share/download/info"); - } catch (Exception e) { - fail(e, "JS函数执行异常"); + getSign = JsExecUtils.executeJs("getSign", "/a/api/share/download/info"); + } catch (ScriptException | IOException | NoSuchMethodException e) { + promise.fail(e); + return; + } + if (getSign == null) { + promise.fail(ArrayUtils.toString(getSign)); return; } log.info("ye getSign: {}={}", getSign.get("0").toString(), getSign.get("1").toString()); @@ -123,11 +140,11 @@ public class YeTool extends PanBase implements IPanTool { try { if (downURLJson.getInteger("code") != 0) { - fail("Ye: downURLJson返回值异常->" + downURLJson); + promise.fail("Ye: downURLJson返回值异常->" + downURLJson); return; } } catch (Exception ignored) { - fail("Ye: downURLJson格式异常->" + downURLJson); + promise.fail("Ye: downURLJson格式异常->" + downURLJson); return; } String downURL = downURLJson.getJsonObject("data").getString("DownloadURL"); @@ -142,21 +159,23 @@ public class YeTool extends PanBase implements IPanTool { JsonObject res3Json = res3.bodyAsJsonObject(); try { if (res3Json.getInteger("code") != 0) { - fail("Ye: downUrl2返回值异常->" + res3Json); + promise.fail("Ye: downUrl2返回值异常->" + res3Json); return; } } catch (Exception ignored) { - fail("Ye: downUrl2格式异常->" + downURLJson); + promise.fail("Ye: downUrl2格式异常->" + downURLJson); return; } promise.complete(res3Json.getJsonObject("data").getString("redirect_url")); - }).onFailure(this.handleFail("获取直链失败")); + }).onFailure(t -> promise.fail(PanExceptionUtils.fillRunTimeException("Ye", + reqBodyJson.encodePrettily(), t))); } catch (MalformedURLException e) { - fail("urlParams解析异常" + e.getMessage()); + promise.fail("urlParams解析异常" + e.getMessage()); } - }).onFailure(this.handleFail(DOWNLOAD_API_URL)); + }).onFailure(t -> promise.fail(PanExceptionUtils.fillRunTimeException("Ye", + reqBodyJson.encodePrettily(), t))); } } diff --git a/web-service/src/main/java/cn/qaiu/lz/common/util/JsExecUtils.java b/web-service/src/main/java/cn/qaiu/lz/common/util/JsExecUtils.java index 501598e..cbcc3a3 100644 --- a/web-service/src/main/java/cn/qaiu/lz/common/util/JsExecUtils.java +++ b/web-service/src/main/java/cn/qaiu/lz/common/util/JsExecUtils.java @@ -6,7 +6,6 @@ import javax.script.Invocable; import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.ScriptException; -import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.net.URL; @@ -18,32 +17,26 @@ import java.net.URL; */ public class JsExecUtils { private static final String JS_PATH = "/js/ye123.js"; - private static Invocable inv; - // 初始化脚本引擎 - static { + /** + * 调用js文件 + */ + public static ScriptObjectMirror executeJs(String functionName, Object... args) throws ScriptException, + IOException, NoSuchMethodException { ScriptEngineManager engineManager = new ScriptEngineManager(); ScriptEngine engine = engineManager.getEngineByName("JavaScript"); // 得到脚本引擎 //获取文件所在的相对路径 URL resource = JsExecUtils.class.getResource("/"); if (resource == null) { - throw new RuntimeException("js resource path is null"); + throw new ScriptException("js resource path is null"); } String path = resource.getPath(); String reader = path + JS_PATH; - try (FileReader fReader = new FileReader(reader)){ - engine.eval(fReader); - fReader.close(); - inv = (Invocable) engine; - } catch (IOException | ScriptException e) { - throw new RuntimeException(e); - } - } + FileReader fReader = new FileReader(reader); + engine.eval(fReader); + fReader.close(); - /** - * 调用js文件 - */ - public static ScriptObjectMirror executeJs(String functionName, Object... args) throws ScriptException, NoSuchMethodException { + Invocable inv = (Invocable) engine; //调用js中的方法 return (ScriptObjectMirror) inv.invokeFunction(functionName, args); } diff --git a/web-service/src/main/java/cn/qaiu/lz/web/http/ServerApi.java b/web-service/src/main/java/cn/qaiu/lz/web/http/ServerApi.java index 774610e..8d608dc 100644 --- a/web-service/src/main/java/cn/qaiu/lz/web/http/ServerApi.java +++ b/web-service/src/main/java/cn/qaiu/lz/web/http/ServerApi.java @@ -43,7 +43,7 @@ public class ServerApi { url = EcTool.SHARE_URL_PREFIX + request.getParam("data"); } try { - IPanTool.shareURLPrefixMatching(url, pwd).parse().onSuccess(resUrl -> { + IPanTool.shareURLPrefixMatching(url).parse(url, pwd).onSuccess(resUrl -> { response.putHeader("location", resUrl).setStatusCode(302).end(); promise.complete(); }).onFailure(t -> promise.fail(t.fillInStackTrace())); @@ -54,12 +54,12 @@ public class ServerApi { } @RouteMapping(value = "/json/parser", method = RouteMethod.GET, order = 3) - public Future parseJson(HttpServerRequest request, String url, String pwd) { + public Future parseJson(HttpServerResponse response, HttpServerRequest request, String url, String pwd) { if (url.contains(EcTool.SHARE_URL_PREFIX)) { // 默认读取Url参数会被截断手动获取一下其他参数 url = EcTool.SHARE_URL_PREFIX + request.getParam("data"); } - return IPanTool.shareURLPrefixMatching(url, pwd).parse(); + return IPanTool.shareURLPrefixMatching(url).parse(url, pwd); } @@ -72,7 +72,7 @@ public class ServerApi { code = keys[1]; } - IPanTool.typeMatching(type, key, code).parse().onSuccess(resUrl -> response.putHeader("location", resUrl) + IPanTool.typeMatching(type).parse(key, code).onSuccess(resUrl -> response.putHeader("location", resUrl) .setStatusCode(302).end()).onFailure(t -> { response.putHeader(CONTENT_TYPE, "text/html;charset=utf-8"); response.end(t.getMessage()); @@ -80,13 +80,13 @@ public class ServerApi { } @RouteMapping(value = "/json/:type/:key", method = RouteMethod.GET, order = 2) - public Future parseKeyJson(String type, String key) { + public Future parseKeyJson(HttpServerResponse response, String type, String key) { String code = ""; if (key.contains("@")) { String[] keys = key.split("@"); key = keys[0]; code = keys[1]; } - return IPanTool.typeMatching(type, key, code).parse(); + return IPanTool.typeMatching(type).parse(key, code); } } diff --git a/web-service/src/main/resources/app.yml b/web-service/src/main/resources/app.yml index b003617..81a0f84 100644 --- a/web-service/src/main/resources/app.yml +++ b/web-service/src/main/resources/app.yml @@ -1,6 +1,7 @@ # 要激活的配置: dev--连接本地数据库; prod连接线上数据库 active: dev -# 版本号 +# 框架版本号 和主版本号 +version_vertx: 4.4.1 version_app: 0.1.6 # 公司名称 -> LOGO版权文字 copyright: QAIU diff --git a/web-service/src/main/resources/http-tools/pan-uc.http b/web-service/src/main/resources/http-tools/pan-uc.http index 0dd2296..10a6ac2 100644 --- a/web-service/src/main/resources/http-tools/pan-uc.http +++ b/web-service/src/main/resources/http-tools/pan-uc.http @@ -10,44 +10,25 @@ content-type: application/json {"pwd_id":"33197dd53ace4","passcode":"","share_for_transfer":true} ### UCpan 第二步 获取fid,share_fid_token GET传参pwd_id,passcode,stoken -https://pc-api.uc.cn/1/clouddrive/transfer_share/detail?pwd_id=33197dd53ace4&passcode=&stoken=4lXGIeQ6rdqjuOPW1MHJpqrQR3RWGFKSAAjpTibsR%2B8%3D +https://pc-api.uc.cn/1/clouddrive/transfer_share/detail?pwd_id=33197dd53ace4&passcode=&stoken=W5b1n2jeFld5RmIusaVOr3vA0vVSCWYQ7Mz8bT2coZM%3D content-type: application/json ### UCpan 第二步获取下载链接 POST json传入fids(fid),pwd_id,stoken,fids_token(share_fid_token) - POST https://pc-api.uc.cn/1/clouddrive/file/download?entry=ft&fr=pc&pr=UCBrowser content-type: application/json -#Cookie: __pus=7576a6d3a511ad7b4c5649a1d89c29ffAAQ06zBxHWghrwEbKRdqBrhXssuYiMIwLLVzi1f2K6qnSL95A79GIxXDEPlYS3NaPjDWOcWVuvbQ3HqTfvqRKr29 { "fids": [ "54c3cd90ed3e45119bb96ed99a562d40" ], "pwd_id": "33197dd53ace4", - "stoken": "7P02U9tWJEkkMgbXaIJxAQyBiqcfPdkbDZ6XoiYsBiA=", + "stoken": "W5b1n2jeFld5RmIusaVOr3vA0vVSCWYQ7Mz8bT2coZM=", "fids_token": [ - "e8a52adcda41d9e218e732b5de549d2a" + "4cb5eabb0ce5a26d12ae5ab8acf68aec" ] } ### # @no-redirect -https://dl-uf-zb.pds.uc.cn/l3PNAKfz/64623447/646b0de6e9f13000c9b14ba182b805312795a82a/646b0de6717e1bfa5bb44dd2a456f103c5177850?Expires=1691488145&OSSAccessKeyId=LTAIyYfxTqY7YZsg&Signature=MvUiIWszmMncqDrsLV%2BlL1HpuYw%3D&x-oss-traffic-limit=503316480&response-content-disposition=attachment%3B%20filename%3DC%23%20Shell%20%28C%23%20Offline%20Compiler%29_2.5.16.apks&callback-var=eyJ4OmF1IjoiLSIsIng6c3AiOiIxOTkiLCJ4OnRva2VuIjoiMi1iYzBhNTgxNTUwOGE0NmQwYmE4YzUxYjAyZGEwNjA5Yi01LTctNjE0NDAtZGFjYjM2NjViYmFhNGY1ZTlkMzc4MDBlYzY0MDMxNjAtNGZhNTliY2RkNzhlYTE0MDg0Mjc5OGVlNDMxZWFlMDciLCJ4OnR0bCI6IjEwODAwIn0%3D&callback=eyJjYWxsYmFja0JvZHlUeXBlIjoiYXBwbGljYXRpb24vanNvbiIsImNhbGxiYWNrU3RhZ2UiOiJiZWZvcmUtZXhlY3V0ZSIsImNhbGxiYWNrRmFpbHVyZUFjdGlvbiI6Imlnbm9yZSIsImNhbGxiYWNrVXJsIjoiaHR0cHM6Ly9hdXRoLWNkbi51Yy5jbi9vdXRlci9vc3MvY2hlY2twbGF5IiwiY2FsbGJhY2tCb2R5Ijoie1wiaG9zdFwiOiR7aHR0cEhlYWRlci5ob3N0fSxcInNpemVcIjoke3NpemV9LFwicmFuZ2VcIjoke2h0dHBIZWFkZXIucmFuZ2V9LFwicmVmZXJlclwiOiR7aHR0cEhlYWRlci5yZWZlcmVyfSxcImNvb2tpZVwiOiR7aHR0cEhlYWRlci5jb29raWV9LFwibWV0aG9kXCI6JHtodHRwSGVhZGVyLm1ldGhvZH0sXCJpcFwiOiR7Y2xpZW50SXB9LFwicG9ydFwiOiR7Y2xpZW50UG9ydH0sXCJvYmplY3RcIjoke29iamVjdH0sXCJzcFwiOiR7eDpzcH0sXCJ0b2tlblwiOiR7eDp0b2tlbn0sXCJhdVwiOiR7eDphdX0sXCJ0dGxcIjoke3g6dHRsfSxcImNsaWVudF90b2tlblwiOiR7cXVlcnlTdHJpbmcuY2xpZW50X3Rva2VufX0ifQ%3D%3D&ud=4-N-5-0-6-N-3-ft-0-2 +https://dl-uf-zb.pds.uc.cn/l3PNAKfz/64623447/646b0de6e9f13000c9b14ba182b805312795a82a/646b0de6717e1bfa5bb44dd2a456f103c5177850?Expires=1690188688&OSSAccessKeyId=LTAIyYfxTqY7YZsg&Signature=gB3rN%2FxPal3ZpReRkB1M4cnvGF4%3D&x-oss-traffic-limit=503316480&response-content-disposition=attachment%3B%20filename%3DC%23%20Shell%20%28C%23%20Offline%20Compiler%29_2.5.16.apks&callback-var=eyJ4OmF1IjoiLSIsIng6c3AiOiIxOTkiLCJ4OnRva2VuIjoiMi0wNDBjYjFjMDNjNzU1YWY1NDc0NjkxNjNmOTYzYWY2NC0yLTctNjE0NDAtZGFjYjM2NjViYmFhNGY1ZTlkMzc4MDBlYzY0MDMxNjAtYTU2MGJiMmU1MzhlNzY0OTFkMDY1MjA2OGRiNmEzMzEiLCJ4OnR0bCI6IjEwODAwIn0%3D&callback=eyJjYWxsYmFja0JvZHlUeXBlIjoiYXBwbGljYXRpb24vanNvbiIsImNhbGxiYWNrU3RhZ2UiOiJiZWZvcmUtZXhlY3V0ZSIsImNhbGxiYWNrRmFpbHVyZUFjdGlvbiI6Imlnbm9yZSIsImNhbGxiYWNrVXJsIjoiaHR0cHM6Ly9hdXRoLWNkbi51Yy5jbi9vdXRlci9vc3MvY2hlY2twbGF5IiwiY2FsbGJhY2tCb2R5Ijoie1wiaG9zdFwiOiR7aHR0cEhlYWRlci5ob3N0fSxcInNpemVcIjoke3NpemV9LFwicmFuZ2VcIjoke2h0dHBIZWFkZXIucmFuZ2V9LFwicmVmZXJlclwiOiR7aHR0cEhlYWRlci5yZWZlcmVyfSxcImNvb2tpZVwiOiR7aHR0cEhlYWRlci5jb29raWV9LFwibWV0aG9kXCI6JHtodHRwSGVhZGVyLm1ldGhvZH0sXCJpcFwiOiR7Y2xpZW50SXB9LFwicG9ydFwiOiR7Y2xpZW50UG9ydH0sXCJvYmplY3RcIjoke29iamVjdH0sXCJzcFwiOiR7eDpzcH0sXCJ0b2tlblwiOiR7eDp0b2tlbn0sXCJhdVwiOiR7eDphdX0sXCJ0dGxcIjoke3g6dHRsfSxcImNsaWVudF90b2tlblwiOiR7cXVlcnlTdHJpbmcuY2xpZW50X3Rva2VufX0ifQ%3D%3D&ud=4-0-5-0-6-N-3-ft-0-2&__pus=7576a6d3a511ad7b4c5649a1d89c29ffAAQ06zBxHWghrwEbKRdqBrhXssuYiMIwLLVzi1f2K6qnSL95A79GIxXDEPlYS3NaPjDWOcWVuvbQ3HqTfvqRKr29 #Cookie: __pus=7576a6d3a511ad7b4c5649a1d89c29ffAAQ06zBxHWghrwEbKRdqBrhXssuYiMIwLLVzi1f2K6qnSL95A79GIxXDEPlYS3NaPjDWOcWVuvbQ3HqTfvqRKr29 - -### -https://dl-uf-zb.pds.uc.cn/l3PNAKfz/64623447/646b0de6e9f13000c9b14ba182b805312795a82a/646b0de6717e1bfa5bb44dd2a456f103c5177850?Expires=1691488387&OSSAccessKeyId=LTAIyYfxTqY7YZsg&Signature=WIy4UGCwd9eNdUnSexRVFUCFZcM%3D&x-oss-traffic-limit=503316480&response-content-disposition=attachment%3B%20filename%3DC%23%20Shell%20%28C%23%20Offline%20Compiler%29_2.5.16.apks&callback-var=eyJ4OmF1IjoiLSIsIng6c3AiOiIxOTkiLCJ4OnRva2VuIjoiMi0wNDBjYjFjMDNjNzU1YWY1NDc0NjkxNjNmOTYzYWY2NC0yLTctNjE0NDAtZGFjYjM2NjViYmFhNGY1ZTlkMzc4MDBlYzY0MDMxNjAtYTU2MGJiMmU1MzhlNzY0OTFkMDY1MjA2OGRiNmEzMzEiLCJ4OnR0bCI6IjEwODAwIn0%3D&callback=eyJjYWxsYmFja0JvZHlUeXBlIjoiYXBwbGljYXRpb24vanNvbiIsImNhbGxiYWNrU3RhZ2UiOiJiZWZvcmUtZXhlY3V0ZSIsImNhbGxiYWNrRmFpbHVyZUFjdGlvbiI6Imlnbm9yZSIsImNhbGxiYWNrVXJsIjoiaHR0cHM6Ly9hdXRoLWNkbi51Yy5jbi9vdXRlci9vc3MvY2hlY2twbGF5IiwiY2FsbGJhY2tCb2R5Ijoie1wiaG9zdFwiOiR7aHR0cEhlYWRlci5ob3N0fSxcInNpemVcIjoke3NpemV9LFwicmFuZ2VcIjoke2h0dHBIZWFkZXIucmFuZ2V9LFwicmVmZXJlclwiOiR7aHR0cEhlYWRlci5yZWZlcmVyfSxcImNvb2tpZVwiOiR7aHR0cEhlYWRlci5jb29raWV9LFwibWV0aG9kXCI6JHtodHRwSGVhZGVyLm1ldGhvZH0sXCJpcFwiOiR7Y2xpZW50SXB9LFwicG9ydFwiOiR7Y2xpZW50UG9ydH0sXCJvYmplY3RcIjoke29iamVjdH0sXCJzcFwiOiR7eDpzcH0sXCJ0b2tlblwiOiR7eDp0b2tlbn0sXCJhdVwiOiR7eDphdX0sXCJ0dGxcIjoke3g6dHRsfSxcImNsaWVudF90b2tlblwiOiR7cXVlcnlTdHJpbmcuY2xpZW50X3Rva2VufX0ifQ%3D%3D&ud=4-0-5-0-6-N-3-ft-0-2 - -### -#@no-cookie-jar -https://dl-uf-zb.pds.uc.cn/l3PNAKfz/64623447/646b0de6e9f13000c9b14ba182b805312795a82a/646b0de6717e1bfa5bb44dd2a456f103c5177850?Expires=1691488539&OSSAccessKeyId=LTAIyYfxTqY7YZsg&Signature=rhD0OQTq2CuMUvp0ZphStKiyyw8%3D&x-oss-traffic-limit=503316480&response-content-disposition=attachment%3B%20filename%3DC%23%20Shell%20%28C%23%20Offline%20Compiler%29_2.5.16.apks&callback-var=eyJ4OmF1IjoiLSIsIng6c3AiOiIxOTkiLCJ4OnRva2VuIjoiMi02YTU3OGNkNjYyMTQzZWI4ODFjZTE0ZGYyNjk5OTQ4OS01LTctNjE0NDAtZGFjYjM2NjViYmFhNGY1ZTlkMzc4MDBlYzY0MDMxNjAtYzlhYWI1YjA5ZDNhYTA5MWU4NTJjNTJlNGRjYWJkZDYiLCJ4OnR0bCI6IjEwODAwIn0%3D&callback=eyJjYWxsYmFja0JvZHlUeXBlIjoiYXBwbGljYXRpb24vanNvbiIsImNhbGxiYWNrU3RhZ2UiOiJiZWZvcmUtZXhlY3V0ZSIsImNhbGxiYWNrRmFpbHVyZUFjdGlvbiI6Imlnbm9yZSIsImNhbGxiYWNrVXJsIjoiaHR0cHM6Ly9hdXRoLWNkbi51Yy5jbi9vdXRlci9vc3MvY2hlY2twbGF5IiwiY2FsbGJhY2tCb2R5Ijoie1wiaG9zdFwiOiR7aHR0cEhlYWRlci5ob3N0fSxcInNpemVcIjoke3NpemV9LFwicmFuZ2VcIjoke2h0dHBIZWFkZXIucmFuZ2V9LFwicmVmZXJlclwiOiR7aHR0cEhlYWRlci5yZWZlcmVyfSxcImNvb2tpZVwiOiR7aHR0cEhlYWRlci5jb29raWV9LFwibWV0aG9kXCI6JHtodHRwSGVhZGVyLm1ldGhvZH0sXCJpcFwiOiR7Y2xpZW50SXB9LFwicG9ydFwiOiR7Y2xpZW50UG9ydH0sXCJvYmplY3RcIjoke29iamVjdH0sXCJzcFwiOiR7eDpzcH0sXCJ0b2tlblwiOiR7eDp0b2tlbn0sXCJhdVwiOiR7eDphdX0sXCJ0dGxcIjoke3g6dHRsfSxcImNsaWVudF90b2tlblwiOiR7cXVlcnlTdHJpbmcuY2xpZW50X3Rva2VufX0ifQ%3D%3D&ud=4-N-5-0-6-N-3-ft-0-2 -Cookie: __pugs=efc5f3f9c041af5dc62eea4481901cbbAAT912628i+uT/WMwOFWBjJ1TjbKGC1j6cyGHSLVzwuPQP74d+rZXO4xJgdG93MC5DUDdgRJcg5y93waA/KPWDSeDY8LPgjB2Ha2tQ3sQ/MXMoRUi/LRdY3psAyC3YOlUDeFwLtkLAXABRgJhKTw6W0v - - - -### -#@no-cookie-jar - -https://dl-uf-zb.pds.uc.cn/l3PNAKfz/64623447/646b0de6e9f13000c9b14ba182b805312795a82a/646b0de6717e1bfa5bb44dd2a456f103c5177850?Expires=1691489999&OSSAccessKeyId=LTAIyYfxTqY7YZsg&Signature=NbQLAEUCkvJxmSsRoIynZ%2BuPMvY%3D&x-oss-traffic-limit=503316480&response-content-disposition=attachment%3B%20filename%3DC%23%20Shell%20%28C%23%20Offline%20Compiler%29_2.5.16.apks&callback-var=eyJ4OmF1IjoiLSIsIng6c3AiOiIxOTkiLCJ4OnRva2VuIjoiMi0wNDBjYjFjMDNjNzU1YWY1NDc0NjkxNjNmOTYzYWY2NC0yLTctNjE0NDAtZGFjYjM2NjViYmFhNGY1ZTlkMzc4MDBlYzY0MDMxNjAtYTU2MGJiMmU1MzhlNzY0OTFkMDY1MjA2OGRiNmEzMzEiLCJ4OnR0bCI6IjEwODAwIn0%3D&callback=eyJjYWxsYmFja0JvZHlUeXBlIjoiYXBwbGljYXRpb24vanNvbiIsImNhbGxiYWNrU3RhZ2UiOiJiZWZvcmUtZXhlY3V0ZSIsImNhbGxiYWNrRmFpbHVyZUFjdGlvbiI6Imlnbm9yZSIsImNhbGxiYWNrVXJsIjoiaHR0cHM6Ly9hdXRoLWNkbi51Yy5jbi9vdXRlci9vc3MvY2hlY2twbGF5IiwiY2FsbGJhY2tCb2R5Ijoie1wiaG9zdFwiOiR7aHR0cEhlYWRlci5ob3N0fSxcInNpemVcIjoke3NpemV9LFwicmFuZ2VcIjoke2h0dHBIZWFkZXIucmFuZ2V9LFwicmVmZXJlclwiOiR7aHR0cEhlYWRlci5yZWZlcmVyfSxcImNvb2tpZVwiOiR7aHR0cEhlYWRlci5jb29raWV9LFwibWV0aG9kXCI6JHtodHRwSGVhZGVyLm1ldGhvZH0sXCJpcFwiOiR7Y2xpZW50SXB9LFwicG9ydFwiOiR7Y2xpZW50UG9ydH0sXCJvYmplY3RcIjoke29iamVjdH0sXCJzcFwiOiR7eDpzcH0sXCJ0b2tlblwiOiR7eDp0b2tlbn0sXCJhdVwiOiR7eDphdX0sXCJ0dGxcIjoke3g6dHRsfSxcImNsaWVudF90b2tlblwiOiR7cXVlcnlTdHJpbmcuY2xpZW50X3Rva2VufX0ifQ%3D%3D&ud=4-0-5-0-6-N-3-ft-0-2 -Cookie: __puus=dc48cb12577eb3df6fe84fdea250ad6fAAOF0LBv/M4HTtkYfuUNdcVLXHZl1x2mw8NQSdxo5abymS+irugphlPNv5kwQZkDI+pXaeOD22v/whNQT5AwUULF0q1nSNXmHqxr20AJjXlEhvbIZNgUfwmw8aOCyarrLi7o7w6w0Rod4DLCSeYGwlTF3P9jMcqCM+WqWHnxKY6i8gaXZkHLObatSHkwivB7Xpc= -Referer: https://fast.uc.cn/ diff --git a/web-service/src/main/resources/http-tools/pan-ye.http b/web-service/src/main/resources/http-tools/pan-ye.http index 1a98e61..6ad3c50 100644 --- a/web-service/src/main/resources/http-tools/pan-ye.http +++ b/web-service/src/main/resources/http-tools/pan-ye.http @@ -119,3 +119,8 @@ Platform:web {"ShareKey":"iaKtVv-6OECd","behavior":1} ### eaefamemdead +POST https://www.123pan.com/a/api/share/download/info?598392083=1691599441-4130548-2079498810 +App-Version:3 +Platform:web + +{"ShareKey":"iaKtVv-ICECd","FileID":2169781,"S3keyFlag":"1815268665-0","Size":163708684,"Etag":"e7f288198505ae4481d638f1f42f1477"} diff --git a/web-service/src/main/resources/http-tools/test.http b/web-service/src/main/resources/http-tools/test.http index e0e8532..ad85cdf 100644 --- a/web-service/src/main/resources/http-tools/test.http +++ b/web-service/src/main/resources/http-tools/test.http @@ -65,10 +65,10 @@ GET http://127.0.0.1:6400/fj/tIfhRqH ### 360亿方云 # @no-redirect -GET http://127.0.0.1:6400/parser?url=https://v2.fangcloud.com/sharing/fb54bdf03c66c04334fe3687a3 +GET http://127.0.0.1:6400/parser?url=https://v2.fangcloud.com/share/2f238f7714cf61cdc631d23d18 ### 360亿方云 -GET http://127.0.0.1:6400/json/fc/fb54bdf03c66c04334fe3687a3 +GET http://127.0.0.1:6400/json/fc/30646fefc8bf936a4766ab8a5e ### 360亿方云 # @no-redirect diff --git a/web-service/src/main/resources/js/ye123.js b/web-service/src/main/resources/js/ye123.js index bcca094..76f0399 100644 --- a/web-service/src/main/resources/js/ye123.js +++ b/web-service/src/main/resources/js/ye123.js @@ -38,7 +38,18 @@ function _0x1b5d95(_0x278d1a) { function _0x4f141a(_0x4075b1) { for (var _0x4eddcb = arguments['length'] > 0x1 && void 0x0 !== arguments[0x1] ? arguments[0x1] : 0xa, - _0x2fc680 = function() { + + _0x4ee01e = function(_0x3bb99e) { + var _0x3bb99e = _0x3bb99e['replace'](/\\r\\n/g, '\x5cn'); + for (var _0x585459 = '', _0x15c988 = 0x0; _0x15c988 < _0x3bb99e['length']; _0x15c988++) { + var _0x36bb3e = _0x3bb99e['charCodeAt'](_0x15c988); + _0x36bb3e < 0x80 ? _0x585459 += String['fromCharCode'](_0x36bb3e) : _0x36bb3e > 0x7f && _0x36bb3e < 0x800 ? (_0x585459 += String['fromCharCode'](_0x36bb3e >> 0x6 | 0xc0), + _0x585459 += String['fromCharCode'](0x3f & _0x36bb3e | 0x80)) : (_0x585459 += String['fromCharCode'](_0x36bb3e >> 0xc | 0xe0), + _0x585459 += String['fromCharCode'](_0x36bb3e >> 0x6 & 0x3f | 0x80), + _0x585459 += String['fromCharCode'](0x3f & _0x36bb3e | 0x80)); + } + return _0x585459; + }, _0x2fc680 = function() { for (var _0x515c63, _0x361314 = [], _0x4cbdba = 0x0; _0x4cbdba < 0x100; _0x4cbdba++) { _0x515c63 = _0x4cbdba; for (var _0x460960 = 0x0; _0x460960 < 0x8; _0x460960++) @@ -48,7 +59,7 @@ function _0x4f141a(_0x4075b1) { return _0x361314; }, _0x4aed86 = _0x2fc680(), - _0x5880f0 = _0x4075b1, + _0x5880f0 = _0x4ee01e(_0x4075b1), _0x492393 = -0x1, _0x25d82c = 0x0; _0x25d82c < _0x5880f0['length']; _0x25d82c++) diff --git a/web-service/src/test/java/cn/qaiu/web/test/TestAESUtil.java b/web-service/src/test/java/cn/qaiu/web/test/TestAESUtil.java index d9bae26..1a46244 100644 --- a/web-service/src/test/java/cn/qaiu/web/test/TestAESUtil.java +++ b/web-service/src/test/java/cn/qaiu/web/test/TestAESUtil.java @@ -65,8 +65,8 @@ public class TestAESUtil { @Test public void testKeyAuth(){ - System.out.println(AESUtils.getAuthKey("/b/api/share/download/info")); - System.out.println(AESUtils.getAuthKey("/b/api/share/download/info")); + System.out.println(AESUtils.getAuthKey("/a/api/share/download/info")); + System.out.println(AESUtils.getAuthKey("/a/api/share/download/info")); System.out.println(AESUtils.getAuthKey("/b/api/share/get")); }