refactor: don't export non-needed fields (#336)

* refactor: don't export non-needed fields

* feat: coderabbit suggestions

* fix: avoid queries panic
This commit is contained in:
Stavros
2025-09-02 01:27:55 +03:00
committed by GitHub
parent 5184c96e85
commit ad4fc7ef5f
16 changed files with 325 additions and 347 deletions

View File

@@ -11,8 +11,8 @@ import (
)
type UIMiddleware struct {
UIFS fs.FS
UIFileServer http.Handler
uiFs fs.FS
uiFileServer http.Handler
}
func NewUIMiddleware() *UIMiddleware {
@@ -26,8 +26,8 @@ func (m *UIMiddleware) Init() error {
return err
}
m.UIFS = ui
m.UIFileServer = http.FileServer(http.FS(ui))
m.uiFs = ui
m.uiFileServer = http.FileServer(http.FS(ui))
return nil
}
@@ -42,13 +42,13 @@ func (m *UIMiddleware) Middleware() gin.HandlerFunc {
c.Next()
return
default:
_, err := fs.Stat(m.UIFS, strings.TrimPrefix(c.Request.URL.Path, "/"))
_, err := fs.Stat(m.uiFs, strings.TrimPrefix(c.Request.URL.Path, "/"))
if os.IsNotExist(err) {
c.Request.URL.Path = "/"
}
m.UIFileServer.ServeHTTP(c.Writer, c.Request)
m.uiFileServer.ServeHTTP(c.Writer, c.Request)
c.Abort()
return
}