summaryrefslogtreecommitdiffstats
path: root/modules
Commit message (Collapse)AuthorAgeFilesLines
* Fix a couple of CommentAsPatch issues. (#14804)zeripath2021-02-273-22/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | * CutDiffAroundLine makes the incorrect assumption that `---` and `+++` always represent part of the header of a diff. This PR adds a flag to its parsing to prevent this problem and adds a streaming parsing technique to CutDiffAroundLine using an io.pipe instead of just sending data to an unbounded buffer. Fix #14711 Signed-off-by: Andrew Thornton <art27@cantab.net> * Handle unquoted comment patch files When making comment patches unfortunately the patch does not always quote the filename This makes the diff --git header ambiguous again. This PR finally adds handling for ambiguity in to parse patch Fix #14812 Signed-off-by: Andrew Thornton <art27@cantab.net> * Add in testing for no error There is no way currently for CutDiffAroundLine in this test to cause an error however, it should still be tested. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix repo-restore bug with poster not replaced (#14759)Lunny Xiao2021-02-222-11/+28
| | | | | | | | | * Fix restore bug * Fix restore bug Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: 6543 <6543@obermui.de>
* Fix go get (#14758)Lunny Xiao2021-02-221-58/+0
| | | | | | | * Fix go get * Fix default branch Co-authored-by: 6543 <6543@obermui.de>
* Export LFS & TimeTracking function status (#14753)65432021-02-201-3/+5
|
* Prevent endless loop if templates missing (#14752)zeripath2021-02-201-0/+4
| | | | | | | | | Since the chi upgrade if the templates are missing an endless loop will occur if status/500.tmpl is missing. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* stopwatch notif: check if timetracking is enabled (#14750)Norwin2021-02-201-0/+3
| | | fixes #14435
* Clarify the suffices and prefixes of setting.AppSubURL and setting.AppURL ↵zeripath2021-02-192-19/+33
| | | | | | | | (#12999) Also removes some unnecessary uses of fmt.Sprintf and adds documentation strings Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix when a commit not found returned 500 (#14732)Lunny Xiao2021-02-181-0/+6
| | | Co-authored-by: Lauris BH <lauris@nix.lv>
* [API] Add Restricted Field to User (#14630)65432021-02-183-6/+10
| | | | | | | | | | | | * Expose Restricted field for User * Add Option to Change Restricted on User via adminEditUser API * Add test who change restricted & test if it changed it ... * make generate-swagger Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Remove NULs byte arrays passed to PostProcess (#14587)zeripath2021-02-181-1/+23
| | | | | | | | | | | | PostProcess is supposed to be parsing and handling HTML fragments, but on fuzzing it appears that there is a weird issue with NUL elements that could cause a memory address error in downstream libraries. The simplest solution is to strip out the weird NULs - they should not be there in any case and would be stripped out anyway. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix github download on migration (#14703)Lunny Xiao2021-02-181-4/+19
| | | | | | | * Fix github download on migration * Use Context for Client Co-authored-by: zeripath <art27@cantab.net>
* Reduce calls to git cat-file -s (#14682)zeripath2021-02-179-28/+141
| | | | | | | | | | | | | * Reduce calls to git cat-file -s There are multiple places where there are repeated calls to git cat-file -s due to the blobs not being created with their size. Through judicious use of git ls-tree -l and slight adjustments to the indexer code we can avoid a lot of these calls. * simplify by always expecting the long format * Also always set the sized field and tell the indexer the update is sized
* Use cat-file --batch in GetLanguageStats (#14685)zeripath2021-02-171-30/+100
| | | | | | | | | | | | | | | | | | | | | | * Use cat-file --batch in GetLanguageStats This PR moves to using a single cat-file --batch in GetLanguageStats significantly reducing the number of processes spawned during language stat processing. Signed-off-by: Andrew Thornton <art27@cantab.net> * placate lint Signed-off-by: Andrew Thornton <art27@cantab.net> * Update modules/git/repo_language_stats_nogogit.go Co-authored-by: a1012112796 <1012112796@qq.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: a1012112796 <1012112796@qq.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Add Password Algorithm option to install page (#14701)zeripath2021-02-161-0/+2
| | | | | | | Add Password Algorithm option to install page Fix #14674 Co-authored-by: John Olheiser <john.olheiser@gmail.com>
* Restore detection of branches are equal on compare page (#14586)zeripath2021-02-161-3/+16
| | | | | | | | Somehow the test for detecting if branches are equal broke this PR restores this functionality. Fix #14502 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Create DB session provider(based on xorm) (#13031)zeripath2021-02-153-1/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Create Xorm session provider This PR creates a Xorm session provider which creates the appropriate Session table for macaron/session. Fix #7137 Signed-off-by: Andrew Thornton <art27@cantab.net> * extraneous l Signed-off-by: Andrew Thornton <art27@cantab.net> * fix lint Signed-off-by: Andrew Thornton <art27@cantab.net> * use key instead of ID to be compatible with go-macaron/session Signed-off-by: Andrew Thornton <art27@cantab.net> * And change the migration too. Signed-off-by: Andrew Thornton <art27@cantab.net> * Update spacing of imports Co-authored-by: 6543 <6543@obermui.de> * Update modules/session/xorm.go Co-authored-by: techknowlogick <matti@mdranta.net> * add xorm provider to the virtual provider Signed-off-by: Andrew Thornton <art27@cantab.net> * prep for master merge * prep for merge master * As per @lunny * move migration out of the way * Move to call this db session as per @lunny Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Allow blocking some email domains from registering an account (#14667)Damien Goutte-Gattat2021-02-153-16/+51
| | | | | | | | | Gitea allows to whitelist email domains so that only email addresses from certain domains are allowed to register an account, but does not currently allows to do the opposite: blacklisting email domains so that addresses from certain domains are *forbidden* to register an account. The idea has been briefly mentioned in the discussion about issue #6350, but never implemented. This PR does that. The rationale is that, in my experience of running a Gitea instance, *a single email domain* is responsible for *most* of the spam accounts, and for *all* of the spam accounts that manage to get past the email confirmation step. So on top of the other spam mitigation measures already available (email confirmation, CAPTCHA, etc.), having the option to block a particularly annoying domain would be helpful. close #13628
* Prevent template renderer from rendering error (#14646)zeripath2021-02-131-6/+7
| | | | | | | | | | | When there is a panic during template rendering unrolled/render will automatically render the error. This leads to the panic being displayed in the page and not a 500 page Fix #14467 Fix #14525 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Prevent race in PersistableChannelUniqueQueue.Has (#14651)zeripath2021-02-131-0/+5
| | | | | | | | | | | There is potentially a race with a slow starting internal queue causing a NPE if Has is checked before the internal queue has been setup. This PR adds a lock on the Has() fn. Fix #14311 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Turn default hash password algorightm back to pbkdf2 from argon2 until we ↵Lunny Xiao2021-02-131-1/+1
| | | | | | | found a better one (#14673) * Turn default hash password algorightm back to pbkdf2 from argon2 until we found a better one * Add a warning on document
* rm gogs relict (#14665)65432021-02-141-6/+0
|
* Added option to disable webhooks (#13176)Paweł Bogusławski2021-02-112-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Added option to disable web hooks This mod introduces DISABLE_WEB_HOOKS parameter in [security] section of app.ini (by default set to false). If set to true it disables web hooks feature. Any existing undelivered web hook tasks will be cancelled. Any existing web hook definitions will be left untouched in db but its delivery tasks will be ignored. Author-Change-Id: IB#1105130 * Webhook spelling fixed Webhook spelling fixed. Fixes: 07df6614dc84cdd2e9f39c57577fa1062bd70012 Related: https://github.com/go-gitea/gitea/pull/13176#pullrequestreview-510868421 Author-Change-Id: IB#1105174 * Parameter description fixed Parameter description fixed. Fixes: 07df6614dc84cdd2e9f39c57577fa1062bd70012 Related: https://github.com/go-gitea/gitea/pull/13176#pullrequestreview-514086107 Author-Change-Id: IB#1105174
* Add dismiss review feature (#12674)a10121127962021-02-1110-0/+62
| | | | | | | | | | | | | | | * Add dismiss review feature refs: https://github.blog/2016-10-12-dismissing-reviews-on-pull-requests/ https://developer.github.com/v3/pulls/reviews/#dismiss-a-review-for-a-pull-request * change modal ui and error message * Add unDismissReview api Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
* Sort / Move project boards (#14634)Romain2021-02-111-4/+4
| | | Sort Project board (#14533)
* [Vendor] Update go-redis to v8.5.0 (#13749)65432021-02-107-47/+78
| | | | | | | | | | | | | | | | | | | | | * Update go-redis to v8.4.0 * github.com/go-redis/redis/v8 v8.4.0 -> v8.5.0 * Apply suggestions from code review Co-authored-by: zeripath <art27@cantab.net> * TODO * Use the Queue termination channel as the default context for pushes Signed-off-by: Andrew Thornton <art27@cantab.net> * missed one Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net>
* Do not assume all 40 char strings are SHA1s (#14624)zeripath2021-02-101-11/+15
| | | | | | | | | | GetCommit() assumes that all 40 char strings are SHA1s. This leads to an error if you try to do a PR on a branch which is 40 characters long. This PR attempts the SHA first - and if it fails will switch to using rev-parse. Fix #14470 Signed-off-by: Andrew Thornton <art27@cantab.net>
* HasPreviousCommit causes recursive load of commits unnecessarily (#14598)zeripath2021-02-102-13/+50
| | | | | | | | This PR improves HasPreviousCommit to prevent the automatic and recursive loading of previous commits using git merge-base --is-ancestor and git rev-list Fix #13684 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Prevent adding nil label to .AddedLabels or .RemovedLabels (#14623)zeripath2021-02-102-0/+22
| | | | | | | | | | | | | | | | | | * Prevent adding nil label to .AddedLabels or .RemovedLabels There are possibly a few old databases out there with malmigrated data that can cause panics with empty labels being migrated. This PR adds a few tests to prevent nil labels being added. Fix #14466 Signed-off-by: Andrew Thornton <art27@cantab.net> * Add doctor command to remove the broken label comments Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
* Ensure memcache TTL cannot be over 30 days (#14592)zeripath2021-02-096-9/+28
| | | | | | | | | | Memcached TTL cannot be > 30 days and if it is attempted the TTL is interpreted as a unix timestamp. This PR ensures that the TTL is switched to a unix timestamp in those cases. Fix #14571 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Remove spurious DataAsync Error logging (#14599)zeripath2021-02-071-3/+0
| | | | | | | Breaking the pipe is a valid way of killing a piped command and any error from a broken cat-file batch command should be passed back up to the writer any way therefore specifically logging it is unnecessary. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix rate limit bug when downloading assets on migrating from github (#14564)Lunny Xiao2021-02-071-0/+5
|
* [API] Add affected files of commits to commit struct (#14579)65432021-02-072-5/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | * Add files affected by a commit to gitea API -- similar to github * Add files affected by a commit to gitea API * Fix stupid error * Fix other stupid typo * Generate swagger tmpl * Comply with convert to git commit refacto * update swagger docs * extend test * format code * Update integrations/api_repo_git_commits_test.go * Update modules/convert/git_commit.go Co-authored-by: Laurent Cahour <laurent.cahour@dont-nod.com> Co-authored-by: zeripath <art27@cantab.net>
* Fix locale init (#14582)John Olheiser2021-02-051-2/+9
| | | | | | | just log if lang is already loaded since we can not reload it Co-authored-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
* Reduce data races (#14549)65432021-02-033-6/+18
| | | | | | | | | | | * Add race conditions into test * Fix Race in GetManager() * DataAsync() use error chan * just log no chan * finish
* [API] Add pagination to ListBranches (#14524)65432021-02-0310-31/+172
| | | | | | | | | | | | | | | | | | * make PaginateUserSlice generic -> PaginateSlice * Add pagination to ListBranches * add skip, limit to Repository.GetBranches() * Move routers/api/v1/utils/utils PaginateSlice -> modules/util/paginate.go * repo_module.GetBranches paginate * fix & rename & more logging * better description Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: a1012112796 <1012112796@qq.com>
* Internal ssh server respect Ciphers, MACs and KeyExchanges settings (#14523)Stefan2021-01-301-3/+7
|
* Move middlewares to web/middleware (#14480)Lunny Xiao2021-01-3021-115/+115
| | | Co-authored-by: 6543 <6543@obermui.de>
* Add Doctor FixWrongUserType (#14522)65432021-01-291-0/+40
| | | | | * Add Doctor FixWrongUserType * use NoAutoTime
* Update docs and comments to remove macaron (#14491)Lunny Xiao2021-01-2912-21/+18
|
* Fix json charset bug (#14514)Lunny Xiao2021-01-291-2/+2
|
* enhancement: add signoff option in commit form (#14516)a10121127962021-01-296-8/+23
| | | Signed-off-by: a1012112796 <1012112796@qq.com>
* Fix load time bug (#14508)Lunny Xiao2021-01-291-4/+10
|
* Add some Unit-Tests (#14500)65432021-01-286-9/+306
| | | | | | | | | | | * fix url * modules/auth/pa: coverage: 40#.0% * modules/base coverage: 67.6% -> 89.9% * modules/cache coverage: 0% -> 12.0% * modules/convert coverage: 27.1% -> 29.7%
* Fix display since time round (#14226)Lunny Xiao2021-01-282-37/+152
| | | | | | | * Fix display since time round * Fix since time * Fix tests
* Fix JSON Header response (#14499)65432021-01-271-1/+1
|
* Fix access log (#14475)Lunny Xiao2021-01-277-15/+120
| | | | | | Fix #14121, #14478. The `AccessLog` middleware has to be after `Contexter` or `APIContexter` so that we can get `LoginUserName` if possible. And also there is a **BREAK** change that it removed internal API access log.
* Fix captcha (#14488)Lunny Xiao2021-01-274-46/+18
| | | | Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lauris BH <lauris@nix.lv>
* Fix switch language (#14484)Lunny Xiao2021-01-271-6/+4
| | | | Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lauris BH <lauris@nix.lv>
* Fix: url.Values map was not initialized (#14485)PhilAtWysdom2021-01-271-0/+3
| | | | | Values map was not initialized, leading to error 500 on submission of initial configuration Co-authored-by: 6543 <6543@obermui.de>
* [Feature] add precise search type for Elastic Search (#12869)Jui-Nan Lin2021-01-277-15/+36
| | | | | | | | * feat: add type query parameters for specifying precise search * feat: add select dropdown in search box Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io>