Add option to disable safe file checking

Closes #65
This commit is contained in:
jvyden 2021-11-24 22:21:07 -05:00
commit d8bb77e80b
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
2 changed files with 7 additions and 2 deletions

View file

@ -3,6 +3,7 @@ using System.IO;
using System.Linq;
using System.Text;
using LBPUnion.ProjectLighthouse.Types.Files;
using LBPUnion.ProjectLighthouse.Types.Settings;
namespace LBPUnion.ProjectLighthouse.Helpers
{
@ -14,6 +15,8 @@ namespace LBPUnion.ProjectLighthouse.Helpers
public static bool IsFileSafe(LbpFile file)
{
if (!ServerSettings.Instance.CheckForUnsafeFiles) return true;
if (file.FileType == LbpFileType.Unknown) file.FileType = DetermineFileType(file.Data);
return file.FileType switch

View file

@ -63,13 +63,13 @@ namespace LBPUnion.ProjectLighthouse.Types.Settings
}
}
public const int CurrentConfigVersion = 8; // MUST BE INCREMENTED FOR EVERY CONFIG CHANGE!
#region Meta
[NotNull]
public static ServerSettings Instance;
public const int CurrentConfigVersion = 7;
[JsonPropertyName("ConfigVersionDoNotModifyOrYouWillBeSlapped")]
public int ConfigVersion { get; set; } = CurrentConfigVersion;
@ -91,5 +91,7 @@ namespace LBPUnion.ProjectLighthouse.Types.Settings
public string ExternalUrl { get; set; } = "http://localhost:10060";
public string ServerDigestKey { get; set; }
public bool UseExternalAuth { get; set; }
public bool CheckForUnsafeFiles { get; set; } = true;
}
}