Merge branch 'cuttingedge-merge-ServerV2' into postgres-Server-V2

# Conflicts:
#	API/MangaDownloadClients/ChromiumDownloadClient.cs
#	Tranga/TrangaSettings.cs
This commit is contained in:
Glax 2025-01-15 22:56:25 +01:00
commit b818f63f2a

View File

@ -9,7 +9,6 @@ namespace API.MangaDownloadClients;
internal class ChromiumDownloadClient : DownloadClient
{
private static IBrowser? _browser;
private const int StartTimeoutMs = 10000;
private readonly HttpDownloadClient _httpDownloadClient;
private static async Task<IBrowser> StartBrowser()
@ -22,7 +21,7 @@ internal class ChromiumDownloadClient : DownloadClient
"--disable-dev-shm-usage",
"--disable-setuid-sandbox",
"--no-sandbox"},
Timeout = StartTimeoutMs
Timeout = 30000
}, new LoggerFactory([new LogProvider()])); //TODO
}
@ -67,15 +66,19 @@ internal class ChromiumDownloadClient : DownloadClient
private RequestResult MakeRequestBrowser(string url, string? referrer = null, string? clickButton = null)
{
if (_browser is null)
return new RequestResult(HttpStatusCode.InternalServerError, null, Stream.Null);
IPage page = _browser.NewPageAsync().Result;
page.DefaultTimeout = 10000;
IResponse response;
try
{
response = page.GoToAsync(url, WaitUntilNavigation.Networkidle0).Result;
response = page.GoToAsync(url, WaitUntilNavigation.Load).Result;
//Log($"Page loaded. {url}");
}
catch (Exception e)
{
//Log($"Could not load Page {url}\n{e.Message}");
page.CloseAsync();
return new RequestResult(HttpStatusCode.InternalServerError, null, Stream.Null);
}