Skip to content

Commit

Permalink
fix: 修复 sign 到期时间计算错误
Browse files Browse the repository at this point in the history
  • Loading branch information
SALTWOOD committed Jul 14, 2024
1 parent df25d9c commit c03bd8d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CSharp-OpenBMCLAPI/Modules/Cluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ protected async Task<int> AsyncRun()
int returns = 0;

this.storage.Initialize();
InitializeService();

// 检查文件
// if (!ClusterRequiredData.Config.noEnable)
Expand All @@ -118,7 +119,6 @@ protected async Task<int> AsyncRun()

await RequestCertification();

InitializeService();

if (!ClusterRequiredData.Config.noEnable) await Enable();

Expand Down
4 changes: 2 additions & 2 deletions CSharp-OpenBMCLAPI/Modules/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ public static bool CheckSign(string? hash, string? secret, string? s, string? e)
var sha1 = SHA1.Create();
var sign = ToUrlSafeBase64String(sha1.ComputeHash(Encoding.UTF8.GetBytes($"{secret}{hash}{e}")));
var timestamp = DateTimeOffset.Now.ToUnixTimeSeconds();
var a = timestamp < (ToDecimal(e) / 100);
return sign == s && timestamp < (ToDecimal(e) / 100);
var a = timestamp < (ToDecimal(e) / 1000);
return sign == s && timestamp < (ToDecimal(e) / 1000);
}

public static bool IsAdministrator()
Expand Down

0 comments on commit c03bd8d

Please sign in to comment.