Compare commits

..

1 Commits

Author SHA1 Message Date
Flaminel
fb438f2ca7 Fix base paths being incorrectly configured for download clients (#173) 2025-06-27 19:44:46 +03:00
3 changed files with 9 additions and 7 deletions

View File

@@ -168,9 +168,7 @@ public sealed class DelugeClient
content.Headers.ContentType = new MediaTypeWithQualityHeaderValue("application/json");
UriBuilder uriBuilder = new(_config.Url);
uriBuilder.Path = string.IsNullOrEmpty(_config.UrlBase)
? $"{uriBuilder.Path.TrimEnd('/')}/json"
: $"{uriBuilder.Path.TrimEnd('/')}/{_config.UrlBase.TrimStart('/').TrimEnd('/')}/json";
uriBuilder.Path = $"{uriBuilder.Path.TrimEnd('/')}/json";
var responseMessage = await _httpClient.PostAsync(uriBuilder.Uri, content);
responseMessage.EnsureSuccessStatusCode();

View File

@@ -53,9 +53,7 @@ public partial class TransmissionService : DownloadService, ITransmissionService
)
{
UriBuilder uriBuilder = new(_downloadClientConfig.Url);
uriBuilder.Path = string.IsNullOrEmpty(_downloadClientConfig.UrlBase)
? $"{uriBuilder.Path.TrimEnd('/')}/rpc"
: $"{uriBuilder.Path.TrimEnd('/')}/{_downloadClientConfig.UrlBase.TrimStart('/').TrimEnd('/')}/rpc";
uriBuilder.Path = $"{uriBuilder.Path.TrimEnd('/')}/rpc";
_client = new Client(
_httpClient,
uriBuilder.Uri.ToString(),

View File

@@ -363,8 +363,9 @@ export class DownloadClientSettingsComponent implements OnDestroy, CanComponentD
const clientType = this.clientForm.get('type')?.value;
const hostControl = this.clientForm.get('host');
const usernameControl = this.clientForm.get('username');
const urlBaseControl = this.clientForm.get('urlBase');
if (!hostControl || !usernameControl) return;
if (!hostControl || !usernameControl || !urlBaseControl) return;
hostControl.setValidators([
Validators.required,
@@ -377,6 +378,11 @@ export class DownloadClientSettingsComponent implements OnDestroy, CanComponentD
usernameControl.clearValidators();
}
// Set default URL base for Transmission
if (clientType === DownloadClientType.Transmission) {
urlBaseControl.setValue('transmission');
}
// Update validation state
hostControl.updateValueAndValidity();
usernameControl.updateValueAndValidity();