CasaOS - A simple, easy-to-use, elegant open-source Personal Cloud system.
remove repeating logging to reduce unnecessary verbosity
Tiger Wang7bd5c6a2b400
diff --git a/common/notify.go b/common/notify.goindex a5cee48..5c738e4 100644--- a/common/notify.go+++ b/common/notify.go@@ -25,7 +25,6 @@ type notifyService struct {}func (n *notifyService) SendNotify(path string, message map[string]interface{}) error {-url := strings.TrimSuffix(n.address, "/") + APICasaOSNotify + "/" + pathbody, err := json.Marshal(message)if err != nil {@@ -40,15 +39,13 @@ func (n *notifyService) SendNotify(path string, message map[string]interface{})return errors.New("failed to send notify (status code: " + fmt.Sprint(response.StatusCode) + ")")}return nil-}// disk: "sys_disk":{"size":56866869248,"avail":5855485952,"health":true,"used":48099700736}// usb: "sys_usb":[{"name": "sdc","size": 7747397632,"model": "DataTraveler_2.0","avail": 7714418688,"children": null}]func (n *notifyService) SendSystemStatusNotify(message map[string]interface{}) error {-url := strings.TrimSuffix(n.address, "/") + APICasaOSNotify + "/system_status"- fmt.Println(url)+body, err := json.Marshal(message)if err != nil {return err@@ -62,8 +59,8 @@ func (n *notifyService) SendSystemStatusNotify(message map[string]interface{}) ereturn errors.New("failed to send notify (status code: " + fmt.Sprint(response.StatusCode) + ")")}return nil-}+func NewNotifyService(runtimePath string) (NotifyService, error) {casaosAddressFile := filepath.Join(runtimePath, CasaOSURLFilename)@@ -79,7 +76,7 @@ func NewNotifyService(runtimePath string) (NotifyService, error) {return nil, err}- if response.StatusCode != 200 {+ if response.StatusCode != http.StatusOK {return nil, errors.New("failed to ping casaos service")}