fix: use /plugin/ prefix for Zoraxy plugin API endpoints (declared + called)
This commit is contained in:
parent
e8a3ed3742
commit
9186e02083
2 changed files with 8 additions and 4 deletions
8
main.go
8
main.go
|
|
@ -27,10 +27,10 @@ func main() {
|
|||
UIPath: "/ui",
|
||||
|
||||
PermittedAPIEndpoints: []zoraxy_plugin.PermittedAPIEndpoint{
|
||||
{Method: "GET", Endpoint: "/api/proxy/list", Reason: "List proxy rules and their tags"},
|
||||
{Method: "GET", Endpoint: "/api/proxy/header/list", Reason: "Read existing custom headers on a domain"},
|
||||
{Method: "POST", Endpoint: "/api/proxy/header/add", Reason: "Copy headers onto tagged domains"},
|
||||
{Method: "POST", Endpoint: "/api/proxy/header/remove", Reason: "Remove copied headers from tagged domains"},
|
||||
{Method: "GET", Endpoint: "/plugin/api/proxy/list", Reason: "List proxy rules and their tags"},
|
||||
{Method: "GET", Endpoint: "/plugin/api/proxy/header/list", Reason: "Read existing custom headers on a domain"},
|
||||
{Method: "POST", Endpoint: "/plugin/api/proxy/header/add", Reason: "Copy headers onto tagged domains"},
|
||||
{Method: "POST", Endpoint: "/plugin/api/proxy/header/remove", Reason: "Remove copied headers from tagged domains"},
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,10 @@ func (c *ZoraxyClient) do(method, path string, form url.Values) ([]byte, error)
|
|||
if form != nil {
|
||||
body = strings.NewReader(form.Encode())
|
||||
}
|
||||
// Zoraxy plugin API endpoints are mounted under /plugin/.
|
||||
if !strings.HasPrefix(path, "/plugin/") {
|
||||
path = "/plugin" + path
|
||||
}
|
||||
req, err := http.NewRequest(method, c.BaseURL+path, body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
Loading…
Reference in a new issue