Refactor routing and documentation for SPA deployment

- Updated the application to serve the SPA from the root path instead of /map/, enhancing accessibility.
- Modified redirect logic to ensure backward compatibility with old /map/* URLs.
- Adjusted documentation across multiple files to reflect the new routing structure and API endpoints.
- Improved handling of OAuth redirects and session management in the backend.
- Updated frontend configuration to align with the new base URL settings.
This commit is contained in:
2026-02-25 00:32:59 +03:00
parent 2c7bf48719
commit fea17e6bac
11 changed files with 73 additions and 69 deletions

View File

@@ -4,26 +4,6 @@ import (
"net/http"
)
func (a *App) redirectRoot(rw http.ResponseWriter, req *http.Request) {
if req.URL.Path != "/" {
http.NotFound(rw, req)
return
}
if a.setupRequired() {
http.Redirect(rw, req, "/map/setup", http.StatusFound)
return
}
http.Redirect(rw, req, "/map/profile", http.StatusFound)
}
func (a *App) redirectLogin(rw http.ResponseWriter, req *http.Request) {
if req.URL.Path != "/login" {
http.NotFound(rw, req)
return
}
http.Redirect(rw, req, "/map/login", http.StatusFound)
}
func (a *App) redirectLogout(rw http.ResponseWriter, req *http.Request) {
if req.URL.Path != "/logout" {
http.NotFound(rw, req)
@@ -33,9 +13,5 @@ func (a *App) redirectLogout(rw http.ResponseWriter, req *http.Request) {
if s != nil {
a.deleteSession(s)
}
http.Redirect(rw, req, "/map/login", http.StatusFound)
}
func (a *App) redirectAdmin(rw http.ResponseWriter, req *http.Request) {
http.Redirect(rw, req, "/map/admin", http.StatusFound)
http.Redirect(rw, req, "/login", http.StatusFound)
}