Multi-token support
This commit is contained in:
@@ -87,7 +87,7 @@ func (dl *Downloader) DownloadFile(
|
||||
return
|
||||
}
|
||||
|
||||
unrestrict, err := torMgr.UnrestrictFile(file, cfg.ShouldServeFromRclone())
|
||||
unrestrict, err := torMgr.UnrestrictFile(file)
|
||||
if dlErr, ok := err.(*zurghttp.DownloadErrorResponse); ok && dlErr.Message == "bytes_limit_reached" {
|
||||
// log.Errorf("Your account has reached the bandwidth limit, please try again after 12AM CET")
|
||||
http.Error(resp, "File is not available (bandwidth limit reached)", http.StatusBadRequest)
|
||||
@@ -122,26 +122,13 @@ func (dl *Downloader) DownloadFile(
|
||||
|
||||
// DownloadLink handles a GET request for downloads
|
||||
func (dl *Downloader) DownloadLink(
|
||||
fileName,
|
||||
link string,
|
||||
unrestrict *realdebrid.Download,
|
||||
resp http.ResponseWriter,
|
||||
req *http.Request,
|
||||
torMgr *intTor.TorrentManager,
|
||||
cfg config.ConfigInterface,
|
||||
log *logutil.Logger,
|
||||
) {
|
||||
// log.Debugf("Opening file %s (%s)", fileName, link)
|
||||
unrestrict, err := torMgr.UnrestrictLink(link, cfg.ShouldServeFromRclone())
|
||||
if dlErr, ok := err.(*zurghttp.DownloadErrorResponse); ok && dlErr.Message == "bytes_limit_reached" {
|
||||
// log.Errorf("Your account has reached the bandwidth limit, please try again after 12AM CET")
|
||||
http.Error(resp, "Link is not available (bandwidth limit reached)", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
log.Errorf("Error unrestricting link %s: %v", link, err)
|
||||
http.Error(resp, "File is not available (can't unrestrict)", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
if cfg.ShouldServeFromRclone() {
|
||||
redirect(resp, req, unrestrict.Download)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user