mirror of
https://github.com/Megghy/MegghysAPI.git
synced 2025-12-06 22:26:56 +08:00
迁移到 Ant Design 并优化 DNS 接口
将项目从 Fluent UI 迁移到 Ant Design Blazor: - 替换 UI 组件,更新样式和脚本。 - 移除 Fluent UI 相关依赖,添加 Ant Design 依赖。 优化 DNS 解析接口: - 将解析接口从 POST 改为 GET,简化参数结构。 - 更新 `DnsResponse` 和配置文件结构。 数据库模型优化: - 为 JSON 数据存储添加 `JArray` 映射支持。 初始化逻辑重构: - 简化 `AutoInit` 初始化逻辑,提升代码可读性。 其他改动: - 升级依赖包版本。 - 移除无用命名空间和属性。
This commit is contained in:
@@ -23,6 +23,11 @@ namespace MegghysAPI.Controllers
|
||||
|
||||
public class DnsResponse
|
||||
{
|
||||
public class DnsQuestion
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public int type { get; set; }
|
||||
}
|
||||
[JsonPropertyName("Status")]
|
||||
public int Status { get; set; }
|
||||
|
||||
@@ -42,17 +47,12 @@ namespace MegghysAPI.Controllers
|
||||
public bool Cd { get; set; }
|
||||
|
||||
[JsonPropertyName("Question")]
|
||||
public List<Dictionary<string, object>> Question { get; set; } = new();
|
||||
public DnsQuestion Question { get; set; }
|
||||
|
||||
[JsonPropertyName("Answer")]
|
||||
public List<DnsRecord>? Answer { get; set; }
|
||||
}
|
||||
|
||||
public class DnsRequest
|
||||
{
|
||||
public string Domain { get; set; } = string.Empty;
|
||||
public string RecordType { get; set; } = "A";
|
||||
}
|
||||
[Route("api/public")]
|
||||
[ApiController]
|
||||
public class PublicController : MControllerBase
|
||||
@@ -67,8 +67,8 @@ namespace MegghysAPI.Controllers
|
||||
return BitConverter.ToString(hashBytes).Replace("-", "").ToLower();
|
||||
}
|
||||
|
||||
[HttpPost("resolve-dns")]
|
||||
public static async Task<IActionResult> ResolveDns([FromBody] DnsRequest request)
|
||||
[HttpGet("resolve-dns")]
|
||||
public async Task<IActionResult> ResolveDns([FromQuery] string domain, [FromQuery] string recordType = "A")
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -84,9 +84,9 @@ namespace MegghysAPI.Controllers
|
||||
}
|
||||
|
||||
var timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
|
||||
var key = CalculateKey(accountId, akSecret, timestamp, request.Domain, akId);
|
||||
var key = CalculateKey(accountId, akSecret, timestamp, domain, akId);
|
||||
|
||||
var url = $"{endpoint}?name={Uri.EscapeDataString(request.Domain)}&type={request.RecordType}&uid={accountId}&ak={akId}&key={key}&ts={timestamp}";
|
||||
var url = $"{endpoint}?name={Uri.EscapeDataString(domain)}&type={recordType}&uid={accountId}&ak={akId}&key={key}&ts={timestamp}";
|
||||
|
||||
Logs.Info($"正在向 {url} 发起DNS请求");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user