mirror of
https://github.com/corvax-team/ss14-wl.git
synced 2026-02-15 03:31:38 +01:00
починил поли(точно)
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.CodeAnalysis.Differencing;
|
||||
using Robust.Server.ServerStatus;
|
||||
|
||||
namespace Content.Server.Administration;
|
||||
@@ -64,7 +65,7 @@ public sealed partial class ServerApi
|
||||
{
|
||||
var absolute_path = context.Url.AbsolutePath;
|
||||
|
||||
if (context.RequestMethod != method || !CheckPathes(absolute_path))
|
||||
if (context.RequestMethod != method || !CheckPathes(absolute_path, exactPath))
|
||||
return false;
|
||||
|
||||
if (!await CheckAccess(context))
|
||||
@@ -79,14 +80,26 @@ public sealed partial class ServerApi
|
||||
});
|
||||
}
|
||||
|
||||
private static bool CheckPathes(string realPath)
|
||||
private static bool CheckPathes(string realPath, string predictedPath)
|
||||
{
|
||||
var search_regex = ParametrSearchRegex();
|
||||
|
||||
if (search_regex.IsMatch(realPath))
|
||||
return true;
|
||||
var is_match = search_regex.Matches(predictedPath)
|
||||
.ToList()
|
||||
.TrueForAll(match =>
|
||||
{
|
||||
if (!match.Success)
|
||||
return false;
|
||||
|
||||
return false;
|
||||
var to_replace = match.Groups[1].Value;
|
||||
|
||||
var inner_regex = new Regex(predictedPath.Replace(to_replace, "(.*)"));
|
||||
var inner_match = inner_regex.Match(realPath);
|
||||
|
||||
return inner_match.Success;
|
||||
});
|
||||
|
||||
return is_match;
|
||||
}
|
||||
|
||||
private static Dictionary<string, string> GetMapArguments(string realPath, string predictedPath)
|
||||
|
||||
Reference in New Issue
Block a user