1. 项目重命名

2. 添加UC网盘解析
3. 添加移动云空间解析 #1
This commit is contained in:
QAIU
2023-05-24 16:20:06 +08:00
parent 455225e566
commit 7358931559
51 changed files with 526 additions and 349 deletions

View File

@@ -3,9 +3,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>lz-cow-api</artifactId>
<artifactId>netdisk-fast-download</artifactId>
<groupId>cn.qaiu</groupId>
<version>0.0.1</version>
<version>0.1.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<version>1.0.8</version>

View File

@@ -83,7 +83,7 @@ public class RouterHandlerFactory implements BaseHttpApi {
ctx.next();
});
// 添加跨域的方法
router.route().handler(CorsHandler.create("*").allowCredentials(true).allowedMethods(httpMethods));
router.route().handler(CorsHandler.create().addRelativeOrigin(".*").allowCredentials(true).allowedMethods(httpMethods));
// 配置文件上传路径
router.route().handler(BodyHandler.create().setUploadsDirectory("uploads"));
@@ -104,6 +104,7 @@ public class RouterHandlerFactory implements BaseHttpApi {
registerNewHandler(router, handler);
} catch (Throwable e) {
LOGGER.error("Error register {}, Error details", handler, e.getCause());
}
}
} catch (Exception e) {
@@ -181,7 +182,10 @@ public class RouterHandlerFactory implements BaseHttpApi {
e.printStackTrace();
}
});
router.mountSubRouter(url, route);
if (url.endsWith("*")) {
throw new IllegalArgumentException("Don't include * when mounting a sub router");
}
router.route(url + "*").subRouter(route);
}
}
}
@@ -312,8 +316,8 @@ public class RouterHandlerFactory implements BaseHttpApi {
}
});
// 解析body-json参数
if ("application/json".equals(ctx.parsedHeaders().contentType().value()) && ctx.getBodyAsJson() != null) {
JsonObject body = ctx.getBodyAsJson();
if ("application/json".equals(ctx.parsedHeaders().contentType().value()) && ctx.body().asJsonObject() != null) {
JsonObject body = ctx.body().asJsonObject();
if (body != null) {
methodParametersTemp.forEach((k, v) -> {
// 只解析已配置包名前缀的实体类
@@ -345,7 +349,7 @@ public class RouterHandlerFactory implements BaseHttpApi {
((Future<?>) data).onSuccess(res -> {
if (res instanceof JsonObject) {
fireJsonResponse(ctx, res);
} else {
} else if (res != null){
fireJsonResponse(ctx, JsonResult.data(res));
}
}).onFailure(e -> fireJsonResponse(ctx, JsonResult.error(e.getMessage())));