diff --git a/Configurations/SimApiJobOptions.cs b/Configurations/SimApiJobOptions.cs index ccfef12..62e0129 100644 --- a/Configurations/SimApiJobOptions.cs +++ b/Configurations/SimApiJobOptions.cs @@ -4,13 +4,30 @@ public class SimApiJobOptions { /// /// WebUi地址,设置为null表示不启用 + /// 默认 /jobs /// public string? DashboardUrl { get; set; } = "/jobs"; + /// + /// webui 用户 + /// 默认 admin + /// public string DashboardAuthUser { get; set; } = "admin"; + + /// + /// webui 密码 + /// 默认 Admin@123! + /// public string DashboardAuthPass { get; set; } = "Admin@123!"; + + /// + /// 设置为null 使用默认redis配置 + /// public string? RedisConfiguration { get; set; } + /// + /// 设置为null 使用默认redis配置 + /// public int? Database { get; set; } = null; public SimApiJobServerConfig[] Servers { get; set; } = [new()]; } diff --git a/Helpers/SimApiJobWebAuth.cs b/Helpers/SimApiJobWebAuth.cs index f27519c..4270f13 100644 --- a/Helpers/SimApiJobWebAuth.cs +++ b/Helpers/SimApiJobWebAuth.cs @@ -11,7 +11,7 @@ public class SimApiJobWebAuth(string user, string pass) : IDashboardAuthorizatio public bool Authorize(DashboardContext context) { var httpContext = context.GetHttpContext(); - var authHeader = httpContext.Request.Headers["Authorization"].FirstOrDefault(); + var authHeader = httpContext.Request.Headers.Authorization.FirstOrDefault(); if (authHeader != null && authHeader.StartsWith("Basic ")) { var encodedUsernamePassword = authHeader.Split(' ', 2, StringSplitOptions.RemoveEmptyEntries)[1].Trim(); diff --git a/Middlewares/SimApiExceptionMiddleware.cs b/Middlewares/SimApiExceptionMiddleware.cs index 7814136..af6f2c4 100644 --- a/Middlewares/SimApiExceptionMiddleware.cs +++ b/Middlewares/SimApiExceptionMiddleware.cs @@ -24,16 +24,19 @@ public class SimApiExceptionMiddleware(RequestDelegate next, ILogger