change icon from object to string

This commit is contained in:
Hunter Kehoe 2022-07-17 15:40:24 -06:00
parent 04f2535e92
commit 99886d7f66
8 changed files with 23 additions and 77 deletions

View file

@ -569,7 +569,7 @@ func (s *Server) parsePublishParams(r *http.Request, v *visitor, m *message) (ca
firebase = readBoolParam(r, true, "x-firebase", "firebase")
m.Title = readParam(r, "x-title", "title", "t")
m.Click = readParam(r, "x-click", "click")
ico := readParam(r, "x-icon", "icon")
m.Icon = readParam(r, "x-icon", "icon")
filename := readParam(r, "x-filename", "filename", "file", "f")
attach := readParam(r, "x-attach", "attach", "a")
if attach != "" || filename != "" {
@ -596,13 +596,6 @@ func (s *Server) parsePublishParams(r *http.Request, v *visitor, m *message) (ca
m.Attachment.Name = "attachment"
}
}
if ico != "" {
m.Icon = &icon{}
if !iconURLRegex.MatchString(ico) {
return false, false, "", false, errHTTPBadRequestIconURLInvalid
}
m.Icon.URL = ico
}
email = readParam(r, "x-email", "x-e-mail", "email", "e-mail", "mail", "e")
if email != "" {
if err := v.EmailAllowed(); err != nil {