summaryrefslogtreecommitdiffstats
path: root/routers
Commit message (Collapse)AuthorAgeFilesLines
* Make LDAP be able to skip local 2FA (#16954)zeripath2021-09-174-4/+15
| | | | | | This PR extends #16594 to allow LDAP to be able to be set to skip local 2FA too. The technique used here would be extensible to PAM and SMTP sources. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Clean-up HookPreReceive and restore functionality for pushing non-standard ↵zeripath2021-09-168-780/+990
| | | | | | | | | | | | | | | | | | refs (#16705) * Clean-up HookPreReceive and restore functionality for pushing non-standard refs There was an inadvertent breaking change in #15629 meaning that notes refs and other git extension refs will be automatically rejected. Further following #14295 and #15629 the pre-recieve hook code is untenably long and too complex. This PR refactors the hook code and removes the incorrect forced rejection of non-standard refs. Fix #16688 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Decrement Fork Num when converting from Fork (#17035)zeripath2021-09-141-4/+2
| | | | | | | | When converting repositories from forks to normal the root NumFork needs to be decremented too. Fix #17026 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Always emit the configuration path (#17036)zeripath2021-09-132-0/+2
| | | | | | Often when handling problems it is not clear which configuration file Gitea is using. This PR simply ensures that the configuration file is emitted. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Use common sessioner for API and Web (#17027)zeripath2021-09-123-28/+21
| | | | | | | | * Use common sessioner for API and Web Instead of creating separate sessioner and doubly initialising the provider just use the same sessioner for the API and Web routes. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Support unprotected file patterns (#16395)Jimmy Praet2021-09-113-0/+23
| | | | | | | Fixes #16381 Note that changes to unprotected files via the web editor still cannot be pushed directly to the protected branch. I could easily add such support for edits and deletes if needed. But for adding, uploading or renaming unprotected files, it is not trivial. * Extract & Move GetAffectedFiles to modules/git
* 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
|