-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Extract api for UI from api v1 routes and remove session dependent for API/v1 #16052
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lunny
changed the title
Split api for UI from api v1 routes
Extract api for UI from api v1 routes
Jun 2, 2021
lunny
force-pushed
the
lunny/api_ui
branch
3 times, most recently
from
June 5, 2021 13:13
654d114
to
d09fa02
Compare
lunny
force-pushed
the
lunny/api_ui
branch
2 times, most recently
from
June 9, 2021 15:26
9c8a3d6
to
d4ae10e
Compare
depends on #16086 |
GiteaBot
added
the
lgtm/need 2
This PR needs two approvals by maintainers to be considered for merging.
label
Jun 9, 2021
@lunny please resolve conficts ;) |
Closed
lunny
force-pushed
the
lunny/api_ui
branch
2 times, most recently
from
July 30, 2021 17:09
d2bc268
to
46060fb
Compare
lunny
force-pushed
the
lunny/api_ui
branch
2 times, most recently
from
August 21, 2021 03:45
40e09b2
to
b2a42da
Compare
Codecov Report
@@ Coverage Diff @@
## main #16052 +/- ##
==========================================
- Coverage 45.38% 45.27% -0.11%
==========================================
Files 760 764 +4
Lines 85495 85736 +241
==========================================
+ Hits 38803 38820 +17
- Misses 40410 40614 +204
- Partials 6282 6302 +20
Continue to review full report at Codecov.
|
lunny
force-pushed
the
lunny/api_ui
branch
3 times, most recently
from
October 15, 2021 08:14
7e75bc1
to
2d4dbf8
Compare
tests are failing |
6543
reviewed
Oct 20, 2021
lunny
changed the title
Extract api for UI from api v1 routes
Extract api for UI from api v1 routes and remove session dependent for API/v1
Mar 25, 2022
This was referenced Apr 4, 2022
6543
pushed a commit
that referenced
this pull request
Apr 7, 2022
Reusing `/api/v1` from Gitea UI Pages have pros and cons. Pros: 1) Less code copy Cons: 1) API/v1 have to support shared session with page requests. 2) You need to consider for each other when you want to change something about api/v1 or page. This PR moves all dependencies to API/v1 from UI Pages. Partially replace #16052
This was referenced Jul 28, 2022
AbdulrhmnGhanem
pushed a commit
to kitspace/gitea
that referenced
this pull request
Aug 24, 2022
Reusing `/api/v1` from Gitea UI Pages have pros and cons. Pros: 1) Less code copy Cons: 1) API/v1 have to support shared session with page requests. 2) You need to consider for each other when you want to change something about api/v1 or page. This PR moves all dependencies to API/v1 from UI Pages. Partially replace go-gitea#16052
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
lgtm/need 2
This PR needs two approvals by maintainers to be considered for merging.
type/enhancement
An improvement of existing functionality
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, API/v1 depends on
Session
auth check but it should be removed. Because mixed UI API requests and API v1 will make something complicated.There are many differences between the two APIs.
UI API in fact should be consumed only by Gitea UI and could not be stable, it could be changed according to UI need and don't care about the break.
But API v1 will be exposed to external applications and should be stable and less break.
UI API should read cookie and session like other routes but API v1 should only read HTTP header for the token when authentication, cookie and session is unnecessary.
UI API should have csrf check but API v1 should not have csrf check.
UI API should not support basic auth but API v1 should support basic auth and token auth
Currently, I copied the routes UI needed from v1 to UI but still use original functions. This is only a start and I think we can do more.
After this merged, API could be disabled or UI could be disabled if someone need that.
depends on #16455