Always share update files; disable forced update check on startup

This commit is contained in:
Zlatin Balevsky
2019-11-06 05:41:58 +00:00
parent e736b42751
commit e9f7a51e16
2 changed files with 8 additions and 0 deletions

View File

@ -20,6 +20,7 @@ class MuWireSettings {
int totalUploadSlots
int uploadSlotsPerUser
int updateCheckInterval
long lastUpdateCheck
boolean autoDownloadUpdate
String updateType
String nickname
@ -60,6 +61,7 @@ class MuWireSettings {
incompleteLocation = new File(incompleteLocationProp)
downloadRetryInterval = Integer.parseInt(props.getProperty("downloadRetryInterval","60"))
updateCheckInterval = Integer.parseInt(props.getProperty("updateCheckInterval","24"))
lastUpdateCheck = Long.parseLong(props.getProperty("lastUpdateChec","0"))
autoDownloadUpdate = Boolean.parseBoolean(props.getProperty("autoDownloadUpdate","true"))
updateType = props.getProperty("updateType","jar")
shareDownloadedFiles = Boolean.parseBoolean(props.getProperty("shareDownloadedFiles","true"))
@ -107,6 +109,7 @@ class MuWireSettings {
props.setProperty("incompleteLocation", incompleteLocation.getAbsolutePath())
props.setProperty("downloadRetryInterval", String.valueOf(downloadRetryInterval))
props.setProperty("updateCheckInterval", String.valueOf(updateCheckInterval))
props.setProperty("lastUpdateCheck", String.valueOf(lastUpdateCheck))
props.setProperty("autoDownloadUpdate", String.valueOf(autoDownloadUpdate))
props.setProperty("updateType",String.valueOf(updateType))
props.setProperty("shareDownloadedFiles", String.valueOf(shareDownloadedFiles))

View File

@ -9,6 +9,7 @@ import com.muwire.core.Persona
import com.muwire.core.download.UIDownloadEvent
import com.muwire.core.files.FileDownloadedEvent
import com.muwire.core.files.FileManager
import com.muwire.core.files.FileSharedEvent
import com.muwire.core.search.QueryEvent
import com.muwire.core.search.SearchEvent
import com.muwire.core.search.UIResultBatchEvent
@ -56,6 +57,7 @@ class UpdateClient {
this.fileManager = fileManager
this.me = me
this.spk = spk
this.lastUpdateCheckTime = settings.lastUpdateCheck
timer = new Timer("update-client",true)
}
@ -84,6 +86,8 @@ class UpdateClient {
return
updateDownloading = false
eventBus.publish(new UpdateDownloadedEvent(version : version, signer : signer, text : text))
if (!settings.shareDownloadedFiles)
eventBus.publish(new FileSharedEvent(file : e.downloadedFile))
}
private void checkUpdate() {
@ -93,6 +97,7 @@ class UpdateClient {
return
}
lastUpdateCheckTime = now
settings.lastUpdateCheck = now
log.info("checking for update")