Allow other then svg

This commit is contained in:
Florian Hoss 2024-06-11 19:08:02 +02:00
parent 9e43e027c5
commit efce5162da
No known key found for this signature in database
GPG key ID: 0638DC11BFD36662
2 changed files with 5 additions and 6 deletions

View file

@ -12,5 +12,8 @@ func SetupRoutes(router *http.ServeMux, sse *sse.Server, appHandler *AppHandler)
fsAssets := http.FileServer(http.Dir("assets")) fsAssets := http.FileServer(http.Dir("assets"))
router.Handle("GET /assets/", http.StripPrefix("/assets/", fsAssets)) router.Handle("GET /assets/", http.StripPrefix("/assets/", fsAssets))
icons := http.FileServer(http.Dir("storage/icons"))
router.Handle("GET /icons/", http.StripPrefix("/icons/", icons))
router.HandleFunc("GET /", appHandler.appHandler) router.HandleFunc("GET /", appHandler.appHandler)
} }

View file

@ -105,12 +105,6 @@ func (bs *BookmarkService) replaceIconString() {
if !(bookmark.IgnoreColor || !ok || color == "") { if !(bookmark.IgnoreColor || !ok || color == "") {
data = []byte(insertColor(string(data), color)) data = []byte(insertColor(string(data), color))
} }
} else if strings.HasPrefix(bookmark.Icon, "di/") {
title := strings.Replace(bookmark.Icon, "di/", "", 1)
data, err = os.ReadFile(simpleIconsFolder + title)
if err != nil {
continue
}
} else { } else {
data, err = os.ReadFile(iconsFolder + bookmark.Icon) data, err = os.ReadFile(iconsFolder + bookmark.Icon)
if err != nil { if err != nil {
@ -118,6 +112,8 @@ func (bs *BookmarkService) replaceIconString() {
} }
} }
bs.bookmarks.Applications[i].Entries[j].Icon = string(data) bs.bookmarks.Applications[i].Entries[j].Icon = string(data)
} else {
bs.bookmarks.Applications[i].Entries[j].Icon = "<img title=\"" + bookmark.Name + "\" src=\"/icons/" + bookmark.Icon + "\"/>"
} }
} }
} }