aboutsummaryrefslogtreecommitdiffstats
path: root/routers
Commit message (Collapse)AuthorAgeFilesLines
* Fix creating OAuth2 auth source from CLI (#14116)Daniil Pankratov2020-12-241-2/+11
| | | | | | | | Fix creation OAuth2 auth source from CLI. Fix #8356 Co-authored-by: Daniil Pankratov <daniil.pankratov@t-systems.com>
* Fix api doc response code (#14123)Norwin2020-12-241-1/+1
| | | | | Fixes #14120
* Ensure that search term and page are not lost on adoption page-turn (#14133)zeripath2020-12-241-1/+10
| | | | | | | Fix #14111 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix spelling avator -> avatar (#14115)Jimmy Praet2020-12-221-1/+1
|
* Inline manifest.json (#14038)silverwind2020-12-222-14/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Inline manifest.json Improve performance by eliminating this separate request and just inline this small JSON in HTML directly as a data uri. Also update previously static app name scripts to use AppName. I've confirmed this as working via "Add to Homescreen" feature which offered to save the shortcut under the new app name. * prerender manifest data on startup * move to settings * restore setting.AppStartTime and use it on admin page * use double quotes because template.URL escapes everything * fix lint * move variable to global context variable * delete template file Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
* Add user filter to issueTrackedTimes, enable usage for issue managers (#14081)Norwin2020-12-221-11/+37
| | | | | | | | | | | | | * add user filter to issueTrackedTimes fixes #14024 * update swagger * allow user filter for issue writers * improve swagger doc * return 404 on invalid user
* rework heatmap permissions (#14080)Norwin2020-12-223-3/+3
| | | | | | | | | | | | | | | | * now uses the same permission model as for the activity feed: only include activities in repos, that the doer has access to. this might be somewhat slower. * also improves handling of user.KeepActivityPrivate (still shows the heatmap to self & admins) * extend tests * adjust integration test to new behaviour * add access to actions for admins * extend heatmap unit tests
* Use the text of pull-request as the squash commit's message (#13071)Mura Li2020-12-211-1/+1
| | | | | | | | | | | Originally, it was filled by the commit messages of the involved commits. In this change, we use the headline comment of the pull request as the commit message when it is a squash merge. Thanks to @zeripath for suggesting the idea. Fixes #12365 Co-authored-by: Mura Li <typeless@users.noreply.github.com>
* Add mentionable teams to tributeValues and change team mention rules to gh's ↵a10121127962020-12-212-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | style (#13198) * Add mentionable teams to tributeValues Signed-off-by: a1012112796 <1012112796@qq.com> * Apply suggestions from code review Co-authored-by: silverwind <me@silverwind.io> * Change team mention rules to gh's style * use org's avator as team avator in ui Signed-off-by: a1012112796 <1012112796@qq.com> * Update modules/markup/html.go * Update models/issue.go Co-authored-by: Lauris BH <lauris@nix.lv> * Update models/issue.go * fix a small nit and update test code Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: 6543 <6543@obermui.de>
* Added option to disable migrations (#13114)Paweł Bogusławski2020-12-214-2/+26
| | | | | | | | | | | | | | | | | | | | | | * Added option to disable migrations This patch introduces DISABLE_MIGRATIONS parameter in [repository] section of app.ini (by default set to false). If set to true it blocks access to repository migration feature. This mod hides also local repo import option in user editor if local repo importing or migrations is disabled. * Alter Example config DISABLE_MIGRATIONS set to false in example config to match its default value. * HTTP error 403 instead of 500 on denied access to migration * Parameter DISABLE_MIGRATIONS exposed via API Fixes: 04b04cf854bcb3ed7659442bcf79822bdebe29e9 Author-Change-Id: IB#1105130
* Show dropdown with all statuses for commit (#13977)Cirno the Strongest2020-12-205-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Show dropdown with all statuses for commit * Use popups * Remove unnecessary change * Style popup * Use divided list * As per @silverwind * Refactor GetLastCommitStatus * Missing dropdown on repo home and commit page * Fix tests * Make status icon be a part of a link on PR list * Fix missing translation call * Indent fix Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Manually approve new registration (#13083)Jiri Vlasak2020-12-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | * Add register manual confirm settings option The new settings option is used when manually approving new registrations. * Enable manual confirmation of new registered user When manual registration confirmation is desired (by default `false`) create new user in the database that is *not active*. The user must then be activated manually. This change speeds up the process of adding new confirmed users for Gitea instances without external auth mechanism. (Currently the option is to manually create new user by admin.) * Update docs/content/doc/advanced/config-cheat-sheet.zh-cn.md Co-authored-by: a1012112796 <1012112796@qq.com> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: a1012112796 <1012112796@qq.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Show status check for merged PRs (#13975)Cirno the Strongest2020-12-181-0/+14
| | | | | | | | | | | * Show status check for merged PRs * Handle PRs with no commits * Styling Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: 6543 <6543@obermui.de>
* [Refactor] CombinedStatus and CommitStatus related functions & structs (#14026)65432020-12-186-50/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * RM unused struct * rename (*CommitStatus) loadRepo() -> loadAttributes() * move ToCommitStatus into its own file * use CommitStatusState instead of StatusState * move CombinedStatus convertion into convert package * let models.GetLatestCommitStatus use repoID direct and accept ListOptions * update swagger docs * fix tests * Fix swagger docs * rm page * fix swagger docs!!! * return json null * always return json * rename api.Status to api.CommitStatus * fix swagger docs * sec swagger fix
* Use native git variants by default with go-git variants as build tag (#13673)zeripath2020-12-173-144/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Move last commit cache back into modules/git Signed-off-by: Andrew Thornton <art27@cantab.net> * Remove go-git from the interface for last commit cache Signed-off-by: Andrew Thornton <art27@cantab.net> * move cacheref to last_commit_cache Signed-off-by: Andrew Thornton <art27@cantab.net> * Remove go-git from routers/private/hook Signed-off-by: Andrew Thornton <art27@cantab.net> * Move FindLFSFiles to pipeline Signed-off-by: Andrew Thornton <art27@cantab.net> * Make no-go-git variants Signed-off-by: Andrew Thornton <art27@cantab.net> * Submodule RefID Signed-off-by: Andrew Thornton <art27@cantab.net> * fix issue with GetCommitsInfo Signed-off-by: Andrew Thornton <art27@cantab.net> * fix GetLastCommitForPaths Signed-off-by: Andrew Thornton <art27@cantab.net> * Improve efficiency Signed-off-by: Andrew Thornton <art27@cantab.net> * More efficiency Signed-off-by: Andrew Thornton <art27@cantab.net> * even faster Signed-off-by: Andrew Thornton <art27@cantab.net> * Reduce duplication * As per @lunny Signed-off-by: Andrew Thornton <art27@cantab.net> * attempt to fix drone Signed-off-by: Andrew Thornton <art27@cantab.net> * fix test-tags Signed-off-by: Andrew Thornton <art27@cantab.net> * default to use no-go-git variants and add gogit build tag Signed-off-by: Andrew Thornton <art27@cantab.net> * placate lint Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @6543 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* HotFix: Hide private partisipation in Orgs (#13994)65432020-12-172-11/+39
| | | | | * HotFix: Hide private partisipation in Orgs * refactor & add node to fuc GetOrganizations
* [API] Add ref to create/edit issue options & deprecated assignee (#13992)65432020-12-151-0/+8
| | | | | * API: Add ref to create/edit issue options * deprecate Assignee in favour of Assignees
* add thumbnail preview section to issue attachments (#13826)bobemoe2020-12-131-3/+4
| | | | | | | | | | | | | | | | * add thumbnail preview section to attachments * dont show thumbnail if the image is already shown inline * update router to pass the `content` to the attachemnts template * limit attachment preview height to 150px (same as width) * remove unused css (referance removed in https://github.com/go-gitea/gitea/pull/11141/files#diff-9faae32445ed9673de2830c9fc35e93f44487f0a0068202988adaf00a5bac850L66 ) * dont show divider after edit if no attachemnts Co-authored-by: James <inbox.dev@jhodges.co.uk> Co-authored-by: 6543 <6543@obermui.de>
* Whenever the password is updated ensure that the hash algorithm is too (#13966)zeripath2020-12-122-3/+3
| | | | | | | | | | | `user.HashPassword` may potentially - and in fact now likely does - change the `passwd_hash_algo` therefore whenever the `passwd` is updated, this also needs to be updated. Fix #13832 Thanks @fblaese for the hint Signed-off-by: Andrew Thornton <art27@cantab.net>
* Possible fix the webhook API creation (#13960)Lunny Xiao2020-12-121-1/+2
| | | | | * Possible fix the webhook API creation * Fix api create webhook bug
* Fix broken migration on webhook (#13911)Lunny Xiao2020-12-092-15/+15
| | | | | | | * Fix broken migration on webhook * Fix lint Co-authored-by: John Olheiser <john.olheiser@gmail.com>
* log error when login failed (#13903)Lunny Xiao2020-12-081-4/+4
| | | Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Log IP on SSH authentication failure for Built-in SSH server (#13150)Eric Lesiuta2020-12-082-0/+3
| | | | | | | | | | | | | | | | | | * Log IP on SSH authentication failure fixes https://github.com/go-gitea/gitea/issues/13094 * include string 'Failed authentication attempt' in error * update fail2ban docs also match failed authentication over command line * better logging of authentication errors with IP addresses * format ... Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: 6543 <6543@obermui.de>
* Move webhook type from int to string (#13664)Lunny Xiao2020-12-084-16/+16
| | | | | | | | | | | | | | * Move webhook type from int to string * rename webhook_services * finish refactor * Fix merge * Ignore unnecessary ci Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
* User Settings: Ignore empty language codes & validate (#13755)65432020-12-041-1/+9
|
* Direct avatar rendering (#13649)silverwind2020-12-032-14/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Direct avatar rendering This adds new template helpers for avatar rendering which output image elements with direct links to avatars which makes them cacheable by the browsers. This should be a major performance improvment for pages with many avatars. * fix avatars of other user's profile pages * fix top border on user avatar name * uncircle avatars * remove old incomplete avatar selector * use title attribute for name and add it back on blame * minor refactor * tweak comments * fix url path join and adjust test to new result * dedupe functions
* Expose default theme in meta and API (#13809)John Olheiser2020-12-031-0/+1
| | | | | Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: 6543 <6543@obermui.de>
* Move Repo APIFormat to convert package (#13787)65432020-12-0212-19/+24
| | | | | * Move Repo APIFormat to convert package * tweek
* move notification APIFormat (#13783)65432020-12-023-3/+6
|
* Flip RUN_MODE detection in router (#13768)silverwind2020-12-011-4/+6
| | | | Missed that part in https://github.com/go-gitea/gitea/pull/13765. It's already in the 1.13 backport so this forward-ports that change again.
* Add Allow-/Block-List for Migrate & Mirrors (#13610)65432020-11-282-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * add black list and white list support for migrating repositories * fix fmt * fix lint * fix vendor * fix modules.txt * clean diff * specify log message * use blocklist/allowlist * allways use lowercase to match url * Apply allow/block * Settings: use existing "migrations" section * convert domains lower case * dont store unused value * Block private addresses for migration by default * fix lint * use proposed-upstream func to detect private IP addr * a nit * add own error for blocked migration, add tests, imprufe api * fix test * fix-if-localhost-is-ipv4 * rename error & error message * rename setting options * Apply suggestions from code review Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Verify password for local-account activation (#13631)65432020-11-281-27/+45
| | | | | | | | | | | | | | | | | | | | | * Verify passwords for activation This is to prevent 3rd party activation * Fix function comment * only veify password on local-account aktivation * fix lint * Update templates/user/auth/activate.tmpl Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Andreas Shimokawa <shimokawa@fsfe.org> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Add block on official review requests branch protection (#13705)a10121127962020-11-283-15/+22
| | | | | Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* Fix missing stylesheets on installation page (#13736)Simon2020-11-281-0/+6
| | | | | | | | | | | | | | When running gitea for the first time, the stylesheets for the installation page are broken since the middleware that statically serves stylesheets does not get executed by chi. This is because if no handlers are registered in chi, it will drop all middleware. This commit introduces a "dummy" handler to deal with that quirk. Closes #13725 Thanks: Lunny Xiao <xiaolunwen@gmail.com> for finding the quirk Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* ui: show 'owner' tag for real owner (#13689)a10121127962020-11-281-2/+21
| | | | | | | | | | | | | | | | | * ui: show 'owner' tag for real owner Signed-off-by: a1012112796 <1012112796@qq.com> * Update custom/conf/app.example.ini * simplify logic fix logic fix a small bug about original author * remove system manager tag Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: Lauris BH <lauris@nix.lv>
* Handle and propagate errors when checking if paths are Dirs, Files or Exist ↵zeripath2020-11-274-12/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | (#13186) * Ensure errors from IsDir propagate * Handle errors when checking IsFile * Handle and propagate errors from IsExist * Update modules/templates/static.go * Update modules/templates/static.go * Return after ctx.ServerError * Apply suggestions from code review * Fix tests The previous merge managed to break repo_form.go Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: Lauris BH <lauris@nix.lv>
* [API] Add more filters to issues search (#13514)65432020-11-231-3/+58
| | | | | | | | | | | * Add time filter for issue search * Add limit option for paggination * Add Filter for: Created by User, Assigned to User, Mentioning User * update swagger * Add Tests for limit, before & since
* Refactor combine label comments with tests (#13619)Lunny Xiao2020-11-202-56/+275
| | | Co-authored-by: Lauris BH <lauris@nix.lv>
* API: Admin EditUser: Make FullName, Email, Website & Location optional (#13562)65432020-11-191-5/+18
| | | | | | | | | * API: Admin EditUser: Make FullName, Email, Website & Location optional * update swagger docs * add Tests Co-authored-by: Lauris BH <lauris@nix.lv>
* Fix issue/pull request list assignee filter (#13647)Karl Heinz Marbaise2020-11-191-0/+2
| | | | | | | | | | | | | | * Fixes #13641 - Filtering in Pull Request kept all the time. - The URL contains all the time the assignee in cases where once a type has been selected. Signed-off-by: Karl Heinz Marbaise <kama@soebes.de> * Followup Fixes #13641 - Filtering in Pull Request kept all the time. - The URL contains all the time the assignee in cases where once a type has been selected. - The same behaviour was observed issues viewed via milestones. Signed-off-by: Karl Heinz Marbaise <kama@soebes.de>
* Remove fetch request from heatmap (#13623)silverwind2020-11-182-4/+18
| | | | | | | | | | | | | | | | | | | * Remove fetch request from heatmap Render heatmap data directly to HTML, eliminating one HTTP request on frontpage and user profile. Also added min-height to the container so the page content will no longer move after loading. * rename and error display * also log the js error * add error handler * remove useless inline style and hide divider on small screens * Update routers/user/home.go * Update routers/user/profile.go
* Fix a bug when check if owner is active (#13612)Lunny Xiao2020-11-182-2/+2
|
* HTTP cache rework and enable caching for storage assets (#13569)silverwind2020-11-172-11/+20
| | | | | | | | | | This enabled HTTP time-based cache for storage assets, primarily avatars. I have not observed If-Modified-Since from browsers during tests but I guess it's good to support regardless. It introduces a new generic httpcache module that can handle both time-based and etag-based caching. Additionally, manifest.json and robots.txt are now also cachable.
* Move metrics from macaron to chi (#13601)Lunny Xiao2020-11-173-22/+22
|
* Fix label display on new issues (#13590)silverwind2020-11-171-0/+1
| | | | | | | | | | | | | | | | | | * Fix label display on new issues PR #13570 broke label rendering for new issues and pulls because missed the fact that the code was relying on the DOM elements being toggled by JavaScript. On top of that, the label rendering for new issues and pull was using an outdated template which I consolidated in a new shared template. * remove wrapper element and style tweaks * style tweaks * use shared template for whole label list Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Use mount but not register for chi routes (#13555)Lunny Xiao2020-11-162-10/+21
| | | | | | | | | | | | | | | * Use mount but not register for chi routes * Fix test * Fix test * Fix test * Fix comment * turn back unnecessary change * Remove the timout middleware since some operations may spend much time.
* Add markdown support in organization description (#13549)wULLSnpAXbWZGYDYyhWTKKspEQoaYxXyhoisqHf2020-11-151-0/+4
| | | | | | | | | | Similarly to how you can write some markdown in user profile description, you can now use the same feature in organization description. As discussed in discord. kudos to @mrsdizzie and @zeripath visualization: ![image](https://user-images.githubusercontent.com/61180606/99115919-8004a200-25f3-11eb-8bbd-ab33de2cabb3.png)
* Add email validity check (#13475)Chris Shyi2020-11-146-1/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Improve error feedback for duplicate deploy keys Instead of a generic HTTP 500 error page, a flash message is rendered with the deploy key page template so inform the user that a key with the intended title already exists. * API returns 422 error when key with name exists * Add email validity checking Add email validity checking for the following routes: [Web interface] 1. User registration 2. User creation by admin 3. Adding an email through user settings [API] 1. POST /admin/users 2. PATCH /admin/users/:username 3. POST /user/emails * Add further tests * Add signup email tests * Add email validity check for linking existing account * Address PR comments * Remove unneeded DB session * Move email check to updateUser Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* [API] Only Return Json (#13511)65432020-11-142-46/+38
| | | | | | | | | | | | | | | | | * Let Branch and Raw Endpoint return json error if not found * Revert "RM RepoRefByTypeForAPI and move needed parts into GetRawFile directly" This reverts commit d826d08577b23765cb3c257e7a861191d1aa9a04. * more similar to RepoRefByType * dedub-code * API should just speak JSON * nice name Co-authored-by: zeripath <art27@cantab.net>
* API: Fix GetQueryBeforeSince (#13559)65432020-11-145-23/+43
|