From 1e1ec9d767ca7995d04779113841a6e6774c17ac Mon Sep 17 00:00:00 2001 From: Ben Sarmiento Date: Fri, 26 Jan 2024 22:15:26 +0100 Subject: [PATCH] Remove preferred hosts --- internal/config/types.go | 30 ++++++++---------------------- internal/handlers/home.go | 5 ----- 2 files changed, 8 insertions(+), 27 deletions(-) diff --git a/internal/config/types.go b/internal/config/types.go index 20bd7c1..97f238a 100644 --- a/internal/config/types.go +++ b/internal/config/types.go @@ -1,9 +1,5 @@ package config -import ( - "math/rand" -) - type ConfigInterface interface { GetConfig() ZurgConfig GetVersion() string @@ -23,7 +19,6 @@ type ConfigInterface interface { EnableRetainFolderNameExtension() bool EnableRetainRDTorrentName() bool ShouldIgnoreRenames() bool - GetRandomPreferredHost() string ShouldServeFromRclone() bool ShouldVerifyDownloadLink() bool ShouldForceIPv6() bool @@ -53,15 +48,14 @@ type ZurgConfig struct { CanRepair bool `yaml:"enable_repair" json:"enable_repair"` DeleteRarFiles bool `yaml:"auto_delete_rar_torrents" json:"auto_delete_rar_torrents"` - RealDebridTimeout int `yaml:"realdebrid_timeout_secs" json:"realdebrid_timeout_secs"` - DownloadMount bool `yaml:"enable_download_mount" json:"enable_download_mount"` - RateLimitSleepSeconds int `yaml:"rate_limit_sleep_secs" json:"rate_limit_sleep_secs"` - RetriesUntilFailed int `yaml:"retries_until_failed" json:"retries_until_failed"` - PreferredHosts []string `yaml:"preferred_hosts" json:"preferred_hosts"` - NetworkBufferSize int `yaml:"network_buffer_size" json:"network_buffer_size"` - ServeFromRclone bool `yaml:"serve_from_rclone" json:"serve_from_rclone"` - VerifyDownloadLink bool `yaml:"verify_download_link" json:"verify_download_link"` - ForceIPv6 bool `yaml:"force_ipv6" json:"force_ipv6"` + RealDebridTimeout int `yaml:"realdebrid_timeout_secs" json:"realdebrid_timeout_secs"` + DownloadMount bool `yaml:"enable_download_mount" json:"enable_download_mount"` + RateLimitSleepSeconds int `yaml:"rate_limit_sleep_secs" json:"rate_limit_sleep_secs"` + RetriesUntilFailed int `yaml:"retries_until_failed" json:"retries_until_failed"` + NetworkBufferSize int `yaml:"network_buffer_size" json:"network_buffer_size"` + ServeFromRclone bool `yaml:"serve_from_rclone" json:"serve_from_rclone"` + VerifyDownloadLink bool `yaml:"verify_download_link" json:"verify_download_link"` + ForceIPv6 bool `yaml:"force_ipv6" json:"force_ipv6"` OnLibraryUpdate string `yaml:"on_library_update" json:"on_library_update"` } @@ -141,14 +135,6 @@ func (z *ZurgConfig) ShouldIgnoreRenames() bool { return !z.IgnoreRenames } -func (z *ZurgConfig) GetRandomPreferredHost() string { - if len(z.PreferredHosts) == 0 { - return "" - } - randomIndex := rand.Intn(len(z.PreferredHosts)) - return z.PreferredHosts[randomIndex] -} - func (z *ZurgConfig) ShouldServeFromRclone() bool { return z.ServeFromRclone } diff --git a/internal/handlers/home.go b/internal/handlers/home.go index 6271736..0753803 100644 --- a/internal/handlers/home.go +++ b/internal/handlers/home.go @@ -214,10 +214,6 @@ func (zr *Handlers) handleHome(resp http.ResponseWriter, req *http.Request) { Retries Until Failed %d - - Preferred Hosts - %s - Network Buffer Size %d @@ -283,7 +279,6 @@ func (zr *Handlers) handleHome(resp http.ResponseWriter, req *http.Request) { response.Config.EnableDownloadMount(), response.Config.GetRateLimitSleepSeconds(), response.Config.GetRetriesUntilFailed(), - strings.Join(response.Config.PreferredHosts, ", "), response.Config.GetNetworkBufferSize(), response.Config.ShouldServeFromRclone(), response.Config.ShouldVerifyDownloadLink(),