mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-06-15 01:47:28 +00:00
refactor: 代码质量清理与日志规范化
- 替换 System.out.println/printStackTrace 为 Logger: MkgsTool, PodTool, WsTool, IpExtractor, ReqIpUtil, LogStatistics - JsPlaygroundLogger 日志列表限制最大 1000 条防止内存泄漏 - JsScriptLoader JarFile 改用 try-with-resources 防止文件句柄泄漏 - DbServiceImpl Thread.sleep 改为 vertx.setTimer 避免阻塞 event loop - 删除未使用的 api.js,删除空的 ParserApiClientLinkTest - 移除前端未使用的导入和死代码 (downloaderService, monacoTypes) - 提取 previewBaseUrl 到 constants.js 常量文件
This commit is contained in:
@@ -8,15 +8,19 @@ import io.vertx.core.http.impl.headers.HeadersMultiMap;
|
||||
import io.vertx.ext.web.client.HttpResponse;
|
||||
import io.vertx.ext.web.client.WebClient;
|
||||
import io.vertx.ext.web.client.WebClientSession;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ReqIpUtil {
|
||||
public static String BASE_URL = "https://ip.ihuan.me";
|
||||
public static String BASE_URL_TEMPLATE = BASE_URL + "/{path}";
|
||||
private static final Logger log = LoggerFactory.getLogger(ReqIpUtil.class);
|
||||
|
||||
public static final String BASE_URL = "https://ip.ihuan.me";
|
||||
public static final String BASE_URL_TEMPLATE = BASE_URL + "/{path}";
|
||||
|
||||
// GET https://ip.ihuan.me/mouse.do -> $("input[name='key']").val("30b4975b5547fed806bd2b9caa18485a");
|
||||
public static String PATH1 = "mouse.do";
|
||||
public static final String PATH1 = "mouse.do";
|
||||
|
||||
public static String PATH2 = "tqdl.html";
|
||||
public static final String PATH2 = "tqdl.html";
|
||||
|
||||
// 创建请求头Map
|
||||
static MultiMap headers = new HeadersMultiMap();
|
||||
@@ -58,15 +62,15 @@ public class ReqIpUtil {
|
||||
|
||||
void next(AsyncResult<HttpResponse<Buffer>> response) {
|
||||
if (response.failed()) {
|
||||
response.cause().printStackTrace();
|
||||
log.error("请求失败", response.cause());
|
||||
} else {
|
||||
HttpResponse<Buffer> res = response.result();
|
||||
System.out.println("Received response with status code " + res.statusCode());
|
||||
System.out.println("Body: " + res.body());
|
||||
log.debug("Received response with status code {}", res.statusCode());
|
||||
log.debug("Body: {}", res.body());
|
||||
webClientSession.getAbs(BASE_URL_TEMPLATE).setTemplateParam("path", PATH1)
|
||||
.putHeaders(headers) // 将请求头Map添加到请求中
|
||||
.send(response2 -> {
|
||||
System.out.println(response2.result().bodyAsString());
|
||||
log.debug("response2: {}", response2.result().bodyAsString());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user