diff --git a/internal/app.go b/internal/app.go
index 40f31d6..39d415e 100644
--- a/internal/app.go
+++ b/internal/app.go
@@ -62,7 +62,9 @@ func MainApp(configPath string) {
log.Named("unrestrict_client"),
)
- api := realdebrid.NewRealDebrid(apiClient, unrestrictClient, log.Named("realdebrid"))
+ downloadClient := http.NewHTTPClient(config.GetToken(), config.GetRetriesUntilFailed(), config.GetDownloadTimeoutSecs(), true, config, log.Named("download_client"))
+
+ api := realdebrid.NewRealDebrid(apiClient, unrestrictClient, downloadClient, log.Named("realdebrid"))
premium.MonitorPremiumStatus(api, zurglog)
@@ -76,7 +78,6 @@ func MainApp(configPath string) {
utils.EnsureDirExists("data") // Ensure the data directory exists
torrentMgr := torrent.NewTorrentManager(config, api, workerPool, log.Named("manager"))
- downloadClient := http.NewHTTPClient(config.GetToken(), config.GetRetriesUntilFailed(), config.GetDownloadTimeoutSecs(), true, config, log.Named("download_client"))
downloader := universal.NewDownloader(downloadClient)
router := chi.NewRouter()
diff --git a/internal/config/types.go b/internal/config/types.go
index 84bbe3b..448804a 100644
--- a/internal/config/types.go
+++ b/internal/config/types.go
@@ -21,7 +21,6 @@ type ConfigInterface interface {
EnableRetainRDTorrentName() bool
ShouldIgnoreRenames() bool
ShouldServeFromRclone() bool
- ShouldVerifyDownloadLink() bool
ShouldForceIPv6() bool
GetApiTimeoutSecs() int
GetDownloadTimeoutSecs() int
@@ -157,10 +156,6 @@ func (z *ZurgConfig) ShouldServeFromRclone() bool {
return z.ServeFromRclone
}
-func (z *ZurgConfig) ShouldVerifyDownloadLink() bool {
- return z.VerifyDownloadLink
-}
-
func (z *ZurgConfig) ShouldForceIPv6() bool {
return z.ForceIPv6
}
diff --git a/internal/handlers/home.go b/internal/handlers/home.go
index 3535297..d880265 100644
--- a/internal/handlers/home.go
+++ b/internal/handlers/home.go
@@ -234,10 +234,6 @@ func (zr *Handlers) handleHome(resp http.ResponseWriter, req *http.Request) {
Serve From Rclone |
%t |
-
- | Verify Download Link |
- %t |
-
| Force IPv6 |
%t |
@@ -318,7 +314,6 @@ func (zr *Handlers) handleHome(resp http.ResponseWriter, req *http.Request) {
response.Config.GetRetriesUntilFailed(),
response.Config.GetNetworkBufferSize(),
response.Config.ShouldServeFromRclone(),
- response.Config.ShouldVerifyDownloadLink(),
response.Config.ShouldForceIPv6(),
response.Config.GetOnLibraryUpdate(),
)
diff --git a/internal/universal/downloader.go b/internal/universal/downloader.go
index 4382408..f98f6e3 100644
--- a/internal/universal/downloader.go
+++ b/internal/universal/downloader.go
@@ -80,13 +80,6 @@ func (dl *Downloader) DownloadFile(directory, torrentName, fileName string, resp
}
}
if cfg.ShouldServeFromRclone() {
- if cfg.ShouldVerifyDownloadLink() {
- if !dl.client.CanFetchFirstByte(unrestrict.Download) {
- log.Warnf("File %s is not available", fileName)
- http.Error(resp, "File is not available", http.StatusInternalServerError)
- return
- }
- }
redirect(resp, req, unrestrict.Download, cfg)
} else {
dl.streamFileToResponse(torrent, file, unrestrict, resp, req, torMgr, cfg, log)
@@ -105,13 +98,6 @@ func (dl *Downloader) DownloadLink(fileName, link string, resp http.ResponseWrit
return
} else {
if cfg.ShouldServeFromRclone() {
- if cfg.ShouldVerifyDownloadLink() {
- if !dl.client.CanFetchFirstByte(unrestrict.Download) {
- log.Warnf("File %s is not available", fileName)
- http.Error(resp, "File is not available", http.StatusInternalServerError)
- return
- }
- }
redirect(resp, req, unrestrict.Download, cfg)
} else {
dl.streamFileToResponse(nil, nil, unrestrict, resp, req, torMgr, cfg, log)
diff --git a/pkg/realdebrid/api.go b/pkg/realdebrid/api.go
index a5441d0..a791e5a 100644
--- a/pkg/realdebrid/api.go
+++ b/pkg/realdebrid/api.go
@@ -15,13 +15,15 @@ import (
type RealDebrid struct {
client *zurghttp.HTTPClient
unrestrictClient *zurghttp.HTTPClient
+ downloadClient *zurghttp.HTTPClient
log *logutil.Logger
}
-func NewRealDebrid(client, unrestrictClient *zurghttp.HTTPClient, log *logutil.Logger) *RealDebrid {
+func NewRealDebrid(client, unrestrictClient, downloadClient *zurghttp.HTTPClient, log *logutil.Logger) *RealDebrid {
return &RealDebrid{
client: client,
unrestrictClient: unrestrictClient,
+ downloadClient: downloadClient,
log: log,
}
}
@@ -101,7 +103,7 @@ func (rd *RealDebrid) UnrestrictLink(link string, checkFirstByte bool) (*Downloa
return nil, fmt.Errorf("undecodable response: %v", err)
}
- if checkFirstByte && !rd.client.CanFetchFirstByte(response.Download) {
+ if checkFirstByte && !rd.downloadClient.CanFetchFirstByte(response.Download) {
return nil, fmt.Errorf("can't fetch first byte")
}