Initial commit: VPN panel on Go, PostgreSQL 17, Docker, Xray-core

This commit is contained in:
vpn-panel
2026-05-21 18:55:14 +03:00
commit 3c2f5226d1
27 changed files with 1778 additions and 0 deletions
+24
View File
@@ -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"}`))
}