Skip to content

Commit

Permalink
Pragmatically disabled verification of downloads from custom sources.
Browse files Browse the repository at this point in the history
  • Loading branch information
sk89q committed Feb 19, 2013
1 parent 52bbb54 commit 06a8191
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/com/sk89q/mclauncher/LaunchTask.java
Expand Up @@ -44,6 +44,7 @@
import com.sk89q.mclauncher.addons.Addon;
import com.sk89q.mclauncher.addons.AddonsProfile;
import com.sk89q.mclauncher.config.Configuration;
import com.sk89q.mclauncher.config.Constants;
import com.sk89q.mclauncher.config.Def;
import com.sk89q.mclauncher.config.LauncherOptions;
import com.sk89q.mclauncher.launch.GameLauncher;
Expand Down Expand Up @@ -631,6 +632,9 @@ private void update(File rootDir, UpdateCache cache, InputStream packageStream,

updater = new Updater(packageStream, rootDir, cache);
updater.setReinstall(forced);
// Verify if it's the default download or if the relevant constant is enabled
updater.setVerifying(configuration.getUpdateUrl() == null
|| Constants.VERIFY_CUSTOM_DOWNLOADS);
updater.registerParameter("user", username);
updater.registerParameter("ticket", "deprecated"); // Now deprecated
for (ProgressListener listener : getProgressListenerList()) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/sk89q/mclauncher/config/Constants.java
Expand Up @@ -37,6 +37,7 @@
*/
public class Constants {

public static final boolean VERIFY_CUSTOM_DOWNLOADS = false;
public static final URL NEWS_URL;

private static final String NEWS_URL_BASE = "http://minecraft.update.sk89q.com/updates/?v=%version%";
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/com/sk89q/mclauncher/update/Updater.java
Expand Up @@ -65,6 +65,7 @@ public class Updater implements DownloadListener {

private static final Logger logger = Logger.getLogger(Updater.class.getCanonicalName());

private boolean verifying = true;
private InputStream packageStream;
private File rootDir;
private UpdateCache cache;
Expand Down Expand Up @@ -96,6 +97,24 @@ public Updater(InputStream packageStream, File rootDir, UpdateCache cache) {
this.cache = cache;
}

/**
* Returns whether signatures are verified after the download.
*
* @return true if verifying
*/
public boolean isVerifying() {
return verifying;
}

/**
* Set whether the signatures of downloaded files should be verified.
*
* @param verifying true to verify
*/
public void setVerifying(boolean verifying) {
this.verifying = verifying;
}

/**
* Get the number of download tries.
*
Expand Down Expand Up @@ -332,6 +351,10 @@ private void downloadFiles() throws UpdateException {
* @throws UpdateException
*/
private void verify() throws UpdateException {
if (!isVerifying()) { // No verification!
return;
}

currentIndex = 0;

SignatureVerifier signatureVerifier = new SignatureVerifier(
Expand Down

1 comment on commit 06a8191

@sk89q
Copy link
Member Author

@sk89q sk89q commented on 06a8191 Feb 19, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.