refactor: notification module

This commit is contained in:
Jacky 2025-02-25 19:06:39 +08:00
parent 34fa4eb204
commit ab46d1de7e
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D
41 changed files with 3989 additions and 2411 deletions

View file

@ -86,14 +86,14 @@ func syncSave(name string, content string) {
}).
Post(fmt.Sprintf("/api/streams/%s", name))
if err != nil {
notification.Error("Save Remote Stream Error", err.Error())
notification.Error("Save Remote Stream Error", err.Error(), nil)
return
}
if resp.StatusCode() != http.StatusOK {
notification.Error("Save Remote Stream Error", NewSyncResult(node.Name, name, resp).String())
notification.Error("Save Remote Stream Error", "Save stream %{name} to %{node} failed", NewSyncResult(node.Name, name, resp))
return
}
notification.Success("Save Remote Stream Success", NewSyncResult(node.Name, name, resp).String())
notification.Success("Save Remote Stream Success", "Save stream %{name} to %{node} successfully", NewSyncResult(node.Name, name, resp))
// Check if the site is enabled, if so then enable it on the remote node
enabledConfigFilePath := nginx.GetConfPath("streams-enabled", name)