mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 15:20:48 -05:00
add support for plugin generated pages (interactions). add disallow vpn command
This commit is contained in:
@ -19,6 +19,7 @@ namespace SharedLibraryCore
|
||||
{
|
||||
public class BaseController : Controller
|
||||
{
|
||||
protected readonly IInteractionRegistration InteractionRegistration;
|
||||
protected readonly IAlertManager AlertManager;
|
||||
|
||||
/// <summary>
|
||||
@ -41,6 +42,7 @@ namespace SharedLibraryCore
|
||||
|
||||
public BaseController(IManager manager)
|
||||
{
|
||||
InteractionRegistration = manager.InteractionRegistration;
|
||||
AlertManager = manager.AlertManager;
|
||||
Manager = manager;
|
||||
Localization = Utilities.CurrentLocalization.LocalizationIndex;
|
||||
@ -71,9 +73,7 @@ namespace SharedLibraryCore
|
||||
CurrentAlias = new EFAlias { Name = "Webfront Guest" }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected async Task SignInAsync(ClaimsPrincipal claimsPrinciple)
|
||||
{
|
||||
await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, claimsPrinciple,
|
||||
@ -86,7 +86,7 @@ namespace SharedLibraryCore
|
||||
});
|
||||
}
|
||||
|
||||
public override void OnActionExecuting(ActionExecutingContext context)
|
||||
public override async void OnActionExecuting(ActionExecutingContext context)
|
||||
{
|
||||
if (!HttpContext.Connection.RemoteIpAddress.GetAddressBytes().SequenceEqual(LocalHost))
|
||||
{
|
||||
@ -154,6 +154,7 @@ namespace SharedLibraryCore
|
||||
&& !communityName.Contains("IW4MAdmin")
|
||||
&& AppConfig.CommunityInformation.IsEnabled;
|
||||
|
||||
ViewBag.Interactions = await InteractionRegistration.GetInteractions("Webfront::Nav");
|
||||
ViewBag.Authorized = Authorized;
|
||||
ViewBag.Url = AppConfig.WebfrontUrl;
|
||||
ViewBag.User = Client;
|
||||
|
@ -10,6 +10,8 @@ namespace SharedLibraryCore.Helpers;
|
||||
public class InteractionData : IInteractionData
|
||||
{
|
||||
public int? EntityId { get; set; }
|
||||
public string InteractionId { get; set; }
|
||||
public InteractionType InteractionType { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
|
@ -8,6 +8,8 @@ namespace SharedLibraryCore.Interfaces;
|
||||
public interface IInteractionData
|
||||
{
|
||||
int? EntityId { get; }
|
||||
string InteractionId { get; }
|
||||
InteractionType InteractionType { get; }
|
||||
bool Enabled { get; }
|
||||
string Name { get; }
|
||||
string Description { get; }
|
||||
@ -22,3 +24,10 @@ public interface IInteractionData
|
||||
InteractionCallback Action { get; }
|
||||
Delegate ScriptAction { get; }
|
||||
}
|
||||
|
||||
public enum InteractionType
|
||||
{
|
||||
ActionButton,
|
||||
RawContent,
|
||||
TemplateContent
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ public interface IInteractionRegistration
|
||||
void RegisterScriptInteraction(string interactionName, string source, Delegate interactionRegistration);
|
||||
void RegisterInteraction(string interactionName, Func<int?, Reference.Game?, CancellationToken, Task<IInteractionData>> interactionRegistration);
|
||||
void UnregisterInteraction(string interactionName);
|
||||
Task<IEnumerable<IInteractionData>> GetInteractions(int? clientId = null,
|
||||
Task<IEnumerable<IInteractionData>> GetInteractions(string interactionPrefix = null, int? clientId = null,
|
||||
Reference.Game? game = null, CancellationToken token = default);
|
||||
Task<string> ProcessInteraction(string interactionId, int originId, int? targetId = null, Reference.Game? game = null, IDictionary<string, string> meta = null, CancellationToken token = default);
|
||||
}
|
||||
|
@ -105,5 +105,6 @@ namespace SharedLibraryCore.Interfaces
|
||||
event EventHandler<GameEvent> OnGameEventExecuted;
|
||||
|
||||
IAlertManager AlertManager { get; }
|
||||
IInteractionRegistration InteractionRegistration { get; }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user