Implement Federated Avatars #2469

Closed
opened 2026-03-22 14:08:31 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @rhclayto on GitHub (Jan 11, 2026).

Description

It would be useful to implement the ability to use federated avatars ( https://libravatar.org/ , a libre Gravatar-like service ), similar to the way Gitea/Forgejo does it. They use this library: https://github.com/gogs/go-libravatar .

Once the library is imported, you can use it like so:

import "strk.kbt.io/projects/go/libravatar"
avt := libravatar.New()
avatar_url := avt.FromEmail("person@example.com")

My use case is I run my own libravatar server for the services that run inside my SSO network. It's working with Gitea & several other services I run. Other people may use the public libravatar service.

Which alternatives did you consider using instead?

As an alternative, since libravatar is compatible with Gravatar-format HTTP requests, you can enable a configurable gravatar/libravatar URL. As a bonus, libravatar can fallback to Gravatar itself.

For instance, currntly you have www.gravatar.com hardcoded

req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, "https://www.gravatar.com/avatar/"+utils.Md5String(strings.ToLower(user.Email))+"?s="+sizeString+"&d=mp", nil)

But you could have it as a variable, so the user could configure the grvatar/libravatar URL to be any compatible gravatar/libravatar service, with default of www.gravatar.com.

https://www.gravatar.com

https://libravatar.org

https://avatars.example.com

avatar:
  gravatarexpiration: 3600
  # Possible new setting.
  gravatarbaseurl: "https://avatars.example.com"
Originally created by @rhclayto on GitHub (Jan 11, 2026). ### Description It would be useful to implement the ability to use federated avatars ( https://libravatar.org/ , a libre Gravatar-like service ), similar to the way Gitea/Forgejo does it. They use this library: https://github.com/gogs/go-libravatar . Once the library is imported, you can use it like so: ```golang import "strk.kbt.io/projects/go/libravatar" avt := libravatar.New() avatar_url := avt.FromEmail("person@example.com") ``` My use case is I run my own libravatar server for the services that run inside my SSO network. It's working with Gitea & several other services I run. Other people may use the public libravatar service. ### Which alternatives did you consider using instead? As an alternative, since libravatar is compatible with Gravatar-format HTTP requests, you can enable a configurable gravatar/libravatar URL. As a bonus, libravatar can fallback to Gravatar itself. For instance, currntly you have www.gravatar.com hardcoded ```golang req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, "https://www.gravatar.com/avatar/"+utils.Md5String(strings.ToLower(user.Email))+"?s="+sizeString+"&d=mp", nil) ``` But you could have it as a variable, so the user could configure the grvatar/libravatar URL to be any compatible gravatar/libravatar service, with default of www.gravatar.com. https://www.gravatar.com https://libravatar.org https://avatars.example.com ```yaml avatar: gravatarexpiration: 3600 # Possible new setting. gravatarbaseurl: "https://avatars.example.com" ```
Author
Owner

@rhclayto commented on GitHub (Jan 11, 2026):

I tried with the second method & it works fine. I'll make a pull request tomorrow in case you're interested. Time for sleep.

@rhclayto commented on GitHub (Jan 11, 2026): I tried with the second method & it works fine. I'll make a pull request tomorrow in case you're interested. Time for sleep.
Author
Owner

@kolaente commented on GitHub (Jan 11, 2026):

Looks good 👍

@kolaente commented on GitHub (Jan 11, 2026): Looks good 👍
Author
Owner

@rhclayto commented on GitHub (Jan 11, 2026):

Pull request here: https://github.com/go-vikunja/vikunja/pull/2083

@rhclayto commented on GitHub (Jan 11, 2026): Pull request here: https://github.com/go-vikunja/vikunja/pull/2083
Author
Owner

@vikunja-bot-app[bot] commented on GitHub (Jan 13, 2026):

This issue has been fixed in #2083, please check with the next unstable build (should be ready for deployment in ~30min, also on the demo).

@vikunja-bot-app[bot] commented on GitHub (Jan 13, 2026): This issue has been fixed in #2083, please check with the next unstable build (should be ready for deployment in ~30min, also on [the demo](https://try.vikunja.io)).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#2469