Initial commit: VPN panel on Go, PostgreSQL 17, Docker, Xray-core
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
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"}`))
|
||||
}
|
||||
Reference in New Issue
Block a user