+
{% block content %}{% endblock %}
-
-
+
-
-
-
+
{% block scripts %}{% endblock %}
-
diff --git a/Master/master/views.py b/Master/master/views.py
index 7b27e6a8e..b5ca7b57f 100644
--- a/Master/master/views.py
+++ b/Master/master/views.py
@@ -5,13 +5,14 @@ Routes and views for the flask application.
from datetime import datetime
from flask import render_template
from master import app
+from master.resources.history_graph import HistoryGraph
@app.route('/')
-@app.route('/home')
def home():
- """Renders the home page."""
+ _history_graph = HistoryGraph().get(500)
return render_template(
'index.html',
- title='Home Page',
- year=datetime.now().year,
- )
\ No newline at end of file
+ title='API Overview',
+ history_graph = _history_graph[0]['message'],
+ data_points = _history_graph[0]['data_points']
+ )
diff --git a/README.md b/README.md
index c091ca6f8..c10fe2f96 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,5 @@
+
# IW4MAdmin
### Quick Start Guide
### Version 2.0
@@ -40,6 +41,10 @@ When **IW4MAdmin** is launched for the _first time_, you will be prompted to set
* Shows a link to your server's discord on the webfront
* _This feature requires an invite link to your discord server_
+`Use Custom Encoding Parser`
+* Allows alternative encodings to be used for parsing game information and events
+* **Russian users should use this and then specify** `windows-1251` **as the encoding string**
+
#### Advanced Configuration
If you wish to further customize your experience of **IW4MAdmin**, the following configuration file(s) will allow you to changes core options using any text-editor.
diff --git a/SharedLibraryCore/Commands/NativeCommands.cs b/SharedLibraryCore/Commands/NativeCommands.cs
index 0bc343c15..a30d3eaa8 100644
--- a/SharedLibraryCore/Commands/NativeCommands.cs
+++ b/SharedLibraryCore/Commands/NativeCommands.cs
@@ -214,11 +214,11 @@ namespace SharedLibraryCore.Commands
public class CUnban : Command
{
public CUnban() :
- base("unban", "unban player by database id", "ub", Player.Permission.SeniorAdmin, true, new CommandArgument[]
+ base("unban", "unban player by client id", "ub", Player.Permission.SeniorAdmin, true, new CommandArgument[]
{
new CommandArgument()
{
- Name = "databaseID",
+ Name = "client id",
Required = true,
},
new CommandArgument()
@@ -576,6 +576,12 @@ namespace SharedLibraryCore.Commands
public override async Task ExecuteAsync(GameEvent E)
{
+ if (E.Data.Length < 3)
+ {
+ await E.Origin.Tell("Please enter at least 3 characters");
+ return;
+ }
+
IList
db_players = (await (E.Owner.Manager.GetClientService() as ClientService)
.GetClientByName(E.Data))
.OrderByDescending(p => p.LastConnection)
diff --git a/SharedLibraryCore/Configuration/ApplicationConfiguration.cs b/SharedLibraryCore/Configuration/ApplicationConfiguration.cs
index 75d9509f8..0915e0cbd 100644
--- a/SharedLibraryCore/Configuration/ApplicationConfiguration.cs
+++ b/SharedLibraryCore/Configuration/ApplicationConfiguration.cs
@@ -17,6 +17,7 @@ namespace SharedLibraryCore.Configuration
public string DiscordInviteCode { get; set; }
public string IPHubAPIKey { get; set; }
public string WebfrontBindUrl { get; set; }
+ public string CustomParserEncoding { get; set; }
public string Id { get; set; }
public List Servers { get; set; }
public int AutoMessagePeriod { get; set; }
@@ -32,6 +33,10 @@ namespace SharedLibraryCore.Configuration
EnableSteppedHierarchy = Utilities.PromptBool("Enable stepped privilege hierarchy");
EnableCustomSayName = Utilities.PromptBool("Enable custom say name");
+ bool useCustomParserEncoding = Utilities.PromptBool("Use custom encoding parser");
+ CustomParserEncoding = useCustomParserEncoding ? Utilities.PromptString("Enter encoding string") : "windows-1252";
+
+
WebfrontBindUrl = "http://127.0.0.1:1624";
if (EnableCustomSayName)
diff --git a/SharedLibraryCore/File.cs b/SharedLibraryCore/File.cs
index ba275e89d..31ffcb2a6 100644
--- a/SharedLibraryCore/File.cs
+++ b/SharedLibraryCore/File.cs
@@ -39,7 +39,7 @@ namespace SharedLibraryCore
if (fileName != string.Empty)
{
Name = fileName;
- Handle = new StreamReader(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, 4096, true), Encoding.UTF8);
+ Handle = new StreamReader(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, 4096, true), Utilities.EncodingType);
sze = Handle.BaseStream.Length;
}
diff --git a/SharedLibraryCore/RCon/Connection.cs b/SharedLibraryCore/RCon/Connection.cs
index 8664b2463..9d1e8c6fb 100644
--- a/SharedLibraryCore/RCon/Connection.cs
+++ b/SharedLibraryCore/RCon/Connection.cs
@@ -130,7 +130,7 @@ namespace SharedLibraryCore.RCon
#if DEBUG
Log.WriteDebug($"Received {bytesRead} bytes from {ServerConnection.RemoteEndPoint}");
#endif
- connectionState.ResponseString.Append(Encoding.UTF7.GetString(connectionState.Buffer, 0, bytesRead).TrimEnd('\0') + '\n');
+ connectionState.ResponseString.Append(Utilities.EncodingType.GetString(connectionState.Buffer, 0, bytesRead).TrimEnd('\0') + '\n');
if (!connectionState.Buffer.Take(4).ToArray().SequenceEqual(new byte[] { 0xFF, 0xFF, 0xFF, 0xFF }))
throw new NetworkException("Unexpected packet received");
diff --git a/SharedLibraryCore/Services/ClientService.cs b/SharedLibraryCore/Services/ClientService.cs
index 5295c7849..8966a23e4 100644
--- a/SharedLibraryCore/Services/ClientService.cs
+++ b/SharedLibraryCore/Services/ClientService.cs
@@ -226,6 +226,9 @@ namespace SharedLibraryCore.Services
public async Task> GetClientByName(string name)
{
+ if (name.Length < 3)
+ return new List();
+
using (var context = new DatabaseContext())
{
var iqClients = (from alias in context.Aliases
diff --git a/SharedLibraryCore/Utilities.cs b/SharedLibraryCore/Utilities.cs
index fed971eb0..4dce4a886 100644
--- a/SharedLibraryCore/Utilities.cs
+++ b/SharedLibraryCore/Utilities.cs
@@ -20,6 +20,7 @@ namespace SharedLibraryCore
{
public static string OperatingDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + Path.DirectorySeparatorChar;
public static readonly Task CompletedTask = Task.FromResult(false);
+ public static Encoding EncodingType;
//Get string with specified number of spaces -- really only for visual output
public static String GetSpaces(int Num)
@@ -197,15 +198,9 @@ namespace SharedLibraryCore
public static int ConvertToIP(this string str)
{
- try
- {
- return BitConverter.ToInt32(System.Net.IPAddress.Parse(str).GetAddressBytes(), 0);
- }
+ System.Net.IPAddress.TryParse(str, out System.Net.IPAddress ip);
- catch (FormatException)
- {
- return 0;
- }
+ return ip == null ? 0 : BitConverter.ToInt32(ip.GetAddressBytes(), 0);
}
public static string ConvertIPtoString(this int ip)