Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for funding config #26125

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Add support for funding config #26125

wants to merge 11 commits into from

Conversation

JakobDev
Copy link
Contributor

@JakobDev JakobDev commented Jul 25, 2023

This adds support for a funding config. This does not mean, Gitea can handle Sponsors. It only mean, that you can add links to you Funding Websites. Take a look at the GitHub Documentation for more Information. It is currently already working, but needs a lot polishing. The backend code is almost finished, so you can comment n that. You can also comment on implementation details. The frontend is not ready at the Moment.

This is currently WIP. You can view the Funding Site only by visiting {RepoURL}/funding. It is not linked anywhere. maybe I transform this Site into a Pop-up like GitHub.

At the moment, only support for custom and ko_fi has been added. This Implementation is designed to be customizable, so Admins can add new Sites too. If you want to add support for Patroen, you can add this to you app.ini:

[funding.patreon]
Text = Patreon/%s
URL = https://patreon.com/%s

To-do:

  • Add all sites
  • Integrate into Repositories
  • Add Icons
  • GitHub allows for some values e.g. custom strings and list of strings as value
  • Write tests
  • Add funding for Users
  • Write Documentation

Screenshot:
grafik
It looks boring at the moment. Needs a bit more polishing.

Implements #26073

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 25, 2023
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 25, 2023
@JakobDev
Copy link
Contributor Author

I had now moved to a Modal:
grafik

@JakobDev
Copy link
Contributor Author

Funding for Users is now supported! It uses the data from the .profile repository. For Organisations, it looks like there is no .profile Repository.

@JakobDev
Copy link
Contributor Author

Iocns are now supported, but the Frontend needs some styling.

grafik

Would be nice to get a comment on this PR.

@GreenImp
Copy link

Looking really good! I didn't expect it to be worked on so quickly 😀

For Organisations, it looks like there is no .profile Repository.

Would it be worth me creating a feature request for an organisation .profile repository, so that we can then add funding to an org?

@pull-request-size pull-request-size bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 28, 2023
@JakobDev
Copy link
Contributor Author

JakobDev commented Jul 28, 2023

Would it be worth me creating a feature request for an organisation .profile repository, so that we can then add funding to an org?

I'm currently using the code to get the Profile Readme to also get the funding config. I can add a new function, which just load the funding config for Organisations, but I wait for Feedback from the Maintainers.

@Utopiah
Copy link

Utopiah commented Aug 30, 2023

Nice, would it work for liberapay: Liberapay too?

@JakobDev
Copy link
Contributor Author

Yes, it would work too

@VetheonGames
Copy link

Is this PR still being worked on? Any way I could help? Would really love to see this feature implemented.

@JakobDev
Copy link
Contributor Author

I'm currently waiting for some feedback from the Maintainers before continuing working

@github-actions github-actions bot added modifies/translation modifies/api This PR adds API routes or modifies them labels Oct 12, 2023
@delvh
Copy link
Member

delvh commented Oct 12, 2023

And now we have a chicken-egg problem as maintainers are waiting for this PR to leave the draft status to review it.

@JakobDev
Copy link
Contributor Author

are waiting for this PR to leave the draft status to review it

I consider the code now as ready, so I remove the draft status. The documentation and the other providers will be added after the Code is reviewed. Organisations are currently not supported.

@JakobDev JakobDev marked this pull request as ready for review October 12, 2023 14:15
Copy link
Member

@a1012112796 a1012112796 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stale?

@@ -650,6 +651,9 @@ func RepoAssignment(ctx *Context) context.CancelFunc {
}
ctx.Repo.GitRepo = gitRepo

ctx.Data["Funding"], _ = funding_service.GetFundingFromDefaultBranch(ctx, ctx.Repo.Repository)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why skip error? looks at least need a error log.

var FundingProviders []*api.FundingProvider

func loadBuiltinFundingProviders() {
FundingProviders = append(FundingProviders, &api.FundingProvider{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest uing option method like lable templates. see https://github.com/go-gitea/gitea/blob/main/modules/options/base.go

return nil, nil
}

gitRepo, err := git.OpenRepository(ctx, r.RepoPath())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

close?

"gopkg.in/yaml.v3"
)

var FundingCandidates = []string{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var FundingCandidates = []string{
var fundingCandidates = []string{


reader, err := treeEntry.Blob().DataAsync()
if err != nil {
log.Debug("DataAsync: %v", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
log.Debug("DataAsync: %v", err)
log.Error("DataAsync: %v", err)

@a1012112796 a1012112796 added this to the 1.23.0 milestone Mar 14, 2024
@lunny lunny modified the milestones: 1.23.0, 1.24.0 Sep 20, 2024
@wxiaoguang wxiaoguang removed this from the 1.24.0 milestone Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/api This PR adds API routes or modifies them modifies/translation size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants