mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-02-25 14:45:23 +00:00
Compare commits
75 Commits
dev-0.1.7
...
0.1.6-rele
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a0e22add8 | ||
|
|
a33863983e | ||
|
|
36db7b28bb | ||
|
|
123eef9f7b | ||
|
|
346d8fd253 | ||
|
|
86f50adaf4 | ||
|
|
281df7b3b1 | ||
|
|
a2b286c58a | ||
|
|
fd0a4abfaa | ||
|
|
989dd8fec5 | ||
|
|
dd3a43ccf8 | ||
|
|
31b1e7e955 | ||
|
|
38fb9623bb | ||
|
|
8b450a4850 | ||
|
|
88806b4622 | ||
|
|
e87149358c | ||
|
|
98aa767787 | ||
|
|
0946047136 | ||
|
|
1628a8f486 | ||
|
|
581c0662f8 | ||
|
|
5b3f614a64 | ||
|
|
db4131c4f9 | ||
|
|
1c0426d827 | ||
|
|
010780b82d | ||
|
|
78f29f7a75 | ||
|
|
5a630db5a6 | ||
|
|
cefcc576b6 | ||
|
|
0e3b5a3007 | ||
|
|
5e271b853c | ||
|
|
54e8f73427 | ||
|
|
34baecb535 | ||
|
|
f75f333cda | ||
|
|
8ea8338cbf | ||
|
|
fc1e10b016 | ||
|
|
87e2e6128a | ||
|
|
7799719b99 | ||
|
|
55a5b52faf | ||
|
|
a578bc58be | ||
|
|
18dc30c03d | ||
|
|
ff2b7608d2 | ||
|
|
5ac5cdced9 | ||
|
|
b6d0a6cd06 | ||
|
|
9a20636d2d | ||
|
|
f5abaca5a1 | ||
|
|
26ab5f7945 | ||
|
|
c14d8fccfd | ||
|
|
fe28050893 | ||
|
|
af9d890f98 | ||
|
|
c640b9d9d1 | ||
|
|
a1dff75bdf | ||
|
|
f02826339a | ||
|
|
656fd672fc | ||
|
|
baa2e0ac75 | ||
|
|
3375144af6 | ||
|
|
028b75cfd4 | ||
|
|
026cd72a4b | ||
|
|
db21eb99f0 | ||
|
|
09aa9a97c2 | ||
|
|
44d18ad273 | ||
|
|
44b82da51d | ||
|
|
0f65e6cb2e | ||
|
|
407f4fafd9 | ||
|
|
66850a72f7 | ||
|
|
4acf716868 | ||
|
|
2158be14ca | ||
|
|
21d3340f3c | ||
|
|
6972b5e761 | ||
|
|
eac1d62f76 | ||
|
|
b88fee9e83 | ||
|
|
e075967c14 | ||
|
|
2c8ee31cb7 | ||
|
|
1bbb7728d8 | ||
|
|
7e0d4b3bad | ||
|
|
5f25d32f97 | ||
|
|
a890ef54a3 |
@@ -1,5 +1,4 @@
|
|||||||
# netdisk-fast-download
|
# netdisk-fast-download
|
||||||
云盘解析服务 (nfd云解析)
|
|
||||||
预览地址 https://lz.qaiu.top
|
预览地址 https://lz.qaiu.top
|
||||||
|
|
||||||
[](https://github.com/qaiu/netdisk-fast-download/actions/workflows/maven.yml)
|
[](https://github.com/qaiu/netdisk-fast-download/actions/workflows/maven.yml)
|
||||||
@@ -7,14 +6,6 @@
|
|||||||
[](https://vertx-china.github.io/)
|
[](https://vertx-china.github.io/)
|
||||||
[](https://github.com/qaiu/netdisk-fast-download/releases/tag/0.1.6-releases)
|
[](https://github.com/qaiu/netdisk-fast-download/releases/tag/0.1.6-releases)
|
||||||
|
|
||||||
## 项目介绍
|
|
||||||
网盘直链解析工具能把网盘分享下载链接转化为直链,已支持蓝奏云/奶牛快传/移动云云空间/小飞机盘/亿方云/123云盘等,支持私密分享。
|
|
||||||
|
|
||||||
## 应用场景:
|
|
||||||
1. 游戏:使用本站工具可自动生成高速直流下载器,用于游戏客户端自动化高速下载安装、更新等。
|
|
||||||
2. 下载:可根据网盘分享的地址解析为直链,方便放到自己网站上供用户下载,节约服务器带宽和磁盘。
|
|
||||||
3. 音视频:可解析为音视频直链,可直接在网页上播放,高清,高速,节约服务器带宽和磁盘。
|
|
||||||
|
|
||||||
## 网盘支持情况:
|
## 网盘支持情况:
|
||||||
> 20230722 UC网盘解析失效,需要登录
|
> 20230722 UC网盘解析失效,需要登录
|
||||||
|
|
||||||
|
|||||||
@@ -157,8 +157,8 @@ public class CreateTable {
|
|||||||
return sql.substring(0, sql.length() - 1) + ");\r\n";
|
return sql.substring(0, sql.length() - 1) + ");\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void createTable(JDBCPool pool) {
|
public static void createTable(JDBCPool pool, String tableClassPath) {
|
||||||
Set<Class<?>> tableClassList = ReflectionUtil.getReflections().getTypesAnnotatedWith(Table.class);
|
Set<Class<?>> tableClassList = ReflectionUtil.getReflections(tableClassPath).getTypesAnnotatedWith(Table.class);
|
||||||
if (tableClassList.isEmpty()) LOGGER.info("Table model class not fount");
|
if (tableClassList.isEmpty()) LOGGER.info("Table model class not fount");
|
||||||
tableClassList.forEach(clazz -> {
|
tableClassList.forEach(clazz -> {
|
||||||
String createTableSQL = getCreateTableSQL(clazz);
|
String createTableSQL = getCreateTableSQL(clazz);
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public class JDBCPoolInit {
|
|||||||
private void poolInitExecute(Promise<String> promise) {
|
private void poolInitExecute(Promise<String> promise) {
|
||||||
// 初始化连接池
|
// 初始化连接池
|
||||||
pool = JDBCPool.pool(vertx, dbConfig);
|
pool = JDBCPool.pool(vertx, dbConfig);
|
||||||
CreateTable.createTable(pool);
|
CreateTable.createTable(pool, dbConfig.getString("tableClassPath"));
|
||||||
promise.complete("init jdbc pool success");
|
promise.complete("init jdbc pool success");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
<slf4j.version>2.0.5</slf4j.version>
|
<slf4j.version>2.0.5</slf4j.version>
|
||||||
<commons-lang3.version>3.12.0</commons-lang3.version>
|
<commons-lang3.version>3.12.0</commons-lang3.version>
|
||||||
<jackson.version>2.14.2</jackson.version>
|
<jackson.version>2.14.2</jackson.version>
|
||||||
<logback.version>1.4.6</logback.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
@@ -40,7 +39,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ch.qos.logback</groupId>
|
<groupId>ch.qos.logback</groupId>
|
||||||
<artifactId>logback-classic</artifactId>
|
<artifactId>logback-classic</artifactId>
|
||||||
<version>${logback.version}</version>
|
<version>1.4.6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package cn.qaiu.vx.core;
|
package cn.qaiu.vx.core;
|
||||||
|
|
||||||
|
import cn.qaiu.vx.core.util.ConfigConstant;
|
||||||
import cn.qaiu.vx.core.util.ConfigUtil;
|
import cn.qaiu.vx.core.util.ConfigUtil;
|
||||||
import cn.qaiu.vx.core.util.VertxHolder;
|
import cn.qaiu.vx.core.util.VertxHolder;
|
||||||
import cn.qaiu.vx.core.verticle.ReverseProxyVerticle;
|
import cn.qaiu.vx.core.verticle.ReverseProxyVerticle;
|
||||||
@@ -17,8 +18,6 @@ import java.util.Calendar;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.concurrent.locks.LockSupport;
|
import java.util.concurrent.locks.LockSupport;
|
||||||
|
|
||||||
import static cn.qaiu.vx.core.util.ConfigConstant.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* vertx启动类 需要在主启动类完成回调
|
* vertx启动类 需要在主启动类完成回调
|
||||||
* <br>Create date 2021-05-07 10:26:54
|
* <br>Create date 2021-05-07 10:26:54
|
||||||
@@ -109,10 +108,10 @@ public final class Deploy {
|
|||||||
private void deployVerticle() {
|
private void deployVerticle() {
|
||||||
tempVertx.close();
|
tempVertx.close();
|
||||||
LOGGER.info("配置读取成功");
|
LOGGER.info("配置读取成功");
|
||||||
customConfig = globalConfig.getJsonObject(CUSTOM);
|
customConfig = globalConfig.getJsonObject(ConfigConstant.CUSTOM);
|
||||||
|
|
||||||
JsonObject vertxConfig = globalConfig.getJsonObject(VERTX);
|
JsonObject vertxConfig = globalConfig.getJsonObject(ConfigConstant.VERTX);
|
||||||
Integer vertxConfigELPS = vertxConfig.getInteger(EVENT_LOOP_POOL_SIZE);
|
Integer vertxConfigELPS = vertxConfig.getInteger(ConfigConstant.EVENT_LOOP_POOL_SIZE);
|
||||||
var vertxOptions = vertxConfigELPS == 0 ?
|
var vertxOptions = vertxConfigELPS == 0 ?
|
||||||
new VertxOptions() : new VertxOptions(vertxConfig);
|
new VertxOptions() : new VertxOptions(vertxConfig);
|
||||||
|
|
||||||
@@ -123,10 +122,10 @@ public final class Deploy {
|
|||||||
VertxHolder.init(vertx);
|
VertxHolder.init(vertx);
|
||||||
//配置保存在共享数据中
|
//配置保存在共享数据中
|
||||||
var sharedData = vertx.sharedData();
|
var sharedData = vertx.sharedData();
|
||||||
LocalMap<String, Object> localMap = sharedData.getLocalMap(LOCAL);
|
LocalMap<String, Object> localMap = sharedData.getLocalMap(ConfigConstant.LOCAL);
|
||||||
localMap.put(GLOBAL_CONFIG, globalConfig);
|
localMap.put(ConfigConstant.GLOBAL_CONFIG, globalConfig);
|
||||||
localMap.put(CUSTOM_CONFIG, customConfig);
|
localMap.put(ConfigConstant.CUSTOM_CONFIG, customConfig);
|
||||||
localMap.put(SERVER, globalConfig.getJsonObject(SERVER));
|
localMap.put(ConfigConstant.SERVER, globalConfig.getJsonObject(ConfigConstant.SERVER));
|
||||||
var future0 = vertx.createSharedWorkerExecutor("other-handle").executeBlocking(bch -> {
|
var future0 = vertx.createSharedWorkerExecutor("other-handle").executeBlocking(bch -> {
|
||||||
handle.handle(globalConfig);
|
handle.handle(globalConfig);
|
||||||
bch.complete("other handle complete");
|
bch.complete("other handle complete");
|
||||||
@@ -170,7 +169,7 @@ public final class Deploy {
|
|||||||
* @return Deployment Options
|
* @return Deployment Options
|
||||||
*/
|
*/
|
||||||
private DeploymentOptions getWorkDeploymentOptions(String name) {
|
private DeploymentOptions getWorkDeploymentOptions(String name) {
|
||||||
return getWorkDeploymentOptions(name, customConfig.getInteger(ASYNC_SERVICE_INSTANCES));
|
return getWorkDeploymentOptions(name, customConfig.getInteger(ConfigConstant.ASYNC_SERVICE_INSTANCES));
|
||||||
}
|
}
|
||||||
|
|
||||||
private DeploymentOptions getWorkDeploymentOptions(String name, int ins) {
|
private DeploymentOptions getWorkDeploymentOptions(String name, int ins) {
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
package cn.qaiu.vx.core.annotaions;
|
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 拦截器配置注解
|
|
||||||
* 正则匹配拦截途径
|
|
||||||
*
|
|
||||||
* @author <a href="https://qaiu.top">QAIU</a>
|
|
||||||
*/
|
|
||||||
@Documented
|
|
||||||
@Inherited
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
public @interface InterceptorConfig {
|
|
||||||
|
|
||||||
String pattern() default "";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 注册顺序,数字越大越先注册
|
|
||||||
*/
|
|
||||||
int order() default 0;
|
|
||||||
}
|
|
||||||
@@ -6,7 +6,6 @@ import cn.qaiu.vx.core.annotaions.RouteMapping;
|
|||||||
import cn.qaiu.vx.core.annotaions.SockRouteMapper;
|
import cn.qaiu.vx.core.annotaions.SockRouteMapper;
|
||||||
import cn.qaiu.vx.core.base.BaseHttpApi;
|
import cn.qaiu.vx.core.base.BaseHttpApi;
|
||||||
import cn.qaiu.vx.core.enums.MIMEType;
|
import cn.qaiu.vx.core.enums.MIMEType;
|
||||||
import cn.qaiu.vx.core.interceptor.Interceptor;
|
|
||||||
import cn.qaiu.vx.core.model.JsonResult;
|
import cn.qaiu.vx.core.model.JsonResult;
|
||||||
import cn.qaiu.vx.core.util.*;
|
import cn.qaiu.vx.core.util.*;
|
||||||
import io.vertx.core.Future;
|
import io.vertx.core.Future;
|
||||||
@@ -23,7 +22,6 @@ import io.vertx.ext.web.RoutingContext;
|
|||||||
import io.vertx.ext.web.handler.BodyHandler;
|
import io.vertx.ext.web.handler.BodyHandler;
|
||||||
import io.vertx.ext.web.handler.CorsHandler;
|
import io.vertx.ext.web.handler.CorsHandler;
|
||||||
import io.vertx.ext.web.handler.StaticHandler;
|
import io.vertx.ext.web.handler.StaticHandler;
|
||||||
import io.vertx.ext.web.handler.TimeoutHandler;
|
|
||||||
import io.vertx.ext.web.handler.sockjs.SockJSHandler;
|
import io.vertx.ext.web.handler.sockjs.SockJSHandler;
|
||||||
import io.vertx.ext.web.handler.sockjs.SockJSHandlerOptions;
|
import io.vertx.ext.web.handler.sockjs.SockJSHandlerOptions;
|
||||||
import javassist.CtClass;
|
import javassist.CtClass;
|
||||||
@@ -40,7 +38,6 @@ import java.util.*;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import static cn.qaiu.vx.core.util.ConfigConstant.ROUTE_TIME_OUT;
|
|
||||||
import static io.vertx.core.http.HttpHeaders.*;
|
import static io.vertx.core.http.HttpHeaders.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,9 +62,10 @@ public class RouterHandlerFactory implements BaseHttpApi {
|
|||||||
|
|
||||||
private final String gatewayPrefix;
|
private final String gatewayPrefix;
|
||||||
|
|
||||||
public RouterHandlerFactory(String gatewayPrefix) {
|
public RouterHandlerFactory(String routerScanAddress, String gatewayPrefix) {
|
||||||
|
Objects.requireNonNull(routerScanAddress, "The router package address scan is empty.");
|
||||||
Objects.requireNonNull(gatewayPrefix, "The gateway prefix is empty.");
|
Objects.requireNonNull(gatewayPrefix, "The gateway prefix is empty.");
|
||||||
reflections = ReflectionUtil.getReflections();
|
reflections = ReflectionUtil.getReflections(routerScanAddress);
|
||||||
this.gatewayPrefix = gatewayPrefix;
|
this.gatewayPrefix = gatewayPrefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,8 +173,6 @@ public class RouterHandlerFactory implements BaseHttpApi {
|
|||||||
route.consumes(mineType);
|
route.consumes(mineType);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置默认超时
|
|
||||||
route.handler(TimeoutHandler.create(SharedDataUtil.getCustomConfig().getInteger(ROUTE_TIME_OUT)));
|
|
||||||
// 先执行拦截方法, 再进入业务请求
|
// 先执行拦截方法, 再进入业务请求
|
||||||
route.handler(interceptor);
|
route.handler(interceptor);
|
||||||
route.handler(ctx -> handlerMethod(instance, method, ctx)).failureHandler(ctx -> {
|
route.handler(ctx -> handlerMethod(instance, method, ctx)).failureHandler(ctx -> {
|
||||||
@@ -238,8 +234,10 @@ public class RouterHandlerFactory implements BaseHttpApi {
|
|||||||
private Handler<RoutingContext> getInterceptor() throws Throwable {
|
private Handler<RoutingContext> getInterceptor() throws Throwable {
|
||||||
// 配置拦截
|
// 配置拦截
|
||||||
Class<?> interceptorClass = Class.forName(SharedDataUtil.getValueForCustomConfig("interceptorClassPath"));
|
Class<?> interceptorClass = Class.forName(SharedDataUtil.getValueForCustomConfig("interceptorClassPath"));
|
||||||
Interceptor handleInstance = (Interceptor)ReflectionUtil.newWithNoParam(interceptorClass);
|
Object handleInstance = ReflectionUtil.newWithNoParam(interceptorClass);
|
||||||
return handleInstance.doHandle();
|
Method doHandle = interceptorClass.getMethod("doHandle");
|
||||||
|
// 反射调用
|
||||||
|
return CastUtil.cast(ReflectionUtil.invoke(doHandle, handleInstance));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,14 +3,11 @@ package cn.qaiu.vx.core.util;
|
|||||||
public interface ConfigConstant {
|
public interface ConfigConstant {
|
||||||
String CUSTOM = "custom";
|
String CUSTOM = "custom";
|
||||||
String VERTX = "vertx";
|
String VERTX = "vertx";
|
||||||
|
|
||||||
String EVENT_LOOP_POOL_SIZE = "eventLoopPoolSize";
|
String EVENT_LOOP_POOL_SIZE = "eventLoopPoolSize";
|
||||||
String LOCAL = "local";
|
String LOCAL = "local";
|
||||||
String SERVER = "server";
|
String SERVER = "server";
|
||||||
String GLOBAL_CONFIG = "globalConfig";
|
String GLOBAL_CONFIG = "globalConfig";
|
||||||
String CUSTOM_CONFIG = "customConfig";
|
String CUSTOM_CONFIG = "customConfig";
|
||||||
String ASYNC_SERVICE_INSTANCES = "asyncServiceInstances";
|
String ASYNC_SERVICE_INSTANCES = "asyncServiceInstances";
|
||||||
String IGNORES_REG="ignoresReg";
|
|
||||||
String BASE_LOCATIONS="baseLocations";
|
|
||||||
|
|
||||||
String ROUTE_TIME_OUT="routeTimeOut";
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,6 @@ import java.net.URL;
|
|||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static cn.qaiu.vx.core.util.ConfigConstant.BASE_LOCATIONS;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 基于org.reflection和javassist的反射工具包
|
* 基于org.reflection和javassist的反射工具包
|
||||||
* 通过包扫描实现路由地址的注解映射
|
* 通过包扫描实现路由地址的注解映射
|
||||||
@@ -35,16 +33,6 @@ import static cn.qaiu.vx.core.util.ConfigConstant.BASE_LOCATIONS;
|
|||||||
*/
|
*/
|
||||||
public final class ReflectionUtil {
|
public final class ReflectionUtil {
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 以默认配置的基础包路径获取反射器
|
|
||||||
*
|
|
||||||
* @return Reflections object
|
|
||||||
*/
|
|
||||||
public static Reflections getReflections() {
|
|
||||||
return getReflections(SharedDataUtil.getStringForCustomConfig(BASE_LOCATIONS));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取反射器
|
* 获取反射器
|
||||||
*
|
*
|
||||||
@@ -60,7 +48,6 @@ public final class ReflectionUtil {
|
|||||||
} else {
|
} else {
|
||||||
packageAddressList = Collections.singletonList(packageAddress);
|
packageAddressList = Collections.singletonList(packageAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
return getReflections(packageAddressList);
|
return getReflections(packageAddressList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,11 +70,10 @@ public final class ReflectionUtil {
|
|||||||
// 发现注解api层 没有继承父类时 这里反射一直有问题(Scanner SubTypesScanner was not configured)
|
// 发现注解api层 没有继承父类时 这里反射一直有问题(Scanner SubTypesScanner was not configured)
|
||||||
// 因此这里需要手动配置各种Scanner扫描器 -- https://blog.csdn.net/qq_29499107/article/details/106889781
|
// 因此这里需要手动配置各种Scanner扫描器 -- https://blog.csdn.net/qq_29499107/article/details/106889781
|
||||||
configurationBuilder.setScanners(
|
configurationBuilder.setScanners(
|
||||||
Scanners.SubTypes.filterResultsBy(s -> true), //允许getAllTypes获取所有Object的子类, 不设置为false则 getAllTypes
|
Scanners.SubTypes.filterResultsBy(s -> true), //允许getAllTypes获取所有Object的子类, 不设置为false则 getAllTypes 会报错.默认为true.
|
||||||
// 会报错.默认为true.
|
|
||||||
new MethodParameterNamesScanner(), //设置方法参数名称 扫描器,否则调用getConstructorParamNames 会报错
|
new MethodParameterNamesScanner(), //设置方法参数名称 扫描器,否则调用getConstructorParamNames 会报错
|
||||||
Scanners.MethodsAnnotated, //设置方法注解 扫描器, 否则getConstructorsAnnotatedWith,getMethodsAnnotatedWith 会报错
|
Scanners.MethodsAnnotated, //设置方法注解 扫描器, 否则getConstructorsAnnotatedWith,getMethodsAnnotatedWith 会报错
|
||||||
new MemberUsageScanner(), //设置 member 扫描器,否则 getMethodUsage 会报错
|
new MemberUsageScanner(), //设置 member 扫描器,否则 getMethodUsage 会报错, 不推荐使用,有可能会报错 Caused by: java.lang.ClassCastException: javassist.bytecode.InterfaceMethodrefInfo cannot be cast to javassist.bytecode.MethodrefInfo
|
||||||
Scanners.TypesAnnotated //设置类注解 扫描器 ,否则 getTypesAnnotatedWith 会报错
|
Scanners.TypesAnnotated //设置类注解 扫描器 ,否则 getTypesAnnotatedWith 会报错
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -112,8 +98,7 @@ public final class ReflectionUtil {
|
|||||||
MethodInfo methodInfo = cm.getMethodInfo();
|
MethodInfo methodInfo = cm.getMethodInfo();
|
||||||
CtClass[] parameterTypes = cm.getParameterTypes();
|
CtClass[] parameterTypes = cm.getParameterTypes();
|
||||||
CodeAttribute codeAttribute = methodInfo.getCodeAttribute();
|
CodeAttribute codeAttribute = methodInfo.getCodeAttribute();
|
||||||
LocalVariableAttribute attr =
|
LocalVariableAttribute attr = (LocalVariableAttribute) codeAttribute.getAttribute(LocalVariableAttribute.tag);
|
||||||
(LocalVariableAttribute) codeAttribute.getAttribute(LocalVariableAttribute.tag);
|
|
||||||
|
|
||||||
boolean flag = true;
|
boolean flag = true;
|
||||||
boolean flag2 = cm.getModifiers() - 1 != AccessFlag.STATIC;
|
boolean flag2 = cm.getModifiers() - 1 != AccessFlag.STATIC;
|
||||||
@@ -125,8 +110,7 @@ public final class ReflectionUtil {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
flag = false;
|
flag = false;
|
||||||
paramMap.put(attr.variableName(j + (flag2 ? 1 : 0)), Pair.of(parameterAnnotations[j - k],
|
paramMap.put(attr.variableName(j + (flag2 ? 1 : 0)), Pair.of(parameterAnnotations[j - k], parameterTypes[j - k]));
|
||||||
parameterTypes[j - k]));
|
|
||||||
}
|
}
|
||||||
} catch (NotFoundException e) {
|
} catch (NotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -230,8 +214,7 @@ public final class ReflectionUtil {
|
|||||||
if (ctClass.isPrimitive() || "java.util.Date".equals(ctClass.getName())) {
|
if (ctClass.isPrimitive() || "java.util.Date".equals(ctClass.getName())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return ctClass.getName().matches("^java\\.lang\\.((Boolean)|(Character)|(Byte)|(Short)|(Integer)|(Long)|" +
|
return ctClass.getName().matches("^java\\.lang\\.((Boolean)|(Character)|(Byte)|(Short)|(Integer)|(Long)|(Float)|(Double)|(String))$");
|
||||||
"(Float)|(Double)|(String))$");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -255,8 +238,7 @@ public final class ReflectionUtil {
|
|||||||
* @throws InstantiationException InstantiationException
|
* @throws InstantiationException InstantiationException
|
||||||
* @throws IllegalAccessException IllegalAccessException
|
* @throws IllegalAccessException IllegalAccessException
|
||||||
*/
|
*/
|
||||||
public static <T> T newWithNoParam(Class<T> handler) throws NoSuchMethodException, InvocationTargetException,
|
public static <T> T newWithNoParam(Class<T> handler) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
|
||||||
InstantiationException, IllegalAccessException {
|
|
||||||
return handler.getConstructor().newInstance();
|
return handler.getConstructor().newInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,11 +32,11 @@ public class SharedDataUtil {
|
|||||||
return (JsonObject) localMap.get(key);
|
return (JsonObject) localMap.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JsonObject getCustomConfig() {
|
public static JsonObject getJsonObjectForCustomConfig(String key) {
|
||||||
return getJsonConfig("customConfig");
|
return getJsonConfig("customConfig").getJsonObject(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getStringForCustomConfig(String key) {
|
public static String getJsonStringForCustomConfig(String key) {
|
||||||
return getJsonConfig("customConfig").getString(key);
|
return getJsonConfig("customConfig").getString(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package cn.qaiu.lz.common.util;
|
package cn.qaiu.vx.core.util;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -30,8 +30,6 @@ public class SnowflakeIdWorker {
|
|||||||
|
|
||||||
// ==============================Fields===========================================
|
// ==============================Fields===========================================
|
||||||
|
|
||||||
//开始时间截 (2021-01-01)
|
|
||||||
private static final long EPOCH = 1609459200000L;
|
|
||||||
/**
|
/**
|
||||||
* 机器id所占的位数
|
* 机器id所占的位数
|
||||||
*/
|
*/
|
||||||
@@ -135,7 +133,9 @@ public class SnowflakeIdWorker {
|
|||||||
//时间截向左移22位(5+5+12)
|
//时间截向左移22位(5+5+12)
|
||||||
long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits;
|
long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits;
|
||||||
|
|
||||||
return ((timestamp - EPOCH) << timestampLeftShift) //
|
//开始时间截 (2021-01-01)
|
||||||
|
long twepoch = 1609459200000L;
|
||||||
|
return ((timestamp - twepoch) << timestampLeftShift) //
|
||||||
| (datacenterId << datacenterIdShift) //
|
| (datacenterId << datacenterIdShift) //
|
||||||
| (workerId << sequenceBits) //
|
| (workerId << sequenceBits) //
|
||||||
| sequence;
|
| sequence;
|
||||||
@@ -220,4 +220,24 @@ public class SnowflakeIdWorker {
|
|||||||
}
|
}
|
||||||
return snowflakeIdWorkerCluster;
|
return snowflakeIdWorkerCluster;
|
||||||
}
|
}
|
||||||
|
//==============================Test=============================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试
|
||||||
|
*/
|
||||||
|
public static void main(String[] args) {
|
||||||
|
final SnowflakeIdWorker snowflakeIdWorkerCluster = idWorkerCluster(0, 1);
|
||||||
|
final SnowflakeIdWorker idWorker = idWorker();
|
||||||
|
for (int i = 0; i < 100; i++) {
|
||||||
|
long id = idWorker.nextId();
|
||||||
|
System.out.println(Long.toBinaryString(id));
|
||||||
|
System.out.println(id);
|
||||||
|
System.out.println("------------");
|
||||||
|
id = snowflakeIdWorkerCluster.nextId();
|
||||||
|
System.out.println(Long.toBinaryString(id));
|
||||||
|
System.out.println(id);
|
||||||
|
System.out.println("------------\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -23,6 +23,7 @@ public class RouterVerticle extends AbstractVerticle {
|
|||||||
|
|
||||||
private static final int port = SharedDataUtil.getValueForServerConfig("port");
|
private static final int port = SharedDataUtil.getValueForServerConfig("port");
|
||||||
private static final Router router = new RouterHandlerFactory(
|
private static final Router router = new RouterHandlerFactory(
|
||||||
|
SharedDataUtil.getJsonStringForCustomConfig("routerLocations"),
|
||||||
SharedDataUtil.getJsonStringForServerConfig("contextPath")).createRouter();
|
SharedDataUtil.getJsonStringForServerConfig("contextPath")).createRouter();
|
||||||
|
|
||||||
private static final JsonObject globalConfig = SharedDataUtil.getJsonConfig("globalConfig");
|
private static final JsonObject globalConfig = SharedDataUtil.getJsonConfig("globalConfig");
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package cn.qaiu.vx.core.verticle;
|
|||||||
import cn.qaiu.vx.core.annotaions.Service;
|
import cn.qaiu.vx.core.annotaions.Service;
|
||||||
import cn.qaiu.vx.core.base.BaseAsyncService;
|
import cn.qaiu.vx.core.base.BaseAsyncService;
|
||||||
import cn.qaiu.vx.core.util.ReflectionUtil;
|
import cn.qaiu.vx.core.util.ReflectionUtil;
|
||||||
|
import cn.qaiu.vx.core.util.SharedDataUtil;
|
||||||
import io.vertx.core.AbstractVerticle;
|
import io.vertx.core.AbstractVerticle;
|
||||||
import io.vertx.core.Promise;
|
import io.vertx.core.Promise;
|
||||||
import io.vertx.serviceproxy.ServiceBinder;
|
import io.vertx.serviceproxy.ServiceBinder;
|
||||||
@@ -26,7 +27,8 @@ public class ServiceVerticle extends AbstractVerticle {
|
|||||||
private static final Set<Class<?>> handlers;
|
private static final Set<Class<?>> handlers;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Reflections reflections = ReflectionUtil.getReflections();
|
String handlerLocations = SharedDataUtil.getJsonStringForCustomConfig("handlerLocations");
|
||||||
|
Reflections reflections = ReflectionUtil.getReflections(handlerLocations);
|
||||||
handlers = reflections.getTypesAnnotatedWith(Service.class);
|
handlers = reflections.getTypesAnnotatedWith(Service.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import io.vertx.core.json.JsonArray;
|
|||||||
import io.vertx.ext.web.RoutingContext;
|
import io.vertx.ext.web.RoutingContext;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import static cn.qaiu.vx.core.util.ConfigConstant.IGNORES_REG;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 默认拦截器实现
|
* 默认拦截器实现
|
||||||
* 校验用户是否合法 <br>
|
* 校验用户是否合法 <br>
|
||||||
@@ -17,8 +15,7 @@ import static cn.qaiu.vx.core.util.ConfigConstant.IGNORES_REG;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class DefaultInterceptor implements Interceptor, BaseHttpApi {
|
public class DefaultInterceptor implements Interceptor, BaseHttpApi {
|
||||||
|
|
||||||
|
private final JsonArray ignores = SharedDataUtil.getJsonArrayForCustomConfig("ignoresReg");
|
||||||
protected final JsonArray ignores = SharedDataUtil.getJsonArrayForCustomConfig(IGNORES_REG);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void beforeHandle(RoutingContext ctx) {
|
public void beforeHandle(RoutingContext ctx) {
|
||||||
@@ -26,7 +23,7 @@ public class DefaultInterceptor implements Interceptor, BaseHttpApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterHandle(RoutingContext ctx) {
|
public void afterHandle(RoutingContext context) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
package cn.qaiu.lz.common.model;
|
|
||||||
|
|
||||||
import cn.qaiu.lz.common.util.SnowflakeIdWorker;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
abstract public class BaseModel {
|
|
||||||
public static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
|
|
||||||
private String id = String.valueOf(SnowflakeIdWorker.idWorker().nextId());
|
|
||||||
|
|
||||||
private String createBy;
|
|
||||||
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
private String updateBy;
|
|
||||||
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package cn.qaiu.lz.common.model;
|
|
||||||
|
|
||||||
import io.vertx.core.MultiMap;
|
|
||||||
|
|
||||||
public class FileInfo extends BaseModel {
|
|
||||||
|
|
||||||
private String fileName;
|
|
||||||
|
|
||||||
private String fileType;
|
|
||||||
|
|
||||||
private Long fileSize;
|
|
||||||
|
|
||||||
private String download;
|
|
||||||
|
|
||||||
private MultiMap header;
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package cn.qaiu.lz.common.model;
|
|
||||||
|
|
||||||
public class ParserInfo {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -23,7 +23,7 @@ public interface IPanTool {
|
|||||||
|
|
||||||
static IPanTool shareURLPrefixMatching(String url, String pwd) {
|
static IPanTool shareURLPrefixMatching(String url, String pwd) {
|
||||||
|
|
||||||
if (url.contains(CowTool.LINK_KEY)) {
|
if (url.startsWith(CowTool.SHARE_URL_PREFIX)) {
|
||||||
return new CowTool(url, pwd);
|
return new CowTool(url, pwd);
|
||||||
} else if (url.startsWith(EcTool.SHARE_URL_PREFIX)) {
|
} else if (url.startsWith(EcTool.SHARE_URL_PREFIX)) {
|
||||||
return new EcTool(url, pwd);
|
return new EcTool(url, pwd);
|
||||||
@@ -35,7 +35,7 @@ public interface IPanTool {
|
|||||||
return new YeTool(url, pwd);
|
return new YeTool(url, pwd);
|
||||||
} else if (url.startsWith(FjTool.SHARE_URL_PREFIX)) {
|
} else if (url.startsWith(FjTool.SHARE_URL_PREFIX)) {
|
||||||
return new FjTool(url, pwd);
|
return new FjTool(url, pwd);
|
||||||
} else if (url.contains(LzTool.LINK_KEY)) {
|
} else if (url.contains("lanzou")) {
|
||||||
return new LzTool(url, pwd);
|
return new LzTool(url, pwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ public class CowTool extends PanBase implements IPanTool {
|
|||||||
private static final String API_REQUEST_URL = "https://cowtransfer.com/core/api/transfer/share";
|
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 static final String SHARE_URL_PREFIX = "https://cowtransfer.com/s/";
|
||||||
|
|
||||||
public static final String LINK_KEY = "cowtransfer.com/s/";
|
|
||||||
|
|
||||||
public CowTool(String key, String pwd) {
|
public CowTool(String key, String pwd) {
|
||||||
super(key, pwd);
|
super(key, pwd);
|
||||||
}
|
}
|
||||||
@@ -32,16 +30,8 @@ public class CowTool extends PanBase implements IPanTool {
|
|||||||
if ("success".equals(resJson.getString("message")) && resJson.containsKey("data")) {
|
if ("success".equals(resJson.getString("message")) && resJson.containsKey("data")) {
|
||||||
JsonObject dataJson = resJson.getJsonObject("data");
|
JsonObject dataJson = resJson.getJsonObject("data");
|
||||||
String guid = dataJson.getString("guid");
|
String guid = dataJson.getString("guid");
|
||||||
StringBuilder url2Build = new StringBuilder(API_REQUEST_URL + "/download?transferGuid=" + guid);
|
String fileId = dataJson.getJsonObject("firstFile").getString("id");
|
||||||
if (dataJson.getBoolean("zipDownload")) {
|
String url2 = API_REQUEST_URL + "/download?transferGuid=" + guid + "&fileId=" + fileId;
|
||||||
// &title=xxx
|
|
||||||
JsonObject firstFolder = dataJson.getJsonObject("firstFolder");
|
|
||||||
url2Build.append("&title=").append(firstFolder.getString("title"));
|
|
||||||
} else {
|
|
||||||
String fileId = dataJson.getJsonObject("firstFile").getString("id");
|
|
||||||
url2Build.append("&fileId=").append(fileId);
|
|
||||||
}
|
|
||||||
String url2 = url2Build.toString();
|
|
||||||
client.getAbs(url2).send().onSuccess(res2 -> {
|
client.getAbs(url2).send().onSuccess(res2 -> {
|
||||||
JsonObject res2Json = res2.bodyAsJsonObject();
|
JsonObject res2Json = res2.bodyAsJsonObject();
|
||||||
if ("success".equals(res2Json.getString("message")) && res2Json.containsKey("data")) {
|
if ("success".equals(res2Json.getString("message")) && res2Json.containsKey("data")) {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package cn.qaiu.lz.common.parser.impl;
|
|||||||
|
|
||||||
import cn.qaiu.lz.common.parser.IPanTool;
|
import cn.qaiu.lz.common.parser.IPanTool;
|
||||||
import cn.qaiu.lz.common.parser.PanBase;
|
import cn.qaiu.lz.common.parser.PanBase;
|
||||||
import cn.qaiu.lz.common.util.JsExecUtils;
|
|
||||||
import cn.qaiu.vx.core.util.VertxHolder;
|
import cn.qaiu.vx.core.util.VertxHolder;
|
||||||
import io.vertx.core.Future;
|
import io.vertx.core.Future;
|
||||||
import io.vertx.core.MultiMap;
|
import io.vertx.core.MultiMap;
|
||||||
@@ -10,10 +9,7 @@ import io.vertx.core.Promise;
|
|||||||
import io.vertx.core.json.JsonObject;
|
import io.vertx.core.json.JsonObject;
|
||||||
import io.vertx.ext.web.client.WebClient;
|
import io.vertx.ext.web.client.WebClient;
|
||||||
import io.vertx.ext.web.client.WebClientOptions;
|
import io.vertx.ext.web.client.WebClientOptions;
|
||||||
import org.openjdk.nashorn.api.scripting.ScriptObjectMirror;
|
|
||||||
|
|
||||||
import javax.script.ScriptException;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@@ -27,13 +23,10 @@ public class LzTool extends PanBase implements IPanTool {
|
|||||||
|
|
||||||
public static final String SHARE_URL_PREFIX = "https://wwwa.lanzoui.com";
|
public static final String SHARE_URL_PREFIX = "https://wwwa.lanzoui.com";
|
||||||
|
|
||||||
public static final String LINK_KEY = "lanzou";
|
|
||||||
|
|
||||||
public LzTool(String key, String pwd) {
|
public LzTool(String key, String pwd) {
|
||||||
super(key, pwd);
|
super(key, pwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public Future<String> parse() {
|
public Future<String> parse() {
|
||||||
String sUrl = key.startsWith("https://") ? key : SHARE_URL_PREFIX + "/" + key;
|
String sUrl = key.startsWith("https://") ? key : SHARE_URL_PREFIX + "/" + key;
|
||||||
|
|
||||||
@@ -44,66 +37,35 @@ public class LzTool extends PanBase implements IPanTool {
|
|||||||
// 匹配iframe
|
// 匹配iframe
|
||||||
Pattern compile = Pattern.compile("src=\"(/fn\\?[a-zA-Z\\d_+/=]{16,})\"");
|
Pattern compile = Pattern.compile("src=\"(/fn\\?[a-zA-Z\\d_+/=]{16,})\"");
|
||||||
Matcher matcher = compile.matcher(html);
|
Matcher matcher = compile.matcher(html);
|
||||||
// 没有Iframe说明是加密分享, 匹配sign通过密码请求下载页面
|
|
||||||
if (!matcher.find()) {
|
if (!matcher.find()) {
|
||||||
// 处理一下JS
|
// 没有Iframe说明是加密分享, 匹配sign通过密码请求下载页面
|
||||||
String jsText = getJsText(html);
|
Pattern compile2 = Pattern.compile("sign=(\\w{16,})");
|
||||||
|
Matcher matcher2 = compile2.matcher(html);
|
||||||
if (jsText == null) {
|
if (!matcher2.find()) {
|
||||||
fail(SHARE_URL_PREFIX + " -> " + sUrl + ": js脚本匹配失败, 可能分享已失效");
|
fail(sUrl + ": sign正则匹配失败, 可能分享已失效");
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
jsText = jsText.replace("document.getElementById('pwd').value", "\"" + pwd + "\"");
|
|
||||||
jsText = jsText.substring(0, jsText.indexOf("document.getElementById('rpt')"));
|
|
||||||
try {
|
|
||||||
ScriptObjectMirror scriptObjectMirror = JsExecUtils.executeDynamicJs(jsText, "down_p");
|
|
||||||
getDownURL(promise, sUrl, client, (Map<String, String>) scriptObjectMirror.get("data"));
|
|
||||||
} catch (ScriptException | NoSuchMethodException e) {
|
|
||||||
fail(e, "js引擎执行失败");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
String sign = matcher2.group(1);
|
||||||
|
getDownURL(promise, sUrl, client, sign);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String iframePath = matcher.group(1);
|
String iframePath = matcher.group(1);
|
||||||
client.getAbs(SHARE_URL_PREFIX + iframePath).send().onSuccess(res2 -> {
|
client.getAbs(SHARE_URL_PREFIX + iframePath).send().onSuccess(res2 -> {
|
||||||
String html2 = res2.bodyAsString();
|
String html2 = res2.bodyAsString();
|
||||||
|
System.out.println(html);
|
||||||
// 去TMD正则
|
Matcher matcher2 = Pattern.compile("'sign'\s*:\s*'(\\w+)'").matcher(html2);
|
||||||
// Matcher matcher2 = Pattern.compile("'sign'\s*:\s*'(\\w+)'").matcher(html2);
|
if (!matcher2.find()) {
|
||||||
String jsText = getJsText(html2);
|
fail(SHARE_URL_PREFIX + iframePath + " -> " + sUrl + ": sign正则匹配失败, 可能分享已失效");
|
||||||
if (jsText == null) {
|
|
||||||
fail(SHARE_URL_PREFIX + iframePath + " -> " + sUrl + ": js脚本匹配失败, 可能分享已失效");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
String sign = matcher2.group(1);
|
||||||
ScriptObjectMirror scriptObjectMirror = JsExecUtils.executeDynamicJs(jsText, null);
|
getDownURL(promise, sUrl, client, sign);
|
||||||
getDownURL(promise, sUrl, client, (Map<String, String>) scriptObjectMirror.get("data"));
|
|
||||||
} catch (ScriptException | NoSuchMethodException e) {
|
|
||||||
fail(e, "js引擎执行失败");
|
|
||||||
}
|
|
||||||
}).onFailure(handleFail(SHARE_URL_PREFIX));
|
}).onFailure(handleFail(SHARE_URL_PREFIX));
|
||||||
}).onFailure(handleFail(sUrl));
|
}).onFailure(handleFail(sUrl));
|
||||||
return promise.future();
|
return promise.future();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getJsText(String html) {
|
private void getDownURL(Promise<String> promise, String key, WebClient client, String sign) {
|
||||||
String jsTagStart = "<script type=\"text/javascript\">";
|
|
||||||
String jsTagEnd = "</script>";
|
|
||||||
int index = html.indexOf(jsTagStart);
|
|
||||||
if (index == -1) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
int startPos = index + jsTagStart.length();
|
|
||||||
int endPos = html.indexOf(jsTagEnd, startPos);
|
|
||||||
return html.substring(startPos, endPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void getDownURL(Promise<String> promise, String key, WebClient client, Map<String, ?> signMap) {
|
|
||||||
MultiMap map = MultiMap.caseInsensitiveMultiMap();
|
|
||||||
signMap.forEach((k, v) -> {
|
|
||||||
map.set(k, v.toString());
|
|
||||||
});
|
|
||||||
MultiMap headers = MultiMap.caseInsensitiveMultiMap();
|
MultiMap headers = MultiMap.caseInsensitiveMultiMap();
|
||||||
var userAgent2 = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, " +
|
var userAgent2 = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, " +
|
||||||
"like " +
|
"like " +
|
||||||
@@ -117,7 +79,8 @@ public class LzTool extends PanBase implements IPanTool {
|
|||||||
String url = SHARE_URL_PREFIX + "/ajaxm.php";
|
String url = SHARE_URL_PREFIX + "/ajaxm.php";
|
||||||
client.postAbs(url).putHeaders(headers).sendForm(MultiMap
|
client.postAbs(url).putHeaders(headers).sendForm(MultiMap
|
||||||
.caseInsensitiveMultiMap()
|
.caseInsensitiveMultiMap()
|
||||||
.setAll(map)).onSuccess(res2 -> {
|
.set("action", "downprocess")
|
||||||
|
.set("sign", sign).set("p", pwd)).onSuccess(res2 -> {
|
||||||
JsonObject urlJson = res2.bodyAsJsonObject();
|
JsonObject urlJson = res2.bodyAsJsonObject();
|
||||||
if (urlJson.getInteger("zt") != 1) {
|
if (urlJson.getInteger("zt") != 1) {
|
||||||
fail(urlJson.getString("inf"));
|
fail(urlJson.getString("inf"));
|
||||||
|
|||||||
@@ -8,16 +8,12 @@ import java.util.Map;
|
|||||||
public class CommonUtils {
|
public class CommonUtils {
|
||||||
|
|
||||||
public static String adaptShortPaths(String urlPrefix, String url) {
|
public static String adaptShortPaths(String urlPrefix, String url) {
|
||||||
|
if (!url.startsWith(urlPrefix)) {
|
||||||
|
url = urlPrefix + url;
|
||||||
|
}
|
||||||
if (url.endsWith(".html")) {
|
if (url.endsWith(".html")) {
|
||||||
url = url.substring(0, url.length() - 5);
|
url = url.substring(0, url.length() - 5);
|
||||||
}
|
}
|
||||||
String prefix = "https://";
|
|
||||||
if (!url.startsWith(urlPrefix) && url.startsWith(prefix)) {
|
|
||||||
urlPrefix = urlPrefix.substring(prefix.length());
|
|
||||||
return url.substring(url.indexOf(urlPrefix) + urlPrefix.length());
|
|
||||||
} else if (!url.startsWith(urlPrefix)) {
|
|
||||||
url = urlPrefix + url;
|
|
||||||
}
|
|
||||||
return url.substring(urlPrefix.length());
|
return url.substring(urlPrefix.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +1,24 @@
|
|||||||
package cn.qaiu.lz.common.util;
|
package cn.qaiu.lz.common.util;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.openjdk.nashorn.api.scripting.ScriptObjectMirror;
|
import org.openjdk.nashorn.api.scripting.ScriptObjectMirror;
|
||||||
|
|
||||||
import javax.script.Invocable;
|
import javax.script.Invocable;
|
||||||
import javax.script.ScriptEngine;
|
import javax.script.ScriptEngine;
|
||||||
import javax.script.ScriptEngineManager;
|
import javax.script.ScriptEngineManager;
|
||||||
import javax.script.ScriptException;
|
import javax.script.ScriptException;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行Js脚本
|
* 执行Js脚本
|
||||||
*
|
|
||||||
* @author <a href="https://qaiu.top">QAIU</a>
|
* @author <a href="https://qaiu.top">QAIU</a>
|
||||||
* @date 2023/7/29 17:35
|
* @date 2023/7/29 17:35
|
||||||
*/
|
*/
|
||||||
public class JsExecUtils {
|
public class JsExecUtils {
|
||||||
private static final String JS_PATH = "js/ye123.js";
|
private static final String JS_PATH = "/js/ye123.js";
|
||||||
private static final String LZ_JS_PATH = "js/lz.js";
|
private static Invocable inv;
|
||||||
|
|
||||||
private static final String RES_PATH;
|
|
||||||
private static final Invocable inv;
|
|
||||||
|
|
||||||
// 初始化脚本引擎
|
// 初始化脚本引擎
|
||||||
static {
|
static {
|
||||||
@@ -36,9 +29,9 @@ public class JsExecUtils {
|
|||||||
if (resource == null) {
|
if (resource == null) {
|
||||||
throw new RuntimeException("js resource path is null");
|
throw new RuntimeException("js resource path is null");
|
||||||
}
|
}
|
||||||
RES_PATH = resource.getPath();
|
String path = resource.getPath();
|
||||||
String reader = RES_PATH + JS_PATH;
|
String reader = path + JS_PATH;
|
||||||
try (FileReader fReader = new FileReader(reader)) {
|
try (FileReader fReader = new FileReader(reader)){
|
||||||
engine.eval(fReader);
|
engine.eval(fReader);
|
||||||
fReader.close();
|
fReader.close();
|
||||||
inv = (Invocable) engine;
|
inv = (Invocable) engine;
|
||||||
@@ -50,40 +43,8 @@ public class JsExecUtils {
|
|||||||
/**
|
/**
|
||||||
* 调用js文件
|
* 调用js文件
|
||||||
*/
|
*/
|
||||||
public static ScriptObjectMirror executeJs(String functionName, Object... args) throws ScriptException,
|
public static ScriptObjectMirror executeJs(String functionName, Object... args) throws ScriptException, NoSuchMethodException {
|
||||||
NoSuchMethodException {
|
//调用js中的方法
|
||||||
//调用js中的函数
|
|
||||||
return (ScriptObjectMirror) inv.invokeFunction(functionName, args);
|
return (ScriptObjectMirror) inv.invokeFunction(functionName, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 调用执行蓝奏云js文件
|
|
||||||
*/
|
|
||||||
public static ScriptObjectMirror executeDynamicJs(String jsText, String funName) throws ScriptException,
|
|
||||||
NoSuchMethodException {
|
|
||||||
ScriptEngineManager engineManager = new ScriptEngineManager();
|
|
||||||
ScriptEngine engine = engineManager.getEngineByName("JavaScript"); // 得到脚本引擎
|
|
||||||
try {
|
|
||||||
//获取文件所在的相对路径
|
|
||||||
Path path;
|
|
||||||
try {
|
|
||||||
path = Paths.get(RES_PATH + LZ_JS_PATH);
|
|
||||||
} catch (RuntimeException ioe) {
|
|
||||||
path = Paths.get(RES_PATH.substring(1) + LZ_JS_PATH);
|
|
||||||
}
|
|
||||||
String jsContent = Files.readString(path) + "\n" + jsText;
|
|
||||||
engine.eval(jsContent);
|
|
||||||
Invocable inv = (Invocable) engine;
|
|
||||||
//调用js中的函数
|
|
||||||
if (StringUtils.isNotEmpty(funName)) {
|
|
||||||
inv.invokeFunction(funName);
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (ScriptObjectMirror) engine.get("signObj");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package cn.qaiu.lz.web.http;
|
package cn.qaiu.lz.web.http;
|
||||||
|
|
||||||
import cn.qaiu.lz.common.parser.IPanTool;
|
import cn.qaiu.lz.common.parser.IPanTool;
|
||||||
import cn.qaiu.lz.common.parser.impl.EcTool;
|
import cn.qaiu.lz.common.parser.impl.*;
|
||||||
import cn.qaiu.lz.web.model.SysUser;
|
import cn.qaiu.lz.web.model.SysUser;
|
||||||
import cn.qaiu.lz.web.service.UserService;
|
import cn.qaiu.lz.web.service.UserService;
|
||||||
import cn.qaiu.vx.core.annotaions.RouteHandler;
|
import cn.qaiu.vx.core.annotaions.RouteHandler;
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import cn.qaiu.lz.web.service.UserService;
|
|||||||
import cn.qaiu.vx.core.annotaions.Service;
|
import cn.qaiu.vx.core.annotaions.Service;
|
||||||
import io.vertx.core.Future;
|
import io.vertx.core.Future;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* lz-web
|
* lz-web
|
||||||
* <br>Create date 2021/8/27 14:09
|
* <br>Create date 2021/8/27 14:09
|
||||||
@@ -19,11 +17,6 @@ public class UserServiceImpl implements UserService {
|
|||||||
@Override
|
@Override
|
||||||
public Future<String> login(SysUser user) {
|
public Future<String> login(SysUser user) {
|
||||||
|
|
||||||
try {
|
|
||||||
TimeUnit.SECONDS.sleep(6);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
return Future.succeededFuture("111");
|
return Future.succeededFuture("111");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,21 +19,19 @@ custom:
|
|||||||
# 异步服务线程数
|
# 异步服务线程数
|
||||||
asyncServiceInstances: 4
|
asyncServiceInstances: 4
|
||||||
# server路由(controller层)所在包路径
|
# server路由(controller层)所在包路径
|
||||||
baseLocations: cn.qaiu.lz
|
routerLocations: cn.qaiu.lz.web.http
|
||||||
# 路由处理默认超时时间(毫秒)
|
|
||||||
routeTimeOut: 15000
|
|
||||||
# 拦截器包路径
|
# 拦截器包路径
|
||||||
interceptorClassPath: cn.qaiu.lz.common.interceptorImpl.DefaultInterceptor
|
interceptorClassPath: cn.qaiu.lz.common.interceptorImpl.DefaultInterceptor
|
||||||
# 拦截器匹配规则
|
# server层包路径
|
||||||
|
handlerLocations: cn.qaiu.lz.web.service
|
||||||
|
# 匹配规则
|
||||||
ignoresReg:
|
ignoresReg:
|
||||||
- .*/login$
|
- .*/login$
|
||||||
- .*/test.*$
|
- .*/test.*$
|
||||||
|
# 实体类包路径匹配正则
|
||||||
# 参数注入的实体类包路径匹配正则 (防止同名类引发歧义)
|
|
||||||
entityPackagesReg:
|
entityPackagesReg:
|
||||||
- ^cn\.qaiu\.lz\.web\.model\..*
|
- ^cn\.qaiu\.lz\.web\.model\..*
|
||||||
|
|
||||||
|
|
||||||
# 数据源配置
|
# 数据源配置
|
||||||
dataSource:
|
dataSource:
|
||||||
provider_class: io.vertx.ext.jdbc.spi.impl.HikariCPDataSourceProvider
|
provider_class: io.vertx.ext.jdbc.spi.impl.HikariCPDataSourceProvider
|
||||||
|
|||||||
@@ -46,14 +46,15 @@ Content-Disposition: form-data; name="email"
|
|||||||
--WebAppBoundary
|
--WebAppBoundary
|
||||||
Content-Disposition: form-data; name="joinProToken"
|
Content-Disposition: form-data; name="joinProToken"
|
||||||
|
|
||||||
|
|
||||||
--WebAppBoundary--
|
--WebAppBoundary--
|
||||||
|
|
||||||
###
|
|
||||||
|
|
||||||
https://cowtransfer.com/core/api/transfer/share/download?transferGuid=eb9df924-7b29-496b-8147-96762fc81d28&title=spring-play
|
|
||||||
|
|
||||||
###
|
###
|
||||||
https://cowtransfer.com/core/api/transfer/share/download?transferGuid=
|
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch web-service/src/main/resources/http-tools/test.http' --prune-empty --tag-name-filter cat -- --all
|
||||||
|
git push origin master --force
|
||||||
###
|
rmdir .git/refs/original/
|
||||||
https://cowtransfer.com/core/api/transfer/share/download?transferGuid=eb9df924-7b29-496b-8147-96762fc81d28
|
git reflog expire --expire=now --all
|
||||||
|
git gc --prune=now
|
||||||
|
git gc --aggressive --prune=now
|
||||||
|
|||||||
@@ -24,13 +24,4 @@ https://developer.lanzoug.com/file/?VDJbZVxtADFSWwY+U2YHa1FuU2tTYgBnBnUGZFNmWylS
|
|||||||
###
|
###
|
||||||
https://developer.lanzoug.com/file/?VTNVa1tqAjMFDAM7BDEAbAE+U2tfbgZhBnVbOQUwVCYEb1IoAToCNwQhVnRXLlcyVWAEdl9uVzkEbFYxVm5VeVVlVSxbNwJ4BWADeAQyAGgBNVN4X3oGbQZxW3sFP1Q8BGhSYAEDAj8ENlY9VzJXZ1U3BDFfMldlBDFWaVY9VXJVM1VxWzsCZwVlA2QEYAAwAWtTYF8wBiIGcVstBWRUZwQ0UjcBbwJ5BGJWNVcsV2RVOgQuX2NXZgQ2VjJWMlVhVWdVNlswAm8FagMxBGAANgE6UzdfYwZgBjFbbAU6VGwEZVIyAWQCZQRkVjZXMFdmVTcENV8uVy8EalYgVixVIVUmVWdbdAI/BTcDaARhADEBblNvXzQGPQY5W3sFLVQ8BGlSYAE6AmsEY1Y2VztXY1U/BDFfM1dnBDRWZFYkVXpVc1VkW2oCIQVuA2QEZgA5AW5TZl8wBjYGMFtkBWFUcwRxUnUBKwJrBGNWNlc7V2NVPwQxXzJXZQQzVmdWLFUhVTxVcls7AmcFYgNnBH4AMwFoU2RfLgY1BjVbawV3VGIEPA==
|
https://developer.lanzoug.com/file/?VTNVa1tqAjMFDAM7BDEAbAE+U2tfbgZhBnVbOQUwVCYEb1IoAToCNwQhVnRXLlcyVWAEdl9uVzkEbFYxVm5VeVVlVSxbNwJ4BWADeAQyAGgBNVN4X3oGbQZxW3sFP1Q8BGhSYAEDAj8ENlY9VzJXZ1U3BDFfMldlBDFWaVY9VXJVM1VxWzsCZwVlA2QEYAAwAWtTYF8wBiIGcVstBWRUZwQ0UjcBbwJ5BGJWNVcsV2RVOgQuX2NXZgQ2VjJWMlVhVWdVNlswAm8FagMxBGAANgE6UzdfYwZgBjFbbAU6VGwEZVIyAWQCZQRkVjZXMFdmVTcENV8uVy8EalYgVixVIVUmVWdbdAI/BTcDaARhADEBblNvXzQGPQY5W3sFLVQ8BGlSYAE6AmsEY1Y2VztXY1U/BDFfM1dnBDRWZFYkVXpVc1VkW2oCIQVuA2QEZgA5AW5TZl8wBjYGMFtkBWFUcwRxUnUBKwJrBGNWNlc7V2NVPwQxXzJXZQQzVmdWLFUhVTxVcls7AmcFYgNnBH4AMwFoU2RfLgY1BjVbawV3VGIEPA==
|
||||||
|
|
||||||
### 20230819新规则
|
|
||||||
POST /ajaxm.php
|
|
||||||
|
|
||||||
# var wsk_sign = 'c20230818';
|
|
||||||
# var aihidcms = 'J5Nh';
|
|
||||||
# var iucjdsd = '';
|
|
||||||
# var ws_sign = 'c20230818';
|
|
||||||
# var sasign = 'AGZQbgk4UGEDCgo1ATEGOlY_aBTlSNVRiV2gEMlA1WmkBJ1R3AWFUMVY2VDsDZQE0Vj4CMgNsADdXZw_c_c';
|
|
||||||
# var ajaxdata = '?ctdf';
|
|
||||||
data : { 'action':'downprocess','signs':ajaxdata,'sign':sasign,'websign':iucjdsd,'websignkey':aihidcms,'ves':1 }
|
|
||||||
|
|||||||
@@ -28,10 +28,6 @@ GET http://127.0.0.1:6400/cow/e4f41b51b5da4f
|
|||||||
# @no-redirect
|
# @no-redirect
|
||||||
GET http://127.0.0.1:6400/parser?url=https://cowtransfer.com/s/9a644fe3e3a748
|
GET http://127.0.0.1:6400/parser?url=https://cowtransfer.com/s/9a644fe3e3a748
|
||||||
|
|
||||||
### 奶牛
|
|
||||||
# @no-redirect
|
|
||||||
GET http://127.0.0.1:6400/parser?url=https://goldrepo.cowtransfer.com/s/026a638795634b
|
|
||||||
|
|
||||||
### 移动云空间 https://www.ecpan.cn/web/#/yunpanProxy?path=%2F%23%2Fdrive%2Foutside&data=81027a5c99af5b11ca004966c945cce6W9Bf2&isShare=1
|
### 移动云空间 https://www.ecpan.cn/web/#/yunpanProxy?path=%2F%23%2Fdrive%2Foutside&data=81027a5c99af5b11ca004966c945cce6W9Bf2&isShare=1
|
||||||
# @no-redirect
|
# @no-redirect
|
||||||
GET http://127.0.0.1:6400/parser?url=https://www.ecpan.cn/web//yunpanProxy?path=%2F%23%2Fdrive%2Foutside&data=81027a5c99af5b11ca004966c945cce6W9Bf2&isShare=1
|
GET http://127.0.0.1:6400/parser?url=https://www.ecpan.cn/web//yunpanProxy?path=%2F%23%2Fdrive%2Foutside&data=81027a5c99af5b11ca004966c945cce6W9Bf2&isShare=1
|
||||||
@@ -98,6 +94,6 @@ GET http://127.0.0.1:6400/ye/iaKtVv-qOECd
|
|||||||
GET http://127.0.0.1:6400/parser?url=https://www.123pan.com/s/iaKtVv-6OECd.html&pwd=DcGe
|
GET http://127.0.0.1:6400/parser?url=https://www.123pan.com/s/iaKtVv-6OECd.html&pwd=DcGe
|
||||||
|
|
||||||
###
|
###
|
||||||
POST http://127.0.0.1:6400/login
|
POST http://127.0.0.1:6400/login1
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
/**
|
|
||||||
* 蓝奏云解析器js签名获取工具
|
|
||||||
*/
|
|
||||||
|
|
||||||
var signObj;
|
|
||||||
|
|
||||||
|
|
||||||
var $, jQuery;
|
|
||||||
|
|
||||||
$ = jQuery = function () {
|
|
||||||
return new jQuery.fn.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
jQuery.fn = jQuery.prototype = {
|
|
||||||
init: function () {
|
|
||||||
return {
|
|
||||||
focus: function (a) {
|
|
||||||
|
|
||||||
},
|
|
||||||
keyup: function(a) {
|
|
||||||
|
|
||||||
},
|
|
||||||
ajax: function (obj) {
|
|
||||||
signObj = obj
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
jQuery.fn.init.prototype = jQuery.fn;
|
|
||||||
|
|
||||||
|
|
||||||
// 伪装jquery.ajax函数获取关键数据
|
|
||||||
$.ajax = function (obj) {
|
|
||||||
signObj = obj
|
|
||||||
}
|
|
||||||
|
|
||||||
var document = {
|
|
||||||
getElementById: function (v) {
|
|
||||||
return {
|
|
||||||
value: 'v'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
package cn.qaiu.vx.core.util;
|
|
||||||
|
|
||||||
import cn.qaiu.lz.common.util.SnowflakeIdWorker;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
public class SnowflakeIdWorkerTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void idWorker() {
|
|
||||||
final SnowflakeIdWorker idWorker = SnowflakeIdWorker.idWorker();
|
|
||||||
for (int i = 0; i < 100; i++) {
|
|
||||||
long id = idWorker.nextId();
|
|
||||||
System.out.println(Long.toBinaryString(id));
|
|
||||||
System.out.println(id);
|
|
||||||
System.out.println("------------");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void idWorkerCluster() {
|
|
||||||
final SnowflakeIdWorker snowflakeIdWorkerCluster = SnowflakeIdWorker.idWorkerCluster(0, 1);
|
|
||||||
for (int i = 0; i < 100; i++) {
|
|
||||||
long id = snowflakeIdWorkerCluster.nextId();
|
|
||||||
System.out.println(Long.toBinaryString(id));
|
|
||||||
System.out.println(id);
|
|
||||||
System.out.println("------------\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user