feat: add setting to networks tab to not validate downloads from modpacks.ch
This commit is contained in:
parent
30d7fcfa47
commit
a0bf1f6f49
5 changed files with 58 additions and 16 deletions
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
|
@ -28,4 +28,5 @@
|
|||
"com.sun.*"
|
||||
],
|
||||
"java.codeGeneration.generateComments": true,
|
||||
"git.inputValidationLength": 100,
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ This changelog only contains the changes that are unreleased. For changes for in
|
|||
- Add in new Vanilla pack installer + support for snapshots [#460]
|
||||
- Allow changing description by double clicking description area
|
||||
- Add in popup message when launcher has update but they're disabled
|
||||
- Add setting to networks tab to not validate downloads from modpacks.ch
|
||||
|
||||
### Fixes
|
||||
- Launcher not working with Java 16 [#465]
|
||||
|
|
|
@ -95,6 +95,7 @@ public class Settings {
|
|||
public int concurrentConnections = 8;
|
||||
public int connectionTimeout = 30;
|
||||
public boolean dontUseHttp2 = false;
|
||||
public boolean dontValidateModpacksChDownloads = false;
|
||||
public boolean enableProxy = false;
|
||||
public String proxyHost = "";
|
||||
public int proxyPort = 8080;
|
||||
|
|
|
@ -51,6 +51,9 @@ public class NetworkSettingsTab extends AbstractSettingsTab implements Relocaliz
|
|||
private final JLabelWithHover dontUseHttp2Label;
|
||||
private final JCheckBox dontUseHttp2;
|
||||
|
||||
private final JLabelWithHover dontValidateModpacksChDownloadsLabel;
|
||||
private final JCheckBox dontValidateModpacksChDownloads;
|
||||
|
||||
private final JLabelWithHover enableProxyLabel;
|
||||
private final JCheckBox enableProxy;
|
||||
|
||||
|
@ -118,6 +121,23 @@ public class NetworkSettingsTab extends AbstractSettingsTab implements Relocaliz
|
|||
dontUseHttp2.setSelected(App.settings.dontUseHttp2);
|
||||
add(dontUseHttp2, gbc);
|
||||
|
||||
// Don't validate Modpacks.ch downloads
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy++;
|
||||
gbc.insets = UIConstants.LABEL_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_TRAILING;
|
||||
dontValidateModpacksChDownloadsLabel = new JLabelWithHover(
|
||||
GetText.tr("Don't Validate Modpacks.Ch Downloads") + "?", HELP_ICON, GetText.tr(
|
||||
"If downloads from modpacks.ch (FTB) should not be validated. This shouldn't be enabled unless encountering issues."));
|
||||
add(dontValidateModpacksChDownloadsLabel, gbc);
|
||||
|
||||
gbc.gridx++;
|
||||
gbc.insets = UIConstants.CHECKBOX_FIELD_INSETS;
|
||||
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||
dontValidateModpacksChDownloads = new JCheckBox();
|
||||
dontValidateModpacksChDownloads.setSelected(App.settings.dontValidateModpacksChDownloads);
|
||||
add(dontValidateModpacksChDownloads, gbc);
|
||||
|
||||
// Enable Proxy
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy++;
|
||||
|
@ -261,6 +281,7 @@ public class NetworkSettingsTab extends AbstractSettingsTab implements Relocaliz
|
|||
App.settings.concurrentConnections = (Integer) concurrentConnections.getValue();
|
||||
App.settings.connectionTimeout = (Integer) connectionTimeout.getValue();
|
||||
App.settings.dontUseHttp2 = dontUseHttp2.isSelected();
|
||||
App.settings.dontValidateModpacksChDownloads = dontValidateModpacksChDownloads.isSelected();
|
||||
App.settings.enableProxy = enableProxy.isSelected();
|
||||
if (enableProxy.isSelected()) {
|
||||
App.settings.proxyHost = proxyHost.getText();
|
||||
|
@ -292,9 +313,13 @@ public class NetworkSettingsTab extends AbstractSettingsTab implements Relocaliz
|
|||
this.connectionTimeoutLabel.setToolTipText(
|
||||
"<html>" + GetText.tr("This determines how long connections will wait before timing out.") + "</html>");
|
||||
|
||||
this.dontUseHttp2Label.setText(GetText.tr("Enable Proxy") + "?");
|
||||
this.dontUseHttp2Label
|
||||
.setToolTipText(GetText.tr("If you use a proxy to connect to the internet you can enable it here."));
|
||||
this.dontUseHttp2Label.setText(GetText.tr("Don't Use HTTP/2") + "?");
|
||||
this.dontUseHttp2Label.setToolTipText(GetText
|
||||
.tr("If HTTP/2 connections shouldn't be used. This should not be checked in a majority of cases."));
|
||||
|
||||
this.dontValidateModpacksChDownloadsLabel.setText(GetText.tr("Don't Validate Modpacks.Ch Downloads") + "?");
|
||||
this.dontValidateModpacksChDownloadsLabel.setToolTipText(GetText.tr(
|
||||
"If downloads from modpacks.ch (FTB) should not be validated. This shouldn't be enabled unless encountering issues."));
|
||||
|
||||
this.enableProxyLabel.setText(GetText.tr("Don't Use HTTP/2") + "?");
|
||||
this.enableProxyLabel.setToolTipText(GetText
|
||||
|
|
|
@ -1540,8 +1540,9 @@ public class InstanceInstaller extends SwingWorker<Boolean, Void> implements Net
|
|||
download = download.hash(mod.md5);
|
||||
}
|
||||
|
||||
// modpacks.ch api just flat out returns wrong hases/sizes so ignore
|
||||
if (modpacksChPackVersionManifest != null) {
|
||||
// modpacks.ch api has had issues in the past, so if user enabled, don't check
|
||||
// hashes
|
||||
if (modpacksChPackVersionManifest != null && App.settings.dontValidateModpacksChDownloads) {
|
||||
download = download.ignoreFailures();
|
||||
}
|
||||
|
||||
|
@ -1664,16 +1665,23 @@ public class InstanceInstaller extends SwingWorker<Boolean, Void> implements Net
|
|||
fireSubProgressUnknown();
|
||||
fireTask(GetText.tr("Calculating Files To Download"));
|
||||
|
||||
List<com.atlauncher.network.Download> filesToDownload = modpacksChPackVersionManifest.files
|
||||
.parallelStream().filter(
|
||||
f -> f.type != ModpacksChPackVersionManifectFileType.MOD)
|
||||
.map(file -> com.atlauncher.network.Download.build().setUrl(file.url).size((long) file.size)
|
||||
.hash(file.sha1).ignoreFailures()
|
||||
.downloadTo(root
|
||||
.resolve((file.path.substring(0, 2).equalsIgnoreCase("./") ? file.path.substring(2)
|
||||
: file.path) + file.name))
|
||||
.withInstanceInstaller(this).withHttpClient(Network.createProgressClient(this)))
|
||||
.collect(Collectors.toList());
|
||||
List<com.atlauncher.network.Download> filesToDownload = modpacksChPackVersionManifest.files.parallelStream()
|
||||
.filter(f -> f.type != ModpacksChPackVersionManifectFileType.MOD).map(file -> {
|
||||
com.atlauncher.network.Download download = com.atlauncher.network.Download.build()
|
||||
.setUrl(file.url).size((long) file.size).hash(file.sha1)
|
||||
.downloadTo(root.resolve(
|
||||
(file.path.substring(0, 2).equalsIgnoreCase("./") ? file.path.substring(2)
|
||||
: file.path) + file.name))
|
||||
.withInstanceInstaller(this).withHttpClient(Network.createProgressClient(this));
|
||||
|
||||
// modpacks.ch api has had issues in the past, so if user enabled, don't check
|
||||
// hashes
|
||||
if (App.settings.dontValidateModpacksChDownloads) {
|
||||
download = download.ignoreFailures();
|
||||
}
|
||||
|
||||
return download;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
fireTask(GetText.tr("Creating Config Directories"));
|
||||
|
||||
|
@ -1766,9 +1774,15 @@ public class InstanceInstaller extends SwingWorker<Boolean, Void> implements Net
|
|||
// we can't check the provided hash and size here otherwise download fails as
|
||||
// their api doesn't return the correct info
|
||||
com.atlauncher.network.Download imageDownload = com.atlauncher.network.Download.build().setUrl(art.url)
|
||||
.size(art.size).hash(art.sha1).downloadTo(root.resolve("instance.png")).ignoreFailures()
|
||||
.size(art.size).hash(art.sha1).downloadTo(root.resolve("instance.png"))
|
||||
.withInstanceInstaller(this).withHttpClient(Network.createProgressClient(this));
|
||||
|
||||
// modpacks.ch api has had issues in the past, so if user enabled, don't check
|
||||
// hashes
|
||||
if (App.settings.dontValidateModpacksChDownloads) {
|
||||
imageDownload = imageDownload.ignoreFailures();
|
||||
}
|
||||
|
||||
this.setTotalBytes(art.size);
|
||||
imageDownload.downloadFile();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue