Skip to content

Commit

Permalink
130.1
Browse files Browse the repository at this point in the history
  • Loading branch information
immisterio committed Feb 4, 2025
1 parent fe9d132 commit 89f6dbe
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 35 deletions.
18 changes: 16 additions & 2 deletions Lampac/Controllers/ApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,13 @@ public ActionResult LamInit(bool lite)
file = file.Replace("{jachost}", "redapi.cfhttp.top");

#region full_btn_priority_hash
string online_version = Regex.Match(FileCache.ReadAllText("plugins/online.js"), "version: '([^']+)'").Groups[1].Value;

string LampaUtilshash(string input)
{
if (!AppInit.conf.online.version)
input = input.Replace($"v{online_version}", "");

string str = (input ?? string.Empty);
int hash = 0;

Expand All @@ -392,10 +397,10 @@ string LampaUtilshash(string input)
return Math.Abs(hash).ToString();
}

string online_version = Regex.Match(FileCache.ReadAllText("plugins/online.js"), "version: '([^']+)'").Groups[1].Value;
string full_btn_priority_hash = LampaUtilshash($"<div class=\"full-start__button selector view--online lampac--button\" data-subtitle=\"{AppInit.conf.online.name ?? "Lampac"} v{online_version}\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 392.697 392.697\" xml:space=\"preserve\">\n <path d=\"M21.837,83.419l36.496,16.678L227.72,19.886c1.229-0.592,2.002-1.846,1.98-3.209c-0.021-1.365-0.834-2.592-2.082-3.145\n L197.766,0.3c-0.903-0.4-1.933-0.4-2.837,0L21.873,77.036c-1.259,0.559-2.073,1.803-2.081,3.18\n C19.784,81.593,20.584,82.847,21.837,83.419z\" fill=\"currentColor\"></path>\n <path d=\"M185.689,177.261l-64.988-30.01v91.617c0,0.856-0.44,1.655-1.167,2.114c-0.406,0.257-0.869,0.386-1.333,0.386\n c-0.368,0-0.736-0.082-1.079-0.244l-68.874-32.625c-0.869-0.416-1.421-1.293-1.421-2.256v-92.229L6.804,95.5\n c-1.083-0.496-2.344-0.406-3.347,0.238c-1.002,0.645-1.608,1.754-1.608,2.944v208.744c0,1.371,0.799,2.615,2.045,3.185\n l178.886,81.768c0.464,0.211,0.96,0.315,1.455,0.315c0.661,0,1.318-0.188,1.892-0.555c1.002-0.645,1.608-1.754,1.608-2.945\n V180.445C187.735,179.076,186.936,177.831,185.689,177.261z\" fill=\"currentColor\"></path>\n <path d=\"M389.24,95.74c-1.002-0.644-2.264-0.732-3.347-0.238l-178.876,81.76c-1.246,0.57-2.045,1.814-2.045,3.185v208.751\n c0,1.191,0.606,2.302,1.608,2.945c0.572,0.367,1.23,0.555,1.892,0.555c0.495,0,0.991-0.104,1.455-0.315l178.876-81.768\n c1.246-0.568,2.045-1.813,2.045-3.185V98.685C390.849,97.494,390.242,96.384,389.24,95.74z\" fill=\"currentColor\"></path>\n <path d=\"M372.915,80.216c-0.009-1.377-0.823-2.621-2.082-3.18l-60.182-26.681c-0.938-0.418-2.013-0.399-2.938,0.045\n l-173.755,82.992l60.933,29.117c0.462,0.211,0.958,0.316,1.455,0.316s0.993-0.105,1.455-0.316l173.066-79.092\n C372.122,82.847,372.923,81.593,372.915,80.216z\" fill=\"currentColor\"></path>\n </svg>\n\n <span>Онлайн</span>\n </div>");
string full_btn_priority_hash = LampaUtilshash($"<div class=\"full-start__button selector view--online lampac--button\" data-subtitle=\"{AppInit.conf.online.name} v{online_version}\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 392.697 392.697\" xml:space=\"preserve\">\n <path d=\"M21.837,83.419l36.496,16.678L227.72,19.886c1.229-0.592,2.002-1.846,1.98-3.209c-0.021-1.365-0.834-2.592-2.082-3.145\n L197.766,0.3c-0.903-0.4-1.933-0.4-2.837,0L21.873,77.036c-1.259,0.559-2.073,1.803-2.081,3.18\n C19.784,81.593,20.584,82.847,21.837,83.419z\" fill=\"currentColor\"></path>\n <path d=\"M185.689,177.261l-64.988-30.01v91.617c0,0.856-0.44,1.655-1.167,2.114c-0.406,0.257-0.869,0.386-1.333,0.386\n c-0.368,0-0.736-0.082-1.079-0.244l-68.874-32.625c-0.869-0.416-1.421-1.293-1.421-2.256v-92.229L6.804,95.5\n c-1.083-0.496-2.344-0.406-3.347,0.238c-1.002,0.645-1.608,1.754-1.608,2.944v208.744c0,1.371,0.799,2.615,2.045,3.185\n l178.886,81.768c0.464,0.211,0.96,0.315,1.455,0.315c0.661,0,1.318-0.188,1.892-0.555c1.002-0.645,1.608-1.754,1.608-2.945\n V180.445C187.735,179.076,186.936,177.831,185.689,177.261z\" fill=\"currentColor\"></path>\n <path d=\"M389.24,95.74c-1.002-0.644-2.264-0.732-3.347-0.238l-178.876,81.76c-1.246,0.57-2.045,1.814-2.045,3.185v208.751\n c0,1.191,0.606,2.302,1.608,2.945c0.572,0.367,1.23,0.555,1.892,0.555c0.495,0,0.991-0.104,1.455-0.315l178.876-81.768\n c1.246-0.568,2.045-1.813,2.045-3.185V98.685C390.849,97.494,390.242,96.384,389.24,95.74z\" fill=\"currentColor\"></path>\n <path d=\"M372.915,80.216c-0.009-1.377-0.823-2.621-2.082-3.18l-60.182-26.681c-0.938-0.418-2.013-0.399-2.938,0.045\n l-173.755,82.992l60.933,29.117c0.462,0.211,0.958,0.316,1.455,0.316s0.993-0.105,1.455-0.316l173.066-79.092\n C372.122,82.847,372.923,81.593,372.915,80.216z\" fill=\"currentColor\"></path>\n </svg>\n\n <span>Онлайн</span>\n </div>");

