mirror of
https://github.com/lampame/lampac-ukraine.git
synced 2026-04-18 02:02:21 +00:00
Compare commits
No commits in common. "31549455ee458cf40311c41e4620aa6db2ebf8ee" and "ee5fae65818e7ecad08721774aae72e6e4ad1e7a" have entirely different histories.
31549455ee
...
ee5fae6581
@ -25,23 +25,6 @@ namespace Shared.Engine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string TryGetMagicAshdiHost(JObject conf)
|
|
||||||
{
|
|
||||||
if (conf == null || !conf.TryGetValue("magic_apn", out var magicToken) || magicToken == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
if (magicToken.Type == JTokenType.Boolean)
|
|
||||||
return magicToken.Value<bool>() ? DefaultHost : null;
|
|
||||||
|
|
||||||
if (magicToken.Type == JTokenType.String)
|
|
||||||
return NormalizeHost(magicToken.Value<string>());
|
|
||||||
|
|
||||||
if (magicToken.Type != JTokenType.Object)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return NormalizeHost(((JObject)magicToken).Value<string>("ashdi"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ApplyInitConf(bool enabled, string host, BaseSettings init)
|
public static void ApplyInitConf(bool enabled, string host, BaseSettings init)
|
||||||
{
|
{
|
||||||
if (init == null)
|
if (init == null)
|
||||||
@ -54,13 +37,8 @@ namespace Shared.Engine
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
host = NormalizeHost(host);
|
if (string.IsNullOrWhiteSpace(host))
|
||||||
if (host == null)
|
host = DefaultHost;
|
||||||
{
|
|
||||||
init.apnstream = false;
|
|
||||||
init.apn = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (init.apn == null)
|
if (init.apn == null)
|
||||||
init.apn = new ApnConf();
|
init.apn = new ApnConf();
|
||||||
@ -104,13 +82,5 @@ namespace Shared.Engine
|
|||||||
|
|
||||||
return $"{host.TrimEnd('/')}/{url}";
|
return $"{host.TrimEnd('/')}/{url}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string NormalizeHost(string host)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(host))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return host.Trim();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,7 +36,6 @@ namespace AnimeON.Controllers
|
|||||||
if (!init.enable)
|
if (!init.enable)
|
||||||
return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
TryEnableMagicApn(init);
|
|
||||||
var invoke = new AnimeONInvoke(init, hybridCache, OnLog, proxyManager, httpHydra);
|
var invoke = new AnimeONInvoke(init, hybridCache, OnLog, proxyManager, httpHydra);
|
||||||
|
|
||||||
if (checksearch)
|
if (checksearch)
|
||||||
@ -383,7 +382,6 @@ namespace AnimeON.Controllers
|
|||||||
if (!init.enable)
|
if (!init.enable)
|
||||||
return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
TryEnableMagicApn(init);
|
|
||||||
var invoke = new AnimeONInvoke(init, hybridCache, OnLog, proxyManager, httpHydra);
|
var invoke = new AnimeONInvoke(init, hybridCache, OnLog, proxyManager, httpHydra);
|
||||||
bool disableAshdiMultivoiceForVod = serial == 1;
|
bool disableAshdiMultivoiceForVod = serial == 1;
|
||||||
OnLog($"AnimeON Play: url={url}, episode_id={episode_id}, serial={serial}");
|
OnLog($"AnimeON Play: url={url}, episode_id={episode_id}, serial={serial}");
|
||||||
@ -465,24 +463,6 @@ namespace AnimeON.Controllers
|
|||||||
return HostStreamProxy(init, link, headers: headers, force_streamproxy: forceProxy);
|
return HostStreamProxy(init, link, headers: headers, force_streamproxy: forceProxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TryEnableMagicApn(OnlinesSettings init)
|
|
||||||
{
|
|
||||||
if (init == null
|
|
||||||
|| init.apn != null
|
|
||||||
|| init.streamproxy
|
|
||||||
|| string.IsNullOrWhiteSpace(ModInit.MagicApnAshdiHost))
|
|
||||||
return;
|
|
||||||
|
|
||||||
string player = new RchClient(HttpContext, host, init, requestInfo).InfoConnected()?.player;
|
|
||||||
bool useInnerPlayer = string.IsNullOrWhiteSpace(player)
|
|
||||||
|| player.Equals("inner", StringComparison.OrdinalIgnoreCase);
|
|
||||||
if (!useInnerPlayer)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ApnHelper.ApplyInitConf(true, ModInit.MagicApnAshdiHost, init);
|
|
||||||
OnLog($"AnimeON: увімкнено magic_apn для Ashdi (player={player ?? "unknown"}).");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool IsCheckOnlineSearchEnabled()
|
private static bool IsCheckOnlineSearchEnabled()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@ -30,7 +30,6 @@ namespace AnimeON
|
|||||||
|
|
||||||
public static OnlinesSettings AnimeON;
|
public static OnlinesSettings AnimeON;
|
||||||
public static bool ApnHostProvided;
|
public static bool ApnHostProvided;
|
||||||
public static string MagicApnAshdiHost;
|
|
||||||
|
|
||||||
public static OnlinesSettings Settings
|
public static OnlinesSettings Settings
|
||||||
{
|
{
|
||||||
@ -57,23 +56,15 @@ namespace AnimeON
|
|||||||
list = new string[] { "socks5://ip:port" }
|
list = new string[] { "socks5://ip:port" }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var defaults = JObject.FromObject(AnimeON);
|
var conf = ModuleInvoke.Init("AnimeON", JObject.FromObject(AnimeON));
|
||||||
defaults["magic_apn"] = new JObject()
|
|
||||||
{
|
|
||||||
["ashdi"] = ApnHelper.DefaultHost
|
|
||||||
};
|
|
||||||
|
|
||||||
var conf = ModuleInvoke.Init("AnimeON", defaults) ?? defaults;
|
|
||||||
bool hasApn = ApnHelper.TryGetInitConf(conf, out bool apnEnabled, out string apnHost);
|
bool hasApn = ApnHelper.TryGetInitConf(conf, out bool apnEnabled, out string apnHost);
|
||||||
MagicApnAshdiHost = ApnHelper.TryGetMagicAshdiHost(conf);
|
|
||||||
conf.Remove("magic_apn");
|
|
||||||
conf.Remove("apn");
|
conf.Remove("apn");
|
||||||
conf.Remove("apn_host");
|
conf.Remove("apn_host");
|
||||||
AnimeON = conf.ToObject<OnlinesSettings>();
|
AnimeON = conf.ToObject<OnlinesSettings>();
|
||||||
if (hasApn)
|
if (hasApn)
|
||||||
ApnHelper.ApplyInitConf(apnEnabled, apnHost, AnimeON);
|
ApnHelper.ApplyInitConf(apnEnabled, apnHost, AnimeON);
|
||||||
ApnHostProvided = ApnHelper.IsEnabled(AnimeON);
|
ApnHostProvided = hasApn && apnEnabled && !string.IsNullOrWhiteSpace(apnHost);
|
||||||
if (ApnHostProvided)
|
if (hasApn && apnEnabled)
|
||||||
{
|
{
|
||||||
AnimeON.streamproxy = false;
|
AnimeON.streamproxy = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,23 +25,6 @@ namespace Shared.Engine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string TryGetMagicAshdiHost(JObject conf)
|
|
||||||
{
|
|
||||||
if (conf == null || !conf.TryGetValue("magic_apn", out var magicToken) || magicToken == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
if (magicToken.Type == JTokenType.Boolean)
|
|
||||||
return magicToken.Value<bool>() ? DefaultHost : null;
|
|
||||||
|
|
||||||
if (magicToken.Type == JTokenType.String)
|
|
||||||
return NormalizeHost(magicToken.Value<string>());
|
|
||||||
|
|
||||||
if (magicToken.Type != JTokenType.Object)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return NormalizeHost(((JObject)magicToken).Value<string>("ashdi"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ApplyInitConf(bool enabled, string host, BaseSettings init)
|
public static void ApplyInitConf(bool enabled, string host, BaseSettings init)
|
||||||
{
|
{
|
||||||
if (init == null)
|
if (init == null)
|
||||||
@ -54,13 +37,8 @@ namespace Shared.Engine
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
host = NormalizeHost(host);
|
if (string.IsNullOrWhiteSpace(host))
|
||||||
if (host == null)
|
host = DefaultHost;
|
||||||
{
|
|
||||||
init.apnstream = false;
|
|
||||||
init.apn = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (init.apn == null)
|
if (init.apn == null)
|
||||||
init.apn = new ApnConf();
|
init.apn = new ApnConf();
|
||||||
@ -104,13 +82,5 @@ namespace Shared.Engine
|
|||||||
|
|
||||||
return $"{host.TrimEnd('/')}/{url}";
|
return $"{host.TrimEnd('/')}/{url}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string NormalizeHost(string host)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(host))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return host.Trim();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,8 +31,6 @@ namespace KlonFUN.Controllers
|
|||||||
if (!init.enable)
|
if (!init.enable)
|
||||||
return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
TryEnableMagicApn(init);
|
|
||||||
|
|
||||||
var invoke = new KlonFUNInvoke(init, hybridCache, OnLog, proxyManager, httpHydra);
|
var invoke = new KlonFUNInvoke(init, hybridCache, OnLog, proxyManager, httpHydra);
|
||||||
|
|
||||||
if (checksearch)
|
if (checksearch)
|
||||||
@ -219,24 +217,6 @@ namespace KlonFUN.Controllers
|
|||||||
return HostStreamProxy(init, link);
|
return HostStreamProxy(init, link);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TryEnableMagicApn(OnlinesSettings init)
|
|
||||||
{
|
|
||||||
if (init == null
|
|
||||||
|| init.apn != null
|
|
||||||
|| init.streamproxy
|
|
||||||
|| string.IsNullOrWhiteSpace(ModInit.MagicApnAshdiHost))
|
|
||||||
return;
|
|
||||||
|
|
||||||
string player = new RchClient(HttpContext, host, init, requestInfo).InfoConnected()?.player;
|
|
||||||
bool useInnerPlayer = string.IsNullOrWhiteSpace(player)
|
|
||||||
|| player.Equals("inner", StringComparison.OrdinalIgnoreCase);
|
|
||||||
if (!useInnerPlayer)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ApnHelper.ApplyInitConf(true, ModInit.MagicApnAshdiHost, init);
|
|
||||||
OnLog($"KlonFUN: увімкнено magic_apn для Ashdi (player={player ?? "unknown"}).");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string StripLampacArgs(string url)
|
private static string StripLampacArgs(string url)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(url))
|
if (string.IsNullOrWhiteSpace(url))
|
||||||
|
|||||||
@ -14,7 +14,6 @@ using System.Security.Authentication;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Shared.Models.Events;
|
|
||||||
|
|
||||||
namespace KlonFUN
|
namespace KlonFUN
|
||||||
{
|
{
|
||||||
@ -22,11 +21,10 @@ namespace KlonFUN
|
|||||||
{
|
{
|
||||||
public static double Version => 2.0;
|
public static double Version => 2.0;
|
||||||
|
|
||||||
public static ModuleConfig KlonFUN;
|
public static OnlinesSettings KlonFUN;
|
||||||
public static bool ApnHostProvided;
|
public static bool ApnHostProvided;
|
||||||
public static string MagicApnAshdiHost;
|
|
||||||
|
|
||||||
public static ModuleConfig Settings
|
public static OnlinesSettings Settings
|
||||||
{
|
{
|
||||||
get => KlonFUN;
|
get => KlonFUN;
|
||||||
set => KlonFUN = value;
|
set => KlonFUN = value;
|
||||||
@ -37,16 +35,7 @@ namespace KlonFUN
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Loaded(InitspaceModel initspace)
|
public void Loaded(InitspaceModel initspace)
|
||||||
{
|
{
|
||||||
UpdateConfig();
|
KlonFUN = new OnlinesSettings("KlonFUN", "https://klon.fun", streamproxy: false, useproxy: false)
|
||||||
EventListener.UpdateInitFile += UpdateConfig;
|
|
||||||
|
|
||||||
// Додаємо підтримку "уточнити пошук".
|
|
||||||
RegisterWithSearch("klonfun");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateConfig()
|
|
||||||
{
|
|
||||||
KlonFUN = new ModuleConfig("KlonFUN", "https://klon.fun", streamproxy: false, useproxy: false)
|
|
||||||
{
|
{
|
||||||
displayname = "KlonFUN",
|
displayname = "KlonFUN",
|
||||||
displayindex = 0,
|
displayindex = 0,
|
||||||
@ -59,24 +48,16 @@ namespace KlonFUN
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var defaults = JObject.FromObject(KlonFUN);
|
var conf = ModuleInvoke.Init("KlonFUN", JObject.FromObject(KlonFUN));
|
||||||
defaults["magic_apn"] = new JObject()
|
|
||||||
{
|
|
||||||
["ashdi"] = ApnHelper.DefaultHost
|
|
||||||
};
|
|
||||||
|
|
||||||
var conf = ModuleInvoke.Init("KlonFUN", defaults) ?? defaults;
|
|
||||||
bool hasApn = ApnHelper.TryGetInitConf(conf, out bool apnEnabled, out string apnHost);
|
bool hasApn = ApnHelper.TryGetInitConf(conf, out bool apnEnabled, out string apnHost);
|
||||||
MagicApnAshdiHost = ApnHelper.TryGetMagicAshdiHost(conf);
|
|
||||||
conf.Remove("magic_apn");
|
|
||||||
conf.Remove("apn");
|
conf.Remove("apn");
|
||||||
conf.Remove("apn_host");
|
conf.Remove("apn_host");
|
||||||
KlonFUN = conf.ToObject<ModuleConfig>();
|
KlonFUN = conf.ToObject<OnlinesSettings>();
|
||||||
if (hasApn)
|
if (hasApn)
|
||||||
ApnHelper.ApplyInitConf(apnEnabled, apnHost, KlonFUN);
|
ApnHelper.ApplyInitConf(apnEnabled, apnHost, KlonFUN);
|
||||||
ApnHostProvided = ApnHelper.IsEnabled(KlonFUN);
|
ApnHostProvided = hasApn && apnEnabled && !string.IsNullOrWhiteSpace(apnHost);
|
||||||
|
|
||||||
if (ApnHostProvided)
|
if (hasApn && apnEnabled)
|
||||||
{
|
{
|
||||||
KlonFUN.streamproxy = false;
|
KlonFUN.streamproxy = false;
|
||||||
}
|
}
|
||||||
@ -85,6 +66,9 @@ namespace KlonFUN
|
|||||||
KlonFUN.apnstream = false;
|
KlonFUN.apnstream = false;
|
||||||
KlonFUN.apn = null;
|
KlonFUN.apn = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Додаємо підтримку "уточнити пошук".
|
||||||
|
RegisterWithSearch("klonfun");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void RegisterWithSearch(string plugin)
|
private static void RegisterWithSearch(string plugin)
|
||||||
@ -123,7 +107,6 @@ namespace KlonFUN
|
|||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
EventListener.UpdateInitFile -= UpdateConfig;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,18 +0,0 @@
|
|||||||
using Shared.Models.Online.Settings;
|
|
||||||
|
|
||||||
namespace KlonFUN
|
|
||||||
{
|
|
||||||
public class MagicApnSettings
|
|
||||||
{
|
|
||||||
public string ashdi { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ModuleConfig : OnlinesSettings
|
|
||||||
{
|
|
||||||
public ModuleConfig(string plugin, string host, string apihost = null, bool useproxy = false, string token = null, bool enable = true, bool streamproxy = false, bool rip = false, bool forceEncryptToken = false, string rch_access = null, string stream_access = null) : base(plugin, host, apihost, useproxy, token, enable, streamproxy, rip, forceEncryptToken, rch_access, stream_access)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public MagicApnSettings magic_apn { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -23,37 +23,20 @@ namespace Shared.Engine
|
|||||||
if (apnToken.Type == JTokenType.Boolean)
|
if (apnToken.Type == JTokenType.Boolean)
|
||||||
{
|
{
|
||||||
enabled = apnToken.Value<bool>();
|
enabled = apnToken.Value<bool>();
|
||||||
host = NormalizeHost(conf.Value<string>("apn_host"));
|
host = conf.Value<string>("apn_host");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (apnToken.Type == JTokenType.String)
|
if (apnToken.Type == JTokenType.String)
|
||||||
{
|
{
|
||||||
host = NormalizeHost(apnToken.Value<string>());
|
host = apnToken.Value<string>();
|
||||||
enabled = host != null;
|
enabled = !string.IsNullOrWhiteSpace(host);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string TryGetMagicAshdiHost(JObject conf)
|
|
||||||
{
|
|
||||||
if (conf == null || !conf.TryGetValue("magic_apn", out var magicToken) || magicToken == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
if (magicToken.Type == JTokenType.Boolean)
|
|
||||||
return magicToken.Value<bool>() ? DefaultHost : null;
|
|
||||||
|
|
||||||
if (magicToken.Type == JTokenType.String)
|
|
||||||
return NormalizeHost(magicToken.Value<string>());
|
|
||||||
|
|
||||||
if (magicToken.Type != JTokenType.Object)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return NormalizeHost(((JObject)magicToken).Value<string>("ashdi"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ApplyInitConf(bool enabled, string host, BaseSettings init)
|
public static void ApplyInitConf(bool enabled, string host, BaseSettings init)
|
||||||
{
|
{
|
||||||
if (init == null)
|
if (init == null)
|
||||||
@ -66,13 +49,8 @@ namespace Shared.Engine
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
host = NormalizeHost(host);
|
if (string.IsNullOrWhiteSpace(host))
|
||||||
if (host == null)
|
host = DefaultHost;
|
||||||
{
|
|
||||||
init.apnstream = false;
|
|
||||||
init.apn = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (init.apn == null)
|
if (init.apn == null)
|
||||||
init.apn = new ApnConf();
|
init.apn = new ApnConf();
|
||||||
@ -116,13 +94,5 @@ namespace Shared.Engine
|
|||||||
|
|
||||||
return $"{host.TrimEnd('/')}/{url}";
|
return $"{host.TrimEnd('/')}/{url}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string NormalizeHost(string host)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(host))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return host.Trim();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,6 @@ namespace Makhno
|
|||||||
var init = loadKit(ModInit.Makhno);
|
var init = loadKit(ModInit.Makhno);
|
||||||
if (!init.enable)
|
if (!init.enable)
|
||||||
return OnError();
|
return OnError();
|
||||||
TryEnableMagicApn(init);
|
|
||||||
Initialization(init);
|
Initialization(init);
|
||||||
|
|
||||||
OnLog($"Makhno: {title} (serial={serial}, s={s}, season={season}, t={t})");
|
OnLog($"Makhno: {title} (serial={serial}, s={s}, season={season}, t={t})");
|
||||||
@ -65,7 +64,6 @@ namespace Makhno
|
|||||||
var init = loadKit(ModInit.Makhno);
|
var init = loadKit(ModInit.Makhno);
|
||||||
if (!init.enable)
|
if (!init.enable)
|
||||||
return OnError();
|
return OnError();
|
||||||
TryEnableMagicApn(init);
|
|
||||||
Initialization(init);
|
Initialization(init);
|
||||||
|
|
||||||
OnLog($"Makhno Play: {title} (s={s}, season={season}, t={t}, episodeId={episodeId}) play={play}");
|
OnLog($"Makhno Play: {title} (s={s}, season={season}, t={t}, episodeId={episodeId}) play={play}");
|
||||||
@ -124,7 +122,6 @@ namespace Makhno
|
|||||||
var init = loadKit(ModInit.Makhno);
|
var init = loadKit(ModInit.Makhno);
|
||||||
if (!init.enable)
|
if (!init.enable)
|
||||||
return OnError();
|
return OnError();
|
||||||
TryEnableMagicApn(init);
|
|
||||||
Initialization(init);
|
Initialization(init);
|
||||||
|
|
||||||
OnLog($"Makhno PlayMovie: {title} ({year}) play={play}");
|
OnLog($"Makhno PlayMovie: {title} ({year}) play={play}");
|
||||||
@ -515,24 +512,6 @@ namespace Makhno
|
|||||||
return HostStreamProxy(init, link);
|
return HostStreamProxy(init, link);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TryEnableMagicApn(OnlinesSettings init)
|
|
||||||
{
|
|
||||||
if (init == null
|
|
||||||
|| init.apn != null
|
|
||||||
|| init.streamproxy
|
|
||||||
|| string.IsNullOrWhiteSpace(ModInit.MagicApnAshdiHost))
|
|
||||||
return;
|
|
||||||
|
|
||||||
string player = new RchClient(HttpContext, host, init, requestInfo).InfoConnected()?.player;
|
|
||||||
bool useInnerPlayer = string.IsNullOrWhiteSpace(player)
|
|
||||||
|| player.Equals("inner", StringComparison.OrdinalIgnoreCase);
|
|
||||||
if (!useInnerPlayer)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ApnHelper.ApplyInitConf(true, ModInit.MagicApnAshdiHost, init);
|
|
||||||
OnLog($"Makhno: увімкнено magic_apn для Ashdi (player={player ?? "unknown"}).");
|
|
||||||
}
|
|
||||||
|
|
||||||
private class ResolveResult
|
private class ResolveResult
|
||||||
{
|
{
|
||||||
public string PlayUrl { get; set; }
|
public string PlayUrl { get; set; }
|
||||||
|
|||||||
@ -28,7 +28,6 @@ namespace Makhno
|
|||||||
|
|
||||||
public static OnlinesSettings Makhno;
|
public static OnlinesSettings Makhno;
|
||||||
public static bool ApnHostProvided;
|
public static bool ApnHostProvided;
|
||||||
public static string MagicApnAshdiHost;
|
|
||||||
|
|
||||||
public static OnlinesSettings Settings
|
public static OnlinesSettings Settings
|
||||||
{
|
{
|
||||||
@ -53,16 +52,8 @@ namespace Makhno
|
|||||||
list = new string[] { "socks5://ip:port" }
|
list = new string[] { "socks5://ip:port" }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var defaults = JObject.FromObject(Makhno);
|
var conf = ModuleInvoke.Init("Makhno", JObject.FromObject(Makhno));
|
||||||
defaults["magic_apn"] = new JObject()
|
|
||||||
{
|
|
||||||
["ashdi"] = ApnHelper.DefaultHost
|
|
||||||
};
|
|
||||||
|
|
||||||
var conf = ModuleInvoke.Init("Makhno", defaults) ?? defaults;
|
|
||||||
bool hasApn = ApnHelper.TryGetInitConf(conf, out bool apnEnabled, out string apnHost);
|
bool hasApn = ApnHelper.TryGetInitConf(conf, out bool apnEnabled, out string apnHost);
|
||||||
MagicApnAshdiHost = ApnHelper.TryGetMagicAshdiHost(conf);
|
|
||||||
conf.Remove("magic_apn");
|
|
||||||
if (hasApn)
|
if (hasApn)
|
||||||
{
|
{
|
||||||
conf.Remove("apn");
|
conf.Remove("apn");
|
||||||
@ -71,8 +62,8 @@ namespace Makhno
|
|||||||
Makhno = conf.ToObject<OnlinesSettings>();
|
Makhno = conf.ToObject<OnlinesSettings>();
|
||||||
if (hasApn)
|
if (hasApn)
|
||||||
ApnHelper.ApplyInitConf(apnEnabled, apnHost, Makhno);
|
ApnHelper.ApplyInitConf(apnEnabled, apnHost, Makhno);
|
||||||
ApnHostProvided = ApnHelper.IsEnabled(Makhno);
|
ApnHostProvided = hasApn && apnEnabled && !string.IsNullOrWhiteSpace(apnHost);
|
||||||
if (ApnHostProvided)
|
if (hasApn && apnEnabled)
|
||||||
{
|
{
|
||||||
Makhno.streamproxy = false;
|
Makhno.streamproxy = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,23 +25,6 @@ namespace Shared.Engine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string TryGetMagicAshdiHost(JObject conf)
|
|
||||||
{
|
|
||||||
if (conf == null || !conf.TryGetValue("magic_apn", out var magicToken) || magicToken == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
if (magicToken.Type == JTokenType.Boolean)
|
|
||||||
return magicToken.Value<bool>() ? DefaultHost : null;
|
|
||||||
|
|
||||||
if (magicToken.Type == JTokenType.String)
|
|
||||||
return NormalizeHost(magicToken.Value<string>());
|
|
||||||
|
|
||||||
if (magicToken.Type != JTokenType.Object)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return NormalizeHost(((JObject)magicToken).Value<string>("ashdi"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ApplyInitConf(bool enabled, string host, BaseSettings init)
|
public static void ApplyInitConf(bool enabled, string host, BaseSettings init)
|
||||||
{
|
{
|
||||||
if (init == null)
|
if (init == null)
|
||||||
@ -54,13 +37,8 @@ namespace Shared.Engine
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
host = NormalizeHost(host);
|
if (string.IsNullOrWhiteSpace(host))
|
||||||
if (host == null)
|
host = DefaultHost;
|
||||||
{
|
|
||||||
init.apnstream = false;
|
|
||||||
init.apn = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (init.apn == null)
|
if (init.apn == null)
|
||||||
init.apn = new ApnConf();
|
init.apn = new ApnConf();
|
||||||
@ -104,13 +82,5 @@ namespace Shared.Engine
|
|||||||
|
|
||||||
return $"{host.TrimEnd('/')}/{url}";
|
return $"{host.TrimEnd('/')}/{url}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string NormalizeHost(string host)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(host))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return host.Trim();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,6 @@ namespace Mikai.Controllers
|
|||||||
if (!init.enable)
|
if (!init.enable)
|
||||||
return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
TryEnableMagicApn(init);
|
|
||||||
var invoke = new MikaiInvoke(init, hybridCache, OnLog, _proxyManager, httpHydra);
|
var invoke = new MikaiInvoke(init, hybridCache, OnLog, _proxyManager, httpHydra);
|
||||||
|
|
||||||
if (checksearch)
|
if (checksearch)
|
||||||
@ -212,7 +211,6 @@ namespace Mikai.Controllers
|
|||||||
if (!init.enable)
|
if (!init.enable)
|
||||||
return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
TryEnableMagicApn(init);
|
|
||||||
if (string.IsNullOrEmpty(url))
|
if (string.IsNullOrEmpty(url))
|
||||||
return OnError("mikai", refresh_proxy: true);
|
return OnError("mikai", refresh_proxy: true);
|
||||||
|
|
||||||
@ -465,24 +463,6 @@ namespace Mikai.Controllers
|
|||||||
return HostStreamProxy(init, link, headers: headers, force_streamproxy: forceProxy);
|
return HostStreamProxy(init, link, headers: headers, force_streamproxy: forceProxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TryEnableMagicApn(OnlinesSettings init)
|
|
||||||
{
|
|
||||||
if (init == null
|
|
||||||
|| init.apn != null
|
|
||||||
|| init.streamproxy
|
|
||||||
|| string.IsNullOrWhiteSpace(ModInit.MagicApnAshdiHost))
|
|
||||||
return;
|
|
||||||
|
|
||||||
string player = new RchClient(HttpContext, host, init, requestInfo).InfoConnected()?.player;
|
|
||||||
bool useInnerPlayer = string.IsNullOrWhiteSpace(player)
|
|
||||||
|| player.Equals("inner", StringComparison.OrdinalIgnoreCase);
|
|
||||||
if (!useInnerPlayer)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ApnHelper.ApplyInitConf(true, ModInit.MagicApnAshdiHost, init);
|
|
||||||
OnLog($"Mikai: увімкнено magic_apn для Ashdi (player={player ?? "unknown"}).");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool IsCheckOnlineSearchEnabled()
|
private static bool IsCheckOnlineSearchEnabled()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@ -29,7 +29,6 @@ namespace Mikai
|
|||||||
|
|
||||||
public static OnlinesSettings Mikai;
|
public static OnlinesSettings Mikai;
|
||||||
public static bool ApnHostProvided;
|
public static bool ApnHostProvided;
|
||||||
public static string MagicApnAshdiHost;
|
|
||||||
|
|
||||||
public static OnlinesSettings Settings
|
public static OnlinesSettings Settings
|
||||||
{
|
{
|
||||||
@ -58,23 +57,15 @@ namespace Mikai
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var defaults = JObject.FromObject(Mikai);
|
var conf = ModuleInvoke.Init("Mikai", JObject.FromObject(Mikai));
|
||||||
defaults["magic_apn"] = new JObject()
|
|
||||||
{
|
|
||||||
["ashdi"] = ApnHelper.DefaultHost
|
|
||||||
};
|
|
||||||
|
|
||||||
var conf = ModuleInvoke.Init("Mikai", defaults) ?? defaults;
|
|
||||||
bool hasApn = ApnHelper.TryGetInitConf(conf, out bool apnEnabled, out string apnHost);
|
bool hasApn = ApnHelper.TryGetInitConf(conf, out bool apnEnabled, out string apnHost);
|
||||||
MagicApnAshdiHost = ApnHelper.TryGetMagicAshdiHost(conf);
|
|
||||||
conf.Remove("magic_apn");
|
|
||||||
conf.Remove("apn");
|
conf.Remove("apn");
|
||||||
conf.Remove("apn_host");
|
conf.Remove("apn_host");
|
||||||
Mikai = conf.ToObject<OnlinesSettings>();
|
Mikai = conf.ToObject<OnlinesSettings>();
|
||||||
if (hasApn)
|
if (hasApn)
|
||||||
ApnHelper.ApplyInitConf(apnEnabled, apnHost, Mikai);
|
ApnHelper.ApplyInitConf(apnEnabled, apnHost, Mikai);
|
||||||
ApnHostProvided = ApnHelper.IsEnabled(Mikai);
|
ApnHostProvided = hasApn && apnEnabled && !string.IsNullOrWhiteSpace(apnHost);
|
||||||
if (ApnHostProvided)
|
if (hasApn && apnEnabled)
|
||||||
{
|
{
|
||||||
Mikai.streamproxy = false;
|
Mikai.streamproxy = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,17 +76,15 @@ modules - optional, if not specified, all modules from the repository will be in
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"displayindex": 1,
|
"displayindex": 1,
|
||||||
"magic_apn": {
|
"apn": true,
|
||||||
"ashdi": "https://tut.im/proxy.php?url={encodeurl}"
|
"apn_host": "domaine.com/{encodeurl}"
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Parameter compatibility:
|
Parameter compatibility:
|
||||||
- `webcorshost` + `useproxy`: work together (parsing via CORS host, and network output can go through a proxy with `useproxy`).
|
- `webcorshost` + `useproxy`: work together (parsing via CORS host, and network output can go through a proxy with `useproxy`).
|
||||||
- `webcorshost` does not conflict with `streamproxy`: CORS is used for parsing, `streamproxy` is used for streaming.
|
- `webcorshost` does not conflict with `streamproxy`: CORS is used for parsing, `streamproxy` is used for streaming.
|
||||||
- `magic_apn.ashdi` використовується тільки для Ashdi-посилань і лише коли значення непорожнє.
|
- `webcorshost` does not conflict with `apn`: APN is used at the streaming stage, not for regular parsing.
|
||||||
- `webcorshost` не конфліктує з `magic_apn`: CORS використовується для парсингу, `magic_apn` — для Ashdi-стрімінгу.
|
|
||||||
|
|
||||||
## JackTor config example (`init.conf`)
|
## JackTor config example (`init.conf`)
|
||||||
|
|
||||||
|
|||||||
@ -25,23 +25,6 @@ namespace Shared.Engine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string TryGetMagicAshdiHost(JObject conf)
|
|
||||||
{
|
|
||||||
if (conf == null || !conf.TryGetValue("magic_apn", out var magicToken) || magicToken == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
if (magicToken.Type == JTokenType.Boolean)
|
|
||||||
return magicToken.Value<bool>() ? DefaultHost : null;
|
|
||||||
|
|
||||||
if (magicToken.Type == JTokenType.String)
|
|
||||||
return NormalizeHost(magicToken.Value<string>());
|
|
||||||
|
|
||||||
if (magicToken.Type != JTokenType.Object)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return NormalizeHost(((JObject)magicToken).Value<string>("ashdi"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ApplyInitConf(bool enabled, string host, BaseSettings init)
|
public static void ApplyInitConf(bool enabled, string host, BaseSettings init)
|
||||||
{
|
{
|
||||||
if (init == null)
|
if (init == null)
|
||||||
@ -54,13 +37,8 @@ namespace Shared.Engine
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
host = NormalizeHost(host);
|
if (string.IsNullOrWhiteSpace(host))
|
||||||
if (host == null)
|
host = DefaultHost;
|
||||||
{
|
|
||||||
init.apnstream = false;
|
|
||||||
init.apn = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (init.apn == null)
|
if (init.apn == null)
|
||||||
init.apn = new ApnConf();
|
init.apn = new ApnConf();
|
||||||
@ -104,13 +82,5 @@ namespace Shared.Engine
|
|||||||
|
|
||||||
return $"{host.TrimEnd('/')}/{url}";
|
return $"{host.TrimEnd('/')}/{url}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string NormalizeHost(string host)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(host))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return host.Trim();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,7 +37,6 @@ namespace Uaflix.Controllers
|
|||||||
return badInitMsg;
|
return badInitMsg;
|
||||||
|
|
||||||
var init = this.init;
|
var init = this.init;
|
||||||
TryEnableMagicApn(init);
|
|
||||||
OnLog($"=== UAFLIX INDEX START ===");
|
OnLog($"=== UAFLIX INDEX START ===");
|
||||||
OnLog($"Uaflix Index: title={title}, serial={serial}, s={s}, play={play}, href={href}, checksearch={checksearch}");
|
OnLog($"Uaflix Index: title={title}, serial={serial}, s={s}, play={play}, href={href}, checksearch={checksearch}");
|
||||||
OnLog($"Uaflix Index: kinopoisk_id={kinopoisk_id}, imdb_id={imdb_id}, id={id}");
|
OnLog($"Uaflix Index: kinopoisk_id={kinopoisk_id}, imdb_id={imdb_id}, id={id}");
|
||||||
@ -436,24 +435,6 @@ namespace Uaflix.Controllers
|
|||||||
return HostStreamProxy(init, link);
|
return HostStreamProxy(init, link);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TryEnableMagicApn(OnlinesSettings init)
|
|
||||||
{
|
|
||||||
if (init == null
|
|
||||||
|| init.apn != null
|
|
||||||
|| init.streamproxy
|
|
||||||
|| string.IsNullOrWhiteSpace(ModInit.MagicApnAshdiHost))
|
|
||||||
return;
|
|
||||||
|
|
||||||
string player = new RchClient(HttpContext, host, init, requestInfo).InfoConnected()?.player;
|
|
||||||
bool useInnerPlayer = string.IsNullOrWhiteSpace(player)
|
|
||||||
|| player.Equals("inner", StringComparison.OrdinalIgnoreCase);
|
|
||||||
if (!useInnerPlayer)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ApnHelper.ApplyInitConf(true, ModInit.MagicApnAshdiHost, init);
|
|
||||||
OnLog($"Uaflix: увімкнено magic_apn для Ashdi (player={player ?? "unknown"}).");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string StripLampacArgs(string url)
|
private static string StripLampacArgs(string url)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(url))
|
if (string.IsNullOrEmpty(url))
|
||||||
|
|||||||
@ -24,7 +24,6 @@ namespace Uaflix
|
|||||||
public static UaflixSettings UaFlix;
|
public static UaflixSettings UaFlix;
|
||||||
|
|
||||||
public static bool ApnHostProvided;
|
public static bool ApnHostProvided;
|
||||||
public static string MagicApnAshdiHost;
|
|
||||||
|
|
||||||
public static UaflixSettings Settings
|
public static UaflixSettings Settings
|
||||||
{
|
{
|
||||||
@ -55,16 +54,8 @@ namespace Uaflix
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var defaults = JObject.FromObject(UaFlix);
|
var conf = ModuleInvoke.Init("Uaflix", JObject.FromObject(UaFlix)) ?? JObject.FromObject(UaFlix);
|
||||||
defaults["magic_apn"] = new JObject()
|
|
||||||
{
|
|
||||||
["ashdi"] = ApnHelper.DefaultHost
|
|
||||||
};
|
|
||||||
|
|
||||||
var conf = ModuleInvoke.Init("Uaflix", defaults) ?? defaults;
|
|
||||||
bool hasApn = ApnHelper.TryGetInitConf(conf, out bool apnEnabled, out string apnHost);
|
bool hasApn = ApnHelper.TryGetInitConf(conf, out bool apnEnabled, out string apnHost);
|
||||||
MagicApnAshdiHost = ApnHelper.TryGetMagicAshdiHost(conf);
|
|
||||||
conf.Remove("magic_apn");
|
|
||||||
conf.Remove("apn");
|
conf.Remove("apn");
|
||||||
conf.Remove("apn_host");
|
conf.Remove("apn_host");
|
||||||
UaFlix = conf.ToObject<UaflixSettings>();
|
UaFlix = conf.ToObject<UaflixSettings>();
|
||||||
@ -72,8 +63,8 @@ namespace Uaflix
|
|||||||
if (hasApn)
|
if (hasApn)
|
||||||
ApnHelper.ApplyInitConf(apnEnabled, apnHost, UaFlix);
|
ApnHelper.ApplyInitConf(apnEnabled, apnHost, UaFlix);
|
||||||
|
|
||||||
ApnHostProvided = ApnHelper.IsEnabled(UaFlix);
|
ApnHostProvided = hasApn && apnEnabled && !string.IsNullOrWhiteSpace(apnHost);
|
||||||
if (ApnHostProvided)
|
if (hasApn && apnEnabled)
|
||||||
{
|
{
|
||||||
UaFlix.streamproxy = false;
|
UaFlix.streamproxy = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user