go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
45.16k stars 5.49k forks source link

Support FUNDING.yml to show sponsors button #26073

Open GreenImp opened 1 year ago

GreenImp commented 1 year ago

Feature Description

GitHub allows adding a "Sponsor" button to repositories, user profiles and organisation pages, which takes the user to a page where they can sponsor the project.

I think this is quite important for open source projects that may be struggling to find time for the dev work, or lacking funding that they need.

It would be really nice if Gitea could do the same.

Desired functionality

Allow users / devlopers to specify funding sources and have a "Sponsor" button show on on a repository page, user profile, or organisation page.

When a user clicks the button, the user should be taken to the specified funding website.

If multiple funding sources are specified, then a dialogue should be shown to allow the user to choose which funding website to visit.

Adding a button

Add button to repository

On GitHub, to add a Sponsor button to a repository, you can add a .github/FUNDING.yml file with a list of available funding options to the repository.

An example can be seen on Gitea's own repo: https://github.com/go-gitea/gitea/blob/a12a5f3652c339b17b187ff424a480631a3c1e1e/.github/FUNDING.yml

And then you need to enable "Sponsorships" in the repository settings.

It would be good if we could do the same in Gitea, using an identically formatted FUNDING.yml file, but in the .gitea directory.

I think the need to also enable it in the repository settings is also good. Otherwise it would show the Sponsor button on forked repos, which may not be desirable.

Add button to user profile

On GitHub, the sponsor button on user profiles only seems to show a button linking to GitHub's own sponsor system.

Obviously Gitea doesn't have anything like this. However, with the new .profile repository functionality, I wonder if we could check if that repo exists for the user and, if so check for a .gitea/FUNDING.yml file. If it exists, use it to display a sponsor button.

Add button to organisation page

I'm not sure if organisations can have a .profile repository as well but, if so, then it would be good to have it on an organisation's profile / home page as well.

Screenshots

Example of the "Sponsor" button on a GitHub profile:

Screenshot from 2023-07-23 19-01-14

Example of the "Sponsor" button on a GitHub organisation page:

Screenshot from 2023-07-23 19-05-09

Example of the "Sponsor" button on a repository page:

Screenshot from 2023-07-23 19-03-02

Example of the modal shown on GitHub if FUNDING.yml contains multiple options:

Screenshot from 2023-07-23 19-08-19

Example of the "Sponsor" button shown at the bottom of the "issues" page:

Screenshot from 2023-07-23 19-11-00

techknowlogick commented 1 year ago

Thanks for the well-thought-out and detailed proposal :)

JakobDev commented 1 year ago

I worked on this some time ago, but I don't finished it. I will continue working on this now.

AverageHelper commented 11 months ago

GitHub seems to support FUNDING.yml files at the repository root as well, not only in the .github folder. (Example)

Should Gitea also support that for compatibility, or search only in .gitea and .github for clarity?

iaxat commented 4 months ago

This is very much needed.