glanceapp / glance

A self-hosted dashboard that puts all your feeds in one place
GNU Affero General Public License v3.0
8.56k stars 297 forks source link

Outdated Simpleicons library version #230

Open Ashpex opened 1 month ago

Ashpex commented 1 month ago

Yesterday, I was looking for the Audiobookshelf icon to add to my services monitor and found that it wasn't available due to an outdated version of the SimpleIcons library. We are currently using version 11.14.0 from cdnjs, while the latest version is already at 13.12

func toSimpleIconIfPrefixed(icon string) (string, bool) {
    if !strings.HasPrefix(icon, "si:") {
        return icon, false
    }

    icon = strings.TrimPrefix(icon, "si:")
    icon = "https://cdnjs.cloudflare.com/ajax/libs/simple-icons/11.14.0/" + icon + ".svg"

    return icon, true
}

Hard-coding the library version into the codebase like this isn't ideal. A better approach would be to retrieve the SimpleIcons source URL from a configuration field. This way, you wouldn't need to update the source code whenever SimpleIcons updates.

svilenmarkov commented 1 month ago

Thanks for bringing this up.

To prevent this from becoming an issue again for the foreseeable future I'll just change this to always use the latest version, however it appears that cdnjs doesn't support doing this so I'll switch to jsdelivr. I wouldn't do this if it were a JS dependency but since it's only used for images I believe it should be fairly safe.