Multi-token support
This commit is contained in:
@@ -21,14 +21,14 @@ import (
|
||||
)
|
||||
|
||||
type Handlers struct {
|
||||
downloader *universal.Downloader
|
||||
torMgr *torrent.TorrentManager
|
||||
cfg config.ConfigInterface
|
||||
api *realdebrid.RealDebrid
|
||||
workerPool *ants.Pool
|
||||
hosts []string
|
||||
initialTraffic atomic.Uint64
|
||||
log *logutil.Logger
|
||||
downloader *universal.Downloader
|
||||
torMgr *torrent.TorrentManager
|
||||
cfg config.ConfigInterface
|
||||
api *realdebrid.RealDebrid
|
||||
workerPool *ants.Pool
|
||||
hosts []string
|
||||
trafficOnStartup atomic.Uint64
|
||||
log *logutil.Logger
|
||||
}
|
||||
|
||||
func init() {
|
||||
@@ -53,9 +53,9 @@ func AttachHandlers(router *chi.Mux, downloader *universal.Downloader, torMgr *t
|
||||
log.Errorf("Failed to get traffic details: %v", err)
|
||||
trafficDetails = make(map[string]int64)
|
||||
}
|
||||
hs.initialTraffic.Store(uint64(0))
|
||||
hs.trafficOnStartup.Store(uint64(0))
|
||||
if _, ok := trafficDetails["real-debrid.com"]; ok {
|
||||
hs.initialTraffic.Store(uint64(trafficDetails["real-debrid.com"]))
|
||||
hs.trafficOnStartup.Store(uint64(trafficDetails["real-debrid.com"]))
|
||||
}
|
||||
|
||||
if cfg.GetUsername() != "" {
|
||||
@@ -426,7 +426,7 @@ func (hs *Handlers) handleDownloadLink(resp http.ResponseWriter, req *http.Reque
|
||||
filename = chi.URLParam(req, "filename")
|
||||
}
|
||||
if download, ok := hs.torMgr.DownloadMap.Get(filename); ok {
|
||||
hs.downloader.DownloadLink(download.Filename, download.Download, resp, req, hs.torMgr, hs.cfg, hs.log)
|
||||
hs.downloader.DownloadLink(download, resp, req, hs.torMgr, hs.cfg, hs.log)
|
||||
} else {
|
||||
http.NotFound(resp, req)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user