Added Config option for Rest spam.
This commit is contained in:
parent
545709e845
commit
811a98bb4c
4 changed files with 8 additions and 4 deletions
|
|
@ -267,7 +267,9 @@ namespace TShockAPI
|
||||||
|
|
||||||
[Description("The maximum value that a character may have for health.")] public int MaxMana = 400;
|
[Description("The maximum value that a character may have for health.")] public int MaxMana = 400;
|
||||||
|
|
||||||
[Description("The number of reserved slots past your max server slot that can be joined by reserved players")] public int ReservedSlots = 20;
|
[Description("The number of reserved slots past your max server slot that can be joined by reserved players")] public int ReservedSlots = 20;
|
||||||
|
|
||||||
|
[Description("The number of reserved slots past your max server slot that can be joined by reserved players")] public bool LogRest = false;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reads a configuration file from a given path
|
/// Reads a configuration file from a given path
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -306,7 +306,7 @@ namespace TShockAPI
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
foreach (var field in typeof(Permissions).GetFields().OrderBy(f => f.Name))
|
foreach (var field in typeof(Permissions).GetFields().OrderBy(f => f.Name))
|
||||||
{
|
{
|
||||||
var name = field.Name;
|
var name = (string)field.GetValue(null);
|
||||||
|
|
||||||
var descattr =
|
var descattr =
|
||||||
field.GetCustomAttributes(false).FirstOrDefault(o => o is DescriptionAttribute) as DescriptionAttribute;
|
field.GetCustomAttributes(false).FirstOrDefault(o => o is DescriptionAttribute) as DescriptionAttribute;
|
||||||
|
|
|
||||||
|
|
@ -196,8 +196,10 @@ namespace Rests
|
||||||
protected virtual object ExecuteCommand(RestCommand cmd, RestVerbs verbs, IParameterCollection parms)
|
protected virtual object ExecuteCommand(RestCommand cmd, RestVerbs verbs, IParameterCollection parms)
|
||||||
{
|
{
|
||||||
object result = cmd.Execute(verbs, parms);
|
object result = cmd.Execute(verbs, parms);
|
||||||
if (cmd.DoLog)
|
if (cmd.DoLog && TShock.Config.LogRest)
|
||||||
|
{
|
||||||
Log.ConsoleInfo("Anonymous requested REST endpoint: " + BuildRequestUri(cmd, verbs, parms, false));
|
Log.ConsoleInfo("Anonymous requested REST endpoint: " + BuildRequestUri(cmd, verbs, parms, false));
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ namespace Rests
|
||||||
}
|
}
|
||||||
|
|
||||||
object result = secureCmd.Execute(verbs, parms, tokenData);
|
object result = secureCmd.Execute(verbs, parms, tokenData);
|
||||||
if (cmd.DoLog)
|
if (cmd.DoLog && TShock.Config.LogRest)
|
||||||
TShock.Utils.SendLogs(string.Format(
|
TShock.Utils.SendLogs(string.Format(
|
||||||
"\"{0}\" requested REST endpoint: {1}", tokenData.Username, this.BuildRequestUri(cmd, verbs, parms, false)),
|
"\"{0}\" requested REST endpoint: {1}", tokenData.Username, this.BuildRequestUri(cmd, verbs, parms, false)),
|
||||||
Color.PaleVioletRed);
|
Color.PaleVioletRed);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue