Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions Translator/Services/TranslationExtractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,24 @@ public async Task<Dictionary<string, string>> ExtractFromBTCPayServerAsync(strin
var url = btcpayUrl.TrimEnd('/') + "/cheat/translations/default-en";
try
{
_logger.LogInformation("Fetching translations from BTCPay Server at {Url}", url);
var response = await _httpClient.GetAsync(url);
Uri uri = new(url, UriKind.Absolute);
HttpResponseMessage response;
if((uri.Host == "localhost" || uri.Host == "127.0.0.1") && uri.Scheme == "https")
{
var handler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
};

_logger.LogInformation("Fetching translations from BTCPay Server at {Url}", url);
var client = new HttpClient(handler);
response = await client.GetAsync(url);
}
else
{
_logger.LogInformation("Fetching translations from BTCPay Server at {Url}", url);
response = await _httpClient.GetAsync(url);
}

if (!response.IsSuccessStatusCode)
{
Expand All @@ -57,6 +73,10 @@ public async Task<Dictionary<string, string>> ExtractFromBTCPayServerAsync(strin
_logger.LogInformation("Fetched {Count} translations from BTCPay Server", translations.Count);
return translations;
}
catch(UriFormatException e)
{
throw new InvalidOperationException($"Malformed URL: {url}\nError: {e.Message}", e);
}
catch (HttpRequestException ex)
{
throw new InvalidOperationException(
Expand Down
10 changes: 10 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,16 @@
"Sha": "bdf2a884d3920bc86804176e3a4ee5a102ec126096319180f141d2d87712f018",
"Maintainer": null,
"Updated": "2026-06-15T10:36:23Z"
},
{
"Code": "ar",
"Bcp47": "ar",
"Name": "Arabic",
"Native": "العربية",
"File": "translations/arabic.json",
"Sha": "509d115150c69d7aab6591314bf74f608100c8fe303f6eb0721f33200adfb0f1",
"Maintainer": "AdilElFarissi|https://github.com/AdilElFarissi",
"Updated": "2026-06-21T22:00:00Z"
}
],
"Redirect": null
Expand Down
Loading
Loading