Lua更新

This commit is contained in:
2026-02-04 02:36:07 +08:00
parent 5a07c7a133
commit 0020d125c7
4 changed files with 1257 additions and 2 deletions

View File

@@ -31,6 +31,9 @@ namespace UniLua
new NameFuncPair("clear", OS_Clear),
new NameFuncPair("getusername", OS_Getusername),
new NameFuncPair("isadmin", OS_Isadmin),
new NameFuncPair("sha256", OS_Sha256),
new NameFuncPair("base64encrypt", OS_Base64Encrypt),
new NameFuncPair("base64decrypt", OS_Base64Decrypt),
#endif
};
@@ -177,6 +180,30 @@ namespace UniLua
lua.PushBoolean(isAdmin);
return 1;
}
private static int OS_Sha256( ILuaState lua )
{
string input = lua.L_CheckString(1);
string hash = CMLeonOS.UserSystem.HashPasswordSha256(input) ?? "";
lua.PushString(hash);
return 1;
}
private static int OS_Base64Encrypt( ILuaState lua )
{
string input = lua.L_CheckString(1);
string encoded = CMLeonOS.Base64Helper.Encode(input);
lua.PushString(encoded);
return 1;
}
private static int OS_Base64Decrypt( ILuaState lua )
{
string input = lua.L_CheckString(1);
string decoded = CMLeonOS.Base64Helper.Decode(input);
lua.PushString(decoded);
return 1;
}
#endif
}
}