Support Forgejo and Gitea avatars in git blame (#41813)

Part of #11043.

Codeberg is a public instance of Forgejo, as confirmed by the API
documentation at https://codeberg.org/api/swagger. Therefore, I renamed
the related component from codeberg to forgejo and added codeberg.org as
a public instance.

Furthermore, to optimize request speed for the commit API, I set
`stat=false&verification=false&files=false`.

<img width="1650" height="1268" alt="CleanShot 2025-11-03 at 19 57
06@2x"
src="https://github.com/user-attachments/assets/c1b4129e-f324-41c2-86dc-5e4f7403c046"
/>

<br/>
<br/>

Regarding Gitea Support: 

Forgejo is a fork of Gitea, and their APIs are currently identical
(e.g., for getting avatars). However, to future-proof against potential
API divergence, I decided to treat them as separate entities. The
current gitea implementation is essentially a copy of the forgejo file
with the relevant type names and the public instance URL updated.

Release Notes:

- Added Support for Forgejo and Gitea avatars in git blame
This commit is contained in:
ᴀᴍᴛᴏᴀᴇʀ
2025-11-05 22:53:28 -05:00
committed by GitHub
parent f824e93eeb
commit 284d8f790a
4 changed files with 547 additions and 22 deletions
@@ -21,7 +21,8 @@ pub fn init(cx: &mut App) {
let provider_registry = GitHostingProviderRegistry::global(cx);
provider_registry.register_hosting_provider(Arc::new(Bitbucket::public_instance()));
provider_registry.register_hosting_provider(Arc::new(Chromium));
provider_registry.register_hosting_provider(Arc::new(Codeberg));
provider_registry.register_hosting_provider(Arc::new(Forgejo::public_instance()));
provider_registry.register_hosting_provider(Arc::new(Gitea::public_instance()));
provider_registry.register_hosting_provider(Arc::new(Gitee));
provider_registry.register_hosting_provider(Arc::new(Github::public_instance()));
provider_registry.register_hosting_provider(Arc::new(Gitlab::public_instance()));
@@ -44,6 +45,10 @@ pub fn register_additional_providers(
provider_registry.register_hosting_provider(Arc::new(gitlab_self_hosted));
} else if let Ok(github_self_hosted) = Github::from_remote_url(&origin_url) {
provider_registry.register_hosting_provider(Arc::new(github_self_hosted));
} else if let Ok(forgejo_self_hosted) = Forgejo::from_remote_url(&origin_url) {
provider_registry.register_hosting_provider(Arc::new(forgejo_self_hosted));
} else if let Ok(gitea_self_hosted) = Gitea::from_remote_url(&origin_url) {
provider_registry.register_hosting_provider(Arc::new(gitea_self_hosted));
}
}