summaryrefslogtreecommitdiffstats
path: root/routers
Commit message (Collapse)AuthorAgeFilesLines
* Add skip and limit to git.GetTags (#16897)65432021-09-102-15/+16
| | | | * Make GetTags() api similar to GetBranches() * Use it for Tag/Release page
* Add setting to OAuth handlers to skip local 2FA authentication (#16594)zeripath2021-09-102-8/+13
| | | | | | | | This PR adds a setting to OAuth and OpenID login sources to allow the source to skip local 2FA authentication. Fix #13939 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Calculate label URL on API (#16186)65432021-09-103-11/+15
| | | close #8028
* Add repo_id for attachment (#16958)Lunny Xiao2021-09-083-38/+17
| | | | | | | When create a new issue or comment and paste/upload an attachment/image, it will not assign an issue id before submit. So if user give up the creating, the attachments will lost key feature and become dirty content. We don't know if we need to delete the attachment even if the repository deleted. This PR add a repo_id in attachment table so that even if a new upload attachment with no issue_id or release_id but should have repo_id. When deleting a repository, they could also be deleted. Co-authored-by: 6543 <6543@obermui.de>
* Make mirror feature more configurable (#16957)65432021-09-076-13/+39
| | | | | | | | | | | Rename`[repository]` `DISABLE_MIRRORS` to `[mirror]` `DISABLE_NEW_PULL` and add `ENABLED` and `DISABLE_NEW_PUSH` with the below meanings: - `ENABLED`: **true**: Enables the mirror functionality. Set to **false** to disable all mirrors. - `DISABLE_NEW_PULL`: **false**: Disable the creation of **new** mirrors. Pre-existing mirrors remain valid. - `DISABLE_NEW_PUSH`: **false**: Disable the creation of **new** push mirrors. Pre-existing mirrors remain valid. Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: delvh <dev.lh@web.de>
* Add Cache-Control to avatar redirects (#16973)silverwind2021-09-061-3/+9
| | | | | | | | | | | | | | * Add Cache-Control to avatar redirects This does seem to do the trick to make the Avatar redirects cachable in Chrome. In Firefox, it does not seem to work, thought and I found no way to suppress the requests to the original URLs, I even tried setting an Etag to no avail. Related discussion in https://github.com/go-gitea/gitea/issues/16964. Co-authored-by: zeripath <art27@cantab.net>
* Ensure that rebase conflicts are handled in updates (#16952)zeripath2021-09-052-0/+18
| | | | | | | | | PR #16125 did not update the error handlers to handle conflict errors relating to rebases. This PR adds them. Fix #16922 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Correctly return the number of Repositories for Organizations (#16807)zeripath2021-09-011-1/+1
| | | | | | | | | | | | | | | Calculate and return the number of Repositories on the dashboard Organization list. This PR restores some of the logic that was removed in #14032 to calculate the number of repos on the dashboard orgs list. Fix #16648 Replaces #16799 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Add option to update pull request by `rebase` (#16125)a10121127962021-08-312-7/+16
| | | | | * add option to update pull request by `rebase` Signed-off-by: a1012112796 <1012112796@qq.com>
* Fix git.Blob.DataAsync(): close pipe since we return a NopCloser (#16899)65432021-08-313-5/+5
| | | | | | | * make sure headGitRepo is closed on err too * refactor * Fix git.Blob.DataAsync(): exec cancel since we already read all bytes (close pipe since we return a NopCloser)
* Repare and Improve GetDiffRangeWithWhitespaceBehavior (#16894)65432021-08-313-14/+12
| | | | | * repare and improve GetDiffRangeWithWhitespaceBehavior * Context with Timeout
* Fix wiki raw commit diff/patch view (#16891)65432021-08-311-1/+1
|
* Ensure wiki repos are all closed (#16886)zeripath2021-08-301-32/+34
| | | | | | | There are multiple places where wiki git repositories are not properly closed. This PR ensures they are closed. Signed-off-by: Andrew Thornton <art27@cantab.net>
* [API] List limited and private orgs if authentificated (#16866)65432021-08-303-4/+4
| | | | | | | * fix bug #16785 and similar * code format * CI.restart()
* Paginate releases page & set default page size to 10 (#16857)Lunny Xiao2021-08-291-2/+8
| | | | | | | * Add release default page and set it to 10 * use limit Co-authored-by: 6543 <6543@obermui.de>
* In Render tolerate not being passed a context (#16842)zeripath2021-08-286-0/+13
| | | | | | | | | | | | | | | | | | | * In Render tolerate not being passed a context It is possible for RenderString to be passed to an external renderer if markdown is set to be rendered by an external renderer. No context is currently sent to these meaning that this will error out. Fix #16835 Signed-off-by: Andrew Thornton <art27@cantab.net> * Add Context to Repo calls for RenderString All calls from routers can easily add the context - so add it. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Refactor the fork service slightly to take ForkRepoOptions (#16744)Kyle Evans2021-08-282-2/+10
| | | | | | | | | | | | | | | | | | | | * Refactor the fork service slightly to take ForkRepoOptions This reduces the number of places we need to change if we want to add other options during fork time. Signed-off-by: Kyle Evans <kevans@FreeBSD.org> * Fix integrations and tests after ForkRepository refactor Signed-off-by: Kyle Evans <kevans@FreeBSD.org> * Update OldRepo -> BaseRepo Signed-off-by: Kyle Evans <kevans@FreeBSD.org> * gofmt pass Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
* Decoupled code from DefaultSigningKey (#16743)KN4CK3R2021-08-272-18/+18
| | | Decoupled code from `DefaultSigningKey`. Makes testing a little bit easier and is cleaner.
* Add modals to Organization and Team remove/leave (#16471)zeripath2021-08-262-6/+47
| | | | | | | | | | | | | | | | | | | | | | | | | * Add modals to Organization and Team remove/leave Add confirmation modals to Organization and Team remove and leave. Fix #16215 Signed-off-by: Andrew Thornton <art27@cantab.net> * avoid for-in Signed-off-by: Andrew Thornton <art27@cantab.net> * Revert "avoid for-in" This reverts commit 2af9a6f9d46ed31b6fc6e3a29e695577dcf09f75. * Apply suggestions from code review Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Add EdDSA JWT signing algorithm (#16786)Aliaksandr Mianzhynski2021-08-252-2/+2
| | | | | | | | * Add EdDSA signing algorithm * Fix typo Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Fix branch pagination error (#16805)Lunny Xiao2021-08-241-1/+1
| | | | | Fix #16801 Even if default branch is removed from the current page, but the total branches number should be still kept. So that the pagination calculation will be correct.
* Add bundle download for repository (#14538)John Olheiser2021-08-242-4/+6
| | | | | | | | | | | | | | | | | * Add bundle download Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix fmt Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix build tags Signed-off-by: jolheiser <john.olheiser@gmail.com> * Download specific commit Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Add missing return to handleSettingRemoteAddrError (#16794)zeripath2021-08-231-0/+1
| | | | | | | | | | There is a missing return in handleSettingRemoteAddrError which means that the error page for repo settings is duplicately rendered. Fix #16771 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Download lfs in git and web workflow from minio/s3 directly (#16731)Abner2021-08-211-0/+12
|
* when the update request doesn't intend to update attachments (eg: change ↵wxiaoguang2021-08-211-10/+12
| | | | checkbox state), ignore attachment updates (#16762)
* Added introspection endpoint. (#16752)KN4CK3R2021-08-202-55/+44
| | | Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Keep attachments on tasklist update (#16750)KN4CK3R2021-08-201-7/+11
| | | | | | | | | | | * Send attachments too. * Use tasklist flag. * use action="ignoreAttachments" instead of "tasklist" * Use boolean parameter. Co-authored-by: zeripath <art27@cantab.net>
* Fix wrong user in OpenID response (#16736)KN4CK3R2021-08-192-10/+85
| | | | | * Fixed usage of wrong user. * Added tests.
* Fix spelling of HookProcReceiveResult (#16690)Lunny Xiao2021-08-141-1/+1
|
* Add filter by owner and team to issue/pulls search endpoint (#16662)Jimmy Praet2021-08-131-0/+39
| | | | | * Filter by owner and team in API issue/pulls search * Add integration test
* [API] generalize list header (#16551)65432021-08-1248-154/+316
| | | | | | | | | | | | | * Add info about list endpoints to CONTRIBUTING.md * Let all list endpoints return X-Total-Count header * Add TODOs for GetCombinedCommitStatusByRef * Fix models/issue_stopwatch.go * Rrefactor models.ListDeployKeys * Introduce helper func and use them for SetLinkHeader related func
* Improve SMTP authentication and Fix user creation bugs (#16612)zeripath2021-08-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Improve SMTP authentication, Fix user creation bugs and add LDAP cert/key options This PR has two parts: Improvements for SMTP authentication: * Default to use SMTPS if port is 465, and allow setting of force SMTPS. * Always use STARTTLS if available * Provide CRAM-MD5 mechanism * Add options for HELO hostname disabling * Add options for providing certificates and keys * Handle application specific password response as a failed user login instead of as a 500. Close #16104 Fix creation of new users: * A bug was introduced when allowing users to change usernames which prevents the creation of external users. * The LoginSource refactor also broke this page. Close #16104 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Related refactors to ctx.FormX functions (#16567)65432021-08-1122-52/+36
| | | | | | | * use FormTrim if posible * speedup goGet * only convert if nessesary
* Add an api endpoint to fetch git notes (#15373) (#16649)nitul19912021-08-113-0/+90
| | | close #15373
* Rename ctx.Form() to ctx.FormString() and move code into own file (#16571)65432021-08-1160-203/+203
| | | | | | | Followup from #16562 prepare for #16567 * Rename ctx.Form() to ctx.FormString() * Reimplement FormX func to need less code and cpu cycles * Move code into own file
* Replace `list.List` with slices (#16311)KN4CK3R2021-08-097-76/+32
| | | | | | | | | | | | | | | | | | | * Replaced list with slice. * Fixed usage of pointer to temporary variable. * Replaced LIFO list with slice. * Lint * Removed type check. * Removed duplicated code. * Lint * Fixed merge. Co-authored-by: 6543 <6543@obermui.de>
* Allow setting X-FRAME-OPTIONS (#16643)zeripath2021-08-062-2/+2
| | | | | | | | | | | | | | | * Allow setting X-FRAME-OPTIONS This PR provides a mechanism to set the X-FRAME-OPTIONS header. Fix #7951 Signed-off-by: Andrew Thornton <art27@cantab.net> * Update docs/content/doc/advanced/config-cheat-sheet.en-us.md Co-authored-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
* Add microsoft oauth2 providers (#16544)zeripath2021-08-052-17/+34
| | | | | | | | | | | | | | | | | * Clean up oauth2 providers Signed-off-by: Andrew Thornton <art27@cantab.net> * Add AzureAD, AzureADv2, MicrosoftOnline OAuth2 providers Signed-off-by: Andrew Thornton <art27@cantab.net> * Apply suggestions from code review * remove unused Scopes Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Set AllowedHeaders on API CORS handler (#16524)zeripath2021-08-042-0/+2
| | | | | | | | Set AllowedHeaders on API CORS handler and add missing Access-Control-Expose-Headers to pull API. Fix #16100 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Swagger AccessToken fixes (#16574)zeripath2021-08-013-7/+12
| | | | | | | | | | | There is a subtle problem with the Swagger definition for AccessTokens which causes autogeneration of APIs for these endpoints to fail. This PR corrects these errors. Ref: https://github.com/zeripath/java-gitea-api/issues/4 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Fix swagger doc by rename repoAddTopíc to repoAddTopic (#16580)Lars Hvam2021-08-011-1/+1
| | | | | * Swagger API: rename repoAddTopíc to repoAddTopic This changes the operationId to only contain 7 bit ascii, note "í" instead of "i"
* Pre-fill suggested New File 'name' and 'content' with Query Params (#16556)AJ ONeal2021-07-291-2/+7
| | | | | * feature: add (GitHub-style) querystrings for pre-filling new file content * docs: add query parameters for new files
* Show correct text when comparing commits on empty pull request (#16569)Marty2021-07-291-0/+4
| | | | | | | | | | | * fix * use own text * Update templates/repo/commits_table.tmpl Co-authored-by: marty <m.karkossa@ultraware.nl> Co-authored-by: zeripath <art27@cantab.net>
* Rename context.Query to context.Form (#16562)Lunny Xiao2021-07-2981-369/+369
|
* Add agit flow support in gitea (#14295)a10121127962021-07-2810-6/+192
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * feature: add agit flow support ref: https://git-repo.info/en/2020/03/agit-flow-and-git-repo/ example: ```Bash git checkout -b test echo "test" >> README.md git commit -m "test" git push origin HEAD:refs/for/master -o topic=test ``` Signed-off-by: a1012112796 <1012112796@qq.com> * fix lint * simplify code add fix some nits * update merge help message * Apply suggestions from code review. Thanks @jiangxin * add forced-update message * fix lint * splite writePktLine * add refs/for/<target-branch>/<topic-branch> support also * Add test code add fix api * fix lint * fix test * skip test if git version < 2.29 * try test with git 2.30.1 * fix permission check bug * fix some nit * logic implify and test code update * fix bug * apply suggestions from code review * prepare for merge Signed-off-by: Andrew Thornton <art27@cantab.net> * fix permission check bug - test code update - apply suggestions from code review @zeripath Signed-off-by: a1012112796 <1012112796@qq.com> * fix bug when target branch isn't exist * prevent some special push and fix some nits * fix lint * try splite * Apply suggestions from code review - fix permission check - handle user rename * fix version negotiation * remane * fix template * handle empty repo * ui: fix branch link under the title * fix nits Co-authored-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Handle too long PR titles correctly (#16517)zeripath2021-07-252-0/+25
| | | | | | | | | | | | | | | The CompareAndPullRequestPost handler for POST to /compare incorrectly handles returning errors to the user. For a start it does not set the necessary markers to switch SimpleMDE but it also does not immediately return to the form. This PR fixes this by setting the appropriate values, fixing the templates and preventing the suggestion of a too long title. Fix #16507 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add an abstract json layout to make it's easier to change json library (#16528)Lunny Xiao2021-07-2411-30/+15
| | | | | | | | | | | * Add an abstract json layout to make it's easier to change json library * Fix import * Fix import sequence * Fix blank lines * Fix blank lines
* switch to maintained lib (#16532)techknowlogick2021-07-241-1/+1
| | | | Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Andrew Thornton <art27@cantab.net>
* Refactor: Move login out of models (#16199)zeripath2021-07-247-84/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `models` does far too much. In particular it handles all `UserSignin`. It shouldn't be responsible for calling LDAP, SMTP or PAM for signing in. Therefore we should move this code out of `models`. This code has to depend on `models` - therefore it belongs in `services`. There is a package in `services` called `auth` and clearly this functionality belongs in there. Plan: - [x] Change `auth.Auth` to `auth.Method` - as they represent methods of authentication. - [x] Move `models.UserSignIn` into `auth` - [x] Move `models.ExternalUserLogin` - [x] Move most of the `LoginVia*` methods to `auth` or subpackages - [x] Move Resynchronize functionality to `auth` - Involved some restructuring of `models/ssh_key.go` to reduce the size of this massive file and simplify its files. - [x] Move the rest of the LDAP functionality in to the ldap subpackage - [x] Re-factor the login sources to express an interfaces `auth.Source`? - I've done this through some smaller interfaces Authenticator and Synchronizable - which would allow us to extend things in future - [x] Now LDAP is out of models - need to think about modules/auth/ldap and I think all of that functionality might just be moveable - [x] Similarly a lot Oauth2 functionality need not be in models too and should be moved to services/auth/source/oauth2 - [x] modules/auth/oauth2/oauth2.go uses xorm... This is naughty - probably need to move this into models. - [x] models/oauth2.go - mostly should be in modules/auth/oauth2 or services/auth/source/oauth2 - [x] More simplifications of login_source.go may need to be done - Allow wiring in of notify registration - *this can now easily be done - but I think we should do it in another PR* - see #16178 - More refactors...? - OpenID should probably become an auth Method but I think that can be left for another PR - Methods should also probably be cleaned up - again another PR I think. - SSPI still needs more refactors.* Rename auth.Auth auth.Method * Restructure ssh_key.go - move functions from models/user.go that relate to ssh_key to ssh_key - split ssh_key.go to try create clearer function domains for allow for future refactors here. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix issue pasted image missing if no release permission (#16520)Lunny Xiao2021-07-231-1/+6
| | | | | | | | | | * Fix issue pasted image missing if no release permission * Update routers/web/web.go Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>