6543 and GitHub
1ebb30e41b
Pass gitRepo down to GetRawDiff, since its used for main repo and wiki ( #19461 )
...
as per https://github.com/go-gitea/gitea/pull/19449#issuecomment-1105283931
pass gitRepo down to GetRawDiff, since its used for main repo and wiki
2022-04-25 20:45:18 +02:00
Lunny Xiao and GitHub
7c164d5a91
Use queue instead of memory queue in webhook send service ( #19390 )
2022-04-25 20:03:01 +02:00
6543 and GitHub
ddbbe6e15c
User specific repoID or xorm builder conditions for issue search ( #19475 )
...
* extend models.IssuesOptions to have more specific repo filter options
* use new options
* unrelated refactor
* rm RepoIDs
2022-04-25 16:06:24 +02:00
Gusted and GitHub
240b3aa218
Mark TemplateLoading error as "UnprocessableEntity" ( #19445 )
...
- Don't return Internal Server error if the user provide incorrect label
template, instead return UnprocessableEntity.
- Resolves #19399
2022-04-22 19:19:55 +02:00
3ec1b6c223
Fix logging of Transfer API ( #19456 )
...
- Use the correct fullname's in tracing calls.
- Return correct function name in error.
Co-authored-by: 6543 <6543@obermui.de >
2022-04-22 00:05:53 +08:00
6543 and GitHub
c764355676
RepoAssignment ensure to close before overwrite ( #19449 )
...
* check if GitRepo already open and close if
* only run RepoAssignment once
* refactor context helper for api to open GitRepo
2022-04-21 17:17:57 +02:00
Gusted and GitHub
f4c1aa75be
Fix DELETE request for non-existent public key ( #19443 )
...
- Add a return for the first "block" of errors, which fixes the double
error messages.
- Add a return for `externallyManaged`.
- Resolves #19398
2022-04-21 03:08:30 +02:00
Gusted and GitHub
23d37673bd
Don't panic on ErrEmailInvalid ( #19441 )
...
- Don't panic on `ErrEmailInvalid`, this was caused due that we were
trying to force `ErrEmailCharIsNotSupported` interface, which panics.
- Resolves #19397
2022-04-20 23:39:30 +02:00
qwerty287 and GitHub
ae6a52440a
Fix panic in team repos API ( #19431 )
...
* Fix panic in team repos API
* Fix pagination
* fmt
2022-04-20 18:43:26 +08:00
zeripath and GitHub
409ff55a29
When updating mirror repo intervals by API reschedule next update too ( #19429 )
...
When a mirror repo interval is updated by the UI it is rescheduled with that interval
however the API does not do this. The API also lacks the enable_prune option.
This PR adds this functionality in to the API Edit Repo endpoint.
Signed-off-by: Andrew Thornton <art27@cantab.net >
2022-04-20 09:20:53 +01:00
KN4CK3R and GitHub
18727df73a
Add Helm Chart registry ( #19406 )
2022-04-19 12:55:35 -04:00
Lunny Xiao and GitHub
b8911fb456
Use a struct as test options ( #19393 )
...
* Use a struct as test options
* Fix name
* Fix test
2022-04-14 21:58:21 +08:00
Anthony Wang
7931e210e5
Make pubKey IRI #main-key instead of /#main-key
2022-04-13 11:19:17 -05:00
f029b9ae4f
Document 409 error returned by repos/migrate api ( #19376 )
...
* Document 409 error returned by repos/migrate api
* Generate swagger spec
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com >
2022-04-12 16:13:07 +08:00
delvh and GitHub
d139c23967
Fix panic in teams API when requesting members ( #19360 )
2022-04-11 20:49:49 +08:00
Lunny Xiao and GitHub
1dfa26e00e
Move milestone to models/issues/ ( #19278 )
...
* Move milestone to models/issues/
* Fix lint
* Fix test
* Fix lint
* Fix lint
2022-04-08 17:11:15 +08:00
Lunny Xiao and GitHub
3c3d49899f
Remove dependent on session auth for api/v1 routers ( #19321 )
...
* Remove dependent on session auth for api/v1 routers
* Remove unnecessary session on API context
* remove missed header
* fix test
* fix missed api/v1
2022-04-08 06:22:10 +02:00
Lunny Xiao and GitHub
783a021889
Never use /api/v1 from Gitea UI Pages ( #19318 )
...
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
2022-04-07 20:59:56 +02:00
KN4CK3R and GitHub
5e242e021b
Package registry changes ( #19305 )
...
* removed debug logs
* fixed SELECT
* removed unneeded error type
* use common SearchVersions method
* remove empty container upload versions
* return err
2022-04-06 03:32:09 +02:00
43ff92e122
An attempt to sync a non-mirror repo must give 400 (Bad Request) ( #19300 )
...
* An attempt to sync a non-mirror repo must give 400 (Bad Request)
* add missing return statement
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com >
Co-authored-by: techknowlogick <techknowlogick@gitea.io >
2022-04-01 14:29:57 -04:00
KN4CK3R and GitHub
08d199245a
Fix container download counter ( #19287 )
...
* Increment counter on manifest download.
* Refactor GetPackageFileStream method.
2022-04-01 01:08:32 +02:00
6543 and GitHub
9c349a4277
Move checks for pulls before merge into own function ( #19271 )
...
This make checks in one single place so they dont differ and maintainer can not forget a check in one place while adding it to the other .... ( as it's atm )
Fix:
* The API does ignore issue dependencies where Web does not
* The API checks if "IsSignedIfRequired" where Web does not - UI probably do but nothing will some to craft custom requests
* Default merge message is crafted a bit different between API and Web if not set on specific cases ...
2022-03-31 16:53:08 +02:00
d4f84f1c93
Move reaction to models/issues/ ( #19264 )
...
* Move reaction to models/issues/
* Fix test
* move the function
* improve code
* Update models/issues/reaction.go
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com >
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com >
2022-03-31 17:20:39 +08:00
wxiaoguang and GitHub
c83168104b
Use a more general (and faster) method to sanitize URLs with credentials ( #19239 )
...
Use a more general method to sanitize URLs with credentials: Simple and intuitive / Faster / Remove all credentials in all URLs
2022-03-31 10:25:40 +08:00
Anthony Wang
1da0d49de7
Clean up some variable declarations
2022-03-30 15:52:52 -05:00
1d332342db
Add Package Registry ( #16510 )
...
* Added package store settings.
* Added models.
* Added generic package registry.
* Added tests.
* Added NuGet package registry.
* Moved service index to api file.
* Added NPM package registry.
* Added Maven package registry.
* Added PyPI package registry.
* Summary is deprecated.
* Changed npm name.
* Sanitize project url.
* Allow only scoped packages.
* Added user interface.
* Changed method name.
* Added missing migration file.
* Set page info.
* Added documentation.
* Added documentation links.
* Fixed wrong error message.
* Lint template files.
* Fixed merge errors.
* Fixed unit test storage path.
* Switch to json module.
* Added suggestions.
* Added package webhook.
* Add package api.
* Fixed swagger file.
* Fixed enum and comments.
* Fixed NuGet pagination.
* Print test names.
* Added api tests.
* Fixed access level.
* Fix User unmarshal.
* Added RubyGems package registry.
* Fix lint.
* Implemented io.Writer.
* Added support for sha256/sha512 checksum files.
* Improved maven-metadata.xml support.
* Added support for symbol package uploads.
* Added tests.
* Added overview docs.
* Added npm dependencies and keywords.
* Added no-packages information.
* Display file size.
* Display asset count.
* Fixed filter alignment.
* Added package icons.
* Formatted instructions.
* Allow anonymous package downloads.
* Fixed comments.
* Fixed postgres test.
* Moved file.
* Moved models to models/packages.
* Use correct error response format per client.
* Use simpler search form.
* Fixed IsProd.
* Restructured data model.
* Prevent empty filename.
* Fix swagger.
* Implemented user/org registry.
* Implemented UI.
* Use GetUserByIDCtx.
* Use table for dependencies.
* make svg
* Added support for unscoped npm packages.
* Add support for npm dist tags.
* Added tests for npm tags.
* Unlink packages if repository gets deleted.
* Prevent user/org delete if a packages exist.
* Use package unlink in repository service.
* Added support for composer packages.
* Restructured package docs.
* Added missing tests.
* Fixed generic content page.
* Fixed docs.
* Fixed swagger.
* Added missing type.
* Fixed ambiguous column.
* Organize content store by sha256 hash.
* Added admin package management.
* Added support for sorting.
* Add support for multiple identical versions/files.
* Added missing repository unlink.
* Added file properties.
* make fmt
* lint
* Added Conan package registry.
* Updated docs.
* Unify package names.
* Added swagger enum.
* Use longer TEXT column type.
* Removed version composite key.
* Merged package and container registry.
* Removed index.
* Use dedicated package router.
* Moved files to new location.
* Updated docs.
* Fixed JOIN order.
* Fixed GROUP BY statement.
* Fixed GROUP BY #2 .
* Added symbol server support.
* Added more tests.
* Set NOT NULL.
* Added setting to disable package registries.
* Moved auth into service.
* refactor
* Use ctx everywhere.
* Added package cleanup task.
* Changed packages path.
* Added container registry.
* Refactoring
* Updated comparison.
* Fix swagger.
* Fixed table order.
* Use token auth for npm routes.
* Enabled ReverseProxy auth.
* Added packages link for orgs.
* Fixed anonymous org access.
* Enable copy button for setup instructions.
* Merge error
* Added suggestions.
* Fixed merge.
* Handle "generic".
* Added link for TODO.
* Added suggestions.
* Changed temporary buffer filename.
* Added suggestions.
* Apply suggestions from code review
Co-authored-by: Thomas Boerger <thomas@webhippie.de >
* Update docs/content/doc/packages/nuget.en-us.md
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com >
Co-authored-by: Thomas Boerger <thomas@webhippie.de >
2022-03-30 16:42:47 +08:00
6543 and GitHub
3e88af898a
Make git.OpenRepository accept Context ( #19260 )
...
* OpenRepositoryCtx -> OpenRepository
* OpenRepository -> openRepositoryWithDefaultContext, only for internal usage
2022-03-30 03:13:41 +08:00
Lunny Xiao and GitHub
74731c3a5a
Move some issue methods as functions ( #19255 )
...
* Move some issue methods as functions
* Fix bug
2022-03-29 16:57:33 +02:00
John Olheiser and GitHub
ea6efba9b3
Granular webhook events in editHook ( #19251 )
...
Signed-off-by: jolheiser <john.olheiser@gmail.com >
2022-03-29 13:55:00 +02:00
76aa33d884
Move init repository related functions to modules ( #19159 )
...
* Move init repository related functions to modules
* Fix lint
* Use ctx but db.DefaultContext
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com >
2022-03-29 15:23:45 +08:00
b06b9a056c
Move organization related structs into sub package ( #18518 )
...
* Move organization related structs into sub package
* Fix test
* Fix lint
* Move more functions into sub packages
* Fix bug
* Fix test
* Update models/organization/team_repo.go
Co-authored-by: KN4CK3R <admin@oldschoolhack.me >
* Apply suggestions from code review
Co-authored-by: KN4CK3R <admin@oldschoolhack.me >
* Fix fmt
* Follow suggestion from @Gusted
* Fix test
* Fix test
* Fix bug
* Use ctx but db.DefaultContext on routers
* Fix bug
* Fix bug
* fix bug
* Update models/organization/team_user.go
* Fix bug
Co-authored-by: KN4CK3R <admin@oldschoolhack.me >
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com >
2022-03-29 14:29:02 +08:00
zeripath and GitHub
e69b7a92ed
Allow API to create file on empty repo ( #19224 )
...
This PR adds the necessary work to make it possible to create files on empty
repos using the API.
Fix #10993
Signed-off-by: Andrew Thornton <art27@cantab.net >
2022-03-28 21:48:41 +02:00
6526733a58
Let web and API routes have different auth methods group ( #19168 )
...
* remove the global methods but create dynamiclly
* Fix lint
* Fix windows lint
* Fix windows lint
* some improvements
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com >
2022-03-28 12:46:28 +08:00
Anthony Wang
373a84a8e2
Clean up whitespace with make fmt
2022-03-27 12:25:56 -05:00
Anthony Wang
21c56f8e94
Use the httplib module instead of http for GET requests
2022-03-27 12:25:27 -05:00
f316582458
Set the default branch for repositories generated from templates ( #19136 )
...
* Set the default branch for repositories generated from templates
* Allows default branch to be set through the API for repos generated from templates
* Update swagger API template
* Only set default branch to the one from the template if not specified
* Use specified default branch if it exists while generating git commits
Fix #19082
Co-authored-by: John Olheiser <john.olheiser@gmail.com >
Co-authored-by: zeripath <art27@cantab.net >
2022-03-27 03:56:28 +01:00
KN4CK3R and GitHub
59b867dc2d
Add ContextUser to http request context ( #18798 )
...
This PR adds a middleware which sets a ContextUser (like GetUserByParams before) in a single place which can be used by other methods. For routes which represent a repo or org the respective middlewares set the field too.
Also fix a bug in modules/context/org.go during refactoring.
2022-03-26 17:04:22 +08:00
Anthony Wang
46973f99fa
Cleanup, handle invalid usernames for ActivityPub person GET request
...
Signed-off-by: Anthony Wang <ta180m@pm.me >
2022-03-24 18:44:44 -05:00
KN4CK3R and GitHub
3f280f89e7
Update HTTP status codes to modern codes ( #18063 )
...
* 2xx/3xx/4xx/5xx -> http.Status...
* http.StatusFound -> http.StatusTemporaryRedirect
* http.StatusMovedPermanently -> http.StatusPermanentRedirect
2022-03-23 12:54:07 +08:00
wxiaoguang and GitHub
7a550b3af2
Use ctx instead of db.DefaultContext in some packages(routers/services/modules) ( #19163 )
...
* Remove `db.DefaultContext` usage in routers, use `ctx` directly
* Use `ctx` directly if there is one, remove some `db.DefaultContext` in `services`
* Use ctx instead of db.DefaultContext for `cmd` and some `modules` packages
* fix incorrect context usage
2022-03-22 16:22:54 +01:00
wxiaoguang and GitHub
2b55422cd7
Fix the bug: deploy key with write access can not push ( #19010 )
...
Use DeployKeyID to replace the IsDeployKey, then CanWriteCode uses the DeployKeyID to check the write permission.
2022-03-22 17:29:07 +08:00
80fd25524e
Renamed ctx.User to ctx.Doer. ( #19161 )
...
Co-authored-by: 6543 <6543@obermui.de >
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com >
2022-03-22 15:03:22 +08:00
Gusted and GitHub
49c5fc565c
Fix NPE /repos/issues/search when not signed in ( #19154 )
...
- Don't panic when on
`/repos/issues/search?{created,assigned,mentioned,review_requested}=true`
when client didn't pass any authentication.
- Resolves #19115
2022-03-20 22:04:51 +01:00
Anthony Wang
f9e33d97cc
Run make fmt and make generate-swagger
...
Signed-off-by: Anthony Wang <ta180m@pm.me >
2022-03-19 09:14:08 -05:00
Anthony Wang
b480c52f60
Change 2021 to 2022, properly format package imports
...
Signed-off-by: Anthony Wang <ta180m@pm.me >
2022-03-19 08:55:58 -05:00
Loïc Dachary and Anthony Wang
97fedf2616
activitypub: implement the ReqSignature middleware
...
Signed-off-by: Loïc Dachary <loic@dachary.org >
2022-03-18 17:34:09 -05:00
Loïc Dachary and Anthony Wang
678a56fbf8
activitypub: add the public key to Person ( #14186 )
...
Refs: https://github.com/go-gitea/gitea/issues/14186
Signed-off-by: Loïc Dachary <loic@dachary.org >
2022-03-18 17:34:09 -05:00
Loïc Dachary and Anthony Wang
4951af4d99
activitypub: implement /api/v1/activitypub/user/{username} ( #14186 )
...
Return informations regarding a Person (as defined in ActivityStreams
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-person ).
Refs: https://github.com/go-gitea/gitea/issues/14186
Signed-off-by: Loïc Dachary <loic@dachary.org >
2022-03-18 17:33:29 -05:00
Lunny Xiao and GitHub
18033f49ba
Restrict email address validation ( #17688 )
...
This didn't follow the RFC but it's a subset of that. I think we should narrow the allowed chars at first and discuss more possibility in future PRs.
2022-03-14 18:39:54 +01:00
Jimmy Praet and GitHub
5184c83f6b
Add config option to disable "Update branch by rebase" ( #18745 )
2022-03-04 03:30:49 -05:00