Seperated the application back into a seperate project
webfront is just a library now
This commit is contained in:
parent
06d3de375b
commit
6d5c368954
25
Application/Application.csproj
Normal file
25
Application/Application.csproj
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
|
<PackageId>RaidMax.IW4MAdmin.Application</PackageId>
|
||||||
|
<Version>2.0.0</Version>
|
||||||
|
<Authors>RaidMax</Authors>
|
||||||
|
<Company>Forever None</Company>
|
||||||
|
<Product>IW4MAdmin</Product>
|
||||||
|
<Description>IW4MAdmin is a complete server administration tool for IW4x and most Call of Duty® dedicated server</Description>
|
||||||
|
<Copyright>2018</Copyright>
|
||||||
|
<PackageLicenseUrl>https://github.com/RaidMax/IW4M-Admin/blob/master/LICENSE</PackageLicenseUrl>
|
||||||
|
<PackageProjectUrl>https://raidmax.org/IW4MAdmin</PackageProjectUrl>
|
||||||
|
<RepositoryUrl>https://github.com/RaidMax/IW4M-Admin</RepositoryUrl>
|
||||||
|
<PackageIconUrl>https://raidmax.org/IW4MAdmin/img/iw4adminicon-3.png</PackageIconUrl>
|
||||||
|
<ApplicationIcon />
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\SharedLibraryCore\SharedLibraryCore.csproj" />
|
||||||
|
<ProjectReference Include="..\WebfrontCore\WebfrontCore.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -1,15 +1,17 @@
|
|||||||
using SharedLibraryCore;
|
using System;
|
||||||
using SharedLibraryCore.Dtos;
|
|
||||||
using SharedLibraryCore.Objects;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace WebfrontCore.Application.API
|
using SharedLibraryCore;
|
||||||
|
using SharedLibraryCore.Dtos;
|
||||||
|
using SharedLibraryCore.Interfaces;
|
||||||
|
using SharedLibraryCore.Objects;
|
||||||
|
|
||||||
|
namespace IW4MAdmin.Application.API
|
||||||
{
|
{
|
||||||
class EventAPI
|
class EventApi : IEventApi
|
||||||
{
|
{
|
||||||
public static Queue<EventInfo> Events = new Queue<EventInfo>();
|
Queue<EventInfo> Events = new Queue<EventInfo>();
|
||||||
static DateTime LastFlagEvent;
|
DateTime LastFlagEvent;
|
||||||
static string[] FlaggedMessageContains =
|
static string[] FlaggedMessageContains =
|
||||||
{
|
{
|
||||||
" wh ",
|
" wh ",
|
||||||
@ -22,9 +24,11 @@ namespace WebfrontCore.Application.API
|
|||||||
"hak",
|
"hak",
|
||||||
"bot"
|
"bot"
|
||||||
};
|
};
|
||||||
static int FlaggedMessageCount;
|
int FlaggedMessageCount;
|
||||||
|
|
||||||
public static void OnServerEventOccurred(object sender, Event E)
|
public Queue<EventInfo> GetEvents() => Events;
|
||||||
|
|
||||||
|
public void OnServerEvent(object sender, Event E)
|
||||||
{
|
{
|
||||||
if (E.Type == Event.GType.Say && E.Origin.Level < Player.Permission.Trusted)
|
if (E.Type == Event.GType.Say && E.Origin.Level < Player.Permission.Trusted)
|
||||||
{
|
{
|
@ -7,7 +7,7 @@ using System.Net;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace IW4MAdmin
|
namespace IW4MAdmin.Application
|
||||||
{
|
{
|
||||||
class ConfigurationGenerator
|
class ConfigurationGenerator
|
||||||
{
|
{
|
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace IW4MAdmin
|
namespace IW4MAdmin.Application
|
||||||
{
|
{
|
||||||
class Logger : SharedLibraryCore.Interfaces.ILogger
|
class Logger : SharedLibraryCore.Interfaces.ILogger
|
||||||
{
|
{
|
@ -6,7 +6,7 @@ using System.IO;
|
|||||||
using SharedLibraryCore.Objects;
|
using SharedLibraryCore.Objects;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace IW4MAdmin
|
namespace IW4MAdmin.Application
|
||||||
{
|
{
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
@ -14,7 +14,7 @@ namespace IW4MAdmin
|
|||||||
static public ApplicationManager ServerManager = ApplicationManager.GetInstance();
|
static public ApplicationManager ServerManager = ApplicationManager.GetInstance();
|
||||||
public static string OperatingDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + Path.DirectorySeparatorChar;
|
public static string OperatingDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + Path.DirectorySeparatorChar;
|
||||||
|
|
||||||
public static bool Start()
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
AppDomain.CurrentDomain.SetData("DataDirectory", OperatingDirectory);
|
AppDomain.CurrentDomain.SetData("DataDirectory", OperatingDirectory);
|
||||||
System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.BelowNormal;
|
System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.BelowNormal;
|
||||||
@ -60,8 +60,7 @@ namespace IW4MAdmin
|
|||||||
Console.WriteLine("Shutdown complete");
|
Console.WriteLine("Shutdown complete");
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
WebfrontCore.Program.Init(ServerManager);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@ -74,7 +73,6 @@ namespace IW4MAdmin
|
|||||||
}
|
}
|
||||||
Console.WriteLine("Press any key to exit...");
|
Console.WriteLine("Press any key to exit...");
|
||||||
Console.ReadKey();
|
Console.ReadKey();
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -12,14 +12,14 @@ using SharedLibraryCore.Helpers;
|
|||||||
using SharedLibraryCore.Exceptions;
|
using SharedLibraryCore.Exceptions;
|
||||||
using SharedLibraryCore.Objects;
|
using SharedLibraryCore.Objects;
|
||||||
using SharedLibraryCore.Services;
|
using SharedLibraryCore.Services;
|
||||||
using WebfrontCore.Application.API;
|
using IW4MAdmin.Application.API;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using WebfrontCore;
|
using WebfrontCore;
|
||||||
using SharedLibraryCore.Configuration;
|
using SharedLibraryCore.Configuration;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
namespace IW4MAdmin
|
namespace IW4MAdmin.Application
|
||||||
{
|
{
|
||||||
public class ApplicationManager : IManager
|
public class ApplicationManager : IManager
|
||||||
{
|
{
|
||||||
@ -38,6 +38,7 @@ namespace IW4MAdmin
|
|||||||
AliasService AliasSvc;
|
AliasService AliasSvc;
|
||||||
PenaltyService PenaltySvc;
|
PenaltyService PenaltySvc;
|
||||||
BaseConfigurationHandler<ApplicationConfiguration> ConfigHandler;
|
BaseConfigurationHandler<ApplicationConfiguration> ConfigHandler;
|
||||||
|
EventApi Api;
|
||||||
#if FTP_LOG
|
#if FTP_LOG
|
||||||
const int UPDATE_FREQUENCY = 700;
|
const int UPDATE_FREQUENCY = 700;
|
||||||
#else
|
#else
|
||||||
@ -55,7 +56,8 @@ namespace IW4MAdmin
|
|||||||
AliasSvc = new AliasService();
|
AliasSvc = new AliasService();
|
||||||
PenaltySvc = new PenaltyService();
|
PenaltySvc = new PenaltyService();
|
||||||
PrivilegedClients = new Dictionary<int, Player>();
|
PrivilegedClients = new Dictionary<int, Player>();
|
||||||
ServerEventOccurred += EventAPI.OnServerEventOccurred;
|
Api = new EventApi();
|
||||||
|
ServerEventOccurred += Api.OnServerEvent;
|
||||||
ConfigHandler = new BaseConfigurationHandler<ApplicationConfiguration>("IW4MAdminSettings");
|
ConfigHandler = new BaseConfigurationHandler<ApplicationConfiguration>("IW4MAdminSettings");
|
||||||
Console.CancelKeyPress += new ConsoleCancelEventHandler(OnCancelKey);
|
Console.CancelKeyPress += new ConsoleCancelEventHandler(OnCancelKey);
|
||||||
}
|
}
|
||||||
@ -314,5 +316,7 @@ namespace IW4MAdmin
|
|||||||
public IConfigurationHandler<ApplicationConfiguration> GetApplicationSettings() => ConfigHandler;
|
public IConfigurationHandler<ApplicationConfiguration> GetApplicationSettings() => ConfigHandler;
|
||||||
|
|
||||||
public IDictionary<int, Player> GetPrivilegedClients() => PrivilegedClients;
|
public IDictionary<int, Player> GetPrivilegedClients() => PrivilegedClients;
|
||||||
|
|
||||||
|
public IEventApi GetEventApi() => Api;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,7 +5,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace WebfrontCore.Application.Misc
|
namespace IW4MAdmin.Application.Misc
|
||||||
{
|
{
|
||||||
public class VPNCheck
|
public class VPNCheck
|
||||||
{
|
{
|
@ -14,7 +14,7 @@ using SharedLibraryCore.Database.Models;
|
|||||||
using SharedLibraryCore.Dtos;
|
using SharedLibraryCore.Dtos;
|
||||||
using SharedLibraryCore.Configuration;
|
using SharedLibraryCore.Configuration;
|
||||||
|
|
||||||
using WebfrontCore.Application.Misc;
|
using IW4MAdmin.Application.Misc;
|
||||||
|
|
||||||
namespace IW4MAdmin
|
namespace IW4MAdmin
|
||||||
{
|
{
|
||||||
@ -358,20 +358,20 @@ namespace IW4MAdmin
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
await ProcessEvent(E);
|
await ProcessEvent(E);
|
||||||
((ApplicationManager)Manager).ServerEventOccurred(this, E);
|
Manager.GetEventApi().OnServerEvent(this, E);
|
||||||
|
|
||||||
foreach (IPlugin P in SharedLibraryCore.Plugins.PluginImporter.ActivePlugins)
|
foreach (IPlugin P in SharedLibraryCore.Plugins.PluginImporter.ActivePlugins)
|
||||||
{
|
{
|
||||||
//#if !DEBUG
|
#if !DEBUG
|
||||||
try
|
try
|
||||||
//#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (cts.IsCancellationRequested)
|
if (cts.IsCancellationRequested)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
await P.OnEventAsync(E, this);
|
await P.OnEventAsync(E, this);
|
||||||
}
|
}
|
||||||
//#if !DEBUG
|
#if !DEBUG
|
||||||
catch (Exception Except)
|
catch (Exception Except)
|
||||||
{
|
{
|
||||||
Logger.WriteError(String.Format("The plugin \"{0}\" generated an error. ( see log )", P.Name));
|
Logger.WriteError(String.Format("The plugin \"{0}\" generated an error. ( see log )", P.Name));
|
||||||
@ -379,7 +379,7 @@ namespace IW4MAdmin
|
|||||||
Logger.WriteDebug(String.Format("Error Trace: {0}", Except.StackTrace));
|
Logger.WriteDebug(String.Format("Error Trace: {0}", Except.StackTrace));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -540,7 +540,6 @@ namespace IW4MAdmin
|
|||||||
}
|
}
|
||||||
oldLines = lines;
|
oldLines = lines;
|
||||||
l_size = LogFile.Length();
|
l_size = LogFile.Length();
|
||||||
if (!((ApplicationManager)Manager).Running)
|
|
||||||
{
|
{
|
||||||
foreach (var plugin in SharedLibraryCore.Plugins.PluginImporter.ActivePlugins)
|
foreach (var plugin in SharedLibraryCore.Plugins.PluginImporter.ActivePlugins)
|
||||||
await plugin.OnUnloadAsync();
|
await plugin.OnUnloadAsync();
|
||||||
@ -964,7 +963,7 @@ namespace IW4MAdmin
|
|||||||
override public void InitializeTokens()
|
override public void InitializeTokens()
|
||||||
{
|
{
|
||||||
Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("TOTALPLAYERS", Manager.GetClientService().GetTotalClientsAsync().Result.ToString));
|
Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("TOTALPLAYERS", Manager.GetClientService().GetTotalClientsAsync().Result.ToString));
|
||||||
Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("VERSION", Program.Version.ToString));
|
Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("VERSION", IW4MAdmin.Application.Program.Version.ToString));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -24,6 +24,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharedLibraryCore", "Shared
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebfrontCore", "WebfrontCore\WebfrontCore.csproj", "{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebfrontCore", "WebfrontCore\WebfrontCore.csproj", "{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Application", "Application\Application.csproj", "{B4626E78-BB22-43F8-A6AD-890B0853D61F}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -234,6 +236,38 @@ Global
|
|||||||
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Stable|x64.Build.0 = Release|Any CPU
|
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Stable|x64.Build.0 = Release|Any CPU
|
||||||
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Stable|x86.ActiveCfg = Release|Any CPU
|
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Stable|x86.ActiveCfg = Release|Any CPU
|
||||||
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Stable|x86.Build.0 = Release|Any CPU
|
{D59AC1F1-2FB9-4BE7-813E-0CCCC4FE9067}.Release-Stable|x86.Build.0 = Release|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Nightly|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Nightly|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Nightly|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Nightly|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Nightly|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Nightly|x64.Build.0 = Release|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Nightly|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Nightly|x86.Build.0 = Release|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Stable|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Stable|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Stable|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Stable|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Stable|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Stable|x64.Build.0 = Release|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Stable|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{B4626E78-BB22-43F8-A6AD-890B0853D61F}.Release-Stable|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
11
SharedLibraryCore/Interfaces/IEventApi.cs
Normal file
11
SharedLibraryCore/Interfaces/IEventApi.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using SharedLibraryCore.Dtos;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace SharedLibraryCore.Interfaces
|
||||||
|
{
|
||||||
|
public interface IEventApi
|
||||||
|
{
|
||||||
|
void OnServerEvent(object sender, Event E);
|
||||||
|
Queue<EventInfo> GetEvents();
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using SharedLibraryCore.Objects;
|
using SharedLibraryCore.Objects;
|
||||||
using SharedLibraryCore.Services;
|
using SharedLibraryCore.Services;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using SharedLibraryCore.Configuration;
|
using SharedLibraryCore.Configuration;
|
||||||
|
|
||||||
namespace SharedLibraryCore.Interfaces
|
namespace SharedLibraryCore.Interfaces
|
||||||
@ -21,5 +22,6 @@ namespace SharedLibraryCore.Interfaces
|
|||||||
AliasService GetAliasService();
|
AliasService GetAliasService();
|
||||||
PenaltyService GetPenaltyService();
|
PenaltyService GetPenaltyService();
|
||||||
IDictionary<int, Player> GetPrivilegedClients();
|
IDictionary<int, Player> GetPrivilegedClients();
|
||||||
|
IEventApi GetEventApi();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
using WebfrontCore.Application.API;
|
|
||||||
|
|
||||||
namespace WebfrontCore.Controllers.API
|
namespace WebfrontCore.Controllers.API
|
||||||
{
|
{
|
||||||
@ -12,7 +11,7 @@ namespace WebfrontCore.Controllers.API
|
|||||||
[Route("event")]
|
[Route("event")]
|
||||||
public ActionResult Index()
|
public ActionResult Index()
|
||||||
{
|
{
|
||||||
var events = EventAPI.Events;
|
var events = Manager.GetEventApi().GetEvents();
|
||||||
var eventsDto = new List<EventInfo>();
|
var eventsDto = new List<EventInfo>();
|
||||||
while (events.Count > 0)
|
while (events.Count > 0)
|
||||||
eventsDto.Add(events.Dequeue());
|
eventsDto.Add(events.Dequeue());
|
||||||
|
@ -19,7 +19,7 @@ namespace WebfrontCore.Controllers
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var client = IW4MAdmin.Program.ServerManager.PrivilegedClients[clientId];
|
var client = Manager.GetPrivilegedClients()[clientId];
|
||||||
string[] hashedPassword = await Task.FromResult(SharedLibraryCore.Helpers.Hashing.Hash(password, client.PasswordSalt));
|
string[] hashedPassword = await Task.FromResult(SharedLibraryCore.Helpers.Hashing.Hash(password, client.PasswordSalt));
|
||||||
|
|
||||||
if (hashedPassword[0] == client.Password)
|
if (hashedPassword[0] == client.Password)
|
||||||
|
@ -1,20 +1,19 @@
|
|||||||
using IW4MAdmin;
|
using System;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
|
||||||
using SharedLibraryCore;
|
|
||||||
using SharedLibraryCore.Database;
|
|
||||||
using SharedLibraryCore.Database.Models;
|
|
||||||
using SharedLibraryCore.Objects;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
|
|
||||||
|
using SharedLibraryCore.Database;
|
||||||
|
using SharedLibraryCore.Database.Models;
|
||||||
|
using SharedLibraryCore.Interfaces;
|
||||||
|
using SharedLibraryCore.Objects;
|
||||||
|
|
||||||
namespace WebfrontCore.Controllers
|
namespace WebfrontCore.Controllers
|
||||||
{
|
{
|
||||||
public class BaseController : Controller
|
public class BaseController : Controller
|
||||||
{
|
{
|
||||||
protected ApplicationManager Manager;
|
protected IManager Manager;
|
||||||
protected readonly DatabaseContext Context;
|
protected readonly DatabaseContext Context;
|
||||||
protected bool Authorized { get; private set; }
|
protected bool Authorized { get; private set; }
|
||||||
protected EFClient User { get; private set; }
|
protected EFClient User { get; private set; }
|
||||||
@ -26,7 +25,7 @@ namespace WebfrontCore.Controllers
|
|||||||
|
|
||||||
public override void OnActionExecuting(ActionExecutingContext context)
|
public override void OnActionExecuting(ActionExecutingContext context)
|
||||||
{
|
{
|
||||||
Manager = IW4MAdmin.Program.ServerManager;
|
Manager = Program.Manager;
|
||||||
|
|
||||||
User = new EFClient()
|
User = new EFClient()
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@ namespace WebfrontCore.Controllers
|
|||||||
{
|
{
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
{
|
{
|
||||||
var activeServers = Manager.Servers.Select(s => new ServerInfo()
|
var activeServers = Manager.GetServers().Select(s => new ServerInfo()
|
||||||
{
|
{
|
||||||
Name = s.Hostname,
|
Name = s.Hostname,
|
||||||
ID = s.GetHashCode(),
|
ID = s.GetHashCode(),
|
||||||
@ -29,7 +29,7 @@ namespace WebfrontCore.Controllers
|
|||||||
public async Task<IActionResult> ExecuteAsync(int serverId, string command)
|
public async Task<IActionResult> ExecuteAsync(int serverId, string command)
|
||||||
{
|
{
|
||||||
|
|
||||||
var server = Manager.Servers.First(s => s.GetHashCode() == serverId);
|
var server = Manager.GetServers().First(s => s.GetHashCode() == serverId);
|
||||||
var client = new Player()
|
var client = new Player()
|
||||||
{
|
{
|
||||||
ClientId = User.ClientId,
|
ClientId = User.ClientId,
|
||||||
|
@ -1,16 +1,20 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using SharedLibraryCore.Interfaces;
|
||||||
|
|
||||||
namespace WebfrontCore
|
namespace WebfrontCore
|
||||||
{
|
{
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
public static IManager Manager;
|
||||||
|
|
||||||
|
public static void Init(IManager mgr)
|
||||||
{
|
{
|
||||||
BuildWebHost(args).Run();
|
Manager = mgr;
|
||||||
|
BuildWebHost().Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IWebHost BuildWebHost(string[] args) =>
|
public static IWebHost BuildWebHost() =>
|
||||||
new WebHostBuilder()
|
new WebHostBuilder()
|
||||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||||
.UseKestrel()
|
.UseKestrel()
|
||||||
|
@ -49,9 +49,6 @@ namespace WebfrontCore
|
|||||||
options.AccessDeniedPath = "/";
|
options.AccessDeniedPath = "/";
|
||||||
options.LoginPath = "/";
|
options.LoginPath = "/";
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!IW4MAdmin.Program.Start())
|
|
||||||
Environment.Exit(-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
|
@ -28,7 +28,7 @@ namespace WebfrontCore.ViewComponents
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var penalties = await IW4MAdmin.ApplicationManager.GetInstance().GetPenaltyService().GetRecentPenalties(15, offset);
|
var penalties = await Program.Manager.GetPenaltyService().GetRecentPenalties(15, offset);
|
||||||
var penaltiesDto = penalties.Select(p => new PenaltyInfo()
|
var penaltiesDto = penalties.Select(p => new PenaltyInfo()
|
||||||
{
|
{
|
||||||
OffenderId = p.OffenderId,
|
OffenderId = p.OffenderId,
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using SharedLibraryCore.Dtos;
|
using SharedLibraryCore.Dtos;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace WebfrontCore.ViewComponents
|
namespace WebfrontCore.ViewComponents
|
||||||
{
|
{
|
||||||
@ -11,7 +8,7 @@ namespace WebfrontCore.ViewComponents
|
|||||||
{
|
{
|
||||||
public IViewComponentResult Invoke()
|
public IViewComponentResult Invoke()
|
||||||
{
|
{
|
||||||
var servers = IW4MAdmin.Program.ServerManager.GetServers();
|
var servers = Program.Manager.GetServers();
|
||||||
var serverInfo = servers.Select(s => new ServerInfo()
|
var serverInfo = servers.Select(s => new ServerInfo()
|
||||||
{
|
{
|
||||||
Name = s.Hostname,
|
Name = s.Hostname,
|
||||||
|
@ -15,6 +15,9 @@
|
|||||||
<PackageProjectUrl>https://raidmax.org/IW4MAdmin</PackageProjectUrl>
|
<PackageProjectUrl>https://raidmax.org/IW4MAdmin</PackageProjectUrl>
|
||||||
<RepositoryUrl>https://github.com/RaidMax/IW4M-Admin</RepositoryUrl>
|
<RepositoryUrl>https://github.com/RaidMax/IW4M-Admin</RepositoryUrl>
|
||||||
<PackageIconUrl>https://raidmax.org/IW4MAdmin/img/iw4adminicon-3.png</PackageIconUrl>
|
<PackageIconUrl>https://raidmax.org/IW4MAdmin/img/iw4adminicon-3.png</PackageIconUrl>
|
||||||
|
<ApplicationIcon />
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<StartupObject />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
Loading…
Reference in New Issue
Block a user