aboutsummaryrefslogtreecommitdiffstats
path: root/routers
Commit message (Collapse)AuthorAgeFilesLines
...
* Use request timeout for git service rpc (#20689) (#20693)parnic2022-08-071-5/+6
| | | | | | | This enables git.Command's Run to optionally use the given context directly so its deadline will be respected. Otherwise, it falls back to the previous behavior of using the supplied timeout or a default timeout value of 360 seconds. repo's serviceRPC() calls now use the context's deadline (which is unset/unlimited) instead of the default 6-minute timeout. This means that large repo clones will no longer arbitrarily time out on the upload-pack step, and pushes can take longer than 6 minutes on the receive-pack step. Fixes #20680
* Send correct NuGet status codes (#20647) (#20677)KN4CK3R2022-08-051-3/+5
| | | | | * Fixed status codes. * Fixed status codes.
* Add default commit messages to PR for squash merge (#20618) (#20645)wxiaoguang2022-08-041-0/+2
| | | | | | | | | Keep the same behavior as 1.16 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: Tyrone Yeh <tyrone_yeh@draytek.com> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
* WebAuthn CredentialID field needs to be increased in size (#20530) (#20555)65432022-07-301-2/+1
| | | | | | | | | | | | | | WebAuthn have updated their specification to set the maximum size of the CredentialID to 1023 bytes. This is somewhat larger than our current size and therefore we need to migrate. The PR changes the struct to add CredentialIDBytes and migrates the CredentialID string to the bytes field before another migration drops the old CredentialID field. Another migration renames this field back. Fix #20457 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net>
* Rework raw file http header logic (#20484) (#20542)silverwind2022-07-301-38/+56
| | | | | | | | | | | | | | - Always respect the user's configured mime type map - Allow more types like image/pdf/video/audio to serve with correct content-type - Shorten cache duration of raw files to 5 minutes, matching GitHub - Don't set `content-disposition: attachment`, let the browser decide whether it wants to download or display a file directly - Implement rfc5987 for filenames, remove previous hack. Confirmed it working in Safari. - Make PDF attachment work in Safari by removing `sandbox` attribute. This change will make a lot more file types open directly in browser now. Logic should generally be more readable than before with less `if` nesting and such. Replaces: https://github.com/go-gitea/gitea/pull/20460 Replaces: https://github.com/go-gitea/gitea/pull/20455 Fixes: https://github.com/go-gitea/gitea/issues/20404
* Add Docker /v2/_catalog endpoint (#20469) (#20556)65432022-07-309-6/+73
| | | | | | | | | | | | | | * Added properties for packages. * Fixed authenticate header format. * Added _catalog endpoint. * Check owner visibility. * Extracted condition. * Added test for _catalog. Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add missing Tabs on organisation/package view (#20539)65432022-07-291-0/+16
| | | hotfix #20106
* packages/generic: Do not restrict package versions to SemVer (#20414) (#20531)65432022-07-291-8/+6
| | | | | | | | There are existing packages out there whose version do not conform to SemVer, yet, one would like to have them available in a generic package repository. To this end, remove the SemVer restriction on package versions when using the Generic package registry, and replace it with a check that simply makes sure the version isn't empty. Signed-off-by: Gergely Nagy <me@gergo.csillger.hu> Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Gergely Nagy <algernon@users.noreply.github.com>
* Fix possible panic when repository is empty (#20509) (#20526)65432022-07-281-4/+8
| | | Backport #20509
* Show hint to link package to repo when viewing empty repo package list ↵Norwin2022-07-271-0/+4
| | | | (#20504) (#20507)
* Add repository condition for issue count (#20496)Tyrone Yeh2022-07-271-0/+1
|
* fix enabling repo packages when projects are off (#20486) (#20488)Norwin2022-07-261-1/+1
|
* Add Cache-Control header to html and api responses, add no-transform ↵silverwind2022-07-232-0/+3
| | | | | | | | | | | | (#20432) (#20459) `no-transform` allegedly disables CloudFlare auto-minify and we did not set caching headers on html or api requests, which seems good to have regardless. Transformation is still allowed for asset requests. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Andrew Thornton <art27@cantab.net>
* Dismiss prior pull reviews if done via web in review dismiss (#20197) (#20407)65432022-07-192-5/+5
|
* Add missing return for when topic isn't found (#20351) (#20395)zeripath2022-07-181-0/+1
|
* Fix commit status icon when in subdirectory (#20285) (#20385)silverwind2022-07-161-7/+7
| | | | | When viewing a subdirectory and the latest commit to that directory in the table, the commit status icon incorrectly showed the status of the HEAD commit instead of the latest for that directory.
* Set target on create release with existing tag (#20381) (#20382)Gusted2022-07-151-0/+1
| | | When you create a new release(e.g. via Tea) and specify a tag that already exists on the repository, Gitea will instead use the `UpdateRelease` functionality. However it currently doesn't set the Target field. This PR fixes that.
* Initialize cron last (#20373) (#20384)zeripath2022-07-151-1/+3
| | | | | | | | Backport #20373 Cron will try to run certain things at startup but these depend on multiple things being set-up. Therefore we should initialize cron last. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Hide notify mail setting ui if not enabled (#20138) (#20336)Lunny Xiao2022-07-131-0/+1
| | | Co-authored-by: 6543 <6543@obermui.de>
* Add write check for creating Commit status (#20332) (#20333)Gusted2022-07-121-1/+1
| | | | | | - Backport #20332 - Add write code checks for creating new commit status - Regression from #5314 - Resolves #20331
* Refactor SSH init code, fix directory creation for TrustedUserCAKeys file ↵wxiaoguang2022-07-111-10/+2
| | | | | | | | (#20299) (#20306) Backport #20299. Follow #20298. Only the `GlobalInitInstalled` function should prepare the SSH files for external server or starts the builtin server. * `trustedUserCaKeys` is removed, use `SSH.TrustedUserCAKeys` directly * introduce `ssh.Init`, move the SSH init code from `routers/init.go` to it * `ssh.Init` will start builtin SSH server or prepare external SSH server files
* Only show Followers that current user can access (#20220) (#20252)zeripath2022-07-062-8/+8
| | | | | | | | | Backport #20220 Users who are following or being followed by a user should only be displayed if the viewing user can see them. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Check if project has the same repository id with issue when assign project ↵Lunny Xiao2022-07-015-6/+30
| | | | | | | | | | | | | | | | | | | | | | | | | to issue (#20133) (#20188) * Check if project has the same repository id with issue when assign project to issue * Check if issue's repository id match project's repository id * Add more permission checking * Remove invalid argument * Fix errors * Add generic check * Remove duplicated check * Return error + add check for new issues * Apply suggestions from code review Co-authored-by: Gusted <williamzijl7@hotmail.com> Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: 6543 <6543@obermui.de>
* Fix wrong login requirement routers (#20101) (#20104)Lunny Xiao2022-06-241-1/+1
|
* Catch the error before the response is processed by goth. (#20000) (#20102)SteveTheEngineer2022-06-241-12/+20
| | | | | | | The code introduced by #18185 gets the error from response after it was processed by goth. That is incorrect, as goth (and golang.org/x/oauth) doesn't really care about the error, and it sends a token request with an empty authorization code to the server anyway, which always results in a `oauth2: cannot fetch token: 400 Bad Request` error from goth. It means that unless the "state" parameter is omitted from the error response (which is required to be present, according to [RFC 6749, Section 4.1.2.1](https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2.1)) or the page is reloaded (makes the session invalid), a 500 Internal Server Error page will be displayed. This fixes it by handling the error before the request is passed to goth.
* Dashboard feed respect setting.UI.FeedPagingNum again (#20094) (#20099)Jimmy Praet2022-06-232-0/+2
| | | Fixes #20080
* Release page show all tags in compare dropdown (#20070) (#20072)65432022-06-211-1/+8
| | | | | | | Backport #20070 Just get all tags when creating the compare dropdown. Fix #19936
* Fix delete pull head ref for DeleteIssue (#20032) (#20034)a10121127962022-06-191-0/+5
| | | | | | | | | Backport #20032 In DeleteIssue the PR git head reference should be `/refs/pull/xxx/head` not `/refs/pull/xxx` Fix #19655 Signed-off-by: a1012112796 <1012112796@qq.com>
* Stop spurious APIFormat stopwatches logs (#20008)zeripath2022-06-171-1/+3
| | | | | | | | | If there are dangling stopwatches with missing issues there will be repeated logging of Unable to APIFormat stopwatches. These are unhelpful and instead we should only log if the error is not an issue not exist error. And we should also prevent an error on missing issue in GetActiveStopwatch too Signed-off-by: Andrew Thornton <art27@cantab.net>
* move agit dependcy (#19998)Lunny Xiao2022-06-171-2/+13
|
* Fix Readme render bug (#19992)Lunny Xiao2022-06-171-1/+1
| | | | | Fix #19988 Co-authored-by: zeripath <art27@cantab.net>
* Use DisplayName() instead of FullName in Oauth provider (#19991)oGi4i2022-06-162-1/+20
| | | | | Use DisplayName() in Oauth as this provides a fallback if FullName is not set. Closes #19382
* fix permission check for delete tag (#19985)a10121127962022-06-165-1/+38
| | | | | | | fix #19970 by the way, fix some error response about protected tags. Signed-off-by: a1012112796 <1012112796@qq.com>
* Allow render HTML with css/js external links (#19017)Lunny Xiao2022-06-164-18/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Allow render HTML with css/js external links * Fix bug because of filename escape chars * Fix lint * Update docs about new configuration item * Fix bug of render HTML in sub directory * Add CSP head for displaying iframe in rendering file * Fix test * Apply suggestions from code review Co-authored-by: delvh <dev.lh@web.de> * Some improvements * some improvement * revert change in SanitizerDisabled of external renderer * Add sandbox for iframe and support allow-scripts and allow-same-origin * refactor * fix * fix lint * fine tune * use single option RENDER_CONTENT_MODE, use sandbox=allow-scripts * fine tune CSP * Apply suggestions from code review Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* In code search, get code unit accessible repos in one (main) query (#19764)Hugo Hoitink2022-06-161-87/+57
| | | | | | | | | | * When non-admin users use code search, get code unit accessible repos in one main query * Modified some comments to match the changes * Removed unnecessary check for Access Mode in Collaboration table Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* Remove tab/TabName usage where it's not needed (#19973)Lauris BH2022-06-151-0/+1
| | | `tab` query argument and `TabName` in context is used only in profile so remove it from all other places where it's not used anymore.
* Move issues related files into models/issues (#19931)Lunny Xiao2022-06-1335-629/+632
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Move access and repo permission to models/perm/access * fix test * fix git test * Move functions sequence * Some improvements per @KN4CK3R and @delvh * Move issues related code to models/issues * Move some issues related sub package * Merge * Fix test * Fix test * Fix test * Fix test * Rename some files
* fix: some typos (#19956)yutotnh2022-06-131-1/+1
|
* Move some code into models/git (#19879)Lunny Xiao2022-06-1216-104/+115
| | | | | | | | | | | | | | | | | | | * Move access and repo permission to models/perm/access * fix test * Move some git related files into sub package models/git * Fix build * fix git test * move lfs to sub package * move more git related functions to models/git * Move functions sequence * Some improvements per @KN4CK3R and @delvh
* Unify repo settings & show better error (#19828)Gusted2022-06-123-10/+14
| | | | * Unify context data * Actually show invalid url in error
* fixed comment typo (#19944)xkcdstickfigure2022-06-111-1/+1
|
* Auto merge pull requests when all checks succeeded via WebUI (#19648)65432022-06-112-0/+39
| | | | | | | | Add WebUI part of Auto merge feature close #19621 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: delvh <dev.lh@web.de>
* Fix some mirror bugs (#18649)Lunny Xiao2022-06-111-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix some mirror bugs * Remove unnecessary code * Fix lint * rename stdard url * Allow more charactors in git ssh protocol url * improve the detection * support ipv6 for git url parse * Fix bug * Fix template * Fix bug * fix template * Fix tmpl * Fix tmpl * Fix parse ssh with interface * Rename functions name Co-authored-by: zeripath <art27@cantab.net>
* Fix data-race problems in git module (quick patch) (#19934)wxiaoguang2022-06-111-1/+1
| | | | | | | * Fix data-race problems in git module * use HomeDir instead of setting.RepoRootPath Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Custom regexp external issues (#17624)Sandro Santilli2022-06-101-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Implement custom regular expression for external issue tracking. Signed-off-by: Alexander Beyn <malex@fatelectrons.org> * Fix syntax/style * Update repo.go * Set metas['regexp'] * gofmt * fix some tests * fix more tests * refactor frontend * use LRU cache for regexp * Update modules/markup/html_internal_test.go Co-authored-by: Alexander Beyn <malex@fatelectrons.org> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor git module, make Gitea use internal git config (#19732)wxiaoguang2022-06-103-9/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Refactor git module, make Gitea use internal git config, add safe.directory config * introduce git.InitSimple and git.InitWithConfigSync, make serv cmd use gitconfig * use HOME instead of GIT_CONFIG_GLOBAL, because git always needs a correct HOME * fix cmd env in cmd/serv.go * fine tune error message * Fix a incorrect test case * fix configAddNonExist * fix configAddNonExist logic, add `--fixed-value` flag, add tests * add configSetNonExist function in case it's needed. * use configSetNonExist for `user.name` and `user.email` * add some comments * Update cmd/serv.go Co-authored-by: zeripath <art27@cantab.net> * Update cmd/serv.go Co-authored-by: zeripath <art27@cantab.net> * Update modules/git/git.go Co-authored-by: zeripath <art27@cantab.net> * Update modules/setting/setting.go Co-authored-by: zeripath <art27@cantab.net> * Update modules/git/repo_attribute.go Co-authored-by: zeripath <art27@cantab.net> * fix spaces in messages * use `configSet("core.protectNTFS", ...)` instead of `globalCommandArgs` * remove GIT_CONFIG_NOSYSTEM, continue to use system's git config * Update cmd/serv.go Co-authored-by: zeripath <art27@cantab.net> * fix merge * remove code for safe.directory * separate git.CommonEnvs to CommonGitCmdEnvs and CommonCmdServEnvs * avoid Golang's data race error Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Feature: Find files in repo (#15028)Roger Luo2022-06-093-0/+85
| | | | | | | | | | | | | | | | * Create finding files page ui in repo page * Get tree entries for find repo files. * Move find files JS to individual file. * gen swagger. * Add enry.IsVendor to exclude entries Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Add support for rendering terminal output with colors (#19497)Lauris BH2022-06-091-0/+11
|
* Automatically render wiki TOC (#19873)zeripath2022-06-081-0/+2
| | | | | | Automatically add sidebar in the wiki view containing a TOC for the wiki page. Make the TOC collapsable Signed-off-by: Andrew Thornton <art27@cantab.net>
* Ensure minimum mirror interval is reported on settings page (#19895)zeripath2022-06-071-9/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Ensure minimum mirror interval is reported on settings page Expecting users to guess the minimum mirror interval appears a little unkind. In this PR we simply change the locale string to include the minimum interval. This will of course be affected by our current localization framework but... we can fix that else where. This PR also includes some fixes for error handling on the settings page as previously the mirror block amongst others would simply disappear on error. Fix #3737 Signed-off-by: Andrew Thornton <art27@cantab.net> * Update options/locale/locale_en-US.ini Co-authored-by: Gusted <williamzijl7@hotmail.com> * placate lint Signed-off-by: Andrew Thornton <art27@cantab.net> * Update options/locale/locale_en-US.ini Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Gusted <williamzijl7@hotmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>