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/Utilities/Server/Services/CoreService/ConnectService.cs
+5
-1
Modified
XFEExtension.NetCore.ServerInteractive/Utilities/Server/Services/CoreService/CoreLogService.cs
+2
-2
Modified
XFEExtension.NetCore.ServerInteractive/Utilities/Server/Services/CoreService/IpBannerService.cs
+1
-1
Modified
XFEExtension.NetCore.ServerInteractive/Utilities/Server/Services/CoreService/UserLoginAutoCleanService.cs
+0
-3
Modified
XFEExtension.NetCore.ServerInteractive/Utilities/Server/Services/CoreService/UserLoginService.cs
+3
-6
XFEstudio/XFEExtension.NetCore.ServerInteractive
优化内置服务的前端显示
68d6448
代码差异
5 个文件
+11
-13
@@ -8,5 +8,9 @@ namespace XFEExtension.NetCore.ServerInteractive.Utilities.Server.Services.CoreS
8
8
public class ConnectService : ServerCoreStandardRegisterAsyncServiceBase
9
9
{
10
10
/// <inheritdoc/>
11
public override async Task StandardRequestReceived() => await Close(DateTime.Now.ToString());
11
public override async Task StandardRequestReceived()
12
{
13
Console.Write("检查连接");
14
await Close(DateTime.Now.ToString());
15
}
12
16
}
@@ -22,14 +22,14 @@ public class CoreLogService : ServerCoreUserServiceBase
22
22
switch (Execute)
23
23
{
24
24
case "get_log":
25
Console.Write($"获取服务器日志请求");
25
Console.Write("获取服务器日志请求");
26
26
UserHelper.ValidatePermission(Json["session"], Json["computerInfo"], ReturnArgs.Args.ClientIP, GetPermission, GetEncryptedUserLoginModelFunction(), GetUserFunction(), ReturnArgs);
27
27
if (!DateTime.TryParse(Json["startDateTime"], out var startDatetime)) Error("起始日期格式不正确");
28
28
if (!DateTime.TryParse(Json["endDateTime"], out var endDatetime)) Error("结束日期格式不正确");
29
29
await Close(XFEConsole.XFEConsole.Log.Export(startDatetime, endDatetime));
30
30
break;
31
31
case "clear_log":
32
Console.Write($"清除服务器日志请求");
32
Console.Write("清除服务器日志请求");
33
33
UserHelper.ValidatePermission(Json["session"], Json["computerInfo"], ReturnArgs.Args.ClientIP, ClearPermission, GetEncryptedUserLoginModelFunction(), GetUserFunction(), ReturnArgs);
34
34
if (File.Exists("server.log"))
35
35
File.Delete("server.log");
@@ -28,7 +28,7 @@ public class IpBannerService : ServerCoreUserServiceBase
28
28
switch (Execute)
29
29
{
30
30
case "get_bannedIpList":
31
Console.Write($"获取禁止的IP地址列表请求");
31
Console.Write("获取禁止的IP地址列表请求");
32
32
UserHelper.ValidatePermission(Json["session"], Json["computerInfo"], ReturnArgs.Args.ClientIP, GetPermission, GetEncryptedUserLoginModelFunction(), GetUserFunction(), ReturnArgs);
33
33
await Close(ServerBaseProfile.BannedIPAddressList.ToJson());
34
34
break;
@@ -67,9 +67,6 @@ public class UserLoginAutoCleanService : ServerCoreRegisterServiceBase, IUserSer
67
67
{
68
68
Console.WriteLine($"[DEBUG]服务器({XFEServerCore.ServerCoreName})没有过期的Session需要清理。");
69
69
}
70
Console.WriteLine("[DEBUG]正在保存日志...");
71
XFEConsole.XFEConsole.Log.Export().WriteIn("server.log");
72
Console.WriteLine("[DEBUG]日志已保存!");
73
70
}
74
71
catch (Exception ex)
75
72
{
@@ -1,11 +1,8 @@
1
1
using System.Net;
2
2
using System.Text.Json;
3
using XFEExtension.NetCore.ServerInteractive.Models.ServerModels;
4
3
using XFEExtension.NetCore.ServerInteractive.Models.UserModels;
5
4
using XFEExtension.NetCore.ServerInteractive.Utilities.Helpers;
6
5
using XFEExtension.NetCore.StringExtension;
7
using XFEExtension.NetCore.StringExtension.Json;
8
using XFEExtension.NetCore.XFETransform.JsonConverter;
9
6
10
7
namespace XFEExtension.NetCore.ServerInteractive.Utilities.Server.Services.CoreService;
11
8
@@ -17,7 +14,7 @@ public class UserLoginService<T> : ServerCoreUserLoginServiceBase<T> where T : c
17
14
/// <inheritdoc/>
18
15
public override async Task StandardRequestReceived()
19
16
{
20
Console.Write($"登录请求:");
17
Console.Write("登录请求");
21
18
var account = Json["account"].ToString();
22
19
var password = Json["password"].ToString();
23
20
var computerInfo = Json["computerInfo"].ToString();
@@ -52,7 +49,7 @@ public class UserLoginService<T> : ServerCoreUserLoginServiceBase<T> where T : c
52
49
}
53
50
};
54
51
AddEncryptedUserLoginModelFunction(userLogin);
55
Console.WriteLine($"[DEBUG]用户 {user.UserName} 登录成功,登录到期时间 {userLogin.UserLoginModel.EndDateTime}");
52
Console.Write($"[DEBUG]用户 {user.UserName} 登录成功,登录到期时间 {userLogin.UserLoginModel.EndDateTime}");
56
53
await ReturnArgs!.Args.ReplyAndClose(JsonSerializer.Serialize(new
57
54
{
58
55
session = $"{user.ID}|{UserHelper.Encrypt(userLogin.Key, userLogin.UserLoginModel)}",
@@ -65,7 +62,7 @@ public class UserLoginService<T> : ServerCoreUserLoginServiceBase<T> where T : c
65
62
userLogin.UserLoginModel.ComputerInfo = computerInfo;
66
63
userLogin.UserLoginModel.LastIPAddress = ReturnArgs!.Args.ClientIP;
67
64
userLogin.UserLoginModel.EndDateTime = DateTime.Now.AddDays(GetLoginKeepDays());
68
Console.WriteLine($"[DEBUG]用户 {user.UserName} 已登录,登录到期时间:{userLogin.UserLoginModel.EndDateTime}");
65
Console.Write($"[DEBUG]用户 {user.UserName} 已登录,登录到期时间:{userLogin.UserLoginModel.EndDateTime}");
69
66
await Close(JsonSerializer.Serialize(new
70
67
{
71
68
session = $"{user.ID}|{UserHelper.Encrypt(userLogin.Key, userLogin.UserLoginModel)}",