Merge 4991596daea57d78dbc0320a6ac708f7dc288021 into 596262d5e043f66b1f97f0dbc55d561d255c5729

This commit is contained in:
mrasong 2023-12-25 22:14:44 -08:00 committed by GitHub
commit cab22712d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -17,6 +17,7 @@ package server
import (
"encoding/json"
"net/http"
"net/url"
"github.com/gorilla/mux"
"github.com/prometheus/client_golang/prometheus/promhttp"
@ -282,7 +283,7 @@ func (svr *Service) apiProxyByTypeAndName(w http.ResponseWriter, r *http.Request
res := GeneralResponse{Code: 200}
params := mux.Vars(r)
proxyType := params["type"]
name := params["name"]
name, _ := url.QueryUnescape(params["name"])
defer func() {
log.Info("Http response [%s]: code [%d]", r.URL.Path, res.Code)
@ -350,7 +351,7 @@ type GetProxyTrafficResp struct {
func (svr *Service) apiProxyTraffic(w http.ResponseWriter, r *http.Request) {
res := GeneralResponse{Code: 200}
params := mux.Vars(r)
name := params["name"]
name, _ := url.QueryUnescape(params["name"])
defer func() {
log.Info("Http response [%s]: code [%d]", r.URL.Path, res.Code)

View File

@ -11,7 +11,7 @@ const props = defineProps<{
}>()
const fetchData = () => {
let url = '../api/traffic/' + props.proxyName
let url = '../api/traffic/' + encodeURIComponent(props.proxyName)
fetch(url, { credentials: 'include' })
.then((res) => {
return res.json()