summaryrefslogtreecommitdiffstats
path: root/routers
Commit message (Collapse)AuthorAgeFilesLines
* Add EasyMDE support for release content editor (#14744)a10121127962021-02-221-0/+8
| | | | | * Add easyMDE(simpleMDE) support for release content editor Signed-off-by: a1012112796 <1012112796@qq.com>
* Fix go get (#14758)Lunny Xiao2021-02-221-1/+65
| | | | | | | * Fix go get * Fix default branch Co-authored-by: 6543 <6543@obermui.de>
* Heatmap days clickable (#13935)gordon--2021-02-202-0/+2
| | | | | | | | | | | | | | | | * Heatmap days clickable * Error handling * Unselect filter * better dayclick handler * made linter happy * clickable heatmap for profiles Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Export LFS & TimeTracking function status (#14753)65432021-02-201-3/+5
|
* Clarify the suffices and prefixes of setting.AppSubURL and setting.AppURL ↵zeripath2021-02-195-18/+15
| | | | | | | | (#12999) Also removes some unnecessary uses of fmt.Sprintf and adds documentation strings Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add UI to delete tracked times (#14100)Norwin2021-02-193-2/+43
| | | Co-authored-by: 6543 <6543@obermui.de>
* Move the stopwatches to the eventsource stream (#14588)zeripath2021-02-191-0/+32
| | | | | | | | | Move the stopwatches to the eventsource stream Use the /user/events eventsource to update the stopwatches instead of polling /api/v1/user/stopwatches if the eventsource is enabled. Signed-off-by: Andrew Thornton <art27@cantab.net>
* routers/routes/web: Fix typo in comment (#14729)Jacob Hrbek2021-02-181-1/+1
|
* [API] Add Restricted Field to User (#14630)65432021-02-181-0/+3
| | | | | | | | | | | | * 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>
* #14699 Make branch names in PR description clickable (#14716)Jimmy Praet2021-02-181-0/+2
|
* Add Password Algorithm option to install page (#14701)zeripath2021-02-161-0/+7
| | | | | | | 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-24/+2
| | | | | | | | 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>
* Allow blocking some email domains from registering an account (#14667)Damien Goutte-Gattat2021-02-151-1/+1
| | | | | | | | | 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
* Whitespace in commits (#14650)vnkmpf2021-02-134-21/+21
| | | | | | | | | * Add whitespace to commit view * Add whitespace to /compare/a...b * Move repeated whitespaceFlags to gitdiff * Add whitespace for wiki pages
* Show Gitea version in swagger (#14654)techknowlogick2021-02-121-1/+1
| | | | | Show Gitea version in swagger Co-authored-by: 6543 <6543@obermui.de>
* Fix PATCH /repos/{owner}/{repo} panic (#14637)Anton Khimich2021-02-111-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix a runtime error when modifying a repository through API call Using the `PATCH /repos/{owner}/{repo}` endpoint and attempting to modify `default_branch` on an empty repository will cause a panic. This commit adds a check for a nil pointer before attempting to dereference it. * Apply suggestions from code review * Apply suggestions from code review * Ensure that the git repository is loaded If you change the default branch for a repository you must change it in git too. Therefore you must open the repository before changing the default branch. Signed-off-by: Andrew Thornton <art27@cantab.net> * Allow empty repos to have their default branches changed Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Anton Khimich <anton.khimicha@mail.utoronto.ca> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Andrew Thornton <art27@cantab.net>
* Added option to disable webhooks (#13176)Paweł Bogusławski2021-02-112-19/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-116-1/+145
| | | | | | | | | | | | | | | * 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-112-6/+10
| | | Sort Project board (#14533)
* Allow org labels to be set with issue templates (#14593)zeripath2021-02-101-1/+8
| | | | | | Fix #13688 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Prevent adding nil label to .AddedLabels or .RemovedLabels (#14623)zeripath2021-02-101-5/+7
| | | | | | | | | | | | | | | | | | * 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-091-1/+1
| | | | | | | | | | 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>
* Add support for ref parameter to get raw file API (#14602)zeripath2021-02-091-1/+21
| | | | | | | | Fix #14597 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* [API] Add delete release by tag & fix unreleased inconsistency (#14563)65432021-02-073-18/+72
| | | | | | | | | * DeleteReleaseByTag delete release not git tags * Add api to delete tag (without release) * fix & extend tests * fix swagger doc
* Add Content-Length header to HEAD requests (#14542)Farid AYOUJIL2021-02-052-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add Content-Length header to HEAD requests This change adds the header Content-Length to HEAD HTTP requests. The previous behaviour was blocking some Windows executables (i.e bitsadmin.exe) from downloading files hosted in Gitea. This along with PR #14541, makes the web server compliant with HTTP RFC 2616 which states "The methods GET and HEAD MUST be supported by all general-purpose servers" and "The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response." This should also respond to issues #8030 and #14532. * This change adds the header Content-Length to HEAD HTTP requests Pass the Size of the content as a parameter to ServeData() instead of calculating it using ioutil.ReadAll(reader) --> this call is dangerous and can result in a denial of service. * Add Content-Length header to HEAD requests Quick fix for imported dependency not used. * Check if size is positiv int ... Co-authored-by: zeripath <art27@cantab.net>
* Honor REGISTER_MANUAL_CONFIRM when doing openid registration (#14548)Michel Ganguin2021-02-051-1/+1
| | | | | REGISTER_MANUAL_CONFIRM is not honored when doing performing an openid registration. The new account is directly accessible. With this patch, the manual confirm flag gets honored in the same way as a "normal" registration.
* Fix lfs file viewer (#14568)Lunny Xiao2021-02-051-21/+16
|
* Fix bug about ListOptions and stars/watchers pagnation (#14556)Lunny Xiao2021-02-041-1/+5
| | | | | | | * Fix bug about ListOptions and stars/watchers pagnation * fix unit test Co-authored-by: 6543 <6543@obermui.de>
* [API] GetRelease by tag only return release (#14397)Cameron Braid2021-02-041-2/+7
| | | | | get release by tag should filter out tag releases to be consistent with list releases and get by id Co-authored-by: 6543 <6543@obermui.de>
* [API] Add pagination to ListBranches (#14524)65432021-02-036-52/+49
| | | | | | | | | | | | | | | | | | * 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>
* Adding Chi's GetHead middleware (#14541)Farid AYOUJIL2021-02-021-1/+2
| | | | | | | | Before moving to Chi, HEAD requests were automatically answered by GET handlers (SetAutoHead(true) from macaron was used). This Change will restore the previous behaviour. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* [API] List, Check, Add & delete endpoints for repository teams (#13630)65432021-02-012-0/+239
| | | | | | | * List, Check, Add & delete endpoints for repository teams * return units on single team responce too * Add Tests
* Move middlewares to web/middleware (#14480)Lunny Xiao2021-01-305-11/+11
| | | Co-authored-by: 6543 <6543@obermui.de>
* Update docs and comments to remove macaron (#14491)Lunny Xiao2021-01-293-4/+1
|
* enhancement: add signoff option in commit form (#14516)a10121127962021-01-292-0/+6
| | | Signed-off-by: a1012112796 <1012112796@qq.com>
* Fix access log (#14475)Lunny Xiao2021-01-273-57/+9
| | | | | | 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-273-1/+10
| | | | Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lauris BH <lauris@nix.lv>
* [Feature] add precise search type for Elastic Search (#12869)Jui-Nan Lin2021-01-272-3/+11
| | | | | | | | * 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>
* Print usefull error if SQLite is used in settings but not supported (#14476)65432021-01-271-5/+8
| | | | | * move log output to points where they are relefant * check explicit of sqlite3 in settings
* Fix panic 500 page rendering (#14474)Lunny Xiao2021-01-261-1/+2
|
* Move macaron to chi (#14293)Lunny Xiao2021-01-2696-1058/+1363
| | | | | | | | | | | | | | | | | | | | | | | | | | | Use [chi](https://github.com/go-chi/chi) instead of the forked [macaron](https://gitea.com/macaron/macaron). Since macaron and chi have conflicts with session share, this big PR becomes a have-to thing. According my previous idea, we can replace macaron step by step but I'm wrong. :( Below is a list of big changes on this PR. - [x] Define `context.ResponseWriter` interface with an implementation `context.Response`. - [x] Use chi instead of macaron, and also a customize `Route` to wrap chi so that the router usage is similar as before. - [x] Create different routers for `web`, `api`, `internal` and `install` so that the codes will be more clear and no magic . - [x] Use https://github.com/unrolled/render instead of macaron's internal render - [x] Use https://github.com/NYTimes/gziphandler instead of https://gitea.com/macaron/gzip - [x] Use https://gitea.com/go-chi/session which is a modified version of https://gitea.com/macaron/session and removed `nodb` support since it will not be maintained. **BREAK** - [x] Use https://gitea.com/go-chi/captcha which is a modified version of https://gitea.com/macaron/captcha - [x] Use https://gitea.com/go-chi/cache which is a modified version of https://gitea.com/macaron/cache - [x] Use https://gitea.com/go-chi/binding which is a modified version of https://gitea.com/macaron/binding - [x] Use https://github.com/go-chi/cors instead of https://gitea.com/macaron/cors - [x] Dropped https://gitea.com/macaron/i18n and make a new one in `code.gitea.io/gitea/modules/translation` - [x] Move validation form structs from `code.gitea.io/gitea/modules/auth` to `code.gitea.io/gitea/modules/forms` to avoid dependency cycle. - [x] Removed macaron log service because it's not need any more. **BREAK** - [x] All form structs have to be get by `web.GetForm(ctx)` in the route function but not as a function parameter on routes definition. - [x] Move Git HTTP protocol implementation to use routers directly. - [x] Fix the problem that chi routes don't support trailing slash but macaron did. - [x] `/api/v1/swagger` now will be redirect to `/api/swagger` but not render directly so that `APIContext` will not create a html render. Notices: - Chi router don't support request with trailing slash - Integration test `TestUserHeatmap` maybe mysql version related. It's failed on my macOS(mysql 5.7.29 installed via brew) but succeed on CI. Co-authored-by: 6543 <6543@obermui.de>
* Redirect on changed user and org name (#11649)Andrew Bezold2021-01-246-39/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add redirect for user * Add redirect for orgs * Add user redirect test * Appease linter * Add comment to DeleteUserRedirect function * Fix locale changes * Fix GetUserByParams * Fix orgAssignment * Remove debug logging * Add redirect prompt * Dont Export DeleteUserRedirect & only use it within a session * Unexport newUserRedirect * cleanup * Fix & Dedub API code * Format Template * Add Migration & rm dublicat * Refactor: unexport newRepoRedirect() & rm dedub del exec * if this fails we'll need to re-rename the user directory Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix lfs preview bug (#14428)Lunny Xiao2021-01-221-1/+4
|
* Enhance Ghost comment mitigation Settings (#14392)65432021-01-213-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | * refactor models.DeleteComment and delete related reactions too * use deleteComment for UserDeleteWithCommentsMaxDays in DeleteUser * nits * Use time.Duration as other time settings have * docs * Resolve Fixme & fix potential deadlock * Disabled by Default * Update Config Value Description * switch args * Update models/issue_comment.go Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net>
* Add TrN for repository limit (#12492)EV3R42021-01-221-5/+4
| | | | | | | | | * Added TrN for repository limit * Removed form.reach_limit_of_creation_0 * disable Create Button if user can not create Co-authored-by: 6543 <6543@obermui.de>
* Add support to migrate from gogs (#14342)65432021-01-211-0/+3
| | | | | | | | | | | | | Add support to migrate gogs: * issues * comments * labels * milestones * wiki Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Andrew Thornton <art27@cantab.net>
* Display current stopwatch in navbar (#14122)Norwin2021-01-212-0/+46
| | | | | | | | | | | | | | | | | * add notification about running stopwatch to header * serialize seconds, duration in stopwatches api * ajax update stopwatch i should get my testenv working locally... * new variant: hover dialog * noscript compatibility * js: live-update stopwatch time * js live update robustness
* load U2F js only on pages which need it (#11585)Kamil Domański2021-01-201-1/+1
| | | | | | * load U2F js only on pages which need it * Update templates/base/head.tmpl
* Project: show referenced PRs in issue cards (#14183)Roberto Santalla2021-01-201-1/+23
| | | Co-authored-by: Lauris BH <lauris@nix.lv>
* Fix log http status is always zero (#14400)Lunny Xiao2021-01-191-2/+10
| | | | | | | * Fix log http status is always zero * Fix lint Co-authored-by: 6543 <6543@obermui.de>