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

Gitea backend for CMS #271

Closed
jimafisk opened this issue Feb 17, 2023 · 4 comments
Closed

Gitea backend for CMS #271

jimafisk opened this issue Feb 17, 2023 · 4 comments
Labels
cms Git-backed content editing enhancement New feature or request

Comments

@jimafisk
Copy link
Member

The people have spoken and they want Gitea backend support for the CMS: https://twitter.com/plentico/status/1615857323292987397

Blocker: Can't commit multiple files to a generic endpoint using the API: go-gitea/gitea#14619

Per these API Docs there are only the 2 following methods for manipulating repo files:

  • PUT /repos​/{owner}​/{repo}​/contents​/{filepath} Update a file in a repository (link)
  • POST ​/repos​/{owner}​/{repo}​/contents​/{filepath} Create a file in a repository (link)
@jimafisk
Copy link
Member Author

We've also been having trouble getting PKCE to work clientside: https://discourse.gitea.io/t/oauth-pkce-example/6573

Sounds like you can't omit the client_secret in Gitea currently: go-gitea/gitea#17107

@jimafisk jimafisk added enhancement New feature or request cms Git-backed content editing labels Jun 1, 2023
@jimafisk
Copy link
Member Author

jimafisk commented Jun 2, 2023

There's been progress on both the API endpoint and PKCE client secret: decaporg/decap-cms#1109 (comment) 🎉

@jimafisk
Copy link
Member Author

jimafisk commented Nov 8, 2024

In testing this, I was getting the following error after being redirected back to my website:

Only refresh_token or authorization_code grant type is supported

I forgot that you need to explicitly set the Content-Type when making your POST/fetch to request the access token (https://forum.gitea.com/t/oauth-pkce-example/6573):

headers: {
    "Content-Type": "application/x-www-form-urlencoded"
}

@jimafisk
Copy link
Member Author

jimafisk commented Nov 8, 2024

Gitea support should be available in v0.7.16 🎉

Just note we added a new provider key to the cms section in plenti.json:

"cms": {
	"provider": "gitea",
	"repo": "https://your-git-host.com/your-org/your-repo",
	"redirect_url": "https://your-static-site.com",
	"app_id": "your-oauth-id-from-gitea",
	"branch": "master"
}

The provider key is helpful since you can self-host Gitea and GitLab, which would make the repo live at a different URL than the officially supported ones (gitlab.com and gitea.com) which wouldn't necessarily communicate which platform you're on. If you omit this key, it defaults back to GitLab to ensure backwards compatibility with older version of Plenti.

Note that since the APIs have not diverged too much at this point, this release also supports the Gitea fork Forgejo and you can use that as a provider name if you prefer.

@jimafisk jimafisk closed this as completed Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cms Git-backed content editing enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant