diff --git a/.vs/config/applicationhost.config b/.vs/config/applicationhost.config deleted file mode 100644 index 9dc83012a..000000000 --- a/.vs/config/applicationhost.config +++ /dev/null @@ -1,1036 +0,0 @@ - - - - - - - -
-
-
-
-
-
-
-
- - - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
- -
-
-
-
-
-
- -
-
-
-
-
- -
-
-
- -
-
- -
-
- -
-
-
- - -
-
-
-
-
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/IW4MAdmin.sln b/IW4MAdmin.sln index c19ec08f0..45e827556 100644 --- a/IW4MAdmin.sln +++ b/IW4MAdmin.sln @@ -19,8 +19,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VotemapPlugin", "Plugins\Vo EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MessageboardPlugin", "Plugins\MessageBoard\MessageboardPlugin.csproj", "{E46C85BD-A99C-484E-BCCE-0F1831C5925E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventAPI", "Plugins\EventAPI\EventAPI.csproj", "{C9E821BF-23AD-4CB5-B7F9-B3B99B606650}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{26E8B310-269E-46D4-A612-24601F16065F}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FastRestartPlugin", "Plugins\FastRestart\FastRestartPlugin.csproj", "{1479DE87-ACB5-4046-81C8-A0BA5041227D}" @@ -206,38 +204,6 @@ Global {E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Stable|x64.ActiveCfg = Release-Stable|Any CPU {E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Stable|x86.ActiveCfg = Release-Stable|Any CPU {E46C85BD-A99C-484E-BCCE-0F1831C5925E}.Release-Stable|x86.Build.0 = Release-Stable|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Debug|x64.ActiveCfg = Debug|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Debug|x64.Build.0 = Debug|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Debug|x86.ActiveCfg = Debug|x86 - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Debug|x86.Build.0 = Debug|x86 - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release|Any CPU.ActiveCfg = Release-Stable|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release|Any CPU.Build.0 = Release-Stable|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release|Mixed Platforms.ActiveCfg = Release-Stable|x86 - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release|Mixed Platforms.Build.0 = Release-Stable|x86 - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release|x64.ActiveCfg = Release-Stable|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release|x64.Build.0 = Release-Stable|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release|x86.ActiveCfg = Release-Stable|x86 - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release|x86.Build.0 = Release-Stable|x86 - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Nightly|Any CPU.ActiveCfg = Release-Nightly|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Nightly|Any CPU.Build.0 = Release-Nightly|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Nightly|Mixed Platforms.ActiveCfg = Release-Nightly|x86 - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Nightly|Mixed Platforms.Build.0 = Release-Nightly|x86 - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Nightly|x64.ActiveCfg = Release-Nightly|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Nightly|x64.Build.0 = Release-Nightly|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Nightly|x86.ActiveCfg = Release-Nightly|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Nightly|x86.Build.0 = Release-Nightly|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Stable|Any CPU.ActiveCfg = Release-Stable|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Stable|Any CPU.Build.0 = Release-Stable|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Stable|Mixed Platforms.ActiveCfg = Release-Stable|x86 - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Stable|Mixed Platforms.Build.0 = Release-Stable|x86 - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Stable|x64.ActiveCfg = Release-Stable|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Stable|x64.Build.0 = Release-Stable|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Stable|x86.ActiveCfg = Release-Stable|Any CPU - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650}.Release-Stable|x86.Build.0 = Release-Stable|Any CPU {1479DE87-ACB5-4046-81C8-A0BA5041227D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1479DE87-ACB5-4046-81C8-A0BA5041227D}.Debug|Any CPU.Build.0 = Debug|Any CPU {1479DE87-ACB5-4046-81C8-A0BA5041227D}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 @@ -339,7 +305,6 @@ Global {AF097E6B-48D5-4452-9CCF-0A81A21F341D} = {26E8B310-269E-46D4-A612-24601F16065F} {428D8EB9-ECA3-4A66-AA59-3A944378C33F} = {26E8B310-269E-46D4-A612-24601F16065F} {E46C85BD-A99C-484E-BCCE-0F1831C5925E} = {26E8B310-269E-46D4-A612-24601F16065F} - {C9E821BF-23AD-4CB5-B7F9-B3B99B606650} = {26E8B310-269E-46D4-A612-24601F16065F} {1479DE87-ACB5-4046-81C8-A0BA5041227D} = {26E8B310-269E-46D4-A612-24601F16065F} {B8C2A759-8663-4F6F-9BA4-19595F5E12C1} = {26E8B310-269E-46D4-A612-24601F16065F} EndGlobalSection diff --git a/Plugins/EventAPI/EventAPI.csproj b/Plugins/EventAPI/EventAPI.csproj index 08dfe5194..e77c8c238 100644 --- a/Plugins/EventAPI/EventAPI.csproj +++ b/Plugins/EventAPI/EventAPI.csproj @@ -69,7 +69,7 @@ - + diff --git a/Plugins/EventAPI/Plugin.cs b/Plugins/EventAPI/Plugin.cs index eebdb36eb..07bbf9fc0 100644 --- a/Plugins/EventAPI/Plugin.cs +++ b/Plugins/EventAPI/Plugin.cs @@ -85,7 +85,7 @@ namespace EventAPI message.Contains("wall") || message.Contains("cheto") || message.Contains("hak") || - message.Contains("bot"); + message.Contains(" bot "); if (flagged) { diff --git a/Plugins/SimpleStats/Commands/ResetStats.cs b/Plugins/SimpleStats/Commands/ResetStats.cs index 95ad2506e..d6c9c1f4c 100644 --- a/Plugins/SimpleStats/Commands/ResetStats.cs +++ b/Plugins/SimpleStats/Commands/ResetStats.cs @@ -9,7 +9,6 @@ using System.Threading.Tasks; namespace StatsPlugin.Commands { - public class ResetStats : Command { public ResetStats() : base("resetstats", "reset your stats to factory-new", "rs", Player.Permission.User, false) { } @@ -32,7 +31,7 @@ namespace StatsPlugin.Commands // fixme: this doesn't work properly when another context exists await svc.SaveChangesAsync(); - await E.Origin.Tell("Your stats have been reset"); + await E.Origin.Tell("Your stats for this server have been reset"); } else diff --git a/Plugins/SimpleStats/Fakes/System.Data.SQLite.fakes b/Plugins/SimpleStats/Fakes/System.Data.SQLite.fakes deleted file mode 100644 index 8cb05f45c..000000000 Binary files a/Plugins/SimpleStats/Fakes/System.Data.SQLite.fakes and /dev/null differ diff --git a/Plugins/SimpleStats/Plugin.cs b/Plugins/SimpleStats/Plugin.cs index 97bde99b7..189bddeac 100644 --- a/Plugins/SimpleStats/Plugin.cs +++ b/Plugins/SimpleStats/Plugin.cs @@ -97,7 +97,7 @@ namespace StatsPlugin double abdomenRatio = 0; double chestAbdomenRatio = 0; - if (clientStats.FirstOrDefault()?.HitLocations.Count > 0) + if (clientStats.Where(cs => cs.HitLocations.Count > 0).FirstOrDefault() != null) { chestRatio = Math.Round(clientStats.Where(c => c.HitLocations.Count > 0).Sum(c => c.HitLocations.First(hl => hl.Location == IW4Info.HitLocation.torso_upper).HitCount) / diff --git a/Plugins/SimpleStats/StatsPlugin.csproj b/Plugins/SimpleStats/StatsPlugin.csproj index 08f0ea6ac..b7eefa518 100644 --- a/Plugins/SimpleStats/StatsPlugin.csproj +++ b/Plugins/SimpleStats/StatsPlugin.csproj @@ -118,6 +118,9 @@ + + + @@ -147,9 +150,7 @@ SharedLibrary - - - + copy /Y "$(TargetDir)$(TargetName).dll" "$(SolutionDir)BUILD\plugins\" diff --git a/SharedLibrary/Database/DatabaseContext.cs b/SharedLibrary/Database/DatabaseContext.cs index cbf16e8a3..c30c36f4d 100644 --- a/SharedLibrary/Database/DatabaseContext.cs +++ b/SharedLibrary/Database/DatabaseContext.cs @@ -56,7 +56,7 @@ namespace SharedLibrary.Database #if !DEBUG foreach (string dllPath in System.IO.Directory.GetFiles($"{Utilities.OperatingDirectory}Plugins")) #else - foreach (string dllPath in System.IO.Directory.GetFiles(@"C:\Users\User\Desktop\stuff\IW4M-Admin\IW4M-Admin\WebfrontCore\bin\x86\Debug\Plugins")) + foreach (string dllPath in System.IO.Directory.GetFiles(@"C:\Projects\IW4M-Admin\WebfrontCore\bin\x86\Debug\Plugins").Where(f => f.Contains(".dll"))) #endif { Assembly library; diff --git a/SharedLibrary/Dtos/ChatInfo.cs b/SharedLibrary/Dtos/ChatInfo.cs new file mode 100644 index 000000000..21a2007ce --- /dev/null +++ b/SharedLibrary/Dtos/ChatInfo.cs @@ -0,0 +1,11 @@ +using System; + +namespace SharedLibrary.Dtos +{ + public class ChatInfo + { + public string Message { get; set; } + public DateTime Time { get; set; } + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/SharedLibrary/Dtos/EventInfo.cs b/SharedLibrary/Dtos/EventInfo.cs new file mode 100644 index 000000000..fc3a383f1 --- /dev/null +++ b/SharedLibrary/Dtos/EventInfo.cs @@ -0,0 +1,39 @@ +using System; + +namespace SharedLibrary.Dtos +{ + public class EventInfo + { + public EventInfo(EventType Ty, EventVersion V, string M, string T, string O, string Ta) + { + Type = Ty; + Version = V; + Message = System.Web.HttpUtility.HtmlEncode(M); + Title = T; + Origin = System.Web.HttpUtility.HtmlEncode(O); + Target = System.Web.HttpUtility.HtmlEncode(Ta); + + ID = Math.Abs(DateTime.Now.GetHashCode()); + } + + public enum EventType + { + NOTIFICATION, + STATUS, + ALERT, + } + + public enum EventVersion + { + IW4MAdmin + } + + public EventType Type; + public EventVersion Version; + public string Message; + public string Title; + public string Origin; + public string Target; + public int ID; + } +} \ No newline at end of file diff --git a/SharedLibrary/Dtos/ServerInfo.cs b/SharedLibrary/Dtos/ServerInfo.cs index ae42657a1..00798cbb2 100644 --- a/SharedLibrary/Dtos/ServerInfo.cs +++ b/SharedLibrary/Dtos/ServerInfo.cs @@ -14,7 +14,7 @@ namespace SharedLibrary.Dtos public string GameType { get; set; } public int ClientCount { get; set; } public int MaxClients { get; set; } - public Chat[] ChatHistory { get; set; } + public ChatInfo[] ChatHistory { get; set; } public List Players { get; set; } public Helpers.PlayerHistory[] PlayerHistory { get; set; } public int ID { get; set; } diff --git a/SharedLibrary/Event.cs b/SharedLibrary/Event.cs index 4e63d1623..1d5afe7c2 100644 --- a/SharedLibrary/Event.cs +++ b/SharedLibrary/Event.cs @@ -8,59 +8,6 @@ using SharedLibrary.Objects; namespace SharedLibrary { - [Serializable] - public class Chat - { - public Chat(string O, String M, DateTime D) - { - Name = O; - Message = M; - Time = D; - - } - - public String Message { get; private set; } - public DateTime Time { get; private set; } - public string Name; - } - - [Serializable] - public struct RestEvent - { - public RestEvent(EventType Ty, EventVersion V, string M, string T, string O, string Ta) - { - Type = Ty; - Version = V; - Message = System.Web.HttpUtility.HtmlEncode(M); - Title = T; - Origin = System.Web.HttpUtility.HtmlEncode(O); - Target = System.Web.HttpUtility.HtmlEncode(Ta); - - ID = Math.Abs(DateTime.Now.GetHashCode()); - } - - public enum EventType - { - NOTIFICATION, - STATUS, - ALERT, - } - - public enum EventVersion - { - IW4MAdmin - } - - public EventType Type; - public EventVersion Version; - public string Message; - public string Title; - public string Origin; - public string Target; - public int ID; - } - - public class Event { public enum GType @@ -135,10 +82,10 @@ namespace SharedLibrary } if (removeTime.Contains("ExitLevel")) - return new Event(GType.MapEnd, line[0], null, null, SV); + return new Event(GType.MapEnd, line[0], new Player() { ClientId = 1 }, null, SV); if (removeTime.Contains("InitGame")) - return new Event(GType.MapChange, line[0], null, null, SV); + return new Event(GType.MapChange, line[0], new Player() { ClientId = 1 }, null, SV); return null; diff --git a/SharedLibrary/LibSQLCE/x86/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest b/SharedLibrary/LibSQLCE/x86/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest new file mode 100644 index 000000000..bbd12ccde --- /dev/null +++ b/SharedLibrary/LibSQLCE/x86/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest @@ -0,0 +1,6 @@ + + + + + +CXED+6HzJlSphyMNOn27ujadC0= MyKED+9DyS+1XcMeaC0Zlw2vFZ0= EeyDE7og6WoPd2oBhYbMEnpFHhY= + \ No newline at end of file diff --git a/SharedLibrary/LibSQLCE/x86/Microsoft.VC90.CRT/README_ENU.txt b/SharedLibrary/LibSQLCE/x86/Microsoft.VC90.CRT/README_ENU.txt new file mode 100644 index 000000000..fc38b3684 Binary files /dev/null and b/SharedLibrary/LibSQLCE/x86/Microsoft.VC90.CRT/README_ENU.txt differ diff --git a/SharedLibrary/LibSQLCE/x86/Microsoft.VC90.CRT/msvcr90.dll b/SharedLibrary/LibSQLCE/x86/Microsoft.VC90.CRT/msvcr90.dll new file mode 100644 index 000000000..e2e66019c Binary files /dev/null and b/SharedLibrary/LibSQLCE/x86/Microsoft.VC90.CRT/msvcr90.dll differ diff --git a/SharedLibrary/LibSQLCE/x86/sqlceca40.dll b/SharedLibrary/LibSQLCE/x86/sqlceca40.dll new file mode 100644 index 000000000..92596101e Binary files /dev/null and b/SharedLibrary/LibSQLCE/x86/sqlceca40.dll differ diff --git a/SharedLibrary/LibSQLCE/x86/sqlcecompact40.dll b/SharedLibrary/LibSQLCE/x86/sqlcecompact40.dll new file mode 100644 index 000000000..41c69ecc5 Binary files /dev/null and b/SharedLibrary/LibSQLCE/x86/sqlcecompact40.dll differ diff --git a/SharedLibrary/LibSQLCE/x86/sqlceer40EN.dll b/SharedLibrary/LibSQLCE/x86/sqlceer40EN.dll new file mode 100644 index 000000000..a40154fd3 Binary files /dev/null and b/SharedLibrary/LibSQLCE/x86/sqlceer40EN.dll differ diff --git a/SharedLibrary/LibSQLCE/x86/sqlceme40.dll b/SharedLibrary/LibSQLCE/x86/sqlceme40.dll new file mode 100644 index 000000000..d737119fa Binary files /dev/null and b/SharedLibrary/LibSQLCE/x86/sqlceme40.dll differ diff --git a/SharedLibrary/LibSQLCE/x86/sqlceqp40.dll b/SharedLibrary/LibSQLCE/x86/sqlceqp40.dll new file mode 100644 index 000000000..dedfc9a3c Binary files /dev/null and b/SharedLibrary/LibSQLCE/x86/sqlceqp40.dll differ diff --git a/SharedLibrary/LibSQLCE/x86/sqlcese40.dll b/SharedLibrary/LibSQLCE/x86/sqlcese40.dll new file mode 100644 index 000000000..cc37e3b54 Binary files /dev/null and b/SharedLibrary/LibSQLCE/x86/sqlcese40.dll differ diff --git a/SharedLibrary/Server.cs b/SharedLibrary/Server.cs index 1a7dcdd72..aebc96a2a 100644 --- a/SharedLibrary/Server.cs +++ b/SharedLibrary/Server.cs @@ -39,7 +39,7 @@ namespace SharedLibrary Players = new List(new Player[18]); Reports = new List(); PlayerHistory = new Queue(); - ChatHistory = new List(); + ChatHistory = new List(); //Configuration = new ConfigurationManager(this.GetType()); NextMessage = 0; InitializeTokens(); @@ -364,7 +364,7 @@ namespace SharedLibrary public List Maps { get; protected set; } public List Rules { get; protected set; } public List Reports { get; set; } - public List ChatHistory { get; protected set; } + public List ChatHistory { get; protected set; } public Queue PlayerHistory { get; private set; } public Game GameName { get; protected set; } diff --git a/SharedLibrary/Services/PenaltyService.cs b/SharedLibrary/Services/PenaltyService.cs index f216e7806..08b04c00e 100644 --- a/SharedLibrary/Services/PenaltyService.cs +++ b/SharedLibrary/Services/PenaltyService.cs @@ -153,7 +153,8 @@ namespace SharedLibrary.Services Offense = penalty.Offense, Type = penalty.Type.ToString() }, - When = penalty.When + When = penalty.When, + Sensitive = penalty.Type == Objects.Penalty.PenaltyType.Flag }; // fixme: is this good and fast? return await iqPenalties.ToListAsync(); diff --git a/SharedLibrary/SharedLibrary.csproj b/SharedLibrary/SharedLibrary.csproj index 0350528cd..c1606a531 100644 --- a/SharedLibrary/SharedLibrary.csproj +++ b/SharedLibrary/SharedLibrary.csproj @@ -154,6 +154,7 @@ + @@ -207,7 +208,16 @@ - + + + + + + + + + + @@ -242,10 +252,8 @@ copy /Y "$(TargetDir)$(TargetName).dll" "$(SolutionDir)BUILD\lib" copy /Y "$(TargetDir)$(TargetName).dll" "$(SolutionDir)Admin\lib" -if not exist "$(TargetDir)x86" md "$(TargetDir)x86" - xcopy /s /y "$(SolutionDir)packages\Microsoft.SqlServer.Compact.4.0.8876.1\NativeBinaries\x86\*.*" "$(TargetDir)x86" -if not exist "$(TargetDir)amd64" md "$(TargetDir)amd64" - xcopy /s /y "$(SolutionDir)packages\Microsoft.SqlServer.Compact.4.0.8876.1\NativeBinaries\amd64\*.*" "$(TargetDir)amd64" +if not exist "$(ProjectDir)LibSQLCE\x86" md "$(TargetDir)x86" + xcopy /s /y "$(ProjectDir)LibSQLCE\x86\*.*" "$(TargetDir)x86" xcopy /Y /I /E "$(TargetDir)*" "$(SolutionDir)BUILD\Lib" diff --git a/SharedLibrary/packages.config b/SharedLibrary/packages.config deleted file mode 100644 index 975fcdfe8..000000000 --- a/SharedLibrary/packages.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/WebfrontCore/Application/API/EventAPI.cs b/WebfrontCore/Application/API/EventAPI.cs new file mode 100644 index 000000000..e2259e93a --- /dev/null +++ b/WebfrontCore/Application/API/EventAPI.cs @@ -0,0 +1,69 @@ +using SharedLibrary; +using System; +using System.Collections.Generic; + +namespace WebfrontCore.Application.API +{ + class EventAPI + { + public static Queue Events = new Queue(); + static DateTime LastFlagEvent; + static string[] FlaggedMessageContains = + { + " wh ", + "hax", + "cheat", + " hack ", + "aim", + "wall", + "cheto", + "hak", + "bot" + }; + static int FlaggedMessageCount; + + public static void OnServerEventOccurred(object sender, Event E) + { + if (E.Type == Event.GType.Say && E.Origin.Level < SharedLibrary.Objects.Player.Permission.Trusted) + { + bool flaggedMessage = false; + foreach (string msg in FlaggedMessageContains) + flaggedMessage = flaggedMessage ? flaggedMessage : E.Data.ToLower().Contains(msg); + + if (flaggedMessage) + FlaggedMessageCount++; + + if (FlaggedMessageCount > 3) + { + if (Events.Count > 20) + Events.Dequeue(); + + FlaggedMessageCount = 0; + + E.Owner.Broadcast("If you suspect someone of ^5CHEATING ^7use the ^5!report ^7command").Wait(); + Events.Enqueue(new SharedLibrary.Dtos.EventInfo( + SharedLibrary.Dtos.EventInfo.EventType.ALERT, + SharedLibrary.Dtos.EventInfo.EventVersion.IW4MAdmin, + "Chat indicates there may be a cheater", + "Alert", + E.Owner.Hostname, "")); + } + + if ((DateTime.UtcNow - LastFlagEvent).Minutes >= 3) + { + FlaggedMessageCount = 0; + LastFlagEvent = DateTime.Now; + } + } + + if (E.Type == Event.GType.Report) + { + Events.Enqueue(new SharedLibrary.Dtos.EventInfo( + SharedLibrary.Dtos.EventInfo.EventType.ALERT, + SharedLibrary.Dtos.EventInfo.EventVersion.IW4MAdmin, + $"**{E.Origin.Name}** has reported **{E.Target.Name}** for: {E.Data.Trim()}", + E.Target.Name, E.Origin.Name, "")); + } + } + } +} diff --git a/WebfrontCore/Application/Logger.cs b/WebfrontCore/Application/Logger.cs index 51a71d4b0..48fed3e24 100644 --- a/WebfrontCore/Application/Logger.cs +++ b/WebfrontCore/Application/Logger.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.IO; namespace IW4MAdmin diff --git a/WebfrontCore/Application/Manager.cs b/WebfrontCore/Application/Manager.cs index c9d9a970a..ff9da110b 100644 --- a/WebfrontCore/Application/Manager.cs +++ b/WebfrontCore/Application/Manager.cs @@ -12,6 +12,7 @@ using SharedLibrary.Helpers; using SharedLibrary.Exceptions; using SharedLibrary.Objects; using SharedLibrary.Services; +using WebfrontCore.Application.API; namespace IW4MAdmin { @@ -22,6 +23,7 @@ namespace IW4MAdmin public List AdministratorIPs { get; set; } public ILogger Logger { get; private set; } public bool Running { get; private set; } + public EventHandler ServerEventOccurred { get; private set; } static ApplicationManager Instance; List TaskStatuses; @@ -47,6 +49,7 @@ namespace IW4MAdmin AliasSvc = new AliasService(); PenaltySvc = new PenaltyService(); AdministratorIPs = new List(); + ServerEventOccurred += EventAPI.OnServerEventOccurred; } public IList GetServers() diff --git a/WebfrontCore/Application/Misc/VPNCheck.cs b/WebfrontCore/Application/Misc/VPNCheck.cs new file mode 100644 index 000000000..b64574e67 --- /dev/null +++ b/WebfrontCore/Application/Misc/VPNCheck.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace WebfrontCore.Application.Misc +{ + public class VPNCheck + { + public static async Task UsingVPN(string ip) + { + try + { + using (var RequestClient = new System.Net.Http.HttpClient()) + { + string response = await RequestClient.GetStringAsync($"http://check.getipintel.net/check.php?ip={ip}&contact=raidmax@live.com"); + double probability = Convert.ToDouble(response); + return probability > 0.9; + } + } + + catch (Exception) + { + return false; + } + } + } +} diff --git a/WebfrontCore/Application/Server.cs b/WebfrontCore/Application/Server.cs index 759c8a50a..f83134ea8 100644 --- a/WebfrontCore/Application/Server.cs +++ b/WebfrontCore/Application/Server.cs @@ -12,6 +12,8 @@ using SharedLibrary.Objects; using System.Text.RegularExpressions; using SharedLibrary.Services; using SharedLibrary.Database.Models; +using SharedLibrary.Dtos; +using WebfrontCore.Application.Misc; namespace IW4MAdmin { @@ -58,7 +60,8 @@ namespace IW4MAdmin } if (polledPlayer.Name == "Unknown Soldier" || - polledPlayer.Name == "UnknownSoldier") + polledPlayer.Name == "UnknownSoldier" || + polledPlayer.Name == "CHEATER") { Logger.WriteDebug($"Kicking {polledPlayer} because their name is generic"); await this.ExecuteCommandAsync($"clientkick {polledPlayer.ClientNumber} \"Please change your name using /name.\""); @@ -139,6 +142,12 @@ namespace IW4MAdmin await ExecuteEvent(new Event(Event.GType.Connect, "", player, null, this)); + + if (await VPNCheck.UsingVPN(player.IPAddressString)) + { + await player.Kick("VPNs are not allowed on this server", new Player() { ClientId = 1 }); + } + return true; } @@ -217,13 +226,13 @@ namespace IW4MAdmin if (E.Origin.Level < C.Permission) { - await E.Origin.Tell("You do not have access to that command!"); + await E.Origin.Tell("You do not have access to that command"); throw new SharedLibrary.Exceptions.CommandException($"{E.Origin} does not have access to \"{C.Name}\""); } if (Args.Length < (C.RequiredArgumentCount)) { - await E.Origin.Tell($"Not enough arguments supplied!"); + await E.Origin.Tell($"Not enough arguments supplied"); await E.Origin.Tell(C.Syntax); throw new SharedLibrary.Exceptions.CommandException($"{E.Origin} did not supply enough arguments for \"{C.Name}\""); } @@ -334,6 +343,7 @@ namespace IW4MAdmin return; await ProcessEvent(E); + ((ApplicationManager)Manager).ServerEventOccurred(this, E); foreach (IPlugin P in SharedLibrary.Plugins.PluginImporter.ActivePlugins) { @@ -588,7 +598,7 @@ namespace IW4MAdmin #if DEBUG { basepath.Value = (GameName == Game.IW4) ? - @"\\tsclient\J\WIN7_10.25\MW2" : + @"Z:\" : @"\\tsclient\G\Program Files (x86)\Steam\SteamApps\common\Call of Duty 4"; } @@ -608,16 +618,16 @@ namespace IW4MAdmin } else { -#if !DEBUG + //#if !DEBUG LogFile = new IFile(logPath); -#else + //#else } - LogFile = new RemoteFile("https://raidmax.org/IW4MAdmin/getlog.php"); -#endif + // LogFile = new RemoteFile("https://raidmax.org/IW4MAdmin/getlog.php"); + //#endif Logger.WriteInfo($"Log file is {logPath}"); #if !DEBUG await Broadcast("IW4M Admin is now ^2ONLINE"); - } + #endif } @@ -626,7 +636,12 @@ namespace IW4MAdmin { if (E.Type == Event.GType.Connect) { - ChatHistory.Add(new Chat(E.Origin.Name, "CONNECTED", DateTime.Now)); + ChatHistory.Add(new ChatInfo() + { + Name = E.Origin.Name, + Message = "CONNECTED", + Time = DateTime.UtcNow + }); if (E.Origin.Level > Player.Permission.Moderator) await E.Origin.Tell($"There are ^5{Reports.Count} ^7recent reports"); @@ -646,7 +661,12 @@ namespace IW4MAdmin else if (E.Type == Event.GType.Disconnect) { - ChatHistory.Add(new Chat(E.Origin.Name, "DISCONNECTED", DateTime.Now)); + ChatHistory.Add(new ChatInfo() + { + Name = E.Origin.Name, + Message = "DISCONNECTED", + Time = DateTime.UtcNow + }); } else if (E.Type == Event.GType.Script) @@ -699,7 +719,12 @@ namespace IW4MAdmin { E.Data = E.Data.StripColors(); - ChatHistory.Add(new Chat(E.Origin.Name, E.Data, DateTime.Now)); + ChatHistory.Add(new ChatInfo() + { + Name = E.Origin.Name, + Message = E.Data, + Time = DateTime.UtcNow + }); } } diff --git a/WebfrontCore/Controllers/API/APIController.cs b/WebfrontCore/Controllers/API/APIController.cs new file mode 100644 index 000000000..ca51822c2 --- /dev/null +++ b/WebfrontCore/Controllers/API/APIController.cs @@ -0,0 +1,13 @@ +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace WebfrontCore.Controllers.API +{ + [Route("api")] + public class APIController : BaseController + { + } +} diff --git a/WebfrontCore/Controllers/API/EventController.cs b/WebfrontCore/Controllers/API/EventController.cs new file mode 100644 index 000000000..182317eb6 --- /dev/null +++ b/WebfrontCore/Controllers/API/EventController.cs @@ -0,0 +1,23 @@ +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using WebfrontCore.Application.API; + +namespace WebfrontCore.Controllers.API +{ + public class EventController : APIController + { + [HttpGet] + [Route("event")] + public ActionResult Index() + { + var events = EventAPI.Events; + var eventsDto = new List(); + while (events.Count > 0) + eventsDto.Add(events.Dequeue()); + return Json(eventsDto); + } + } +} diff --git a/WebfrontCore/Controllers/BaseController.cs b/WebfrontCore/Controllers/BaseController.cs index 98e794897..bc4665cd2 100644 --- a/WebfrontCore/Controllers/BaseController.cs +++ b/WebfrontCore/Controllers/BaseController.cs @@ -18,7 +18,9 @@ namespace WebfrontCore.Controllers public override void OnActionExecuting(ActionExecutingContext context) { Manager = IW4MAdmin.Program.ServerManager; - Authorized = Manager.AdministratorIPs.Contains(context.HttpContext.Connection.RemoteIpAddress.ToString().ConvertToIP()); + Authorized = context.HttpContext.Connection.RemoteIpAddress.ToString() == "127.0.0.1" || + Manager.AdministratorIPs.Contains(context.HttpContext.Connection.RemoteIpAddress.ToString().ConvertToIP()); + ViewBag.Authorized = Authorized; base.OnActionExecuting(context); } } diff --git a/WebfrontCore/Controllers/ClientController.cs b/WebfrontCore/Controllers/ClientController.cs index f580066cf..d60689f33 100644 --- a/WebfrontCore/Controllers/ClientController.cs +++ b/WebfrontCore/Controllers/ClientController.cs @@ -38,12 +38,25 @@ namespace WebfrontCore.Controllers .OrderBy(i => i) .ToList(), }; + var meta = await MetaService.GetMeta(client.ClientId); + var penaltyMeta = await Manager.GetPenaltyService() + .ReadGetClientPenaltiesAsync(client.ClientId); + var administeredPenaltiesMeta = await Manager.GetPenaltyService() + .ReadGetClientPenaltiesAsync(client.ClientId, false); + + if (client.Level > SharedLibrary.Objects.Player.Permission.Trusted) + clientDto.Meta.Add(new ProfileMeta() + { + Key = "Masked", + Value = client.Masked ? "Is" : "Is not", + Sensitive = false, + When = DateTime.MinValue + }); + clientDto.Meta.AddRange(Authorized ? meta : meta.Where(m => !m.Sensitive)); - clientDto.Meta.AddRange(await Manager.GetPenaltyService() - .ReadGetClientPenaltiesAsync(client.ClientId)); - clientDto.Meta.AddRange(await Manager.GetPenaltyService() - .ReadGetClientPenaltiesAsync(client.ClientId, false)); + clientDto.Meta.AddRange(Authorized ? penaltyMeta : penaltyMeta.Where(m => !m.Sensitive)); + clientDto.Meta.AddRange(Authorized ? administeredPenaltiesMeta : penaltyMeta.Where(m => !m.Sensitive)); clientDto.Meta = clientDto.Meta .OrderByDescending(m => m.When) .ToList(); diff --git a/WebfrontCore/Program.cs b/WebfrontCore/Program.cs index f0c3967b2..4b889bd6e 100644 --- a/WebfrontCore/Program.cs +++ b/WebfrontCore/Program.cs @@ -1,9 +1,6 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; +using System.IO; using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; namespace WebfrontCore { @@ -11,16 +8,16 @@ namespace WebfrontCore { public static void Main(string[] args) { + var config = new ConfigurationBuilder() + .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) + .Build(); + var host = new WebHostBuilder() .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup() -#if !DEBUG - .UseUrls("http://server.nbsclan.org:8080") -#else - .UseUrls("http://127.0.0.1:5000;http://192.168.88.254:5000") -#endif + .UseUrls(config["Web:Address"]) .Build(); host.Run(); diff --git a/WebfrontCore/Startup.cs b/WebfrontCore/Startup.cs index 19d9c0468..0f738ab60 100644 --- a/WebfrontCore/Startup.cs +++ b/WebfrontCore/Startup.cs @@ -24,7 +24,7 @@ namespace WebfrontCore IW4MAdmin.Program.Start(); } - public IConfigurationRoot Configuration { get; } + public static IConfigurationRoot Configuration { get; private set; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) diff --git a/WebfrontCore/Views/Client/Profile/Index.cshtml b/WebfrontCore/Views/Client/Profile/Index.cshtml index 44e1b5dbd..e64c605ec 100644 --- a/WebfrontCore/Views/Client/Profile/Index.cshtml +++ b/WebfrontCore/Views/Client/Profile/Index.cshtml @@ -8,35 +8,50 @@
- @{ - string displayAliasButton = Model.Aliases.Count > 0 ? "" : "display: none;"; - } -

@Model.Name

-
- @{ - foreach (string alias in Model.Aliases) - { - @alias
- } +

+ + @Model.Name + @if (Model.Aliases.Count > 0 || ViewBag.Authorized) + { + } -

-
-
-
@Model.Level
-
-
- Played @Model.TimePlayed hours -
-
- First seen @Model.FirstSeen ago -
-
- Last seen @Model.LastSeen ago -
-
-
+ + +
+ @{ + foreach (string alias in Model.Aliases) + { + @alias
+ } + + if (ViewBag.Authorized) + { + foreach (string ip in Model.IPs) + { + @ip + } + + } + } +
+
+
@Model.Level
+
+
+ Played @Model.TimePlayed hours +
+
+ First seen @Model.FirstSeen ago +
+
+ Last seen @Model.LastSeen ago +
+ +
+ +
diff --git a/WebfrontCore/Views/Shared/_Layout.cshtml b/WebfrontCore/Views/Shared/_Layout.cshtml index 7acdae94c..c37f27152 100644 --- a/WebfrontCore/Views/Shared/_Layout.cshtml +++ b/WebfrontCore/Views/Shared/_Layout.cshtml @@ -35,6 +35,24 @@ + +
@RenderBody()
diff --git a/WebfrontCore/app.config b/WebfrontCore/app.config index 6a931919a..f992bd05c 100644 --- a/WebfrontCore/app.config +++ b/WebfrontCore/app.config @@ -8,6 +8,7 @@ + diff --git a/WebfrontCore/appsettings.json b/WebfrontCore/appsettings.json index 44ed6f6ef..aac58dad5 100644 --- a/WebfrontCore/appsettings.json +++ b/WebfrontCore/appsettings.json @@ -6,5 +6,8 @@ "System": "Information", "Microsoft": "None" } + }, + "Web": { + "Address": "127.0.0.1:5000" } } diff --git a/WebfrontCore/wwwroot/js/profile.js b/WebfrontCore/wwwroot/js/profile.js index d6d04b8ea..a9011de09 100644 --- a/WebfrontCore/wwwroot/js/profile.js +++ b/WebfrontCore/wwwroot/js/profile.js @@ -49,6 +49,19 @@ $(document).ready(function () { } }); + /* + get ip geolocation info into modal + */ + $('.ip-locate-link').click(function (e) { + $.getJSON("http://ip-api.com/json/" + $(this).data("ip")) + .done(function (response) { + $('.modal-title').text($(this).data("ip")); + $('.modal-body').text(JSON.stringify(response, null, 4)); + $('#mainModal').modal(); + }); + + }); + }); function penaltyToName(penaltyName) {