Корень сайта / → рабочая страница (/admin/, /first-run до настройки) вместо 404
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -191,6 +191,19 @@ func NewServer(cfg ServerConfig) (*Server, error) {
|
||||
registerIncoming(mux, adminTpl, inDeps)
|
||||
globalOutgoingStore = NewOutgoingStore()
|
||||
registerDepoSim(mux, adminTpl)
|
||||
// корень сайта: http://сервер:8080/ → рабочая страница (до входа authMiddleware отправит на вход,
|
||||
// до первичной настройки — на /first-run); прочие неизвестные адреса — 404.
|
||||
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path != "/" {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
if firstRunPending() {
|
||||
http.Redirect(w, r, "/first-run", http.StatusSeeOther)
|
||||
return
|
||||
}
|
||||
http.Redirect(w, r, "/admin/", http.StatusSeeOther)
|
||||
})
|
||||
registerDepoTest(mux, adminTpl) // тестирование DEPO: сценарии с имитацией НРД, только база депозитария // песочница сверки с DEPO (имитация ответа Fancy)
|
||||
outDeps := outgoingDeps{
|
||||
store: globalOutgoingStore,
|
||||
|
||||
Reference in New Issue
Block a user