Skip to content

Commit

Permalink
1. 代理配置
Browse files Browse the repository at this point in the history
  • Loading branch information
qaiu committed Dec 17, 2024
1 parent 2be0b65 commit 8752768
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
5 changes: 1 addition & 4 deletions parser/src/main/java/cn/qaiu/parser/PanBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
import io.vertx.core.Handler;
import io.vertx.core.Promise;
import io.vertx.core.json.DecodeException;
import io.vertx.core.json.Json;
import io.vertx.core.json.JsonObject;
import io.vertx.core.net.ProxyOptions;
import io.vertx.core.net.ProxyType;
import io.vertx.core.net.impl.VertxHandler;
import io.vertx.ext.web.client.HttpResponse;
import io.vertx.ext.web.client.WebClient;
import io.vertx.ext.web.client.WebClientOptions;
Expand All @@ -21,7 +19,6 @@

import java.util.Arrays;
import java.util.Iterator;
import java.util.Map;

/**
* 解析器抽象类包含promise, HTTP Client, 默认失败方法等;
Expand Down Expand Up @@ -77,7 +74,7 @@ public PanBase(ShareLinkInfo shareLinkInfo) {
proxyOptions.setUsername(proxy.getString("username"));
}
if (StringUtils.isNotEmpty(proxy.getString("password"))) {
proxyOptions.setUsername(proxy.getString("password"));
proxyOptions.setPassword(proxy.getString("password"));
}
this.client = WebClient.create(WebClientVertxInit.get(),
new WebClientOptions()
Expand Down
21 changes: 11 additions & 10 deletions web-service/src/main/java/cn/qaiu/lz/AppMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,19 @@ private static void exec(JsonObject jsonObject) {
if (jsonObject.containsKey(ConfigConstant.PROXY)) {
LocalMap<Object, Object> localMap = VertxHolder.getVertxInstance().sharedData().getLocalMap(LOCAL);
JsonArray proxyJsonArray = jsonObject.getJsonArray(ConfigConstant.PROXY);
if (proxyJsonArray != null) {
proxyJsonArray.forEach(proxyJson -> {
String panTypes = ((JsonObject)proxyJson).getString("panTypes");

proxyJsonArray.forEach(proxyJson -> {
String panTypes = ((JsonObject)proxyJson).getString("panTypes");

if (!panTypes.isEmpty()) {
JsonObject jsonObject1 = new JsonObject();
for (String s : panTypes.split(",")) {
jsonObject1.put(s, proxyJson);
if (!panTypes.isEmpty()) {
JsonObject jsonObject1 = new JsonObject();
for (String s : panTypes.split(",")) {
jsonObject1.put(s, proxyJson);
}
localMap.put("proxy", jsonObject1);
}
localMap.put("proxy", jsonObject1);
}
});
});
}

}
}
Expand Down

0 comments on commit 8752768

Please sign in to comment.