Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
141df8c7b8 | ||
|
|
f5d739711d |
No files matched your search
@@ -138,6 +138,17 @@ jobs:
|
||||
|
||||
def put(name: str, data: bytes):
|
||||
url = upload_root + "/" + urllib.parse.quote(name, safe="")
|
||||
# Gitea refuses to overwrite a generic package file (HTTP 409), so the previous copy of this one
|
||||
# file is deleted right before it is uploaded again (keeps the gap without a file as short as possible).
|
||||
delete = urllib.request.Request(url, method="DELETE")
|
||||
delete.add_header("Authorization", "token " + token)
|
||||
delete.add_header("User-Agent", "tdlm-hmcl-publish")
|
||||
try:
|
||||
with urllib.request.urlopen(delete, timeout=300) as response:
|
||||
response.read()
|
||||
except urllib.error.HTTPError as exc:
|
||||
if exc.code != 404:
|
||||
raise SystemExit("HTTP %s deleting the old %s: %s" % (exc.code, name, exc.read()[:300]))
|
||||
request = urllib.request.Request(url, data=data, method="PUT")
|
||||
request.add_header("Authorization", "token " + token)
|
||||
request.add_header("Content-Type", "application/octet-stream")
|
||||
|
||||
@@ -141,9 +141,9 @@ public final class Metadata {
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Default client Server Modpack fileApi (CDN mirror of Pack's `tdlm-client/latest` layout).
|
||||
/// Default client Server Modpack fileApi: the Nexus raw repository `tdlm-client` read through the CDN host.
|
||||
public static final String DEFAULT_CLIENT_FILE_API =
|
||||
"https://packages.dandanton.com/tdlm-client/latest";
|
||||
"https://maven.dandanton.com/repository/tdlm-client";
|
||||
|
||||
/// Stable client update root (`server-manifest.json` and `overrides/` live under this URL).
|
||||
///
|
||||
|
||||
@@ -398,12 +398,22 @@ public final class Controllers {
|
||||
.whenComplete(Schedulers.javafx(), (result, exception) -> {
|
||||
if (exception != null) {
|
||||
LOG.warning("Failed to fetch client Server Modpack manifest", exception);
|
||||
Controllers.dialog(
|
||||
manifestUrl + "\n" + exception.getMessage(),
|
||||
i18n("message.error"),
|
||||
MessageType.ERROR);
|
||||
Instances.importModpack();
|
||||
return;
|
||||
}
|
||||
ServerModpackManifest manifest =
|
||||
JsonUtils.fromMaybeMalformedJson(result, ServerModpackManifest.class);
|
||||
if (manifest == null) {
|
||||
LOG.warning("Malformed client Server Modpack manifest from " + manifestUrl);
|
||||
Controllers.dialog(
|
||||
i18n("modpack.type.server.malformed"),
|
||||
i18n("message.error"),
|
||||
MessageType.ERROR);
|
||||
Instances.importModpack();
|
||||
return;
|
||||
}
|
||||
Controllers.getDecorator().startWizard(
|
||||
|
||||
Reference in new issue
Block a user