Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

feat: Gitea backend refactoring #833

Merged
merged 4 commits into from
Jun 6, 2023

Conversation

denyskon
Copy link
Contributor

@denyskon denyskon commented Jun 5, 2023

Changes

With go-gitea/gitea#24887 and go-gitea/gitea#25033 being merged, the two major issues with the Gitea backend can finally be resolved:

  1. Authorization: Up until now, Gitea didn't support PKCE auth. As Netlify doesn't support Gitea, users were required to setup an external OAuth provider (e. g. https://github.com/denyskon/teabag). With Allow for PKCE flow without client secret + add docs go-gitea/gitea#25033, Gitea now supports PKCE auth, which allows for simple and secure client-side authorization without using an OAuth provider.
    -> refactor authentication to use PKCE

  2. Multiple-file commits: As above, modifying or creating multiple files wasn't possible using Gitea's API. With API endpoint for changing/creating/deleting multiple files go-gitea/gitea#24887, a new API endpoint was added which provides this functionality. The original behavior caused a lot of problems (too many commits for multiple files -> too many CI runs -> high server load, entries appearing before the included media....)
    -> refactor file saving/deletion to use new API endpoint

These changes are a big quality improvement for the backend and a step towards bringing it out of beta.

Consequences

This refactoring counts as breaking for two reasons:

  1. API endpoints: some of the endpoints used by the backend starting from now will only be available since Gitea 1.20, which is expected to be released around the 1st of July 2023. Older Gitea versions won't work.

  2. Config: the backend config slightly changes because of the switch to PKCE auth. Users will need to update their config accordingly to the docs.

To Do

The breaking changes need to be documented in a migration guide for Static CMS v3.0 or the release notes.

Other

With this change, the Gitea backend no longer depends on third-party infrastructure beside the Gitea instance, allowing for testing using the official test instance provided by the Gitea project.

@netlify
Copy link

netlify bot commented Jun 5, 2023

Deploy Preview for staticjscms ready!

Name Link
🔨 Latest commit deeafdd
🔍 Latest deploy log https://app.netlify.com/sites/staticjscms/deploys/647e414fb15f4e0008ed00bd
😎 Deploy Preview https://deploy-preview-833.staticcms.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Jun 5, 2023

Deploy Preview for demo-staticjscms ready!

Name Link
🔨 Latest commit deeafdd
🔍 Latest deploy log https://app.netlify.com/sites/demo-staticjscms/deploys/647e414f2f87b10008975a21
😎 Deploy Preview https://deploy-preview-833.demo.staticcms.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@denyskon denyskon changed the title Gitea backend refactor feat: Gitea backend refactoring Jun 5, 2023
@codecov
Copy link

codecov bot commented Jun 5, 2023

Codecov Report

Merging #833 (deeafdd) into next (77f5a51) will increase coverage by 0.10%.
The diff coverage is 63.26%.

@@            Coverage Diff             @@
##             next     #833      +/-   ##
==========================================
+ Coverage   51.56%   51.67%   +0.10%     
==========================================
  Files         218      218              
  Lines        9254     9264      +10     
  Branches     2440     2442       +2     
==========================================
+ Hits         4772     4787      +15     
+ Misses       4135     4130       -5     
  Partials      347      347              
Impacted Files Coverage Δ
packages/core/src/lib/auth/pkce-oauth.ts 6.84% <0.00%> (+0.27%) ⬆️
...ges/core/src/backends/gitea/AuthenticationPage.tsx 23.07% <15.38%> (-3.02%) ⬇️
...ackages/core/src/backends/gitea/implementation.tsx 46.10% <33.33%> (-0.28%) ⬇️
packages/core/src/backends/gitea/API.ts 59.34% <96.55%> (+5.58%) ⬆️

@KaneFreeman KaneFreeman merged commit 6cb1098 into StaticJsCMS:next Jun 6, 2023
@denyskon denyskon deleted the feat/gitea-backend-refactor branch June 6, 2023 15:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants