detached c616c8d

Fix LangKey not set in context

commit
c616c8dfd6026e5962bb140938777d0fcad24bf3
author
bnema · · 2023-11-04 09:45 UTC
parent
8885be8
signature
unsigned
1 file · +11 -6
M internal/httpserve/router.go +11 -6
@@ -8,29 +8,34 @@ import (
88 "github.com/labstack/echo/v4"
99 )
1010
11-// RegisterRoutes registers all routes for the application
11+// RegisterRoutes registers all routes and middlewares
1212 func RegisterRoutes(e *echo.Echo, a *server.App) *echo.Echo {
13+ // Initiate the session middleware
14+ e.Use(middleware.InitSessionMiddleware(a))
15+
16+ // Language detection
17+ e.Use(middleware.LanguageDetection)
18+
1319 AdminPath := a.Config.Admin.Path
1420 bindLoginRoute(e, a, AdminPath)
1521 bindAPIEndpoints(e, a)
1622
1723 // SetCommonDataMiddleware will pass data to the renderer
1824 e.Use(middleware.SetCommonDataMiddleware(a))
25+
1926 // Error handler middleware
2027 e.Use(middleware.ErrorHandler)
21- // Initiate the session middleware
22- e.Use(middleware.InitSessionMiddleware(a))
28+
2329 // Use middlewares
2430 e.Use(middleware.SecureRoutes())
31+
2532 // Color scheme detection for dark/light mode
2633 e.Use(middleware.ColorSchemeDetection)
27- // Language detection
28- e.Use(middleware.LanguageDetection)
2934
30- // --- Register routes --- //
3135 bindAdminRoute(e, a, AdminPath)
3236 bindStaticRoute(e, a, "/*")
3337 bindHTMXEndpoints(e, a)
38+
3439 // Protect the root path with a 403
3540 e.GET("/", func(c echo.Context) error {
3641 return c.String(403, "403 Forbidden")
@@ -8,29 +8,34 @@ import (
8 "github.com/labstack/echo/v4"8 "github.com/labstack/echo/v4"
9 )9 )
10 10
11-// RegisterRoutes registers all routes for the application11+// RegisterRoutes registers all routes and middlewares
12 func RegisterRoutes(e *echo.Echo, a *server.App) *echo.Echo {12 func RegisterRoutes(e *echo.Echo, a *server.App) *echo.Echo {
13+ // Initiate the session middleware
14+ e.Use(middleware.InitSessionMiddleware(a))
15+
16+ // Language detection
17+ e.Use(middleware.LanguageDetection)
18+
13 AdminPath := a.Config.Admin.Path19 AdminPath := a.Config.Admin.Path
14 bindLoginRoute(e, a, AdminPath)20 bindLoginRoute(e, a, AdminPath)
15 bindAPIEndpoints(e, a)21 bindAPIEndpoints(e, a)
16 22
17 // SetCommonDataMiddleware will pass data to the renderer23 // SetCommonDataMiddleware will pass data to the renderer
18 e.Use(middleware.SetCommonDataMiddleware(a))24 e.Use(middleware.SetCommonDataMiddleware(a))
25+
19 // Error handler middleware26 // Error handler middleware
20 e.Use(middleware.ErrorHandler)27 e.Use(middleware.ErrorHandler)
21- // Initiate the session middleware28+
22- e.Use(middleware.InitSessionMiddleware(a))
23 // Use middlewares29 // Use middlewares
24 e.Use(middleware.SecureRoutes())30 e.Use(middleware.SecureRoutes())
31+
25 // Color scheme detection for dark/light mode32 // Color scheme detection for dark/light mode
26 e.Use(middleware.ColorSchemeDetection)33 e.Use(middleware.ColorSchemeDetection)
27- // Language detection
28- e.Use(middleware.LanguageDetection)
29 34
30- // --- Register routes --- //
31 bindAdminRoute(e, a, AdminPath)35 bindAdminRoute(e, a, AdminPath)
32 bindStaticRoute(e, a, "/*")36 bindStaticRoute(e, a, "/*")
33 bindHTMXEndpoints(e, a)37 bindHTMXEndpoints(e, a)
38+
34 // Protect the root path with a 40339 // Protect the root path with a 403
35 e.GET("/", func(c echo.Context) error {40 e.GET("/", func(c echo.Context) error {
36 return c.String(403, "403 Forbidden")41 return c.String(403, "403 Forbidden")

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close