Compare commits

..

87 Commits

Author SHA1 Message Date
QAIU
efe2dabce4 蓝奏云规则微调, 框架优化(70%) 2023-08-23 14:55:08 +08:00
qaiu
18f932f831 Update LzTool.java 2023-08-21 12:27:39 +08:00
qaiu
2818011518 Update README.md 2023-08-20 10:36:39 +08:00
qaiu
991e9bc153 Merge pull request #13 from qaiu/dev
蓝奏云规则修改, 奶牛功能增强
2023-08-20 10:35:02 +08:00
qaiu
bee8401580 修复蓝奏云pan解析错误的问题#12 2023-08-20 10:29:00 +08:00
QAIU
15be132d54 Merge remote-tracking branch 'origin/dev' into dev 2023-08-19 17:29:04 +08:00
QAIU
cac06295e4 奶牛快传支持下载zip目录分享#11, core框架优化 2023-08-19 17:28:30 +08:00
qaiu
db430832cc Update README.md 2023-08-13 00:58:12 +08:00
qaiu
d8c8bee898 Update README.md 2023-08-13 00:55:20 +08:00
qaiu
0b050a407f Update README.md 2023-08-13 00:54:21 +08:00
QAIU
10e4082d44 奶牛快传支持下载zip目录分享#11, core框架优化 2023-08-11 15:28:37 +08:00
QAIU
92d4f4fc79 core框架优化 2023-08-10 14:54:45 +08:00
qaiu
6a0e22add8 修复123pan解析错误的问题#9 2023-08-10 01:49:41 +08:00
qaiu
a33863983e 代码结构优化;修复123pan解析错误的问题#9 2023-08-10 01:45:39 +08:00
qaiu
36db7b28bb 代码结构优化;修复123pan解析错误的问题#9 2023-08-10 01:42:34 +08:00
qaiu
123eef9f7b 代码结构优化
修复123pan解析错误的问题#9
2023-08-10 01:38:20 +08:00
qaiu
346d8fd253 Merge pull request #10 from qaiu/master
Master
2023-08-10 01:17:11 +08:00
qaiu
86f50adaf4 fixed 123pan /b/api/share/download/info->/a/api/share/download/info 2023-08-10 00:59:09 +08:00
QAIU
281df7b3b1 代码结构优化, 异常处理优化 2023-08-08 17:36:36 +08:00
QAIU
a2b286c58a 代码结构优化, 异常处理优化 2023-08-08 11:34:32 +08:00
QAIU
fd0a4abfaa 0 2023-08-04 17:49:30 +08:00
qaiu
989dd8fec5 Update README.md 2023-08-02 17:53:04 +08:00
QAIU
dd3a43ccf8 0 2023-08-01 14:42:32 +08:00
qaiu
31b1e7e955 前端页面优化 2023-07-31 22:43:23 +08:00
qaiu
38fb9623bb 前端页面优化 2023-07-31 22:41:33 +08:00
QAIU
8b450a4850 0 2023-07-31 14:07:12 +08:00
QAIU
88806b4622 Merge remote-tracking branch 'origin/main' 2023-07-31 13:56:49 +08:00
QAIU
e87149358c 360亿方云API-URL变更 2023-07-31 13:56:35 +08:00
qaiu
98aa767787 Update README.md 2023-07-31 12:06:59 +08:00
qaiu
0946047136 Update README.md 2023-07-31 12:03:34 +08:00
qaiu
1628a8f486 Merge pull request #6 from qaiu/dependabot/npm_and_yarn/web-front/webpack-5.88.2
Bump webpack from 5.75.0 to 5.88.2 in /web-front
2023-07-31 11:42:09 +08:00
qaiu
581c0662f8 Merge pull request #7 from qaiu/dependabot/npm_and_yarn/web-front/word-wrap-1.2.5
Bump word-wrap from 1.2.3 to 1.2.5 in /web-front
2023-07-31 11:41:57 +08:00
dependabot[bot]
5b3f614a64 Bump webpack from 5.75.0 to 5.88.2 in /web-front
Bumps [webpack](https://github.com/webpack/webpack) from 5.75.0 to 5.88.2.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.75.0...v5.88.2)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-31 03:39:18 +00:00
QAIU
db4131c4f9 lz.qaiu.top加入前端页面 2023-07-31 11:38:23 +08:00
qaiu
1c0426d827 前端优化 2023-07-31 05:08:13 +08:00
dependabot[bot]
010780b82d Bump word-wrap from 1.2.3 to 1.2.5 in /web-front
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.5.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.5)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-30 19:22:56 +00:00
qaiu
78f29f7a75 Merge remote-tracking branch 'origin/main' 2023-07-31 03:22:02 +08:00
qaiu
5a630db5a6 添加前端页面 2023-07-31 03:21:39 +08:00
qaiu
cefcc576b6 Update README.md 2023-07-31 00:20:52 +08:00
qaiu
0e3b5a3007 Update README.md 2023-07-30 16:29:27 +08:00
qaiu
5e271b853c 添加 通过JS文件获取123pan签名 2023-07-29 18:08:30 +08:00
QAIU
54e8f73427 123网盘解析规则优化 2023-07-27 17:45:53 +08:00
QAIU
34baecb535 123网盘解析规则优化 2023-07-24 10:47:01 +08:00
QAIU
f75f333cda Merge remote-tracking branch 'origin/main' 2023-07-24 10:41:43 +08:00
QAIU
8ea8338cbf 123网盘解析规则优化 2023-07-24 10:41:25 +08:00
qaiu
fc1e10b016 Update README.md 2023-07-23 15:15:25 +08:00
qaiu
87e2e6128a Update README.md 2023-07-23 15:13:23 +08:00
qaiu
7799719b99 Update README.md 2023-07-23 15:12:58 +08:00
qaiu
55a5b52faf Update README.md
lz.qaiu.top测试123pan 下载Dragonwell JDK17
2023-07-22 15:33:10 +08:00
qaiu
a578bc58be Update README.md
lz.qaiu.top测试123pan 下载Dragonwell JDK17
2023-07-22 15:32:13 +08:00
QAIU
18dc30c03d 修改123网盘解析规则 2023-07-22 12:34:02 +08:00
QAIU
ff2b7608d2 细节优化 2023-07-21 10:29:21 +08:00
qaiu
5ac5cdced9 Update README.md 2023-07-16 04:26:05 +08:00
qaiu
b6d0a6cd06 修改win服务模板 2023-07-16 03:45:54 +08:00
qaiu
9a20636d2d - 更新版本号: 0.1.5->0.1.6 2023-07-16 03:11:41 +08:00
qaiu
f5abaca5a1 - WebServer: PanTool优化异常处理
- Core: Vertx事件循环线程数调整
2023-07-16 02:47:39 +08:00
qaiu
26ab5f7945 Merge pull request #5 from qaiu/dependabot/maven/com.h2database-h2-2.2.220
Bump h2 from 2.1.214 to 2.2.220
2023-07-10 06:05:17 +08:00
qaiu
c14d8fccfd Merge pull request #4 from qaiu/dependabot/maven/core-database/com.h2database-h2-2.2.220
Bump h2 from 2.1.214 to 2.2.220 in /core-database
2023-07-10 06:04:58 +08:00
dependabot[bot]
fe28050893 Bump h2 from 2.1.214 to 2.2.220
Bumps [h2](https://github.com/h2database/h2database) from 2.1.214 to 2.2.220.
- [Release notes](https://github.com/h2database/h2database/releases)
- [Commits](https://github.com/h2database/h2database/compare/version-2.1.214...version-2.2.220)

---
updated-dependencies:
- dependency-name: com.h2database:h2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-07 22:01:48 +00:00
dependabot[bot]
af9d890f98 Bump h2 from 2.1.214 to 2.2.220 in /core-database
Bumps [h2](https://github.com/h2database/h2database) from 2.1.214 to 2.2.220.
- [Release notes](https://github.com/h2database/h2database/releases)
- [Commits](https://github.com/h2database/h2database/compare/version-2.1.214...version-2.2.220)

---
updated-dependencies:
- dependency-name: com.h2database:h2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-07 22:00:11 +00:00
QAIU
c640b9d9d1 解决一些 warning jdk14对可序列化对象添加@Serial 2023-06-21 16:49:01 +08:00
QAIU
a1dff75bdf Merge remote-tracking branch 'origin/main' 2023-06-21 15:40:42 +08:00
QAIU
f02826339a musetransfer api test 2023-06-21 15:40:24 +08:00
qaiu
656fd672fc Zzz 2023-06-21 02:53:58 +00:00
qaiu
baa2e0ac75 Cow解析重复创建实例VertxHolder.getVertxInstance() 2023-06-21 02:53:24 +00:00
qaiu
3375144af6 cow parse fail return 2023-06-21 02:50:19 +00:00
QAIU
028b75cfd4 add mu pan 2023-06-14 17:47:20 +08:00
QAIU
026cd72a4b Zzz 2023-06-14 16:14:37 +08:00
qaiu
db21eb99f0 Update README.md 2023-06-14 15:48:21 +08:00
qaiu
09aa9a97c2 Update README.md 2023-06-14 15:48:08 +08:00
qaiu
44d18ad273 Update README.md 2023-06-14 15:40:08 +08:00
qaiu
44b82da51d Create LICENSE 2023-06-14 15:23:59 +08:00
QAIU
0f65e6cb2e Zzz 2023-06-14 11:57:58 +08:00
QAIU
407f4fafd9 Zzz 2023-06-14 11:56:33 +08:00
QAIU
66850a72f7 Zzz 2023-06-14 11:53:27 +08:00
QAIU
4acf716868 依赖打包优化 2023-06-14 11:26:33 +08:00
qaiu
2158be14ca 修复Linux运行脚本 2023-06-14 10:30:16 +08:00
QAIU
21d3340f3c Linux部署服务模板修改 2023-06-13 15:11:32 +08:00
qaiu
6972b5e761 Update README.md 2023-06-13 13:58:26 +08:00
QAIU
eac1d62f76 update 0.1.5 2023-06-13 13:25:22 +08:00
QAIU
b88fee9e83 update 0.1.5 2023-06-13 13:23:09 +08:00
QAIU
e075967c14 移动云空间需要注意的地方 2023-06-13 10:53:02 +08:00
qaiu
2c8ee31cb7 Merge pull request #3 from qaiu/dev
Controller 层不支持方法重载: ServerApi
2023-06-13 10:30:36 +08:00
qaiu
1bbb7728d8 Controller 层不支持方法重载: ServerApi 2023-06-13 10:29:23 +08:00
qaiu
7e0d4b3bad 接口重构 2023-06-13 08:22:11 +08:00
qaiu
5f25d32f97 接口重构 2023-06-13 05:43:37 +08:00
QAIU
a890ef54a3 测试相关 2023-06-12 16:41:06 +08:00
17 changed files with 213 additions and 57 deletions

View File

@@ -82,7 +82,7 @@ public final class Deploy {
var calendar = Calendar.getInstance();
calendar.setTime(new Date());
var year = calendar.get(Calendar.YEAR);
var logoTemplete = """
var logoTemplate = """
Web Server powered by:\s
____ ____ _ _ _ \s
@@ -95,7 +95,7 @@ public final class Deploy {
""";
System.out.printf(logoTemplete,
System.out.printf(logoTemplate,
conf.getString("version_app"),
VersionCommand.getVersion(),
conf.getString("copyright"),

View File

@@ -0,0 +1,15 @@
package cn.qaiu.vx.core.annotaions;
import java.lang.annotation.*;
@Documented
@Inherited
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface HandleSortFilter {
/**
* 注册顺序,数字越大越先注册<br>
* 值<0时会过滤掉该处理器
*/
int value() default 0;
}

View File

@@ -1,8 +1,11 @@
package cn.qaiu.vx.core.base;
import cn.qaiu.vx.core.interceptor.AfterInterceptor;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.web.RoutingContext;
import java.util.Set;
import static io.vertx.core.http.HttpHeaders.CONTENT_TYPE;
/**
@@ -13,6 +16,10 @@ import static io.vertx.core.http.HttpHeaders.CONTENT_TYPE;
*/
public interface BaseHttpApi {
default Set<AfterInterceptor> getAfterInterceptor() {
return null;
}
default void fireJsonResponse(RoutingContext ctx, JsonObject jsonResult) {
ctx.response().putHeader(CONTENT_TYPE, "application/json; charset=utf-8")
.setStatusCode(200)
@@ -21,11 +28,28 @@ public interface BaseHttpApi {
default <T> void fireJsonResponse(RoutingContext ctx, T jsonResult) {
JsonObject jsonObject = JsonObject.mapFrom(jsonResult);
fireJsonResponse(ctx, jsonObject);
if (!ctx.response().ended()) {
fireJsonResponse(ctx, jsonObject);
}
handleAfterInterceptor(ctx, jsonObject);
}
default void handleAfterInterceptor(RoutingContext ctx, JsonObject jsonObject){
Set<AfterInterceptor> afterInterceptor = getAfterInterceptor();
if (afterInterceptor != null) {
afterInterceptor.forEach(ai -> ai.handle(ctx.request(), jsonObject));
}
if (!ctx.response().ended()) {
fireJsonResponse(ctx, "handleAfterInterceptor end.");
}
}
default void fireTextResponse(RoutingContext ctx, String text) {
ctx.response().putHeader("content-type", "text/html; charset=utf-8").end(text);
ctx.response().putHeader(CONTENT_TYPE, "text/html; charset=utf-8").end(text);
Set<AfterInterceptor> afterInterceptor = getAfterInterceptor();
if (afterInterceptor != null) {
afterInterceptor.forEach(ai -> ai.handle(ctx.request(), new JsonObject().put("text", text)));
}
}
default void sendError(int statusCode, RoutingContext ctx) {

View File

@@ -1,12 +1,9 @@
package cn.qaiu.vx.core.handlerfactory;
import cn.qaiu.vx.core.annotaions.DateFormat;
import cn.qaiu.vx.core.annotaions.RouteHandler;
import cn.qaiu.vx.core.annotaions.RouteMapping;
import cn.qaiu.vx.core.annotaions.SockRouteMapper;
import cn.qaiu.vx.core.annotaions.*;
import cn.qaiu.vx.core.base.BaseHttpApi;
import cn.qaiu.vx.core.enums.MIMEType;
import cn.qaiu.vx.core.interceptor.Interceptor;
import cn.qaiu.vx.core.interceptor.AfterInterceptor;
import cn.qaiu.vx.core.interceptor.BeforeInterceptor;
import cn.qaiu.vx.core.model.JsonResult;
import cn.qaiu.vx.core.util.*;
import io.vertx.core.Future;
@@ -75,21 +72,22 @@ public class RouterHandlerFactory implements BaseHttpApi {
* 开始扫描并注册handler
*/
public Router createRouter() {
Router router = Router.router(VertxHolder.getVertxInstance());
// 主路由
Router mainRouter = Router.router(VertxHolder.getVertxInstance());
// 静态资源
String path = SharedDataUtil.getJsonConfig("server")
.getString("staticResourcePath");
if (!StringUtils.isEmpty(path)) {
// 静态资源
router.route("/*").handler(StaticHandler
mainRouter.route("/*").handler(StaticHandler
.create(path)
.setCachingEnabled(true)
.setDefaultContentEncoding("UTF-8"));
}
router.route().handler(ctx -> {
mainRouter.route().handler(ctx -> {
LOGGER.debug("The HTTP service request address information ===>path:{}, uri:{}, method:{}",
ctx.request().path(), ctx.request().absoluteURI(), ctx.request().method());
ctx.response().headers().add(ACCESS_CONTROL_ALLOW_ORIGIN, "*");
@@ -100,11 +98,15 @@ public class RouterHandlerFactory implements BaseHttpApi {
ctx.next();
});
// 添加跨域的方法
router.route().handler(CorsHandler.create().addRelativeOrigin(".*").allowCredentials(true).allowedMethods(httpMethods));
mainRouter.route().handler(CorsHandler.create().addRelativeOrigin(".*").allowCredentials(true).allowedMethods(httpMethods));
// 配置文件上传路径
router.route().handler(BodyHandler.create().setUploadsDirectory("uploads"));
mainRouter.route().handler(BodyHandler.create().setUploadsDirectory("uploads"));
// 拦截器
Set<Handler<RoutingContext>> interceptorSet = getInterceptorSet();
Route route0 = mainRouter.route("/*");
interceptorSet.forEach(route0::handler);
try {
Set<Class<?>> handlers = reflections.getTypesAnnotatedWith(RouteHandler.class);
@@ -118,7 +120,7 @@ public class RouterHandlerFactory implements BaseHttpApi {
for (Class<?> handler : sortedHandlers) {
try {
// 注册请求处理方法
registerNewHandler(router, handler);
registerNewHandler(mainRouter, handler);
} catch (Throwable e) {
LOGGER.error("Error register {}, Error details", handler, e.getCause());
@@ -128,12 +130,12 @@ public class RouterHandlerFactory implements BaseHttpApi {
LOGGER.error("Manually Register Handler Fail, Error details" + e.getMessage());
}
// 错误请求处理
router.errorHandler(405, ctx -> fireJsonResponse(ctx, JsonResult
mainRouter.errorHandler(405, ctx -> fireJsonResponse(ctx, JsonResult
.error("Method Not Allowed", 405)));
router.errorHandler(404, ctx -> ctx.response().setStatusCode(404).setChunked(true)
mainRouter.errorHandler(404, ctx -> ctx.response().setStatusCode(404).setChunked(true)
.end("Internal server error: 404 not found"));
return router;
return mainRouter;
}
/**
@@ -157,8 +159,6 @@ public class RouterHandlerFactory implements BaseHttpApi {
method -> method.isAnnotationPresent(SockRouteMapper.class)
).toList());
// 拦截器
Handler<RoutingContext> interceptor = getInterceptor();
// 依次注册处理方法
for (Method method : methodList) {
if (method.isAnnotationPresent(RouteMapping.class)) {
@@ -177,8 +177,6 @@ public class RouterHandlerFactory implements BaseHttpApi {
// 设置默认超时
route.handler(TimeoutHandler.create(SharedDataUtil.getCustomConfig().getInteger(ROUTE_TIME_OUT)));
// 先执行拦截方法, 再进入业务请求
route.handler(interceptor);
route.handler(ctx -> handlerMethod(instance, method, ctx)).failureHandler(ctx -> {
if (ctx.response().ended()) return;
ctx.failure().printStackTrace();
@@ -235,11 +233,9 @@ public class RouterHandlerFactory implements BaseHttpApi {
* @return Handler
* @throws Throwable Throwable
*/
private Handler<RoutingContext> getInterceptor() throws Throwable {
private Set<Handler<RoutingContext>> getInterceptorSet() {
// 配置拦截
Class<?> interceptorClass = Class.forName(SharedDataUtil.getValueForCustomConfig("interceptorClassPath"));
Interceptor handleInstance = (Interceptor)ReflectionUtil.newWithNoParam(interceptorClass);
return handleInstance.doHandle();
return getBeforeInterceptor().stream().map(BeforeInterceptor::doHandle).collect(Collectors.toSet());
}
/**
@@ -369,11 +365,13 @@ public class RouterHandlerFactory implements BaseHttpApi {
fireJsonResponse(ctx, res);
} else if (res != null) {
fireJsonResponse(ctx, JsonResult.data(res));
} else {
handleAfterInterceptor(ctx, null);
}
}).onFailure(e -> fireJsonResponse(ctx, JsonResult.error(e.getMessage())));
} else {
ctx.response().headers().set(CONTENT_TYPE, MIMEType.TEXT_HTML.getValue());
ctx.end(data.toString());
fireTextResponse(ctx, data.toString());
}
}
} catch (Throwable e) {
@@ -404,4 +402,23 @@ public class RouterHandlerFactory implements BaseHttpApi {
}
return fmt;
}
@Override
public Set<AfterInterceptor> getAfterInterceptor() {
Set<Class<? extends AfterInterceptor>> afterInterceptorClassSet =
reflections.getSubTypesOf(AfterInterceptor.class);
if (afterInterceptorClassSet == null) {
return null;
}
return CommonUtil.sortClassSet(afterInterceptorClassSet);
}
private Set<BeforeInterceptor> getBeforeInterceptor() {
Set<Class<? extends BeforeInterceptor>> interceptorClassSet =
reflections.getSubTypesOf(BeforeInterceptor.class);
if (interceptorClassSet == null) {
return new HashSet<>();
}
return CommonUtil.sortClassSet(interceptorClassSet);
}
}

View File

@@ -0,0 +1,15 @@
package cn.qaiu.vx.core.interceptor;
import io.vertx.core.http.HttpServerRequest;
import io.vertx.core.json.JsonObject;
/**
* 后置拦截器接口
*
* @author <a href="https://qaiu.top">QAIU</a>
*/
public interface AfterInterceptor {
void handle(HttpServerRequest request, JsonObject responseData);
}

View File

@@ -4,18 +4,16 @@ import io.vertx.core.Handler;
import io.vertx.ext.web.RoutingContext;
/**
* 拦截器接口
* <br>Create date 2021-05-06 09:20:37
* 前置拦截器接口
*
* @author <a href="https://qaiu.top">QAIU</a>
*/
public interface Interceptor {
public interface BeforeInterceptor {
default Handler<RoutingContext> doHandle() {
return this::beforeHandle;
return this::handle;
}
void beforeHandle(RoutingContext context);
void handle(RoutingContext context);
void afterHandle(RoutingContext context);
}

View File

@@ -1,5 +1,6 @@
package cn.qaiu.vx.core.util;
import cn.qaiu.vx.core.annotaions.HandleSortFilter;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.json.JsonObject;
import org.apache.commons.beanutils.ConvertUtils;
@@ -15,6 +16,8 @@ import java.net.URL;
import java.net.UnknownHostException;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* CommonUtil
@@ -70,10 +73,11 @@ public class CommonUtil {
} catch (UnknownHostException e) {
return false;
}
try(Socket ignored = new Socket(Address, port)) {
//建立一个Socket连接
try (Socket ignored = new Socket(Address, port)) {
//建立一个Socket连接
flag = true;
} catch (IOException ignoredException) {}
} catch (IOException ignoredException) {
}
return flag;
}
@@ -126,4 +130,32 @@ public class CommonUtil {
LocalConstant.put(configName, map);
LOGGER.info("读取配置{}成功", configName);
}
public static <T> Set<T> sortClassSet(Set<Class<? extends T>> set) {
return set.stream().filter(c1 -> {
HandleSortFilter s1 = c1.getAnnotation(HandleSortFilter.class);
if (s1 != null) {
return s1.value() > 0;
} else {
return true;
}
}).sorted((c1, c2) -> {
HandleSortFilter s1 = c1.getAnnotation(HandleSortFilter.class);
HandleSortFilter s2 = c2.getAnnotation(HandleSortFilter.class);
int n1 = 0, n2 = 0;
if (s1 != null) {
n1 = s1.value();
}
if (s2 != null) {
n2 = s2.value();
}
return n1 - n2;
}).map(c -> {
try {
return ReflectionUtil.newWithNoParam(c);
} catch (Exception e) {
throw new RuntimeException(e);
}
}).collect(Collectors.toSet());
}
}

View File

@@ -0,0 +1,17 @@
package cn.qaiu.vx.core.util;
import io.vertx.core.Promise;
import io.vertx.core.http.HttpHeaders;
import io.vertx.core.http.HttpServerResponse;
public class ResponseUtil {
public static void redirect(HttpServerResponse response, String url) {
response.putHeader(HttpHeaders.LOCATION, url).setStatusCode(302).end();
}
public static void redirect(HttpServerResponse response, String url, Promise<?> promise) {
redirect(response, url);
promise.complete();
}
}

View File

@@ -19,6 +19,7 @@
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<packageDirectory>${project.basedir}/web-service/target/package</packageDirectory>
</properties>

View File

@@ -1,7 +1,7 @@
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.annotaions.HandleSortFilter;
import cn.qaiu.vx.core.interceptor.BeforeInterceptor;
import cn.qaiu.vx.core.util.SharedDataUtil;
import io.vertx.core.json.JsonArray;
import io.vertx.ext.web.RoutingContext;
@@ -10,23 +10,20 @@ import lombok.extern.slf4j.Slf4j;
import static cn.qaiu.vx.core.util.ConfigConstant.IGNORES_REG;
/**
* 默认拦截器实现
* 校验用户是否合法 <br>
* TODO 暂时只做简单实现
* 前置拦截器实现
*/
@Slf4j
public class DefaultInterceptor implements Interceptor, BaseHttpApi {
@HandleSortFilter(1)
public class DefaultInterceptor implements BeforeInterceptor {
protected final JsonArray ignores = SharedDataUtil.getJsonArrayForCustomConfig(IGNORES_REG);
@Override
public void beforeHandle(RoutingContext ctx) {
public void handle(RoutingContext ctx) {
System.out.println("进入前置拦截器->" + ctx.request().path());
ctx.next();
}
@Override
public void afterHandle(RoutingContext ctx) {
}
}

View File

@@ -0,0 +1,26 @@
package cn.qaiu.lz.common.interceptorImpl;
import cn.qaiu.vx.core.annotaions.HandleSortFilter;
import cn.qaiu.vx.core.interceptor.AfterInterceptor;
import cn.qaiu.vx.core.util.SharedDataUtil;
import io.vertx.core.http.HttpServerRequest;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import lombok.extern.slf4j.Slf4j;
import static cn.qaiu.vx.core.util.ConfigConstant.IGNORES_REG;
/**
*
*/
@Slf4j
@HandleSortFilter(99)
public class LogStatistics implements AfterInterceptor {
protected final JsonArray ignores = SharedDataUtil.getJsonArrayForCustomConfig(IGNORES_REG);
@Override
public void handle(HttpServerRequest request, JsonObject responseData) {
System.out.println("后置拦截-->" + responseData + " path:" + request.path());
}
}

View File

@@ -15,6 +15,7 @@ public interface IPanTool {
case "uc" -> new UcTool(key, pwd);
case "ye" -> new YeTool(key, pwd);
case "fj" -> new FjTool(key, pwd);
case "qk" -> new QkTool(key, pwd);
default -> {
throw new UnsupportedOperationException("未知分享类型");
}

View File

@@ -90,7 +90,7 @@ public class LzTool extends PanBase implements IPanTool {
private String getJsText(String html) {
String jsTagStart = "<script type=\"text/javascript\">";
String jsTagEnd = "</script>";
int index = html.indexOf(jsTagStart);
int index = html.lastIndexOf(jsTagStart);
if (index == -1) {
return null;
}

View File

@@ -1,12 +1,20 @@
package cn.qaiu.lz.common.parser.impl;
import cn.qaiu.lz.common.parser.IPanTool;
import cn.qaiu.lz.common.parser.PanBase;
import io.vertx.core.Future;
import io.vertx.core.Promise;
public class QkTool {
public static Future<String> parse() {
public class QkTool extends PanBase implements IPanTool {
public QkTool(String key, String pwd) {
super(key, pwd);
}
public Future<String> parse() {
Promise<String> promise = Promise.promise();
promise.complete("https://lz.qaiu.top");
return promise.future();
}
}

View File

@@ -8,6 +8,7 @@ import cn.qaiu.vx.core.annotaions.RouteHandler;
import cn.qaiu.vx.core.annotaions.RouteMapping;
import cn.qaiu.vx.core.enums.RouteMethod;
import cn.qaiu.vx.core.util.AsyncServiceUtil;
import cn.qaiu.vx.core.util.ResponseUtil;
import io.vertx.core.Future;
import io.vertx.core.Promise;
import io.vertx.core.http.HttpServerRequest;
@@ -44,8 +45,7 @@ public class ServerApi {
}
try {
IPanTool.shareURLPrefixMatching(url, pwd).parse().onSuccess(resUrl -> {
response.putHeader("location", resUrl).setStatusCode(302).end();
promise.complete();
ResponseUtil.redirect(response, resUrl, promise);
}).onFailure(t -> promise.fail(t.fillInStackTrace()));
} catch (Exception e) {
promise.fail(e);
@@ -72,8 +72,7 @@ public class ServerApi {
code = keys[1];
}
IPanTool.typeMatching(type, key, code).parse().onSuccess(resUrl -> response.putHeader("location", resUrl)
.setStatusCode(302).end()).onFailure(t -> {
IPanTool.typeMatching(type, key, code).parse().onSuccess(resUrl -> ResponseUtil.redirect(response, resUrl)).onFailure(t -> {
response.putHeader(CONTENT_TYPE, "text/html;charset=utf-8");
response.end(t.getMessage());
});

View File

@@ -11,7 +11,7 @@
# offset: 1
# limit: 60
# @no-cookie-jar
POST https://api.feijipan.com/ws/recommend/list?devType=6&devModel=Chrome&extra=2&shareId=146731&type=0&offset=1&limit=60
POST https://api.feijipan.com/ws/recommend/list?devType=6&devModel=Chrome&extra=2&shareId=193186&type=0&offset=1&limit=60
# 654488C79332E7279F9A38367BD72D3B
# 4703B103BD6871F83441233393695EF3

View File

@@ -50,6 +50,12 @@ public class TestAESUtil {
Assert.assertEquals(146731, AESUtils.idEncrypt("7jy0zlv"));
}
@Test
public void test00() throws IllegalBlockSizeException, NoSuchPaddingException, BadPaddingException,
NoSuchAlgorithmException, InvalidKeyException {
System.out.println(AESUtils.decryptByBase64AES(AESUtils.CIPHER_AES2, AESUtils.CIPHER_AES));
}
@Test
public void testTs() {
System.out.println(System.currentTimeMillis());