Fix /status for UDMP (#17)
This commit is contained in:
@@ -21,6 +21,9 @@ const (
|
|||||||
|
|
||||||
loginPath = "/api/login"
|
loginPath = "/api/login"
|
||||||
loginPathNew = "/api/auth/login"
|
loginPathNew = "/api/auth/login"
|
||||||
|
|
||||||
|
statusPath = "/status"
|
||||||
|
statusPathNew = "/proxy/network/status"
|
||||||
)
|
)
|
||||||
|
|
||||||
type NotFoundError struct{}
|
type NotFoundError struct{}
|
||||||
@@ -45,8 +48,9 @@ type Client struct {
|
|||||||
c *http.Client
|
c *http.Client
|
||||||
baseURL *url.URL
|
baseURL *url.URL
|
||||||
|
|
||||||
apiPath string
|
apiPath string
|
||||||
loginPath string
|
loginPath string
|
||||||
|
statusPath string
|
||||||
|
|
||||||
csrf string
|
csrf string
|
||||||
|
|
||||||
@@ -112,12 +116,14 @@ func (c *Client) setAPIUrlStyle(ctx context.Context) error {
|
|||||||
// the new API returns a 200 for a / request
|
// the new API returns a 200 for a / request
|
||||||
c.apiPath = apiPathNew
|
c.apiPath = apiPathNew
|
||||||
c.loginPath = loginPathNew
|
c.loginPath = loginPathNew
|
||||||
|
c.statusPath = statusPathNew
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// The old version returns a "302" (to /manage) for a / request
|
// The old version returns a "302" (to /manage) for a / request
|
||||||
c.apiPath = apiPath
|
c.apiPath = apiPath
|
||||||
c.loginPath = loginPath
|
c.loginPath = loginPath
|
||||||
|
c.statusPath = statusPath
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +146,8 @@ func (c *Client) Login(ctx context.Context, user, pass string) error {
|
|||||||
UUID string `json:"uuid"`
|
UUID string `json:"uuid"`
|
||||||
} `json:"meta"`
|
} `json:"meta"`
|
||||||
}
|
}
|
||||||
err = c.do(ctx, "GET", "/status", nil, &status)
|
|
||||||
|
err = c.do(ctx, "GET", c.statusPath, nil, &status)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user