detached 7968bd9

Merge branch 'main' into docker-client

commit
7968bd976db95a3259c8ecc87d583a470b4c55f9
author
bnema · · 2023-09-04 19:40 UTC
merge of
261161a + 7701658 · diff against the first parent
signature
unsigned
3 files · +20 -0
M go.mod +4 -0
@@ -21,6 +21,9 @@ require (
2121 github.com/klauspost/compress v1.16.7 // indirect
2222 github.com/moby/patternmatcher v0.6.0 // indirect
2323 github.com/moby/sys/sequential v0.5.0 // indirect
24+ github.com/gorilla/context v1.1.1 // indirect
25+ github.com/gorilla/securecookie v1.1.1 // indirect
26+ github.com/gorilla/sessions v1.2.1 // indirect
2427 github.com/opencontainers/go-digest v1.0.0 // indirect
2528 github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b // indirect
2629 github.com/opencontainers/runc v1.1.9 // indirect
@@ -35,6 +38,7 @@ require (
3538 )
3639
3740 require (
41+ github.com/labstack/echo-contrib v0.15.0
3842 github.com/labstack/gommon v0.4.0 // indirect
3943 github.com/mattn/go-colorable v0.1.13 // indirect
4044 github.com/mattn/go-isatty v0.0.19 // indirect
@@ -21,6 +21,9 @@ require (
21 github.com/klauspost/compress v1.16.7 // indirect21 github.com/klauspost/compress v1.16.7 // indirect
22 github.com/moby/patternmatcher v0.6.0 // indirect22 github.com/moby/patternmatcher v0.6.0 // indirect
23 github.com/moby/sys/sequential v0.5.0 // indirect23 github.com/moby/sys/sequential v0.5.0 // indirect
24+ github.com/gorilla/context v1.1.1 // indirect
25+ github.com/gorilla/securecookie v1.1.1 // indirect
26+ github.com/gorilla/sessions v1.2.1 // indirect
24 github.com/opencontainers/go-digest v1.0.0 // indirect27 github.com/opencontainers/go-digest v1.0.0 // indirect
25 github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b // indirect28 github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b // indirect
26 github.com/opencontainers/runc v1.1.9 // indirect29 github.com/opencontainers/runc v1.1.9 // indirect
@@ -35,6 +38,7 @@ require (
35 )38 )
36 39
37 require (40 require (
41+ github.com/labstack/echo-contrib v0.15.0
38 github.com/labstack/gommon v0.4.0 // indirect42 github.com/labstack/gommon v0.4.0 // indirect
39 github.com/mattn/go-colorable v0.1.13 // indirect43 github.com/mattn/go-colorable v0.1.13 // indirect
40 github.com/mattn/go-isatty v0.0.19 // indirect44 github.com/mattn/go-isatty v0.0.19 // indirect
M go.sum +8 -0 generated file: collapsed
M internal/http/middlewares/detect-lang.go +8 -0
@@ -3,6 +3,7 @@ package middlewares
33 import (
44 "strings"
55
6+ "github.com/labstack/echo-contrib/session"
67 "github.com/labstack/echo/v4"
78 )
89
@@ -19,6 +20,13 @@ func LanguageDetectionMiddleware(next echo.HandlerFunc) echo.HandlerFunc {
1920 }
2021
2122 func detectCurrentLanguage(c echo.Context) string {
23+ // Check if the lang key is set in the session storage
24+ sess, _ := session.Get("session", c) // Assuming you have a session named "session"
25+ if langValue, ok := sess.Values["lang"]; ok {
26+ return langValue.(string) // Return the lang value from the session storage
27+ }
28+
29+ // If lang key is not set, proceed with "Accept-Language" header detection
2230 header := c.Request().Header.Get("Accept-Language")
2331 if strings.Contains(header, "fr") {
2432 return "fr"
@@ -3,6 +3,7 @@ package middlewares
3 import (3 import (
4 "strings"4 "strings"
5 5
6+ "github.com/labstack/echo-contrib/session"
6 "github.com/labstack/echo/v4"7 "github.com/labstack/echo/v4"
7 )8 )
8 9
@@ -19,6 +20,13 @@ func LanguageDetectionMiddleware(next echo.HandlerFunc) echo.HandlerFunc {
19 }20 }
20 21
21 func detectCurrentLanguage(c echo.Context) string {22 func detectCurrentLanguage(c echo.Context) string {
23+ // Check if the lang key is set in the session storage
24+ sess, _ := session.Get("session", c) // Assuming you have a session named "session"
25+ if langValue, ok := sess.Values["lang"]; ok {
26+ return langValue.(string) // Return the lang value from the session storage
27+ }
28+
29+ // If lang key is not set, proceed with "Accept-Language" header detection
22 header := c.Request().Header.Get("Accept-Language")30 header := c.Request().Header.Get("Accept-Language")
23 if strings.Contains(header, "fr") {31 if strings.Contains(header, "fr") {
24 return "fr"32 return "fr"

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