Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c0dc05c58c |
@@ -52,5 +52,5 @@ public class LoginModel : PageModel
|
|||||||
public IActionResult OnPostKakao() => Challenge(BuildProps("kakao"), PortalOAuthDefaults.KakaoScheme);
|
public IActionResult OnPostKakao() => Challenge(BuildProps("kakao"), PortalOAuthDefaults.KakaoScheme);
|
||||||
|
|
||||||
private static AuthenticationProperties BuildProps(string provider) =>
|
private static AuthenticationProperties BuildProps(string provider) =>
|
||||||
new() { RedirectUri = $"/taxbaik/portal/external-callback?provider={provider}" };
|
new() { RedirectUri = $"/portal/external-callback?provider={provider}" };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,8 +89,8 @@ var authenticationBuilder = builder.Services.AddAuthentication(opts =>
|
|||||||
opts.Cookie.HttpOnly = true;
|
opts.Cookie.HttpOnly = true;
|
||||||
opts.Cookie.SameSite = SameSiteMode.Lax;
|
opts.Cookie.SameSite = SameSiteMode.Lax;
|
||||||
opts.Cookie.SecurePolicy = isProduction ? CookieSecurePolicy.Always : CookieSecurePolicy.SameAsRequest;
|
opts.Cookie.SecurePolicy = isProduction ? CookieSecurePolicy.Always : CookieSecurePolicy.SameAsRequest;
|
||||||
opts.LoginPath = "/taxbaik/portal/login";
|
opts.LoginPath = "/portal/login";
|
||||||
opts.AccessDeniedPath = "/taxbaik/portal/login";
|
opts.AccessDeniedPath = "/portal/login";
|
||||||
opts.SlidingExpiration = true;
|
opts.SlidingExpiration = true;
|
||||||
opts.ExpireTimeSpan = TimeSpan.FromDays(7);
|
opts.ExpireTimeSpan = TimeSpan.FromDays(7);
|
||||||
})
|
})
|
||||||
@@ -111,7 +111,7 @@ if (!string.IsNullOrWhiteSpace(googleClientId) && !string.IsNullOrWhiteSpace(goo
|
|||||||
opts.SignInScheme = PortalOAuthDefaults.ExternalScheme;
|
opts.SignInScheme = PortalOAuthDefaults.ExternalScheme;
|
||||||
opts.ClientId = googleClientId;
|
opts.ClientId = googleClientId;
|
||||||
opts.ClientSecret = googleClientSecret;
|
opts.ClientSecret = googleClientSecret;
|
||||||
opts.CallbackPath = "/taxbaik/portal/signin-google";
|
opts.CallbackPath = "/portal/signin-google";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ if (!string.IsNullOrWhiteSpace(naverClientId) && !string.IsNullOrWhiteSpace(nave
|
|||||||
opts.SignInScheme = PortalOAuthDefaults.ExternalScheme;
|
opts.SignInScheme = PortalOAuthDefaults.ExternalScheme;
|
||||||
opts.ClientId = naverClientId;
|
opts.ClientId = naverClientId;
|
||||||
opts.ClientSecret = naverClientSecret;
|
opts.ClientSecret = naverClientSecret;
|
||||||
opts.CallbackPath = "/taxbaik/portal/signin-naver";
|
opts.CallbackPath = "/portal/signin-naver";
|
||||||
opts.AuthorizationEndpoint = "https://nid.naver.com/oauth2.0/authorize";
|
opts.AuthorizationEndpoint = "https://nid.naver.com/oauth2.0/authorize";
|
||||||
opts.TokenEndpoint = "https://nid.naver.com/oauth2.0/token";
|
opts.TokenEndpoint = "https://nid.naver.com/oauth2.0/token";
|
||||||
opts.UserInformationEndpoint = "https://openapi.naver.com/v1/nid/me";
|
opts.UserInformationEndpoint = "https://openapi.naver.com/v1/nid/me";
|
||||||
@@ -156,7 +156,7 @@ if (!string.IsNullOrWhiteSpace(kakaoClientId) && !string.IsNullOrWhiteSpace(kaka
|
|||||||
opts.SignInScheme = PortalOAuthDefaults.ExternalScheme;
|
opts.SignInScheme = PortalOAuthDefaults.ExternalScheme;
|
||||||
opts.ClientId = kakaoClientId;
|
opts.ClientId = kakaoClientId;
|
||||||
opts.ClientSecret = kakaoClientSecret;
|
opts.ClientSecret = kakaoClientSecret;
|
||||||
opts.CallbackPath = "/taxbaik/portal/signin-kakao";
|
opts.CallbackPath = "/portal/signin-kakao";
|
||||||
opts.AuthorizationEndpoint = "https://kauth.kakao.com/oauth/authorize";
|
opts.AuthorizationEndpoint = "https://kauth.kakao.com/oauth/authorize";
|
||||||
opts.TokenEndpoint = "https://kauth.kakao.com/oauth/token";
|
opts.TokenEndpoint = "https://kauth.kakao.com/oauth/token";
|
||||||
opts.UserInformationEndpoint = "https://kapi.kakao.com/v2/user/me";
|
opts.UserInformationEndpoint = "https://kapi.kakao.com/v2/user/me";
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ public interface ITelegramNotificationService
|
|||||||
Task SendInfoAsync(string title, string message, CancellationToken ct = default);
|
Task SendInfoAsync(string title, string message, CancellationToken ct = default);
|
||||||
Task SendInquiryNotificationAsync(string message, CancellationToken ct = default);
|
Task SendInquiryNotificationAsync(string message, CancellationToken ct = default);
|
||||||
Task SendSystemNotificationAsync(string message, CancellationToken ct = default);
|
Task SendSystemNotificationAsync(string message, CancellationToken ct = default);
|
||||||
Task SendReportAsync(string reportTitle, string reportContent, CancellationToken ct = default);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TelegramNotificationService : ITelegramNotificationService
|
public class TelegramNotificationService : ITelegramNotificationService
|
||||||
@@ -97,10 +96,4 @@ public class TelegramNotificationService : ITelegramNotificationService
|
|||||||
var text = $"<b>ℹ️ {title}</b>\n\n{message}\n\n<i>{DateTime.UtcNow:yyyy-MM-dd HH:mm:ss} UTC</i>";
|
var text = $"<b>ℹ️ {title}</b>\n\n{message}\n\n<i>{DateTime.UtcNow:yyyy-MM-dd HH:mm:ss} UTC</i>";
|
||||||
await SendMessageAsync(text, ct);
|
await SendMessageAsync(text, ct);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SendReportAsync(string reportTitle, string reportContent, CancellationToken ct = default)
|
|
||||||
{
|
|
||||||
var text = $"<b>📊 {reportTitle}</b>\n\n{reportContent}\n\n<i>{DateTime.UtcNow:yyyy-MM-dd HH:mm:ss} UTC</i>";
|
|
||||||
await SendToChat(_systemChatId, text, ct);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class TelegramReportBackgroundService(
|
|||||||
var telegram = scope.ServiceProvider.GetRequiredService<ITelegramNotificationService>();
|
var telegram = scope.ServiceProvider.GetRequiredService<ITelegramNotificationService>();
|
||||||
|
|
||||||
var report = await reportService.BuildDailyReportAsync(date, ct);
|
var report = await reportService.BuildDailyReportAsync(date, ct);
|
||||||
await telegram.SendReportAsync("일간 세무/상담 현황 리포트", TelegramReportService.FormatDailyMessage(report), ct);
|
await telegram.SendSystemNotificationAsync(TelegramReportService.FormatDailyMessage(report), ct);
|
||||||
_lastDailyReportDate = date;
|
_lastDailyReportDate = date;
|
||||||
logger.LogInformation("Daily telegram report sent for {Date}", date);
|
logger.LogInformation("Daily telegram report sent for {Date}", date);
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ public class TelegramReportBackgroundService(
|
|||||||
var telegram = scope.ServiceProvider.GetRequiredService<ITelegramNotificationService>();
|
var telegram = scope.ServiceProvider.GetRequiredService<ITelegramNotificationService>();
|
||||||
|
|
||||||
var report = await reportService.BuildWeeklyReportAsync(weekStart, ct);
|
var report = await reportService.BuildWeeklyReportAsync(weekStart, ct);
|
||||||
await telegram.SendReportAsync("주간 세무/매출 종합 리포트", TelegramReportService.FormatWeeklyMessage(report), ct);
|
await telegram.SendSystemNotificationAsync(TelegramReportService.FormatWeeklyMessage(report), ct);
|
||||||
_lastWeeklyReportWeekStart = weekStart;
|
_lastWeeklyReportWeekStart = weekStart;
|
||||||
logger.LogInformation("Weekly telegram report sent for {WeekStart}", weekStart);
|
logger.LogInformation("Weekly telegram report sent for {WeekStart}", weekStart);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user