mirror of
https://github.com/akyaiy/GoSally-mvp.git
synced 2026-01-03 09:12:25 +00:00
Refactor configuration and update handling:
- Modify .luarc.json to include global Lua scripts. - Update Makefile to include LDFLAGS for versioning. - Enhance node.go to implement version checking and update handling. - Refactor Lua global variables in _globals.lua and echo.lua to use new structures. - Remove deprecated http.lua and update config.yaml for TLS and update settings. - Introduce new update.go for version management and update checking. - Add tests for version comparison in update_test.go. - Improve error handling in various server methods.
This commit is contained in:
@@ -8,6 +8,8 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"regexp"
|
||||
|
||||
"github.com/akyaiy/GoSally-mvp/core/config"
|
||||
)
|
||||
|
||||
func (h *HandlerV1) ErrNotFound(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -17,7 +19,7 @@ func (h *HandlerV1) ErrNotFound(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (h *HandlerV1) newUUID() string {
|
||||
bytes := make([]byte, 16)
|
||||
bytes := make([]byte, int(config.GetInternalConsts().GetUUIDLength()/2))
|
||||
_, err := rand.Read(bytes)
|
||||
if err != nil {
|
||||
h.log.Error("Failed to generate UUID", slog.String("error", err.Error()))
|
||||
@@ -43,7 +45,12 @@ func (h *HandlerV1) writeJSONError(status int, msg string) {
|
||||
"error": msg,
|
||||
"code": status,
|
||||
}
|
||||
json.NewEncoder(h.w).Encode(resp)
|
||||
if err := json.NewEncoder(h.w).Encode(resp); err != nil {
|
||||
h.log.Error("Failed to write JSON error response",
|
||||
slog.String("error", err.Error()),
|
||||
slog.Int("status", status))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (h *HandlerV1) extractDescriptionStatic(path string) (string, error) {
|
||||
|
||||
Reference in New Issue
Block a user