Skip to content

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
svera committed Oct 25, 2023
1 parent 14e6ac9 commit 9833532
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
10 changes: 7 additions & 3 deletions internal/webserver/controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ func SetupControllers(cfg Config, db *gorm.DB, metadataReaders map[string]metada
emailSendingConfigured = false
}

supportedLanguages := getSupportedLanguages()

return Controllers{
Auth: authController,
Users: usersController,
Expand Down Expand Up @@ -101,10 +103,11 @@ func SetupControllers(cfg Config, db *gorm.DB, metadataReaders map[string]metada
TokenLookup: "cookie:coreander",
ErrorHandler: func(c *fiber.Ctx, err error) error {
return c.Status(fiber.StatusForbidden).Render("auth/login", fiber.Map{
"Lang": chooseBestLanguage(c, getSupportedLanguages()),
"Lang": chooseBestLanguage(c, supportedLanguages),
"Title": "Login",
"Version": c.App().Config().AppName,
"EmailSendingConfigured": emailSendingConfigured,
"SupportedLanguages": supportedLanguages,
}, "layout")
},
}),
Expand All @@ -116,10 +119,11 @@ func SetupControllers(cfg Config, db *gorm.DB, metadataReaders map[string]metada
err = c.Next()
if cfg.RequireAuth {
return c.Status(fiber.StatusForbidden).Render("auth/login", fiber.Map{
"Lang": chooseBestLanguage(c, getSupportedLanguages()),
"Lang": chooseBestLanguage(c, supportedLanguages),
"Title": "Login",
"Version": c.App().Config().AppName,
"EmailSendingConfigured": emailSendingConfigured,
"SupportedLanguages": supportedLanguages,
}, "layout")
}
return err
Expand All @@ -139,7 +143,7 @@ func SetupControllers(cfg Config, db *gorm.DB, metadataReaders map[string]metada
err = c.Status(code).Render(
fmt.Sprintf("errors/%d", code),
fiber.Map{
"Lang": chooseBestLanguage(c, getSupportedLanguages()),
"Lang": chooseBestLanguage(c, supportedLanguages),
"Title": "Coreander",
"Session": jwtclaimsreader.SessionData(c),
"Version": c.App().Config().AppName,
Expand Down
1 change: 1 addition & 0 deletions internal/webserver/embedded/translations/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
"Dark": "Oscuro"
"Auto": "Auto"
"Highlight": "Destacar"
"Highlights": "Destacados"
"%s highlights": "Destacados de %s"
"Remove from highlights": "Quitar de destacados"
"%d highlighted documents": "%d documentos destacados"
1 change: 1 addition & 0 deletions internal/webserver/embedded/translations/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
"Dark": "Noir"
"Auto": "Auto"
"Highlight": "Ajouter aux favoris"
"Highlights": "Favoris"
"%s highlights": "Favoris du %s"
"Remove from highlights": "Retirer des favoris"
"%d highlighted documents": "%d documents favoris"

0 comments on commit 9833532

Please sign in to comment.