Skip to content

Commit 2481dfa

Browse files
committed
fix api
1 parent 95a881a commit 2481dfa

File tree

11 files changed

+16
-27
lines changed

11 files changed

+16
-27
lines changed

assets/frpc/static/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!doctype html> <html lang=en> <head> <meta charset=utf-8> <title>frp client admin UI</title> <link rel="shortcut icon" href="favicon.ico"></head> <body> <div id=app></div> <script type="text/javascript" src="manifest.js?9b7dd6f843b02e4142ac"></script><script type="text/javascript" src="vendor.js?f837702123a3b4f7a651"></script></body> </html>
1+
<!doctype html> <html lang=en> <head> <meta charset=utf-8> <title>frp client admin UI</title> <link rel="shortcut icon" href="favicon.ico"></head> <body> <div id=app></div> <script type="text/javascript" src="manifest.js?d2cd6337d30c7b22e836"></script><script type="text/javascript" src="vendor.js?edb271e1d9c81f857840"></script></body> </html>

assets/frpc/static/manifest.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/frpc/static/vendor.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/frpc/statik/statik.go

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

assets/frps/static/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!DOCTYPE html> <html lang=en> <head> <meta charset=utf-8> <title>frps dashboard</title> <link rel="shortcut icon" href="favicon.ico"></head> <body> <div id=app></div> <script type="text/javascript" src="manifest.js?bc42bc4eff72df8da372"></script><script type="text/javascript" src="vendor.js?ee403fce53c8757fc931"></script></body> </html>
1+
<!DOCTYPE html> <html lang=en> <head> <meta charset=utf-8> <title>frps dashboard</title> <link rel="shortcut icon" href="favicon.ico"></head> <body> <div id=app></div> <script type="text/javascript" src="manifest.js?14bea8276eef86cc7c61"></script><script type="text/javascript" src="vendor.js?51925ec1a77936b64d61"></script></body> </html>

assets/frps/static/manifest.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/frps/static/vendor.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/frps/statik/statik.go

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

cmd/frpc/sub/reload.go

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ package sub
1616

1717
import (
1818
"encoding/base64"
19-
"encoding/json"
2019
"fmt"
2120
"io/ioutil"
2221
"net/http"
@@ -25,7 +24,6 @@ import (
2524

2625
"github.com/spf13/cobra"
2726

28-
"github.com/fatedier/frp/client"
2927
"github.com/fatedier/frp/g"
3028
"github.com/fatedier/frp/models/config"
3129
)
@@ -79,21 +77,16 @@ func reload() error {
7977
if err != nil {
8078
return err
8179
} else {
82-
if resp.StatusCode != 200 {
83-
return fmt.Errorf("admin api status code [%d]", resp.StatusCode)
80+
if resp.StatusCode == 200 {
81+
return nil
8482
}
83+
8584
defer resp.Body.Close()
8685
body, err := ioutil.ReadAll(resp.Body)
8786
if err != nil {
8887
return err
8988
}
90-
res := &client.GeneralResponse{}
91-
err = json.Unmarshal(body, &res)
92-
if err != nil {
93-
return fmt.Errorf("unmarshal http response error: %s", strings.TrimSpace(string(body)))
94-
} else if res.Code != 0 {
95-
return fmt.Errorf(res.Msg)
96-
}
89+
return fmt.Errorf("code [%d], %s", resp.StatusCode, strings.TrimSpace(string(body)))
9790
}
9891
return nil
9992
}

server/dashboard_api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,6 @@ func (svr *Service) ApiProxyTraffic(w http.ResponseWriter, r *http.Request) {
318318
trafficResp.TrafficOut = proxyTrafficInfo.TrafficOut
319319
}
320320

321-
buf, _ := json.Marshal(&res)
321+
buf, _ := json.Marshal(&trafficResp)
322322
res.Msg = string(buf)
323323
}

0 commit comments

Comments
 (0)