feat: add fnOS packaging, storage workflows and release pipeline

This commit is contained in:
2026-08-11 18:05:49 +08:00
parent c5922f9b08
commit 95932f0199
181 changed files with 24024 additions and 1164 deletions
+47
View File
@@ -0,0 +1,47 @@
using dy.net.model.dto;
using dy.net.service;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace dy.net.Controllers
{
[Route("api/email")]
[ApiController]
[Authorize]
public sealed class EmailController : ControllerBase
{
private readonly EmailNotificationSettingsService _settings;
public EmailController(EmailNotificationSettingsService settings) => _settings = settings;
[HttpGet("config")]
public async Task<IActionResult> GetConfig()
{
var settings = await _settings.GetAsync();
return ApiResult.Success(_settings.ToDto(settings));
}
[HttpPut("config")]
public async Task<IActionResult> UpdateConfig(EmailNotificationSettingsDto dto)
{
try { return ApiResult.Success(await _settings.SaveAsync(dto)); }
catch (InvalidOperationException ex) { return ApiResult.Fail(ex.Message); }
}
[HttpPost("test")]
public async Task<IActionResult> Test(EmailNotificationSettingsDto dto, CancellationToken cancellationToken)
{
try
{
var message = await _settings.TestAsync(dto, cancellationToken);
return ApiResult.Success(new { message });
}
catch (Exception ex) when (ex is not OperationCanceledException)
{
var message = ex.GetBaseException().Message;
Serilog.Log.Warning(ex, "SMTP 测试邮件发送失败");
return ApiResult.Fail(string.IsNullOrWhiteSpace(message) ? "测试邮件发送失败" : message);
}
}
}
}