25 lines
622 B
Go
25 lines
622 B
Go
package handlers
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
func (h *Handler) Home(w http.ResponseWriter, r *http.Request) {
|
|
ctx := r.Context()
|
|
hasAdmin, _ := h.users.HasAdmin(ctx)
|
|
userCount, _ := h.users.CountUsers(ctx)
|
|
|
|
h.render(w, "index", h.pageData(w, r, "VPN Панель — Xray", map[string]any{
|
|
"HasAdmin": hasAdmin,
|
|
"CanRegister": !hasAdmin,
|
|
"UserCount": userCount,
|
|
"XrayVersion": "Xray-core",
|
|
"Installed": h.cfg.Installed,
|
|
}))
|
|
}
|
|
|
|
func (h *Handler) Health(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.Write([]byte(`{"status":"ok","core":"xray"}`))
|
|
}
|