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>
|
<p class="help">Maximum download speed in Megabytes per second. When set to 0 unlimited speed is used.</p>
|
||||||
</div>
|
</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">
|
<div class="field">
|
||||||
<label class="label">Maximum unpack processes</label>
|
<label class="label">Maximum unpack processes</label>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ export class SettingsComponent implements OnInit {
|
||||||
public settingUnpackLimit: number;
|
public settingUnpackLimit: number;
|
||||||
public settingMinFileSize: number;
|
public settingMinFileSize: number;
|
||||||
public settingOnlyDownloadAvailableFiles: boolean;
|
public settingOnlyDownloadAvailableFiles: boolean;
|
||||||
|
public settingProxyServer: string;
|
||||||
|
|
||||||
constructor(private settingsService: SettingsService) {}
|
constructor(private settingsService: SettingsService) {}
|
||||||
|
|
||||||
|
|
@ -68,6 +69,7 @@ export class SettingsComponent implements OnInit {
|
||||||
this.settingUnpackLimit = parseInt(this.getSetting(results, 'UnpackLimit'), 10);
|
this.settingUnpackLimit = parseInt(this.getSetting(results, 'UnpackLimit'), 10);
|
||||||
this.settingMinFileSize = parseInt(this.getSetting(results, 'MinFileSize'), 10);
|
this.settingMinFileSize = parseInt(this.getSetting(results, 'MinFileSize'), 10);
|
||||||
this.settingOnlyDownloadAvailableFiles = this.getSetting(results, 'OnlyDownloadAvailableFiles') === '1';
|
this.settingOnlyDownloadAvailableFiles = this.getSetting(results, 'OnlyDownloadAvailableFiles') === '1';
|
||||||
|
this.settingProxyServer = this.getSetting(results, 'ProxyServer');
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
this.error = err.error;
|
this.error = err.error;
|
||||||
|
|
@ -124,6 +126,10 @@ export class SettingsComponent implements OnInit {
|
||||||
settingId: 'OnlyDownloadAvailableFiles',
|
settingId: 'OnlyDownloadAvailableFiles',
|
||||||
value: (this.settingOnlyDownloadAvailableFiles ? '1' : '0').toString(),
|
value: (this.settingOnlyDownloadAvailableFiles ? '1' : '0').toString(),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
settingId: 'ProxyServer',
|
||||||
|
value: this.settingProxyServer,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
this.settingsService.update(settings).subscribe(
|
this.settingsService.update(settings).subscribe(
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,12 @@ namespace RdtClient.Data.Data
|
||||||
SettingId = "DownloadMaxSpeed",
|
SettingId = "DownloadMaxSpeed",
|
||||||
Type = "Int32",
|
Type = "Int32",
|
||||||
Value = "0"
|
Value = "0"
|
||||||
|
},
|
||||||
|
new Setting
|
||||||
|
{
|
||||||
|
SettingId = "ProxyServer",
|
||||||
|
Type = "String",
|
||||||
|
Value = ""
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,8 @@ namespace RdtClient.Service.Services
|
||||||
}
|
}
|
||||||
settingDownloadMaxSpeed = settingDownloadMaxSpeed * 1024 * 1024;
|
settingDownloadMaxSpeed = settingDownloadMaxSpeed * 1024 * 1024;
|
||||||
|
|
||||||
|
var settingProxyServer = settings.GetString("ProxyServer");
|
||||||
|
|
||||||
var downloadOpt = new DownloadConfiguration
|
var downloadOpt = new DownloadConfiguration
|
||||||
{
|
{
|
||||||
MaxTryAgainOnFailover = Int32.MaxValue,
|
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 = new DownloadService(downloadOpt);
|
||||||
|
|
||||||
_downloader.DownloadProgressChanged += (_, args) =>
|
_downloader.DownloadProgressChanged += (_, args) =>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue