Skip to content

Commit

Permalink
125.1
Browse files Browse the repository at this point in the history
  • Loading branch information
immisterio committed Nov 21, 2024
1 parent 2b9dcb3 commit b76e4c9
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 28 deletions.
2 changes: 1 addition & 1 deletion JinEnergy/Online/OnlineApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ void send(string name, string plugin, BaseSettings init, string? arg_title = nul
if (arg.kinopoisk_id > 0 && AppInit.VoKino.enable)
VoKinoInvoke.SendOnline(AppInit.VoKino, online, bwa: true);

send("Rezka - " + (AppInit.Rezka.premium || AppInit.typeConf == "web" ? "2160p" : "720p"), "rezka", AppInit.Rezka);
send("Rezka - " + ((AppInit.Rezka.premium || AppInit.typeConf == "web") ? "2160p" : "720p"), "rezka", AppInit.Rezka);
send("JinxЕМ - 1080p", "videodb", AppInit.VideoDB);
//send("VideoCDN - 1080p", "vcdn", AppInit.VCDN, argTitle_vpn);
//send("Kinobase - 1080p", "kinobase", AppInit.Kinobase);
Expand Down
3 changes: 3 additions & 0 deletions Online/Controllers/Anime/AnimeGo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ async public Task<ActionResult> Index(string title, int year, int pid, int s, st
if (IsOverridehost(init, out string overridehost))
return Redirect(overridehost);

if (init.rhub)
return ShowError(RchClient.ErrorMsg);

if (pid == 0)
{
#region Поиск
Expand Down
4 changes: 2 additions & 2 deletions Online/Controllers/Anime/Animevost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async public Task<ActionResult> Index(string rchtype, string title, int year, st
string memkey = $"animevost:search:{title}";
if (!hybridCache.TryGetValue(memkey, out List<(string title, string year, string uri, string s)> catalog))
{
if (rchtype == "web")
if (string.IsNullOrEmpty(rchtype) || rchtype == "web")
return ShowError(RchClient.ErrorType(rchtype));

if (rch.IsNotConnected())
Expand Down Expand Up @@ -95,7 +95,7 @@ async public Task<ActionResult> Index(string rchtype, string title, int year, st
string memKey = $"animevost:playlist:{uri}";
if (!hybridCache.TryGetValue(memKey, out List<(string episode, string id)> links))
{
if (rchtype == "web")
if (string.IsNullOrEmpty(rchtype) || rchtype == "web")
return ShowError(RchClient.ErrorType(rchtype));

if (rch.IsNotConnected())
Expand Down
6 changes: 3 additions & 3 deletions Online/Controllers/Kinotochka.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async public Task<ActionResult> Index(string rchtype, long kinopoisk_id, string
string memKey = $"kinotochka:seasons:{title}";
if (!hybridCache.TryGetValue(memKey, out List<(string name, string uri, string season)> links))
{
if (rchtype == "web")
if (string.IsNullOrEmpty(rchtype) || rchtype == "web")
return ShowError(RchClient.ErrorType(rchtype));

if (rch.IsNotConnected())
Expand Down Expand Up @@ -98,7 +98,7 @@ async public Task<ActionResult> Index(string rchtype, long kinopoisk_id, string
string memKey = $"kinotochka:playlist:{newsuri}";
if (!hybridCache.TryGetValue(memKey, out List<(string name, string uri)> links))
{
if (rchtype == "web")
if (string.IsNullOrEmpty(rchtype) || rchtype == "web")
return ShowError(RchClient.ErrorType(rchtype));

if (rch.IsNotConnected())
Expand Down Expand Up @@ -160,7 +160,7 @@ async public Task<ActionResult> Index(string rchtype, long kinopoisk_id, string
string memKey = $"kinotochka:view:{kinopoisk_id}";
if (!hybridCache.TryGetValue(memKey, out string file))
{
if (rchtype == "web")
if (string.IsNullOrEmpty(rchtype) || rchtype == "web")
return ShowError(RchClient.ErrorType(rchtype));

if (rch.IsNotConnected())
Expand Down
2 changes: 1 addition & 1 deletion Online/Controllers/Kinoukr.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async public Task<ActionResult> Index(string rchtype, string title, string origi

var cache = await InvokeCache<EmbedModel>($"kinoukr:view:{title}:{year}:{href}:{clarification}", cacheTime(40, init: init), proxyManager, async res =>
{
if (rchtype == "web")
if (string.IsNullOrEmpty(rchtype) || rchtype == "web")
return ShowError(RchClient.ErrorType(rchtype));

if (rch.IsNotConnected())
Expand Down
2 changes: 1 addition & 1 deletion Online/Controllers/Redheadsound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async public Task<ActionResult> Index(string rchtype, string title, string origi

var cache = await InvokeCache<EmbedModel>($"redheadsound:view:{title}:{year}:{clarification}", cacheTime(30, init: init), proxyManager, async res =>
{
if (rchtype == "web")
if (string.IsNullOrEmpty(rchtype) || rchtype == "web")
return ShowError(RchClient.ErrorType(rchtype));

if (rch.IsNotConnected())
Expand Down
46 changes: 29 additions & 17 deletions Online/OnlineApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using Microsoft.Extensions.Caching.Memory;
using Shared.Engine;
using Shared.Engine.Online;
using System.Data;

namespace Lampac.Controllers
{
Expand Down Expand Up @@ -277,12 +278,15 @@ async Task<string> getTabus(string imdb)
#region events
[HttpGet]
[Route("lifeevents")]
public ActionResult LifeEvents(long id, string imdb_id, long kinopoisk_id, int serial, string source)
public ActionResult LifeEvents(string memkey, long id, string imdb_id, long kinopoisk_id, int serial, string source)
{
string json = null;
JsonResult error(string msg) => Json(new { accsdb = true, ready = true, online = new string[] { }, msg });

if (memoryCache.TryGetValue(checkOnlineSearchKey(id, source), out (bool ready, int tasks, string online) res))
if (string.IsNullOrEmpty(memkey))
memkey = checkOnlineSearchKey(id, source);

if (memoryCache.TryGetValue(memkey, out (bool ready, int tasks, string online) res))
{
if (res.ready && (res.online == null || !res.online.Contains("\"show\":true")))
{
Expand All @@ -302,7 +306,7 @@ public ActionResult LifeEvents(long id, string imdb_id, long kinopoisk_id, int s

[HttpGet]
[Route("lite/events")]
async public Task<ActionResult> Events(long id, string imdb_id, long kinopoisk_id, string title, string original_title, string original_language, int year, string source, int serial = -1, bool life = false, bool islite = false, string account_email = null)
async public Task<ActionResult> Events(long id, string imdb_id, long kinopoisk_id, string title, string original_title, string original_language, int year, string source, string rchtype, int serial = -1, bool life = false, bool islite = false, string account_email = null)
{
var online = new List<(string name, string url, string plugin, int index)>(20);
bool isanime = original_language == "ja";
Expand Down Expand Up @@ -336,9 +340,17 @@ async public Task<ActionResult> Events(long id, string imdb_id, long kinopoisk_i
}
}

void send(string name, BaseSettings init, string plugin = null, string arg_title = null, string arg_url = null)
void send(string name, BaseSettings init, string plugin = null, string arg_title = null, string arg_url = null, string rch_access = null)
{
if (init.enable && !init.rip)
bool enable = init.enable && !init.rip;

if (init.rhub)
{
if (rch_access != null && rchtype != null) // null == all
enable = rch_access.Contains(rchtype);
}

if (enable)
{
string url = init.overridehost;
if (string.IsNullOrEmpty(url) && init.overridehosts != null && init.overridehosts.Length > 0)
Expand Down Expand Up @@ -379,9 +391,9 @@ void send(string name, BaseSettings init, string plugin = null, string arg_title
{
send("Anilibria", conf.AnilibriaOnline);
send("AnimeLib", conf.AnimeLib);
send("Animevost", conf.Animevost);
send("Animevost", conf.Animevost, rch_access: "apk,cors");
send("MoonAnime (Украинский)", conf.MoonAnime, "moonanime");
send("Animebesst", conf.Animebesst);
send("Animebesst", conf.Animebesst, rch_access: "apk");
send("AnimeGo", conf.AnimeGo);
send("AniMedia", conf.AniMedia);
}
Expand Down Expand Up @@ -433,19 +445,19 @@ void send(string name, BaseSettings init, string plugin = null, string arg_title
send("Eneyida (Украинский)", conf.Eneyida, "eneyida");

if (!isanime)
send("Kinoukr (Украинский)", conf.Kinoukr, "kinoukr");
send("Kinoukr (Украинский)", conf.Kinoukr, "kinoukr", rch_access: "apk,cors");

if (AppInit.conf.Collaps.two)
send("Collaps", conf.Collaps, "collaps-dash");
send("Collaps", conf.Collaps);

if (serial == -1 || serial == 0)
send("Redheadsound", conf.Redheadsound);
send("Redheadsound", conf.Redheadsound, rch_access: "apk,cors");

if (kinopoisk_id > 0)
send("HDVB", conf.HDVB);

send("Kinotochka", conf.Kinotochka);
send("Kinotochka", conf.Kinotochka, rch_access: "apk,cors");

if ((serial == -1 || (serial == 1 && !isanime)) && kinopoisk_id > 0)
send("CDNmovies", conf.CDNmovies);
Expand All @@ -471,7 +483,7 @@ void send(string name, BaseSettings init, string plugin = null, string arg_title

if (chos)
{
string memkey = checkOnlineSearchKey(id, source);
string memkey = checkOnlineSearchKey(id, source, online.Count);
if (!memoryCache.TryGetValue(memkey, out (bool ready, int tasks, string online) cache) || !conf.multiaccess)
{
memoryCache.Set(memkey, cache, DateTime.Now.AddSeconds(20));
Expand All @@ -480,10 +492,10 @@ void send(string name, BaseSettings init, string plugin = null, string arg_title
var links = new ConcurrentBag<(string code, int index, bool work)>();

foreach (var o in online)
tasks.Add(checkSearch(links, tasks, o.index, o.name, o.url, o.plugin, id, imdb_id, kinopoisk_id, title, original_title, original_language, source, year, serial, life));
tasks.Add(checkSearch(memkey, links, tasks, o.index, o.name, o.url, o.plugin, id, imdb_id, kinopoisk_id, title, original_title, original_language, source, year, serial, life));

if (life)
return Content("{\"life\":true}", contentType: "application/javascript; charset=utf-8");
return Json(new { life = true, memkey });

await Task.WhenAll(tasks);

Expand All @@ -495,7 +507,7 @@ void send(string name, BaseSettings init, string plugin = null, string arg_title
}

if (life)
return Content("{\"life\":true}", contentType: "application/javascript; charset=utf-8");
return Json(new { life = true, memkey });

return Content($"[{cache.online.Replace("{localhost}", host)}]", contentType: "application/javascript; charset=utf-8");
}
Expand All @@ -508,9 +520,9 @@ void send(string name, BaseSettings init, string plugin = null, string arg_title


#region checkSearch
static string checkOnlineSearchKey(long id, string source) => $"ApiController:checkOnlineSearch:{id}:{source?.Replace("tmdb", "")?.Replace("cub", "")}";
static string checkOnlineSearchKey(long id, string source, int count = 0) => CrypTo.md5($"ApiController:checkOnlineSearch:{id}:{source?.Replace("tmdb", "")?.Replace("cub", "")}:{count}");

async Task checkSearch(ConcurrentBag<(string code, int index, bool work)> links, List<Task> tasks, int index, string name, string uri, string plugin,
async Task checkSearch(string memkey, ConcurrentBag<(string code, int index, bool work)> links, List<Task> tasks, int index, string name, string uri, string plugin,
long id, string imdb_id, long kinopoisk_id, string title, string original_title, string original_language, string source, int year, int serial, bool life)
{
string srq = uri.Replace("{localhost}", $"http://{AppInit.conf.localhost}:{AppInit.conf.listenport}");
Expand Down Expand Up @@ -637,7 +649,7 @@ async Task checkSearch(ConcurrentBag<(string code, int index, bool work)> links,

links.Add(("{" + $"\"name\":\"{name}\",\"url\":\"{uri}\",\"index\":{index},\"show\":{work.ToString().ToLower()},\"balanser\":\"{plugin}\",\"rch\":{rch.ToString().ToLower()}" + "}", index, work));

memoryCache.Set(checkOnlineSearchKey(id, source), (links.Count == tasks.Count, tasks.Count, string.Join(",", links.OrderByDescending(i => i.work).ThenBy(i => i.index).Select(i => i.code))), DateTime.Now.AddMinutes(5));
memoryCache.Set(memkey, (links.Count == tasks.Count, tasks.Count, string.Join(",", links.OrderByDescending(i => i.work).ThenBy(i => i.index).Select(i => i.code))), DateTime.Now.AddMinutes(5));
}
#endregion
}
Expand Down
2 changes: 1 addition & 1 deletion Shared.Model/AppInit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public class AppInit
/// <summary>
/// aHR0cHM6Ly92aWJpeC5vcmcvYXBpL2V4dGVybmFsL2RvY3VtZW50YXRpb24=
/// </summary>
public OnlinesSettings Vibix { get; set; } = new OnlinesSettings("kwwsv=22ylel{1ruj", enable: false);
public OnlinesSettings Vibix { get; set; } = new OnlinesSettings("kwwsv=22ylel{1ruj", enable: false, streamproxy: true);

public KinoPubSettings KinoPub { get; set; } = new KinoPubSettings("kwwsv=22dsl1vuyns1frp") { uhd = true, hevc = true, hdr = true, filetype = "hls4" };

Expand Down
4 changes: 2 additions & 2 deletions Shared/Engine/BaseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public class BaseController : Controller, IDisposable
{
IServiceScope serviceScope;

public static string appversion => "124";
public static string appversion => "125";

public static string minorversion => "9";
public static string minorversion => "1";

public HybridCache hybridCache { get; private set; }

Expand Down

0 comments on commit b76e4c9

Please sign in to comment.