Files
backend/router.go
NanamiAdmin 40d4ccaa8a feat(proxy): add endpoint to list proxy configurations
Implement new GET endpoint `/frpcAct/proxyMgr/list` to retrieve proxy configurations from frpc instance config files. Includes handler function, API documentation, and route setup. The endpoint validates user permissions, reads and parses the config file, and returns structured proxy data with instance information.
2026-03-21 08:57:44 +08:00

44 lines
1.5 KiB
Go

package main
import (
"fmt"
"net/http"
"super-frpc/postLog"
)
func setupRoutes() {
postLog.Info("Setting up routes...")
http.HandleFunc("/system/getStatus", GetStatusHandler)
http.HandleFunc("/system/getSoftwareInfo", GetSoftwareInfoHandler)
logHandler := postLog.NewLogSocketHandler(postLog.GetLogBroadcaster())
http.HandleFunc("/system/getLogs", logHandler.Handle)
http.HandleFunc("/register", RegisterHandler)
http.HandleFunc("/login", LoginHandler)
http.HandleFunc("/logout", LogoutHandler)
http.HandleFunc("/userMgr/create", CreateUserHandler)
http.HandleFunc("/userMgr/remove", RemoveUserHandler)
http.HandleFunc("/userMgr/list", ListUserHandler)
// http.HandleFunc("/userMgr/modify", ModifyUserHandler)
http.HandleFunc("/sessionMgr/list", ListActiveSessionsHandler)
http.HandleFunc("/sessionMgr/remove", RemoveSessionHandler)
http.HandleFunc("/frpcAct/instanceMgr/create", CreateInstanceHandler)
http.HandleFunc("/frpcAct/instanceMgr/delete", DeleteInstanceHandler)
http.HandleFunc("/frpcAct/instanceMgr/modify", ModifyInstanceHandler)
http.HandleFunc("/frpcAct/instanceMgr/list", ListInstancesHandler)
http.HandleFunc("/frpcAct/proxyMgr/create", CreateProxyHandler)
http.HandleFunc("/frpcAct/proxyMgr/delete", DeleteProxyHandler)
http.HandleFunc("/frpcAct/proxyMgr/list", ListProxiesHandler)
http.HandleFunc("/", NotFoundHandler)
}
func NotFoundHandler(w http.ResponseWriter, r *http.Request) {
postLog.Error(fmt.Sprintf("Route not found: %s %s", r.Method, r.URL.Path))
SendErrorResponse(w, http.StatusNotFound, "Invalid request path")
}