perf: 优化插件更新检测器
This commit is contained in:
@@ -15,6 +15,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
@@ -45,6 +46,9 @@ public final class UpdateCheckUtils {
|
||||
switch (checkType) {
|
||||
case "GITEA_RELEASES": {
|
||||
lastRelease = getGiteaLastRelease(baseUrl, gitRepo, gitToken);
|
||||
if (downloadUrl == null) {
|
||||
downloadUrl = URI.create(baseUrl).resolve(gitRepo).toString();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "GITLAB_RELEASES": {
|
||||
@@ -53,6 +57,9 @@ public final class UpdateCheckUtils {
|
||||
break;
|
||||
}
|
||||
lastRelease = getGitlabLastRelease(baseUrl, projectID, gitToken);
|
||||
if (downloadUrl == null) {
|
||||
downloadUrl = URI.create(baseUrl).resolve(gitRepo).toString();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -104,7 +111,6 @@ public final class UpdateCheckUtils {
|
||||
JsonArray array = JSON_PARSER.parse(reader).getAsJsonArray();
|
||||
for (JsonElement element : array) {
|
||||
JsonObject object = element.getAsJsonObject();
|
||||
//noinspection SpellCheckingInspection
|
||||
if (object.get("prerelease").getAsBoolean()) {
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user