From 8492072be1c3588a8458cee40ea547939dff3e46 Mon Sep 17 00:00:00 2001 From: MEHMETKECECI Date: Fri, 13 Feb 2026 20:52:03 +0300 Subject: [PATCH] Merge remote-tracking branch 'origin/master' # Conflicts: # ui/src/pages/OrderList.vue --- svc/main.go | 36 ++++++++++++++++++++++++++++-------- ui/.quasar/tsconfig.json | 10 +++++----- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/svc/main.go b/svc/main.go index 9cdf219..c625799 100644 --- a/svc/main.go +++ b/svc/main.go @@ -12,7 +12,10 @@ import ( "log" "net/http" "os" + "path" + "path/filepath" "runtime/debug" + "strings" "github.com/gorilla/mux" "github.com/joho/godotenv" @@ -594,14 +597,13 @@ func main() { log.Fatal(http.ListenAndServe(":8080", handler)) } -func mountSPA(m gorilla.Mux) { - m.Group(func(r chi.Router) { - r.NotFound(spaIndex) - r.Get("/", spaIndex) - }) +func mountSPA(r *mux.Router) { + r.NotFoundHandler = http.HandlerFunc(spaIndex) + r.HandleFunc("/", spaIndex).Methods(http.MethodGet) } func spaIndex(w http.ResponseWriter, r *http.Request) { + uiDir := uiRootDir() p := r.URL.Path if r.URL.Path == "/logo.png" { @@ -626,20 +628,38 @@ func spaIndex(w http.ResponseWriter, r *http.Request) { return } - name := path.Join(app.RUN.UiDir, filepath.FromSlash(p)) + name := path.Join(uiDir, filepath.FromSlash(p)) f, err := os.Stat(name) if err != nil { if os.IsNotExist(err) { - http.ServeFile(w, r, fmt.Sprintf("%s/index.html", app.RUN.UiDir)) + http.ServeFile(w, r, filepath.Join(uiDir, "index.html")) return } + + http.Error(w, "internal server error", http.StatusInternalServerError) + return } if f.IsDir() { - Forbidden(w, nil) + http.Error(w, "forbidden", http.StatusForbidden) return } http.ServeFile(w, r, name) } + +func uiRootDir() string { + if d := strings.TrimSpace(os.Getenv("UI_DIR")); d != "" { + return d + } + + candidates := []string{"../ui/dist", "./ui/dist"} + for _, d := range candidates { + if fi, err := os.Stat(d); err == nil && fi.IsDir() { + return d + } + } + + return "../ui/dist" +} diff --git a/ui/.quasar/tsconfig.json b/ui/.quasar/tsconfig.json index 6721662..99f52b3 100644 --- a/ui/.quasar/tsconfig.json +++ b/ui/.quasar/tsconfig.json @@ -64,19 +64,19 @@ "./../src/stores/*" ], "#q-app": [ - "./../node_modules/.pnpm/@quasar+app-webpack@4.3.2_pinia@3.0.4_vue@3.5.20__quasar@2.18.6_sass@1.97.3_tslib@2.8.1_ea0679f3401f6e63bbfdc4dae8ab5531/node_modules/@quasar/app-webpack/types/index.d.ts" + "./../node_modules/@quasar/app-webpack/types/index.d.ts" ], "#q-app/wrappers": [ - "./../node_modules/.pnpm/@quasar+app-webpack@4.3.2_pinia@3.0.4_vue@3.5.20__quasar@2.18.6_sass@1.97.3_tslib@2.8.1_ea0679f3401f6e63bbfdc4dae8ab5531/node_modules/@quasar/app-webpack/types/app-wrappers.d.ts" + "./../node_modules/@quasar/app-webpack/types/app-wrappers.d.ts" ], "#q-app/bex/background": [ - "./../node_modules/.pnpm/@quasar+app-webpack@4.3.2_pinia@3.0.4_vue@3.5.20__quasar@2.18.6_sass@1.97.3_tslib@2.8.1_ea0679f3401f6e63bbfdc4dae8ab5531/node_modules/@quasar/app-webpack/types/bex/entrypoints/background.d.ts" + "./../node_modules/@quasar/app-webpack/types/bex/entrypoints/background.d.ts" ], "#q-app/bex/content": [ - "./../node_modules/.pnpm/@quasar+app-webpack@4.3.2_pinia@3.0.4_vue@3.5.20__quasar@2.18.6_sass@1.97.3_tslib@2.8.1_ea0679f3401f6e63bbfdc4dae8ab5531/node_modules/@quasar/app-webpack/types/bex/entrypoints/content.d.ts" + "./../node_modules/@quasar/app-webpack/types/bex/entrypoints/content.d.ts" ], "#q-app/bex/private/bex-bridge": [ - "./../node_modules/.pnpm/@quasar+app-webpack@4.3.2_pinia@3.0.4_vue@3.5.20__quasar@2.18.6_sass@1.97.3_tslib@2.8.1_ea0679f3401f6e63bbfdc4dae8ab5531/node_modules/@quasar/app-webpack/types/bex/bex-bridge.d.ts" + "./../node_modules/@quasar/app-webpack/types/bex/bex-bridge.d.ts" ] } },