mirror of
https://github.com/lampame/lampac-ukraine.git
synced 2026-04-16 09:22:21 +00:00
Add magic apn
This commit is contained in:
parent
312be86e27
commit
fc7ddf2668
@ -31,6 +31,14 @@ namespace KlonFUN.Controllers
|
|||||||
if (!init.enable)
|
if (!init.enable)
|
||||||
return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
|
if (init.apn is null
|
||||||
|
&& !init.streamproxy
|
||||||
|
&& init.magic_apn
|
||||||
|
&& new RchClient(HttpContext, host, init, requestInfo).InfoConnected().player == "inner")
|
||||||
|
{
|
||||||
|
ApnHelper.ApplyInitConf(true, null, init);
|
||||||
|
}
|
||||||
|
|
||||||
var invoke = new KlonFUNInvoke(init, hybridCache, OnLog, proxyManager, httpHydra);
|
var invoke = new KlonFUNInvoke(init, hybridCache, OnLog, proxyManager, httpHydra);
|
||||||
|
|
||||||
if (checksearch)
|
if (checksearch)
|
||||||
|
|||||||
@ -14,6 +14,7 @@ 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
|
||||||
{
|
{
|
||||||
@ -21,10 +22,10 @@ namespace KlonFUN
|
|||||||
{
|
{
|
||||||
public static double Version => 2.0;
|
public static double Version => 2.0;
|
||||||
|
|
||||||
public static OnlinesSettings KlonFUN;
|
public static ModuleConfig KlonFUN;
|
||||||
public static bool ApnHostProvided;
|
public static bool ApnHostProvided;
|
||||||
|
|
||||||
public static OnlinesSettings Settings
|
public static ModuleConfig Settings
|
||||||
{
|
{
|
||||||
get => KlonFUN;
|
get => KlonFUN;
|
||||||
set => KlonFUN = value;
|
set => KlonFUN = value;
|
||||||
@ -35,7 +36,16 @@ namespace KlonFUN
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Loaded(InitspaceModel initspace)
|
public void Loaded(InitspaceModel initspace)
|
||||||
{
|
{
|
||||||
KlonFUN = new OnlinesSettings("KlonFUN", "https://klon.fun", streamproxy: false, useproxy: false)
|
UpdateConfig();
|
||||||
|
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,
|
||||||
@ -52,7 +62,7 @@ namespace KlonFUN
|
|||||||
bool hasApn = ApnHelper.TryGetInitConf(conf, out bool apnEnabled, out string apnHost);
|
bool hasApn = ApnHelper.TryGetInitConf(conf, out bool apnEnabled, out string apnHost);
|
||||||
conf.Remove("apn");
|
conf.Remove("apn");
|
||||||
conf.Remove("apn_host");
|
conf.Remove("apn_host");
|
||||||
KlonFUN = conf.ToObject<OnlinesSettings>();
|
KlonFUN = conf.ToObject<ModuleConfig>();
|
||||||
if (hasApn)
|
if (hasApn)
|
||||||
ApnHelper.ApplyInitConf(apnEnabled, apnHost, KlonFUN);
|
ApnHelper.ApplyInitConf(apnEnabled, apnHost, KlonFUN);
|
||||||
ApnHostProvided = hasApn && apnEnabled && !string.IsNullOrWhiteSpace(apnHost);
|
ApnHostProvided = hasApn && apnEnabled && !string.IsNullOrWhiteSpace(apnHost);
|
||||||
@ -66,9 +76,6 @@ 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)
|
||||||
@ -107,6 +114,7 @@ namespace KlonFUN
|
|||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
EventListener.UpdateInitFile -= UpdateConfig;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
13
KlonFUN/ModuleConfig.cs
Normal file
13
KlonFUN/ModuleConfig.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using Shared.Models.Online.Settings;
|
||||||
|
|
||||||
|
namespace KlonFUN
|
||||||
|
{
|
||||||
|
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 bool magic_apn { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user