Allow fixed width and height for safari

This commit is contained in:
Florian Hoss 2024-06-12 08:58:36 +02:00
parent 8ad7cc0fa4
commit ee8d730a71
No known key found for this signature in database
GPG key ID: 0638DC11BFD36662

View file

@ -115,7 +115,7 @@ func (bs *BookmarkService) replaceIconString() {
continue
}
}
bs.bookmarks.Applications[i].Entries[j].Icon = string(data)
bs.bookmarks.Applications[i].Entries[j].Icon = insertWidthHeight(string(data))
} else {
bs.bookmarks.Applications[i].Entries[j].Icon = "<img title=\"" + bookmark.Name + "\" src=\"/icons/" + bookmark.Icon + "\"/>"
}
@ -157,3 +157,11 @@ func insertColor(svg, color string) string {
}
return parts[0] + "<svg " + `fill="#` + color + `" ` + parts[1]
}
func insertWidthHeight(svg string) string {
parts := strings.SplitN(svg, "<svg", 2)
if len(parts) != 2 {
return svg
}
return parts[0] + "<svg width=\"2rem\" height=\"2rem\" " + parts[1]
}