Merge remote-tracking branch 'origin/master'

# Conflicts:
#	ui/src/pages/OrderList.vue
This commit is contained in:
2026-02-13 20:52:03 +03:00
parent 5a249ab510
commit 50325504dd
2 changed files with 33 additions and 13 deletions

View File

@@ -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"
}

View File

@@ -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"
]
}
},