Move all optional file download to separate button on sidebar

This commit is contained in:
shortcutme 2020-02-07 16:40:04 +01:00
parent 6d425f30fe
commit c91f2f0a09
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
2 changed files with 10 additions and 3 deletions

View File

@ -315,7 +315,7 @@ class UiWebsocketPlugin(object):
body.append(_("""
<li>
<label>{_[Download and help distribute all files]}</label>
<label>{_[Help distribute added optional files]}</label>
<input type="checkbox" class="checkbox" id="checkbox-autodownloadoptional" {checked}/><div class="checkbox-skin"></div>
"""))
@ -326,6 +326,7 @@ class UiWebsocketPlugin(object):
<label>{_[Auto download big file size limit]}</label>
<input type='text' class='text text-num' value="{autodownload_bigfile_size_limit}" id='input-autodownload_bigfile_size_limit'/><span class='text-post'>MB</span>
<a href='#Set' class='button' id='button-autodownload_bigfile_size_limit'>{_[Set]}</a>
<a href='#Download+previous' class='button' id='button-autodownload_previous'>{_[Download previous files]}</a>
</div>
"""))
body.append("</li>")
@ -754,8 +755,6 @@ class UiWebsocketPlugin(object):
@flag.no_multiuser
def actionSiteSetAutodownloadoptional(self, to, owned):
self.site.settings["autodownloadoptional"] = bool(owned)
self.site.bad_files = {}
gevent.spawn(self.site.update, check_files=True)
self.site.worker_manager.removeSolvedFileTasks()
@flag.no_multiuser

View File

@ -372,6 +372,14 @@ class Sidebar extends Class
@updateHtmlTag()
return false
# Site start download optional files
@tag.find("#button-autodownload_previous").off("click touchend").on "click touchend", =>
@wrapper.ws.cmd "siteUpdate", {"address": @wrapper.site_info.address, "check_files": true}, =>
@wrapper.notifications.add "done-download_optional", "done", "Optional files downloaded", 5000
@wrapper.notifications.add "start-download_optional", "info", "Optional files download started", 5000
return false
# Database reload
@tag.find("#button-dbreload").off("click touchend").on "click touchend", =>
@wrapper.ws.cmd "dbReload", [], =>