mirror of
https://github.com/lampame/lampac-ukraine.git
synced 2026-04-16 17:32:20 +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;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (init == null)
|
||||
@ -54,13 +37,8 @@ namespace Shared.Engine
|
||||
return;
|
||||
}
|
||||
|
||||
host = NormalizeHost(host);
|
||||
if (host == null)
|
||||
{
|
||||
init.apnstream = false;
|
||||
init.apn = null;
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(host))
|
||||
host = DefaultHost;
|
||||
|
||||
if (init.apn == null)
|
||||
init.apn = new ApnConf();
|
||||
@ -104,13 +82,5 @@ namespace Shared.Engine
|
||||
|
||||
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)
|
||||
return Forbid();
|
||||
|
||||
TryEnableMagicApn(init);
|
||||
var invoke = new AnimeONInvoke(init, hybridCache, OnLog, proxyManager, httpHydra);
|
||||
|
||||
if (checksearch)
|
||||
@ -383,7 +382,6 @@ namespace AnimeON.Controllers
|
||||
if (!init.enable)
|
||||
return Forbid();
|
||||
|
||||
TryEnableMagicApn(init);
|
||||
var invoke = new AnimeONInvoke(init, hybridCache, OnLog, proxyManager, httpHydra);
|
||||
bool disableAshdiMultivoiceForVod = serial == 1;
|
||||
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);
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
try
|
||||
|
||||
@ -30,7 +30,6 @@ namespace AnimeON
|
||||
|
||||
public static OnlinesSettings AnimeON;
|
||||
public static bool ApnHostProvided;
|
||||
public static string MagicApnAshdiHost;
|
||||
|
||||
public static OnlinesSettings Settings
|
||||
{
|
||||
@ -57,23 +56,15 @@ namespace AnimeON
|
||||
list = new string[] { "socks5://ip:port" }
|
||||
}
|
||||
};
|
||||
var defaults = JObject.FromObject(AnimeON);
|
||||
defaults["magic_apn"] = new JObject()
|
||||
{
|
||||
["ashdi"] = ApnHelper.DefaultHost
|
||||
};
|
||||
|
||||
var conf = ModuleInvoke.Init("AnimeON", defaults) ?? defaults;
|
||||
var conf = ModuleInvoke.Init("AnimeON", JObject.FromObject(AnimeON));
|
||||
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_host");
|
||||
AnimeON = conf.ToObject<OnlinesSettings>();
|
||||
if (hasApn)
|
||||
ApnHelper.ApplyInitConf(apnEnabled, apnHost, AnimeON);
|
||||
ApnHostProvided = ApnHelper.IsEnabled(AnimeON);
|
||||
if (ApnHostProvided)
|
||||
ApnHostProvided = hasApn && apnEnabled && !string.IsNullOrWhiteSpace(apnHost);
|
||||
if (hasApn && apnEnabled)
|
||||
{
|
||||
AnimeON.streamproxy = false;
|
||||
}
|
||||
@ -244,4 +235,4 @@ namespace AnimeON
|
||||
}
|
||||
|
||||
public record ConnectResponse(bool IsUpdateUnavailable, bool IsNoiseEnabled);
|
||||
}
|
||||
}
|
||||
@ -25,23 +25,6 @@ namespace Shared.Engine
|
||||
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)
|
||||
{
|
||||
if (init == null)
|
||||
@ -54,13 +37,8 @@ namespace Shared.Engine
|
||||
return;
|
||||
}
|
||||
|
||||
host = NormalizeHost(host);
|
||||
if (host == null)
|
||||
{
|
||||
init.apnstream = false;
|
||||
init.apn = null;
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(host))
|
||||
host = DefaultHost;
|
||||
|
||||
if (init.apn == null)
|
||||
init.apn = new ApnConf();
|
||||
@ -104,13 +82,5 @@ namespace Shared.Engine
|
||||
|
||||
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)
|
||||
return Forbid();
|
||||
|
||||
TryEnableMagicApn(init);
|
||||
|
||||
var invoke = new KlonFUNInvoke(init, hybridCache, OnLog, proxyManager, httpHydra);
|
||||
|
||||
if (checksearch)
|
||||
@ -219,24 +217,6 @@ namespace KlonFUN.Controllers
|
||||
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)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(url))
|
||||
|
||||
@ -14,7 +14,6 @@ using System.Security.Authentication;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Shared.Models.Events;
|
||||
|
||||
namespace KlonFUN
|
||||
{
|
||||
@ -22,11 +21,10 @@ namespace KlonFUN
|
||||
{
|
||||
public static double Version => 2.0;
|
||||
|
||||
public static ModuleConfig KlonFUN;
|
||||
public static OnlinesSettings KlonFUN;
|
||||
public static bool ApnHostProvided;
|
||||
public static string MagicApnAshdiHost;
|
||||
|
||||
public static ModuleConfig Settings
|
||||
public static OnlinesSettings Settings
|
||||
{
|
||||
get => KlonFUN;
|
||||
set => KlonFUN = value;
|
||||
@ -37,16 +35,7 @@ namespace KlonFUN
|
||||
/// </summary>
|
||||
public void Loaded(InitspaceModel initspace)
|
||||
{
|
||||
UpdateConfig();
|
||||
EventListener.UpdateInitFile += UpdateConfig;
|
||||
|
||||
// Додаємо підтримку "уточнити пошук".
|
||||
RegisterWithSearch("klonfun");
|
||||
}
|
||||
|
||||
private void UpdateConfig()
|
||||
{
|
||||
KlonFUN = new ModuleConfig("KlonFUN", "https://klon.fun", streamproxy: false, useproxy: false)
|
||||
KlonFUN = new OnlinesSettings("KlonFUN", "https://klon.fun", streamproxy: false, useproxy: false)
|
||||
{
|
||||
displayname = "KlonFUN",
|
||||
displayindex = 0,
|
||||
@ -59,24 +48,16 @@ namespace KlonFUN
|
||||
}
|
||||
};
|
||||
|
||||
var defaults = JObject.FromObject(KlonFUN);
|
||||
defaults["magic_apn"] = new JObject()
|
||||
{
|
||||
["ashdi"] = ApnHelper.DefaultHost
|
||||
};
|
||||
|
||||
var conf = ModuleInvoke.Init("KlonFUN", defaults) ?? defaults;
|
||||
var conf = ModuleInvoke.Init("KlonFUN", JObject.FromObject(KlonFUN));
|
||||
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_host");
|
||||
KlonFUN = conf.ToObject<ModuleConfig>();
|
||||
KlonFUN = conf.ToObject<OnlinesSettings>();
|
||||
if (hasApn)
|
||||
ApnHelper.ApplyInitConf(apnEnabled, apnHost, KlonFUN);
|
||||
ApnHostProvided = ApnHelper.IsEnabled(KlonFUN);
|
||||
ApnHostProvided = hasApn && apnEnabled && !string.IsNullOrWhiteSpace(apnHost);
|
||||
|
||||
if (ApnHostProvided)
|
||||
if (hasApn && apnEnabled)
|
||||
{
|
||||
KlonFUN.streamproxy = false;
|
||||
}
|
||||
@ -85,6 +66,9 @@ namespace KlonFUN
|
||||
KlonFUN.apnstream = false;
|
||||
KlonFUN.apn = null;
|
||||
}
|
||||
|
||||
// Додаємо підтримку "уточнити пошук".
|
||||
RegisterWithSearch("klonfun");
|
||||
}
|
||||
|
||||
private static void RegisterWithSearch(string plugin)
|
||||
@ -123,7 +107,6 @@ namespace KlonFUN
|
||||
|
||||
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)
|
||||
{
|
||||
enabled = apnToken.Value<bool>();
|
||||
host = NormalizeHost(conf.Value<string>("apn_host"));
|
||||
host = conf.Value<string>("apn_host");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (apnToken.Type == JTokenType.String)
|
||||
{
|
||||
host = NormalizeHost(apnToken.Value<string>());
|
||||
enabled = host != null;
|
||||
host = apnToken.Value<string>();
|
||||
enabled = !string.IsNullOrWhiteSpace(host);
|
||||
return true;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (init == null)
|
||||
@ -66,13 +49,8 @@ namespace Shared.Engine
|
||||
return;
|
||||
}
|
||||
|
||||
host = NormalizeHost(host);
|
||||
if (host == null)
|
||||
{
|
||||
init.apnstream = false;
|
||||
init.apn = null;
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(host))
|
||||
host = DefaultHost;
|
||||
|
||||
if (init.apn == null)
|
||||
init.apn = new ApnConf();
|
||||
@ -116,13 +94,5 @@ namespace Shared.Engine
|
||||
|
||||
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);
|
||||
if (!init.enable)
|
||||
return OnError();
|
||||
TryEnableMagicApn(init);
|
||||
Initialization(init);
|
||||
|
||||
OnLog($"Makhno: {title} (serial={serial}, s={s}, season={season}, t={t})");
|
||||
@ -65,7 +64,6 @@ namespace Makhno
|
||||
var init = loadKit(ModInit.Makhno);
|
||||
if (!init.enable)
|
||||
return OnError();
|
||||
TryEnableMagicApn(init);
|
||||
Initialization(init);
|
||||
|
||||
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);
|
||||
if (!init.enable)
|
||||
return OnError();
|
||||
TryEnableMagicApn(init);
|
||||
Initialization(init);
|
||||
|
||||
OnLog($"Makhno PlayMovie: {title} ({year}) play={play}");
|
||||
@ -515,24 +512,6 @@ namespace Makhno
|
||||
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
|
||||
{
|
||||
public string PlayUrl { get; set; }
|
||||
|
||||
@ -28,7 +28,6 @@ namespace Makhno
|
||||
|
||||
public static OnlinesSettings Makhno;
|
||||
public static bool ApnHostProvided;
|
||||
public static string MagicApnAshdiHost;
|
||||
|
||||
public static OnlinesSettings Settings
|
||||
{
|
||||
@ -53,16 +52,8 @@ namespace Makhno
|
||||
list = new string[] { "socks5://ip:port" }
|
||||
}
|
||||
};
|
||||
var defaults = JObject.FromObject(Makhno);
|
||||
defaults["magic_apn"] = new JObject()
|
||||
{
|
||||
["ashdi"] = ApnHelper.DefaultHost
|
||||
};
|
||||
|
||||
var conf = ModuleInvoke.Init("Makhno", defaults) ?? defaults;
|
||||
var conf = ModuleInvoke.Init("Makhno", JObject.FromObject(Makhno));
|
||||
bool hasApn = ApnHelper.TryGetInitConf(conf, out bool apnEnabled, out string apnHost);
|
||||
MagicApnAshdiHost = ApnHelper.TryGetMagicAshdiHost(conf);
|
||||
conf.Remove("magic_apn");
|
||||
if (hasApn)
|
||||
{
|
||||
conf.Remove("apn");
|
||||
@ -71,8 +62,8 @@ namespace Makhno
|
||||
Makhno = conf.ToObject<OnlinesSettings>();
|
||||
if (hasApn)
|
||||
ApnHelper.ApplyInitConf(apnEnabled, apnHost, Makhno);
|
||||
ApnHostProvided = ApnHelper.IsEnabled(Makhno);
|
||||
if (ApnHostProvided)
|
||||
ApnHostProvided = hasApn && apnEnabled && !string.IsNullOrWhiteSpace(apnHost);
|
||||
if (hasApn && apnEnabled)
|
||||
{
|
||||
Makhno.streamproxy = false;
|
||||
}
|
||||
|
||||
@ -25,23 +25,6 @@ namespace Shared.Engine
|
||||
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)
|
||||
{
|
||||
if (init == null)
|
||||
@ -54,13 +37,8 @@ namespace Shared.Engine
|
||||
return;
|
||||
}
|
||||
|
||||
host = NormalizeHost(host);
|
||||
if (host == null)
|
||||
{
|
||||
init.apnstream = false;
|
||||
init.apn = null;
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(host))
|
||||
host = DefaultHost;
|
||||
|
||||
if (init.apn == null)
|
||||
init.apn = new ApnConf();
|
||||
@ -104,13 +82,5 @@ namespace Shared.Engine
|
||||
|
||||
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)
|
||||
return Forbid();
|
||||
|
||||
TryEnableMagicApn(init);
|
||||
var invoke = new MikaiInvoke(init, hybridCache, OnLog, _proxyManager, httpHydra);
|
||||
|
||||
if (checksearch)
|
||||
@ -212,7 +211,6 @@ namespace Mikai.Controllers
|
||||
if (!init.enable)
|
||||
return Forbid();
|
||||
|
||||
TryEnableMagicApn(init);
|
||||
if (string.IsNullOrEmpty(url))
|
||||
return OnError("mikai", refresh_proxy: true);
|
||||
|
||||
@ -465,24 +463,6 @@ namespace Mikai.Controllers
|
||||
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()
|
||||
{
|
||||
try
|
||||
|
||||
@ -29,7 +29,6 @@ namespace Mikai
|
||||
|
||||
public static OnlinesSettings Mikai;
|
||||
public static bool ApnHostProvided;
|
||||
public static string MagicApnAshdiHost;
|
||||
|
||||
public static OnlinesSettings Settings
|
||||
{
|
||||
@ -58,23 +57,15 @@ namespace Mikai
|
||||
}
|
||||
};
|
||||
|
||||
var defaults = JObject.FromObject(Mikai);
|
||||
defaults["magic_apn"] = new JObject()
|
||||
{
|
||||
["ashdi"] = ApnHelper.DefaultHost
|
||||
};
|
||||
|
||||
var conf = ModuleInvoke.Init("Mikai", defaults) ?? defaults;
|
||||
var conf = ModuleInvoke.Init("Mikai", JObject.FromObject(Mikai));
|
||||
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_host");
|
||||
Mikai = conf.ToObject<OnlinesSettings>();
|
||||
if (hasApn)
|
||||
ApnHelper.ApplyInitConf(apnEnabled, apnHost, Mikai);
|
||||
ApnHostProvided = ApnHelper.IsEnabled(Mikai);
|
||||
if (ApnHostProvided)
|
||||
ApnHostProvided = hasApn && apnEnabled && !string.IsNullOrWhiteSpace(apnHost);
|
||||
if (hasApn && apnEnabled)
|
||||
{
|
||||
Mikai.streamproxy = false;
|
||||
}
|
||||
@ -245,4 +236,4 @@ namespace Mikai
|
||||
}
|
||||
|
||||
public record ConnectResponse(bool IsUpdateUnavailable, bool IsNoiseEnabled);
|
||||
}
|
||||
}
|
||||
@ -76,17 +76,15 @@ modules - optional, if not specified, all modules from the repository will be in
|
||||
]
|
||||
},
|
||||
"displayindex": 1,
|
||||
"magic_apn": {
|
||||
"ashdi": "https://tut.im/proxy.php?url={encodeurl}"
|
||||
}
|
||||
"apn": true,
|
||||
"apn_host": "domaine.com/{encodeurl}"
|
||||
}
|
||||
```
|
||||
|
||||
Parameter compatibility:
|
||||
- `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.
|
||||
- `magic_apn.ashdi` використовується тільки для Ashdi-посилань і лише коли значення непорожнє.
|
||||
- `webcorshost` не конфліктує з `magic_apn`: CORS використовується для парсингу, `magic_apn` — для Ashdi-стрімінгу.
|
||||
- `webcorshost` does not conflict with `apn`: APN is used at the streaming stage, not for regular parsing.
|
||||
|
||||
## JackTor config example (`init.conf`)
|
||||
|
||||
|
||||
@ -25,23 +25,6 @@ namespace Shared.Engine
|
||||
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)
|
||||
{
|
||||
if (init == null)
|
||||
@ -54,13 +37,8 @@ namespace Shared.Engine
|
||||
return;
|
||||
}
|
||||
|
||||
host = NormalizeHost(host);
|
||||
if (host == null)
|
||||
{
|
||||
init.apnstream = false;
|
||||
init.apn = null;
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(host))
|
||||
host = DefaultHost;
|
||||
|
||||
if (init.apn == null)
|
||||
init.apn = new ApnConf();
|
||||
@ -104,13 +82,5 @@ namespace Shared.Engine
|
||||
|
||||
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;
|
||||
|
||||
var init = this.init;
|
||||
TryEnableMagicApn(init);
|
||||
OnLog($"=== UAFLIX INDEX START ===");
|
||||
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}");
|
||||
@ -436,24 +435,6 @@ namespace Uaflix.Controllers
|
||||
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)
|
||||
{
|
||||
if (string.IsNullOrEmpty(url))
|
||||
|
||||
@ -24,7 +24,6 @@ namespace Uaflix
|
||||
public static UaflixSettings UaFlix;
|
||||
|
||||
public static bool ApnHostProvided;
|
||||
public static string MagicApnAshdiHost;
|
||||
|
||||
public static UaflixSettings Settings
|
||||
{
|
||||
@ -55,16 +54,8 @@ namespace Uaflix
|
||||
}
|
||||
};
|
||||
|
||||
var defaults = JObject.FromObject(UaFlix);
|
||||
defaults["magic_apn"] = new JObject()
|
||||
{
|
||||
["ashdi"] = ApnHelper.DefaultHost
|
||||
};
|
||||
|
||||
var conf = ModuleInvoke.Init("Uaflix", defaults) ?? defaults;
|
||||
var conf = ModuleInvoke.Init("Uaflix", JObject.FromObject(UaFlix)) ?? JObject.FromObject(UaFlix);
|
||||
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_host");
|
||||
UaFlix = conf.ToObject<UaflixSettings>();
|
||||
@ -72,8 +63,8 @@ namespace Uaflix
|
||||
if (hasApn)
|
||||
ApnHelper.ApplyInitConf(apnEnabled, apnHost, UaFlix);
|
||||
|
||||
ApnHostProvided = ApnHelper.IsEnabled(UaFlix);
|
||||
if (ApnHostProvided)
|
||||
ApnHostProvided = hasApn && apnEnabled && !string.IsNullOrWhiteSpace(apnHost);
|
||||
if (hasApn && apnEnabled)
|
||||
{
|
||||
UaFlix.streamproxy = false;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user