lampac/SISI/Controllers/Ebalovo/ViewController.cs
lampac-talks f843f04fd4 chore: initial commit 154.3
Signed-off-by: lampac-talks <lampac-talks@users.noreply.github.com>
2026-01-30 16:23:09 +03:00

64 lines
2.3 KiB
C#

using Microsoft.AspNetCore.Mvc;
namespace SISI.Controllers.Ebalovo
{
public class ViewController : BaseSisiController
{
public ViewController() : base(AppInit.conf.Ebalovo) { }
[HttpGet]
[Route("elo/vidosik")]
async public Task<ActionResult> Index(string uri, bool related)
{
if (await IsRequestBlocked(rch: true))
return badInitMsg;
if (rch?.enable == true && 484 > rch.InfoConnected()?.apkVersion)
{
rch.Disabled(); // на версиях ниже java.lang.OutOfMemoryError
if (!init.rhub_fallback)
return OnError("apkVersion", false);
}
rhubFallback:
var cache = await InvokeCacheResult<StreamItem>(ipkey($"ebalovo:view:{uri}"), 20, async e =>
{
string ehost = await RootController.goHost(init.corsHost());
var stream_links = await EbalovoTo.StreamLinks(httpHydra, "elo/vidosik", ehost, uri,
async location =>
{
var headers = httpHeaders(init, HeadersModel.Init(
("referer", $"{ehost}/"),
("sec-fetch-dest", "video"),
("sec-fetch-mode", "no-cors"),
("sec-fetch-site", "same-origin")
));
if (rch?.enable == true)
{
var res = await rch.Headers(init.cors(location), null, headers);
return res.currentUrl;
}
return await Http.GetLocation(init.cors(location), timeoutSeconds: init.httptimeout, httpversion: init.httpversion, proxy: proxy, headers: httpHeaders(init));
}
);
if (stream_links?.qualitys == null || stream_links.qualitys.Count == 0)
return e.Fail("stream_links", refresh_proxy: true);
return e.Success(stream_links);
});
if (IsRhubFallback(cache))
goto rhubFallback;
if (related)
return await PlaylistResult(cache.Value?.recomends, cache.ISingleCache, null, total_pages: 1);
return OnResult(cache);
}
}
}