0302-добавил куки и сломал десктоп авторизацию.

сложно поддерживать однояйцевых близнецов - desktop и TMA, подготовил к рефакторингу структуры
This commit is contained in:
2026-02-03 09:32:02 +03:00
parent 88620f3fb6
commit ea1e5bbf6a
14 changed files with 547 additions and 86 deletions

View File

@@ -135,7 +135,7 @@ func main() {
settingsHandler := handlers.NewSettingsHandler(accountRepo, catalogRepo)
settingsHandler.SetRMSFactory(rmsFactory)
invoicesHandler := handlers.NewInvoiceHandler(invoicesService, syncService)
authHandler := handlers.NewAuthHandler(authService, cfg.Telegram.BotUsername)
authHandler := handlers.NewAuthHandler(authService, accountRepo, cfg.Telegram.BotUsername)
// 10. Telegram Bot (Передаем syncService и authService)
if cfg.Telegram.Token != "" {
@@ -176,8 +176,12 @@ func main() {
// Хендлер инициализации desktop авторизации (без middleware)
api.POST("/auth/init-desktop", authHandler.InitDesktopAuth)
// Новые endpoints для сессионной авторизации
api.POST("/auth/session", authHandler.CreateSession)
api.GET("/auth/me", authHandler.GetMe)
api.POST("/auth/logout", authHandler.Logout)
api.Use(middleware.AuthMiddleware(accountRepo, cfg.Telegram.Token, cfg.Security.SecretKey, cfg.App.MaintenanceMode, cfg.App.DevIDs))
api.Use(middleware.AuthMiddleware(accountRepo, authService, cfg.Telegram.Token, cfg.Security.SecretKey, cfg.App.MaintenanceMode, cfg.App.DevIDs))
{
// Drafts & Invoices
api.GET("/drafts", draftsHandler.GetDrafts)