glance icon indicating copy to clipboard operation
glance copied to clipboard

Outdated Simpleicons library version

Open Ashpex opened this issue 1 year ago • 1 comments

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.

Ashpex avatar Oct 03 '24 00:10 Ashpex

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.

svilenmarkov avatar Oct 10 '24 11:10 svilenmarkov

Thanks :)

Ashpex avatar Dec 21 '24 17:12 Ashpex