XFEExtension.NetCore.ServerInteractive
[DLL] Server interaction extension, including user identity verification and querying in conjunction with AutoConfig
关注
0
Fork
0
Star
0
返回提交历史
Modified
XFEExtension.NetCore.ServerInteractive.Test/Program.cs
+4
-2
Modified
XFEExtension.NetCore.ServerInteractive/Utilities/Server/XFEServerCore.cs
+0
-1
Modified
XFEExtension.NetCore.ServerInteractive/Utilities/Services/CoreService/EntryPointVerifyServer.cs
+12
-2
XFEstudio/XFEExtension.NetCore.ServerInteractive
更改服务器信息显示逻辑
5bc3e6b
代码差异
3 个文件
+16
-5
@@ -34,7 +34,7 @@ internal class Program
34
34
return JsonSerializer.Serialize(order);
35
35
}
36
36
37
//[SMTest]
37
[SMTest]
38
38
public static async Task<bool> AddOrder() => await serverInteractive.TableRequester.Add<Order>(new()
39
39
{
40
40
Description = "测试订单的描述",
@@ -51,7 +51,7 @@ internal class Program
51
51
}
52
52
}
53
53
54
[SMTest]
54
//[SMTest]
55
55
public static async Task ChangeOrder()
56
56
{
57
57
var result = await serverInteractive.TableRequester.Get<Order>();
@@ -61,6 +61,7 @@ internal class Program
61
61
order.Name = "Test001";
62
62
await serverInteractive.TableRequester.Change(order);
63
63
}
64
64
65
[SMTest]
65
66
public static async Task GetOrder2()
66
67
{
@@ -69,5 +70,6 @@ internal class Program
69
70
{
70
71
Console.WriteLine($"ID:{order.ID}\tName:{order.Name}\tDS:{order.Description}");
71
72
}
73
Console.ReadLine();
72
74
}
73
75
}
@@ -62,7 +62,6 @@ public abstract class XFEServerCore : CoreServerServiceBase
62
62
63
63
private async void CyberCommServer_RequestReceived(object? sender, CyberCommRequestEventArgs e)
64
64
{
65
Console.WriteLine($"[DEBUG]接收到请求【{e.ClientIP}】");
66
65
var r = new ServerCoreReturnArgs
67
66
{
68
67
Args = e
@@ -14,8 +14,18 @@ public class EntryPointVerifyServer : ServerCoreVerifyServiceBase
14
14
/// <inheritdoc/>
15
15
public override bool VerifyRequest(object? sender, CyberCommRequestEventArgs e, ServerCoreReturnArgs r)
16
16
{
17
if (ServerBaseProfile.BannedIPAddressList.Contains(e.ClientIP)) throw new StopAction(() => r.Close(HttpStatusCode.Forbidden), "您的已被封禁");
18
if (e.RequestURL?.Segments.Length > 2 && $"{e.RequestURL?.Segments[0]}{e.RequestURL?.Segments[1]}" != $"/{ServerBaseProfile.EntryPoint}" && e.RequestMethod != "POST") throw new StopAction(() => r.Close(HttpStatusCode.BadGateway), "请求的API接口不正确");
17
Console.Write($"[DEBUG]【{e.ClientIP}】接收到请求");
18
if (ServerBaseProfile.BannedIPAddressList.Contains(e.ClientIP)) throw new StopAction(() =>
19
{
20
Console.WriteLine("-校验失败");
21
r.Close(HttpStatusCode.Forbidden);
22
}, "您的已被封禁");
23
if (e.RequestURL?.Segments.Length > 2 && $"{e.RequestURL?.Segments[0]}{e.RequestURL?.Segments[1]}" != $"/{ServerBaseProfile.EntryPoint}" && e.RequestMethod != "POST") throw new StopAction(() =>
24
{
25
Console.WriteLine("-校验失败");
26
r.Close(HttpStatusCode.BadGateway);
27
}, "请求的API接口不正确");
28
Console.WriteLine("-校验通过");
19
29
return true;
20
30
}
21
31
}