mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-14 06:17:47 -04:00
尝试从候选源获取 AuthlibInjectorVersionInfo (#2711)
* 尝试从候选源获取 AuthlibInjectorVersionInfo * update * update * update
This commit is contained in:
parent
0bcda9eb46
commit
19cae84a01
@ -110,11 +110,22 @@ public class AuthlibInjectorDownloader implements AuthlibInjectorArtifactProvide
|
|||||||
}
|
}
|
||||||
|
|
||||||
private AuthlibInjectorVersionInfo getLatestArtifactInfo() throws IOException {
|
private AuthlibInjectorVersionInfo getLatestArtifactInfo() throws IOException {
|
||||||
try {
|
IOException exception = null;
|
||||||
return HttpRequest.GET(downloadProvider.get().injectURL(LATEST_BUILD_URL)).getJson(AuthlibInjectorVersionInfo.class);
|
for (URL url : downloadProvider.get().injectURLWithCandidates(LATEST_BUILD_URL)) {
|
||||||
} catch (JsonParseException e) {
|
try {
|
||||||
throw new IOException("Malformed response", e);
|
return HttpRequest.GET(url.toExternalForm()).getJson(AuthlibInjectorVersionInfo.class);
|
||||||
|
} catch (IOException | JsonParseException e) {
|
||||||
|
if (exception == null) {
|
||||||
|
exception = new IOException("Failed to fetch authlib-injector artifact info");
|
||||||
|
}
|
||||||
|
exception.addSuppressed(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (exception == null) {
|
||||||
|
exception = new IOException("No authlib-injector download providers available");
|
||||||
|
}
|
||||||
|
throw exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Optional<AuthlibInjectorArtifactInfo> getLocalArtifact() {
|
private Optional<AuthlibInjectorArtifactInfo> getLocalArtifact() {
|
||||||
@ -133,7 +144,7 @@ public class AuthlibInjectorDownloader implements AuthlibInjectorArtifactProvide
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class AuthlibInjectorVersionInfo {
|
private static final class AuthlibInjectorVersionInfo {
|
||||||
@SerializedName("build_number")
|
@SerializedName("build_number")
|
||||||
public int buildNumber;
|
public int buildNumber;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user