enhance(site): notification of sync

This commit is contained in:
Jacky 2024-10-26 11:26:29 +08:00
parent 497d5cddea
commit 2ee057a857
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D
21 changed files with 1336 additions and 184 deletions

View file

@ -69,16 +69,17 @@ func syncEnable(name string) {
client := resty.New()
client.SetBaseURL(node.URL)
resp, err := client.R().
SetHeader("X-Node-Secret", node.Token).
Post(fmt.Sprintf("/api/sites/%s/enable", name))
if err != nil {
notification.Error("Enable Remote Site Error", err.Error())
return
}
if resp.StatusCode() != http.StatusOK {
notification.Error("Enable Remote Site Error", string(resp.Body()))
notification.Error("Enable Remote Site Error", NewSyncResult(node.Name, name, resp).String())
return
}
notification.Success("Enable Remote Site Success", string(resp.Body()))
notification.Success("Enable Remote Site Success", NewSyncResult(node.Name, name, resp).String())
}()
}