Add Proxy Server setting.
This commit is contained in:
parent
4cf25b6b37
commit
5e8d65fcb2
4 changed files with 28 additions and 1 deletions
|
|
@ -89,6 +89,14 @@
|
|||
<p class="help">Maximum download speed in Megabytes per second. When set to 0 unlimited speed is used.</p>
|
||||
</div>
|
||||
|
||||
<div class="field" *ngIf="settingDownloadClient === 'MultiPart'">
|
||||
<label class="label">Proxy Server</label>
|
||||
<div class="control">
|
||||
<input class="input" type="text" maxlength="1000" [(ngModel)]="settingProxyServer" />
|
||||
</div>
|
||||
<p class="help">Address of a proxy server.</p>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label class="label">Maximum unpack processes</label>
|
||||
<div class="control">
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -117,6 +117,12 @@ namespace RdtClient.Data.Data
|
|||
SettingId = "DownloadMaxSpeed",
|
||||
Type = "Int32",
|
||||
Value = "0"
|
||||
},
|
||||
new Setting
|
||||
{
|
||||
SettingId = "ProxyServer",
|
||||
Type = "String",
|
||||
Value = ""
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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) =>
|
||||
|
|
|
|||
Loading…
Reference in a new issue