Dump torrents job
This commit is contained in:
@@ -163,7 +163,7 @@ func (zr *Handlers) handleHome(resp http.ResponseWriter, req *http.Request) {
|
||||
<td>%s</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan="22">Config</td>
|
||||
<td rowspan="23">Config</td>
|
||||
<td>Version</td>
|
||||
<td>%s</td>
|
||||
</tr>
|
||||
@@ -223,6 +223,14 @@ func (zr *Handlers) handleHome(resp http.ResponseWriter, req *http.Request) {
|
||||
<td>Refresh Download Mount Every...</td>
|
||||
<td>%d mins</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Get downloads limit</td>
|
||||
<td>%d items</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Dump Torrents Every...</td>
|
||||
<td>%d mins</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Rate Limit Sleep for...</td>
|
||||
<td>%d secs</td>
|
||||
@@ -273,6 +281,9 @@ func (zr *Handlers) handleHome(resp http.ResponseWriter, req *http.Request) {
|
||||
<form method="post" action="/remount/downloads">
|
||||
<input type="submit" value="Remount downloads" />
|
||||
</form>
|
||||
<form method="post" action="/dump/torrents">
|
||||
<input type="submit" value="Dump torrents" />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -323,6 +334,8 @@ func (zr *Handlers) handleHome(resp http.ResponseWriter, req *http.Request) {
|
||||
response.Config.GetTorrentsCount(),
|
||||
response.Config.GetDownloadTimeoutSecs(),
|
||||
response.Config.GetDownloadsEveryMins(),
|
||||
response.Config.GetDownloadsLimit(),
|
||||
response.Config.GetDumpTorrentsEveryMins(),
|
||||
response.Config.GetRateLimitSleepSecs(),
|
||||
response.Config.GetRetriesUntilFailed(),
|
||||
response.Config.GetNetworkBufferSize(),
|
||||
@@ -367,6 +380,13 @@ func (zr *Handlers) handleRemountDownloads(resp http.ResponseWriter, req *http.R
|
||||
fmt.Fprint(resp, "Remounting downloads...")
|
||||
}
|
||||
|
||||
func (zr *Handlers) handleDumpTorrents(resp http.ResponseWriter, req *http.Request) {
|
||||
resp.Header().Set("Refresh", "2; url=/")
|
||||
zr.torMgr.DumpTrigger <- struct{}{}
|
||||
zr.log.Infof("Triggered dump of torrents")
|
||||
fmt.Fprint(resp, "Dumping torrents...")
|
||||
}
|
||||
|
||||
func bToMb(b uint64) uint64 {
|
||||
return b / 1024 / 1024
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ func AttachHandlers(router *chi.Mux, downloader *universal.Downloader, torMgr *t
|
||||
router.Post("/reboot/refresh", hs.handleRebootRefreshWorker)
|
||||
router.Post("/reboot/repair", hs.handleRebootRepairWorker)
|
||||
router.Post("/remount/downloads", hs.handleRemountDownloads)
|
||||
router.Post("/dump/torrents", hs.handleDumpTorrents)
|
||||
// version
|
||||
router.Get(fmt.Sprintf("/{mountType}/%s", version.FILE), hs.handleVersionFile)
|
||||
router.Head(fmt.Sprintf("/{mountType}/%s", version.FILE), hs.handleCheckVersionFile)
|
||||
|
||||
Reference in New Issue
Block a user