mirror of
https://github.com/C9Glax/tranga.git
synced 2025-02-22 23:30:13 +01:00
Merge branch 'cuttingedge-merge-ServerV2' into cuttingedge
This commit is contained in:
commit
e5be5703f8
@ -10,7 +10,6 @@ namespace Tranga.MangaConnectors;
|
|||||||
internal class ChromiumDownloadClient : DownloadClient
|
internal class ChromiumDownloadClient : DownloadClient
|
||||||
{
|
{
|
||||||
private static IBrowser? _browser;
|
private static IBrowser? _browser;
|
||||||
private const int StartTimeoutMs = 10000;
|
|
||||||
private readonly HttpDownloadClient _httpDownloadClient;
|
private readonly HttpDownloadClient _httpDownloadClient;
|
||||||
|
|
||||||
private static async Task<IBrowser> StartBrowser(Logging.Logger? logger = null)
|
private static async Task<IBrowser> StartBrowser(Logging.Logger? logger = null)
|
||||||
@ -24,7 +23,7 @@ internal class ChromiumDownloadClient : DownloadClient
|
|||||||
"--disable-dev-shm-usage",
|
"--disable-dev-shm-usage",
|
||||||
"--disable-setuid-sandbox",
|
"--disable-setuid-sandbox",
|
||||||
"--no-sandbox"},
|
"--no-sandbox"},
|
||||||
Timeout = StartTimeoutMs
|
Timeout = TrangaSettings.ChromiumStartupTimeoutMs
|
||||||
}, new LoggerFactory([new LogProvider(logger)]));
|
}, new LoggerFactory([new LogProvider(logger)]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,8 +69,10 @@ internal class ChromiumDownloadClient : DownloadClient
|
|||||||
|
|
||||||
private RequestResult MakeRequestBrowser(string url, string? referrer = null, string? clickButton = null)
|
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;
|
IPage page = _browser.NewPageAsync().Result;
|
||||||
page.DefaultTimeout = 10000;
|
page.DefaultTimeout = TrangaSettings.ChromiumPageTimeoutMs;
|
||||||
IResponse response;
|
IResponse response;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -35,6 +35,8 @@ public static class TrangaSettings
|
|||||||
};
|
};
|
||||||
|
|
||||||
public static Dictionary<RequestType, int> requestLimits { get; set; } = DefaultRequestLimits;
|
public static Dictionary<RequestType, int> requestLimits { get; set; } = DefaultRequestLimits;
|
||||||
|
public static int ChromiumStartupTimeoutMs { get; set; } = 30000;
|
||||||
|
public static int ChromiumPageTimeoutMs { get; set; } = 30000;
|
||||||
|
|
||||||
public static void LoadFromWorkingDirectory(string directory)
|
public static void LoadFromWorkingDirectory(string directory)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user