file = file.Replace("{full_btn_priority_hash}", full_btn_priority_hash);
file = file.Replace("{btn_priority_forced}", AppInit.conf.online.btn_priority_forced.ToString().ToLower());
#endregion

#region domain token
Expand Down Expand Up @@ -557,6 +562,15 @@ public ActionResult InvcSyncJS(string token)
}
#endregion

#region invc-rch.js
[HttpGet]
[Route("invc-rch.js")]
public ActionResult InvcRchJS()
{
return Content(FileCache.ReadAllText("plugins/invc-rch.js").Replace("{localhost}", host), "application/javascript; charset=utf-8");
}
#endregion


#region weblog
[HttpGet]
Expand Down
11 changes: 6 additions & 5 deletions Lampac/Controllers/StorageController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ static StorageController()


[Route("/storage/get")]
public ActionResult Get(string path, bool responseInfo)
public ActionResult Get(string path, string pathfile, bool responseInfo)
{
string outFile = getFilePath(path, false);
string outFile = getFilePath(path, pathfile, false);
if (outFile == null || !IO.File.Exists(outFile))
return Content("{\"success\": false, \"msg\": \"outFile\"}", "application/json; charset=utf-8");

Expand All @@ -43,15 +43,15 @@ public ActionResult Get(string path, bool responseInfo)

[HttpPost]
[Route("/storage/set")]
async public Task<ActionResult> Set([FromQuery]string path, [FromQuery]string events)
async public Task<ActionResult> Set([FromQuery]string path, [FromQuery]string pathfile, [FromQuery]string events)
{
if (!AppInit.conf.storage.enable)
return Content("{\"success\": false, \"msg\": \"disabled\"}", "application/json; charset=utf-8");

if (HttpContext.Request.ContentLength > AppInit.conf.storage.max_size)
return Content("{\"success\": false, \"msg\": \"max_size\"}", "application/json; charset=utf-8");

string outFile = getFilePath(path, true);
string outFile = getFilePath(path, pathfile, true);
if (outFile == null)
return Content("{\"success\": false, \"msg\": \"outFile\"}", "application/json; charset=utf-8");

Expand Down Expand Up @@ -88,12 +88,13 @@ async public Task<ActionResult> Set([FromQuery]string path, [FromQuery]string ev


#region getFilePath
string getFilePath(string path, bool createDirectory)
string getFilePath(string path, string pathfile, bool createDirectory)
{
string id = requestInfo.user_uid;
if (string.IsNullOrEmpty(id))
return null;

id += pathfile;
string md5key = AppInit.conf.storage.md5name ? CrypTo.md5(id) : Regex.Replace(id, "(\\@|_)", "");

if (createDirectory)
Expand Down
20 changes: 13 additions & 7 deletions Lampac/Engine/CRON/LampaCron.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ public static class LampaCron

async public static Task Run()
{
await Task.Delay(TimeSpan.FromMinutes(2)).ConfigureAwait(false);
await Task.Delay(TimeSpan.FromMinutes(1)).ConfigureAwait(false);

while (true)
{
try
{
var init = AppInit.conf.LampaWeb;
bool istree = !string.IsNullOrEmpty(init.tree);

async ValueTask<bool> update()
{
Expand All @@ -28,7 +29,10 @@ async ValueTask<bool> update()
if (!File.Exists("wwwroot/lampa-main/app.min.js"))
return true;

string gitapp = await HttpClient.Get($"https://raw.githubusercontent.com/yumata/lampa/{(string.IsNullOrEmpty(init.tree) ? "main" : init.tree)}/app.min.js", weblog: false);
if (istree && File.Exists($"wwwroot/lampa-main/{init.tree}"))
return false;

string gitapp = await HttpClient.Get($"https://raw.githubusercontent.com/yumata/lampa/{(istree ? init.tree : "main")}/app.min.js", weblog: false);
if (gitapp == null || !gitapp.Contains("author: 'Yumata'"))
return false;

Expand All @@ -46,9 +50,8 @@ async ValueTask<bool> update()

if (await update())
{
string uri = string.IsNullOrEmpty(init.tree) ?
"https://github.com/yumata/lampa/archive/refs/heads/main.zip" :
$"https://github.com/yumata/lampa/archive/{init.tree}.zip";
string uri = istree ? $"https://github.com/yumata/lampa/archive/{init.tree}.zip" :
"https://github.com/yumata/lampa/archive/refs/heads/main.zip";

byte[] array = await HttpClient.Download(uri, MaxResponseContentBufferSize: 20_000_000, timeoutSeconds: 40);
if (array != null)
Expand All @@ -58,13 +61,16 @@ async ValueTask<bool> update()
await File.WriteAllBytesAsync("wwwroot/lampa.zip", array);
ZipFile.ExtractToDirectory("wwwroot/lampa.zip", "wwwroot/", overwriteFiles: true);

if (!string.IsNullOrEmpty(init.tree))
if (istree)
{
string plugins_black_list = File.Exists("wwwroot/lampa-main/plugins_black_list.json") ? File.ReadAllText("wwwroot/lampa-main/plugins_black_list.json") : "[]";
string modification = File.Exists("wwwroot/lampa-main/plugins/modification.js") ? File.ReadAllText("wwwroot/lampa-main/plugins/modification.js") : string.Empty;

Directory.Move("wwwroot/lampa-main", $"wwwroot/lampa-old-{DateTime.Now.ToFileTime()}");
if (Directory.Exists("wwwroot/lampa-main"))
Directory.Move("wwwroot/lampa-main", $"wwwroot/lampa-old-{DateTime.Now.ToFileTime()}");

Directory.Move($"wwwroot/lampa-{init.tree}", "wwwroot/lampa-main");
File.WriteAllText($"wwwroot/lampa-main/{init.tree}", string.Empty);

Directory.CreateDirectory("wwwroot/lampa-main/plugins");
File.WriteAllText("wwwroot/lampa-main/plugins_black_list.json", plugins_black_list);
Expand Down
2 changes: 1 addition & 1 deletion Lampac/Engine/Middlewares/Accsdb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public Task Invoke(HttpContext httpContext)
if (httpContext.Request.Path.Value.EndsWith("/personal.lampa"))
return _next(httpContext);

if (httpContext.Request.Path.Value != "/" && !Regex.IsMatch(httpContext.Request.Path.Value, "^/((proxy-dash|ts|ws|headers|myip|geo|version|weblog|rch/result|merchant/payconfirm|bind)(/|$)|(extensions|kit)$|on/|(lite|online|sisi|timecode|sync|tmdbproxy|dlna|ts|tracks|backup|invc-ws)/js/|(streampay|b2pay|cryptocloud|freekassa|litecoin)/|lite/(filmixpro|fxapi/lowlevel/|kinopubpro|vokinotk|rhs/bind)|([^/]+/)?app\\.min\\.js|css/app\\.css|[a-zA-Z]+\\.js|msx/start\\.json|samsung\\.wgt)"))
if (httpContext.Request.Path.Value != "/" && !Regex.IsMatch(httpContext.Request.Path.Value, "^/((proxy-dash|ts|ws|headers|myip|geo|version|weblog|rch/result|merchant/payconfirm|bind)(/|$)|(extensions|kit)$|on/|(lite|online|sisi|timecode|sync|tmdbproxy|dlna|ts|tracks|backup|invc-ws)/js/|(streampay|b2pay|cryptocloud|freekassa|litecoin)/|lite/(filmixpro|fxapi/lowlevel/|kinopubpro|vokinotk|rhs/bind)|([^/]+/)?app\\.min\\.js|css/app\\.css|[a-zA-Z\\-]+\\.js|msx/start\\.json|samsung\\.wgt)"))
{
bool limitip = false;

Expand Down
12 changes: 5 additions & 7 deletions Online/OnlineApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ public ActionResult Online(string token)
file = Regex.Replace(file, "description: \\'([^\\']+)?\\'", $"description: '{init.description}'");
file = Regex.Replace(file, "apn: \\'([^\\']+)?\\'", $"apn: '{init.apn}'");

if (init.forced_checkRchtype)
file = file.Replace("window.rchtype", "Defined.rchtype");

file = file.Replace("return status$1;", "return true;"); // отключение рекламы

return Content(file, contentType: "application/javascript; charset=utf-8");
Expand Down Expand Up @@ -378,14 +375,15 @@ void send(string name, BaseSettings init, string plugin = null, string arg_title
{
if (AppInit.conf.accsdb.enable)
{
if (user != null)
if (init.group > 0)
{
if (init.group > user.group && init.group_hide)
return;
if (init.group_hide)
if (user == null || init.group > user.group)
return;
}
else
{
if (string.IsNullOrEmpty(AppInit.conf.accsdb.premium_pattern))
if (user == null && string.IsNullOrEmpty(AppInit.conf.accsdb.premium_pattern))
return;
}
}
Expand Down
4 changes: 2 additions & 2 deletions SISI/SisiApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ void send(string name, BaseSettings init, string plugin = null, string rch_acces

if (enable)
{
if (AppInit.conf.accsdb.enable)
if (AppInit.conf.accsdb.enable && init.group > 0 && init.group_hide)
{
var user = requestInfo.user;
if (user == null || (init.group > user.group && init.group_hide))
if (user == null || init.group > user.group)
return;
}

Expand Down
2 changes: 1 addition & 1 deletion Shared.Engine/Online/FanCDN.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public string Html(EmbedModel? root, long kinopoisk_id, string? title, string? o
var etpl = new EpisodeTpl();

foreach (var episode in root.serial.First(i => i.id == t).folder[s.ToString()].folder)
etpl.Append($"{episode.Key} серия", title ?? original_title, s.ToString(), episode.Key, episode.Value.file, vast: vast);
etpl.Append($"{episode.Key} серия", title ?? original_title, s.ToString(), episode.Key, onstreamfile.Invoke(episode.Value.file), vast: vast);

if (rjson)
return etpl.ToJson(vtpl);
Expand Down
15 changes: 11 additions & 4 deletions Shared/AppInit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,19 @@ public static void LoadModules()
autoupdatetrackers = true, addTrackersToMagnet = true, intervalUpdateTrackers = 90
};

public WebConf LampaWeb = new WebConf() { autoupdate = true, intervalupdate = 90, basetag = true, index = "lampa-main/index.html" };
public WebConf LampaWeb = new WebConf()
{
autoupdate = true,
intervalupdate = 90,
basetag = true, index = "lampa-main/index.html",
tree = "ab0433fd6d0b6308f588f4aa44c939cfcebf9d4d"
};

public OnlineConf online = new OnlineConf()
{
public OnlineConf online = new OnlineConf()
{
findkp = "all", checkOnlineSearch = true,
component = "lampac", name = "Lampac", description = "Плагин для просмотра онлайн сериалов и фильмов", version = true
component = "lampac", name = "Lampac", description = "Плагин для просмотра онлайн сериалов и фильмов",
version = true, btn_priority_forced = true
};

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

public static string appversion => "129";
public static string appversion => "130";

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

public HybridCache hybridCache { get; private set; }

Expand Down
4 changes: 2 additions & 2 deletions Shared/Engine/CORE/RchClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,14 @@ public bool IsNotSupport(string rch_deny, out string rch_msg)
#endregion

#region InfoConnected
public (int version, string host, string rchtype) InfoConnected()
public (int version, string host, string href, string rchtype) InfoConnected()
{
var client = clients.FirstOrDefault(i => i.Value.ip == ip);
if (client.Value.json == null)
return default;

JObject json = client.Value.json;
return (json.Value<int>("version"), json.Value<string>("host"), json.Value<string>("rchtype"));
return (json.Value<int>("version"), json.Value<string>("host"), json.Value<string>("href"), json.Value<string>("rchtype"));
}
#endregion
}
Expand Down
4 changes: 2 additions & 2 deletions Shared/Models/AppConf/OnlineConf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ public class OnlineConf

public bool checkOnlineSearch { get; set; }

public bool forced_checkRchtype { get; set; }


public string component { get; set; }

Expand All @@ -17,6 +15,8 @@ public class OnlineConf

public bool version { get; set; }

public bool btn_priority_forced { get; set; }


public string apn { get; set; }
}
Expand Down

0 comments on commit 89f6dbe

Please sign in to comment.