initial support of homepage labels

This commit is contained in:
yusing
2024-10-03 02:53:05 +08:00
parent ae61a2335d
commit 90130411f9
7 changed files with 76 additions and 39 deletions

View File

@@ -17,6 +17,7 @@ const (
ListMiddlewares = "middlewares"
ListMiddlewareTrace = "middleware_trace"
ListMatchDomains = "match_domains"
ListHomepageConfig = "homepage_config"
)
func List(cfg *config.Config, w http.ResponseWriter, r *http.Request) {
@@ -36,6 +37,8 @@ func List(cfg *config.Config, w http.ResponseWriter, r *http.Request) {
listMiddlewareTrace(w, r)
case ListMatchDomains:
listMatchDomains(cfg, w, r)
case ListHomepageConfig:
listHomepageConfig(cfg, w, r)
default:
U.HandleErr(w, r, U.ErrInvalidKey("what"), http.StatusBadRequest)
}
@@ -78,3 +81,7 @@ func listMiddlewares(w http.ResponseWriter, r *http.Request) {
func listMatchDomains(cfg *config.Config, w http.ResponseWriter, r *http.Request) {
U.HandleErr(w, r, U.RespondJson(w, cfg.Value().MatchDomains))
}
func listHomepageConfig(cfg *config.Config, w http.ResponseWriter, r *http.Request) {
U.HandleErr(w, r, U.RespondJson(w, cfg.HomepageConfig()))
}