diff --git a/core/src/main/groovy/com/muwire/core/MuWireSettings.groovy b/core/src/main/groovy/com/muwire/core/MuWireSettings.groovy index 50ac7d09..43509aa3 100644 --- a/core/src/main/groovy/com/muwire/core/MuWireSettings.groovy +++ b/core/src/main/groovy/com/muwire/core/MuWireSettings.groovy @@ -14,6 +14,7 @@ class MuWireSettings { int downloadRetryInterval int updateCheckInterval boolean autoDownloadUpdate + String updateType String nickname File downloadLocation CrawlerResponse crawlerResponse @@ -39,6 +40,7 @@ class MuWireSettings { downloadRetryInterval = Integer.parseInt(props.getProperty("downloadRetryInterval","1")) updateCheckInterval = Integer.parseInt(props.getProperty("updateCheckInterval","24")) autoDownloadUpdate = Boolean.parseBoolean(props.getProperty("autoDownloadUpdate","true")) + updateType = props.getProperty("updateType","jar") shareDownloadedFiles = Boolean.parseBoolean(props.getProperty("shareDownloadedFiles","true")) downloadSequentialRatio = Float.valueOf(props.getProperty("downloadSequentialRatio","0.8")) hostClearInterval = Integer.valueOf(props.getProperty("hostClearInterval","60")) @@ -65,6 +67,7 @@ class MuWireSettings { props.setProperty("downloadRetryInterval", String.valueOf(downloadRetryInterval)) props.setProperty("updateCheckInterval", String.valueOf(updateCheckInterval)) props.setProperty("autoDownloadUpdate", String.valueOf(autoDownloadUpdate)) + props.setProperty("updateType",updateType) props.setProperty("shareDownloadedFiles", String.valueOf(shareDownloadedFiles)) props.setProperty("downloadSequentialRatio", String.valueOf(downloadSequentialRatio)) props.setProperty("hostClearInterval", String.valueOf(hostClearInterval)) diff --git a/core/src/main/groovy/com/muwire/core/update/UpdateClient.groovy b/core/src/main/groovy/com/muwire/core/update/UpdateClient.groovy index 41605177..29998495 100644 --- a/core/src/main/groovy/com/muwire/core/update/UpdateClient.groovy +++ b/core/src/main/groovy/com/muwire/core/update/UpdateClient.groovy @@ -140,13 +140,20 @@ class UpdateClient { log.info("no new version available") return } + + String infoHash + if (settings.updateType == "jar") { + infoHash = payload.infoHash + } else + infoHash = payload[settings.updateType] + if (!settings.autoDownloadUpdate) { log.info("new version $payload.version available, publishing event") - eventBus.publish(new UpdateAvailableEvent(version : payload.version, signer : payload.signer, infoHash : payload.infoHash)) + eventBus.publish(new UpdateAvailableEvent(version : payload.version, signer : payload.signer, infoHash : infoHash)) } else { log.info("new version $payload.version available") - updateInfoHash = new InfoHash(Base64.decode(payload.infoHash)) + updateInfoHash = new InfoHash(Base64.decode(infoHash)) if (fileManager.rootToFiles.containsKey(updateInfoHash)) eventBus.publish(new UpdateDownloadedEvent(version : payload.version, signer : payload.signer)) else { diff --git a/gui/griffon-app/lifecycle/Ready.groovy b/gui/griffon-app/lifecycle/Ready.groovy index 5ba03558..b5a9a2c0 100644 --- a/gui/griffon-app/lifecycle/Ready.groovy +++ b/gui/griffon-app/lifecycle/Ready.groovy @@ -49,6 +49,7 @@ class Ready extends AbstractLifecycleHandler { log.info("creating new properties") props = new MuWireSettings() props.embeddedRouter = Boolean.parseBoolean(System.getProperties().getProperty("embeddedRouter")) + props.updateType = System.getProperty("updateType") def nickname while (true) { nickname = JOptionPane.showInputDialog(null,