Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
immisterio committed Apr 1, 2024
1 parent 096e452 commit d949390
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
26 changes: 16 additions & 10 deletions Lampac/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,18 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IMemoryC
memoryCache = memory;
Shared.Startup.Configure(app, memory);
HybridCache.Configure(memory);
HttpClient.onlog += (e, log) => { _ = soks.Send(log, "http"); };
HttpClient.httpClientFactory = httpClientFactory;
bool manifestload = File.Exists("module/manifest.json");

if (manifestload)
HttpClient.onlog += (e, log) => { _ = soks.Send(log, "http"); };

if (!File.Exists("passwd"))
File.WriteAllText("passwd", Guid.NewGuid().ToString());

try
{
if (AppInit.conf.puppeteer.enable)
if (manifestload && AppInit.conf.puppeteer.enable)
{
_ = Task.Run(async () =>
{
Expand All @@ -140,16 +143,19 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IMemoryC
}
catch { }

Console.WriteLine(JsonConvert.SerializeObject(AppInit.conf, Formatting.Indented, new JsonSerializerSettings()
if (manifestload)
{
//DefaultValueHandling = DefaultValueHandling.Ignore,
NullValueHandling = NullValueHandling.Ignore
}));
Console.WriteLine(JsonConvert.SerializeObject(AppInit.conf, Formatting.Indented, new JsonSerializerSettings()
{
//DefaultValueHandling = DefaultValueHandling.Ignore,
NullValueHandling = NullValueHandling.Ignore
}));

if (AppInit.conf.multiaccess)
{
ThreadPool.GetMinThreads(out int workerThreads, out int completionPortThreads);
ThreadPool.SetMinThreads(Math.Max(100, workerThreads), Math.Max(20, completionPortThreads));
if (AppInit.conf.multiaccess)
{
ThreadPool.GetMinThreads(out int workerThreads, out int completionPortThreads);
ThreadPool.SetMinThreads(Math.Max(100, workerThreads), Math.Max(20, completionPortThreads));
}
}

app.UseDeveloperExceptionPage();
Expand Down
10 changes: 4 additions & 6 deletions Online/Controllers/Zetflix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ async public Task<ActionResult> Index(long id, int serial, long kinopoisk_id, st

string html = await InvokeCache($"zetfix:view:{kinopoisk_id}:{rs}", cacheTime(40), async () =>
{
if (!AppInit.conf.multiaccess)
return await black_magic(kinopoisk_id, rs);

string uri = $"{AppInit.conf.Zetflix.host}/iplayer/videodb.php?kp={kinopoisk_id}" + (s > 0 ? $"&season={s}" : "");

if (!AppInit.conf.multiaccess)
return await black_magic(uri);

string html = string.IsNullOrEmpty(PHPSESSID) ? null : await HttpClient.Get(uri, cookie: $"PHPSESSID={PHPSESSID}", headers: HeadersModel.Init("Referer", "https://www.google.com/"));
if (html != null && !html.StartsWith("<script>(function"))
{
Expand Down Expand Up @@ -104,7 +104,7 @@ async public Task<ActionResult> Index(long id, int serial, long kinopoisk_id, st

static DateTime excookies = default;

async ValueTask<string> black_magic(long kinopoisk_id, int s)
async ValueTask<string> black_magic(string uri)
{
if (cookies != null && DateTime.Now > excookies)
cookies = null;
Expand All @@ -119,8 +119,6 @@ async ValueTask<string> black_magic(long kinopoisk_id, int s)
if (page == null)
return null;

string uri = $"{AppInit.conf.Zetflix.host}/iplayer/videodb.php?kp={kinopoisk_id}" + (s > 0 ? $"&season={s}" : "");

var response = await page.GoToAsync($"view-source:{uri}");
string html = await response.TextAsync();

Expand Down

0 comments on commit d949390

Please sign in to comment.