mirror of
https://github.com/C9Glax/tranga.git
synced 2025-04-14 04:13:18 +02:00
Merge branch 'cuttingedge-merge-ServerV2' into postgres-Server-V2
# Conflicts: # API/MangaDownloadClients/ChromiumDownloadClient.cs # Tranga/TrangaSettings.cs
This commit is contained in:
commit
b818f63f2a
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user