新增 OTA WatchDog 编排与车队健康/报警后端。

覆盖包库回传、任务下发、CDM 任务同步与报警采集,并为包/任务 ID 与上传文件名加上路径安全校验。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zhaowei.huang
2026-07-26 11:31:51 +08:00
co-authored by Cursor
parent f4f4cd1d1b
commit 4223a572c5
25 changed files with 3552 additions and 6 deletions
+26
View File
@@ -0,0 +1,26 @@
using System.Security.Cryptography;
namespace MiGu.Server.Ota;
public static class OtaHash
{
/// <summary>与参考 OTA 工具一致:MD5 → Base64,并去掉 '-'。</summary>
public static string OfFile(string path)
{
using var fs = File.OpenRead(path);
var hash = MD5.HashData(fs);
return Convert.ToBase64String(hash).Replace("-", "", StringComparison.Ordinal);
}
public static string OfBytes(ReadOnlySpan<byte> bytes)
{
var hash = MD5.HashData(bytes);
return Convert.ToBase64String(hash).Replace("-", "", StringComparison.Ordinal);
}
public static string Short(string? hash, int len = 8)
{
if (string.IsNullOrEmpty(hash)) return "—";
return hash.Length <= len ? hash : hash[..len];
}
}