diff --git a/client/src/app/navbar/settings/settings.component.html b/client/src/app/navbar/settings/settings.component.html index 29bae0f..0bcc145 100644 --- a/client/src/app/navbar/settings/settings.component.html +++ b/client/src/app/navbar/settings/settings.component.html @@ -89,6 +89,14 @@

Maximum download speed in Megabytes per second. When set to 0 unlimited speed is used.

+
+ +
+ +
+

Address of a proxy server.

+
+
diff --git a/client/src/app/navbar/settings/settings.component.ts b/client/src/app/navbar/settings/settings.component.ts index b1d9fb6..cb8cb0e 100644 --- a/client/src/app/navbar/settings/settings.component.ts +++ b/client/src/app/navbar/settings/settings.component.ts @@ -46,6 +46,7 @@ export class SettingsComponent implements OnInit { public settingUnpackLimit: number; public settingMinFileSize: number; public settingOnlyDownloadAvailableFiles: boolean; + public settingProxyServer: string; constructor(private settingsService: SettingsService) {} @@ -68,6 +69,7 @@ export class SettingsComponent implements OnInit { this.settingUnpackLimit = parseInt(this.getSetting(results, 'UnpackLimit'), 10); this.settingMinFileSize = parseInt(this.getSetting(results, 'MinFileSize'), 10); this.settingOnlyDownloadAvailableFiles = this.getSetting(results, 'OnlyDownloadAvailableFiles') === '1'; + this.settingProxyServer = this.getSetting(results, 'ProxyServer'); }, (err) => { this.error = err.error; @@ -124,6 +126,10 @@ export class SettingsComponent implements OnInit { settingId: 'OnlyDownloadAvailableFiles', value: (this.settingOnlyDownloadAvailableFiles ? '1' : '0').toString(), }, + { + settingId: 'ProxyServer', + value: this.settingProxyServer, + }, ]; this.settingsService.update(settings).subscribe( diff --git a/server/RdtClient.Data/Data/DataContext.cs b/server/RdtClient.Data/Data/DataContext.cs index 2296ca1..46048fb 100644 --- a/server/RdtClient.Data/Data/DataContext.cs +++ b/server/RdtClient.Data/Data/DataContext.cs @@ -117,6 +117,12 @@ namespace RdtClient.Data.Data SettingId = "DownloadMaxSpeed", Type = "Int32", Value = "0" + }, + new Setting + { + SettingId = "ProxyServer", + Type = "String", + Value = "" } }; diff --git a/server/RdtClient.Service/Services/DownloadClient.cs b/server/RdtClient.Service/Services/DownloadClient.cs index 17bb87f..da71cfd 100644 --- a/server/RdtClient.Service/Services/DownloadClient.cs +++ b/server/RdtClient.Service/Services/DownloadClient.cs @@ -162,7 +162,9 @@ namespace RdtClient.Service.Services settingDownloadMaxSpeed = 0; } settingDownloadMaxSpeed = settingDownloadMaxSpeed * 1024 * 1024; - + + var settingProxyServer = settings.GetString("ProxyServer"); + var downloadOpt = new DownloadConfiguration { MaxTryAgainOnFailover = Int32.MaxValue, @@ -184,6 +186,11 @@ namespace RdtClient.Service.Services } }; + if (!String.IsNullOrWhiteSpace(settingProxyServer)) + { + downloadOpt.RequestConfiguration.Proxy = new WebProxy(new Uri(settingProxyServer), false); + } + _downloader = new DownloadService(downloadOpt); _downloader.DownloadProgressChanged += (_, args) =>