summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Migration 204 use Sync2 (#18044)65432021-12-202-1/+2
| | | | | * format nit * Sync2
* Move POST /{username}/action/{action} to simply POST /{username} (#18045)zeripath2021-12-203-7/+5
| | | | | | | | | | The current code unfortunately requires that `action` be a reserved repository name as it prevents posts to change the settings for action repositories. However, we can simply change action handler to work on POST /{username} instead. Fix #18037 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix delete u2f keys modal (#18040)Lunny Xiao2021-12-201-1/+1
|
* Reset Session ID on login (#18018)zeripath2021-12-209-11/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Reset Session ID on login When logging in the SessionID should be reset and the session cleaned up. Signed-off-by: Andrew Thornton <art27@cantab.net> * with new session.RegenerateID function Signed-off-by: Andrew Thornton <art27@cantab.net> * update go-chi/session Signed-off-by: Andrew Thornton <art27@cantab.net> * Ensure that session id is changed after oauth data is set and between account linking pages too Signed-off-by: Andrew Thornton <art27@cantab.net> * placate lint Signed-off-by: Andrew Thornton <art27@cantab.net> * as per review Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add grafana gitea-mixin (#17758)Vitaly Zhuravlev2021-12-2012-0/+668
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This PR adds gitea-mixin, configurable Grafana dashboards (and potentially prometheus alerts+recording rules) based on Gitea [metrics](https://docs.gitea.io/en-us/config-cheat-sheet/#metrics-metrics). The overview dashboard is described using jsonnet and grafonnet library: https://grafana.github.io/grafonnet-lib/ Mixins help to define dashboard and alerts as code so they can be collaboratively improved by the users. ![image](https://user-images.githubusercontent.com/14870891/142862822-fe57b384-c74a-4103-8548-033e92f90751.png) __ ## Generate config files You can manually generate dashboards, but first you should install some tools: ```bash go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb go get github.com/google/go-jsonnet/cmd/jsonnet # or in brew: brew install go-jsonnet ``` For linting and formatting, you would also need `mixtool` and `jsonnetfmt` installed. If you have a working Go development environment, it's easiest to run the following: ```bash go get github.com/monitoring-mixins/mixtool/cmd/mixtool go get github.com/google/go-jsonnet/cmd/jsonnetfmt ``` The files in `dashboards_out` need to be imported into your Grafana server. The exact details will be depending on your environment. Edit `config.libsonnet` (for example, list of Gitea metrics to be shown under stats can be adjusted). if required and then build JSON dashboard files for Grafana: ```bash make ``` For more about mixins, please see: https://github.com/monitoring-mixins/docs https://www.youtube.com/watch?v=GDdnL5R_l-Y* add gitea mixin * remove alerts/rules * gitea-mixin: add interval factor of 1/2 to remove duplicated change events * gitea-mixin: fix changes panel, add aggregation interval for changes panel * gitea-mixin: add totals singlestat * gitea mixin: switch change graph to timeseries type * add color overrides for issue labels * bump grafonnet version * gitea-mixin: convert graphs to timeseries * gitea-mixin: make fmt * gitea-mixin: add .PHONE in Makefile * gitea-mixin: add time configration * gitea-mixin: make fmt and collapse addPanel grid * gitea-mixin: add static ids for shared panels * gitea-mixin: add flags showIssuesByRepository, showIssuesByLabel to show/hide corresponding panels * gitea-mixin: update aggregation interval * gitea-mixin: update defaults * gitea-mixin: update panel names * rename dir to gitea-monitoring-mixin * gitea-mixin: add gitea_issues_open, gitea_issues_closed metrics * gitea-mixin: update visible name for datasource * gitea-mixin: update README Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
* Simplify parameter types (#18006)Gusted2021-12-2059-116/+115
| | | Remove repeated type declarations in function definitions.
* Update chroma (#18033)zeripath2021-12-2036-679/+933
| | | | | | Update chroma to 0.9.4 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Prevent off-by-one error on comments on newly appended lines (#18029)zeripath2021-12-202-0/+53
| | | | | | | | | | | | | | | | | * Prevent off-by-one error on comments on newly appended lines There was a bug in CutDiffAroundLine whereby if a file without a terminal new line has a patch which appends lines to it and a comment is placed on one of those lines the comment diff will be a line out of place. This fixes CutDiffAroundLine to simply ignore the missing terminal newline - however, we should really improve this rendering to add a marker to say that there was a previously missing terminal newline. Fix #17875 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Abort merge if head has been updated before pressing merge (#18032)zeripath2021-12-209-9/+42
| | | | | | | | | | | | | | | | | | | | | | | * Abort merge if head has been updated before pressing merge It is possible that a PR head may be pushed to between the merge page being shown and the merge button being pressed. Pass the current expected head in as a parameter and cancel the merge if it has changed. Fix #18028 Signed-off-by: Andrew Thornton <art27@cantab.net> * adjust swagger Signed-off-by: Andrew Thornton <art27@cantab.net> * fix test Signed-off-by: Andrew Thornton <art27@cantab.net> * placate lint Signed-off-by: Andrew Thornton <art27@cantab.net>
* no need for docker image mirror (#18031)techknowlogick2021-12-191-18/+0
| | | Co-authored-by: zeripath <art27@cantab.net>
* Stop printing 03d after escaped characters in logs (#18030)zeripath2021-12-191-1/+1
| | | | | | | | Strangely a weird bug was present in the log escaping code whereby any escaped character would gain 03d - this was due to a mistake in the format string where it should have read %03o but read instead %o03d. This has led to spurious 03d trailing characters on these escaped characters! Signed-off-by: Andrew Thornton <art27@cantab.net>
* Reset locale on login (#18023)zeripath2021-12-191-0/+33
| | | | | | | | | | | | | | * Reset locale on login Fix #18020 Signed-off-by: Andrew Thornton <art27@cantab.net> * Update routers/web/user/auth.go Co-authored-by: Gusted <williamzijl7@hotmail.com> Co-authored-by: Gusted <williamzijl7@hotmail.com>
* Add support for ssh commit signing (#17743)Wim2021-12-19182-15178/+17444
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add support for ssh commit signing * Split out ssh verification to separate file * Show ssh key fingerprint on commit page * Update sshsig lib * Make sure we verify against correct namespace * Add ssh public key verification via ssh signatures When adding a public ssh key also validate that this user actually owns the key by signing a token with the private key. * Remove some gpg references and make verify key optional * Fix spaces indentation * Update options/locale/locale_en-US.ini Co-authored-by: Gusted <williamzijl7@hotmail.com> * Update templates/user/settings/keys_ssh.tmpl Co-authored-by: Gusted <williamzijl7@hotmail.com> * Update options/locale/locale_en-US.ini Co-authored-by: Gusted <williamzijl7@hotmail.com> * Update options/locale/locale_en-US.ini Co-authored-by: Gusted <williamzijl7@hotmail.com> * Update models/ssh_key_commit_verification.go Co-authored-by: Gusted <williamzijl7@hotmail.com> * Reword ssh/gpg_key_success message * Change Badsignature to NoKeyFound * Add sign/verify tests * Fix upstream api changes to user_model User * Match exact on SSH signature * Fix code review remarks 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>
* Improve TestPatch to use git read-tree -m and implement git-merge-one-file ↵zeripath2021-12-193-6/+377
| | | | | | | | | | | | | functionality (#18004) The current TestPatch conflict code uses a plain git apply which does not properly account for 3-way merging. However, we can improve things using `git read-tree -m` to do a three-way merge then follow the algorithm used in merge-one-file. We can also use `--patience` and/or `--histogram` to generate a nicer diff for applying patches too. Fix #13679 Fix #6417 Signed-off-by: Andrew Thornton <art27@cantab.net>
* [skip ci] Updated licenses and gitignoresGiteaBot2021-12-194-0/+18
|
* Change <a> elements to underline on hover (#17898)silverwind2021-12-186-29/+27
| | | | | | | | | Fomantic brings a opinionated style that removed underline on mouse hover which I think is important UX to have. This re-enables the underline in the Fomantic config and fixes a few cases where underline was deemed disruptive.
* [skip ci] Updated translations via CrowdinGiteaBot2021-12-182-0/+18
|
* Support open compare page directly (#17975)Lunny Xiao2021-12-172-14/+13
| | | | | | | | | * Support open compare page directly * simple code * Some improvements Co-authored-by: 6543 <6543@obermui.de>
* Add option to define refs in issue templates (#17842)qwerty2872021-12-175-5/+14
| | | | Adds a markdown header option `ref` that allows you to set the ref the issue should belong.
* Fix outType on gitea dump (#18000)Gusted2021-12-171-2/+5
| | | | | | - Force to output the dump file to use the given `--type`. - Resolves #17959
* Fix rename notification bug (#18008)Lunny Xiao2021-12-172-2/+4
|
* Ensure complexity, minlength and ispwned are checked on password setting ↵zeripath2021-12-173-1/+25
| | | | | | | | | | | | (#18005) It appears that there are several places that password length, complexity and ispwned are not currently been checked when changing passwords. This PR adds these. Fix #17977 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Use JSON module instead of stdlib json (#18003)Gusted2021-12-172-2/+2
|
* Prevent hang in git cat-file if repository is not a valid repository and ↵zeripath2021-12-1618-26/+209
| | | | | | | | | | | | | | | | | | | | | | | | | | other fixes (#17991) This PR contains multiple fixes. The most important of which is: * Prevent hang in git cat-file if the repository is not a valid repository Unfortunately it appears that if git cat-file is run in an invalid repository it will hang until stdin is closed. This will result in deadlocked /pulls pages and dangling git cat-file calls if a broken repository is tried to be reviewed or pulls exists for a broken repository. Fix #14734 Fix #9271 Fix #16113 Otherwise there are a few small other fixes included which this PR was initially intending to fix: * Fix panic on partial compares due to missing PullRequestWorkInProgressPrefixes * Fix links on pulls pages due to regression from #17551 - by making most /issues routes match /pulls too - Fix #17983 * Fix links on feeds pages due to another regression from #17551 but also fix issue with syncing tags - Fix #17943 * Add missing locale entries for oauth group claims * Prevent NPEs if ColorFormat is called on nil users, repos or teams.
* Prevent double decoding of % in url params (#17997)zeripath2021-12-1612-1/+41
| | | | | | | | | | | | | | There was an unfortunate regression in #14293 which has led to the double decoding of url parameter elements if they contain a '%'. This is due to an issue with the way chi decodes its RoutePath. In detail the problem lies in mux.go where the routeHTTP path uses the URL.RawPath or even the URL.Path instead of the escaped path to do routing. This PR simply forcibly sets the routePath to that of the EscapedPath. Fix #17938 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add Reindex buttons to repository settings page (#17494)zeripath2021-12-164-2/+95
| | | | | | | | | | This PR adds reindexing request buttons to the repository settings page. Fix #3796 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Set correct language for Dockerfile variants (#17999)silverwind2021-12-161-0/+1
|
* Fix TemplateRepo no longer in models.repo (#17993)Caellion2021-12-161-0/+10
| | | | | | | | | | | | | * Fixes error 500 that appears when trying to browse code of a repository generated from template * forgot to update comment * Update models/repo/repo.go Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> * Update repo.go Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Make AvatarRenderedSizeFactor configurable and set it to 3 (#17951)silverwind2021-12-167-16/+22
| | | | | | | | | | | | Save a bit of bandwidth by only requesting 3-times the rendered avatar size. Factor 4 is only really beneficial on a handful of mobile phones and I don't think they are the primary device we design for. Configurability contributed by zeripath. Fixes: https://github.com/go-gitea/gitea/pull/17422 Fixes: https://github.com/go-gitea/gitea/issues/16287 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* [skip ci] Updated translations via CrowdinGiteaBot2021-12-169-35/+26
|
* Fixed emoji alias not parsed in links (#16221)KN4CK3R2021-12-152-9/+16
| | | | | | | | * Do not skip links. * Restrict text in links to emojis. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
* Shorten page title in file view (#17987)silverwind2021-12-151-1/+5
| | | | | | | | Move the more relevant sections of the page title earlier which make it possible to distinguish multiple tabs from each other when tab width is limited. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor HTTP request context (#17979)wxiaoguang2021-12-1526-176/+138
|
* Add missing `X-Total-Count` and fix some related bugs (#17968)qwerty2872021-12-1524-36/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add missing `X-Total-Count` and fix some related bugs Adds `X-Total-Count` header to APIs that return a list but doesn't have it yet. Fixed bugs: * not returned after reporting error (https://github.com/qwerty287/gitea/blob/39eb82446c6fe5da3d79124e1f701f3795625b69/routers/api/v1/user/star.go#L70) * crash with index out of bounds, API issue/issueSubscriptions I also found various endpoints that return lists but do not apply/support pagination yet: ``` /repos/{owner}/{repo}/issues/{index}/labels /repos/{owner}/{repo}/issues/comments/{id}/reactions /repos/{owner}/{repo}/branch_protections /repos/{owner}/{repo}/contents /repos/{owner}/{repo}/hooks/git /repos/{owner}/{repo}/issue_templates /repos/{owner}/{repo}/releases/{id}/assets /repos/{owner}/{repo}/reviewers /repos/{owner}/{repo}/teams /user/emails /users/{username}/heatmap ``` If this is not expected, an new issue should be opened. Closes #13043 * fmt * Update routers/api/v1/repo/issue_subscription.go Co-authored-by: KN4CK3R <admin@oldschoolhack.me> * Use FindAndCount Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: 6543 <6543@obermui.de>
* [skip ci] Updated translations via CrowdinGiteaBot2021-12-152-3/+7
|
* Use non-expiring key. (#17984)KN4CK3R2021-12-141-125/+78
|
* Add Option to synchronize Admin & Restricted states from OIDC/OAuth2 along ↵zeripath2021-12-1417-88/+344
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with Setting Scopes (#16766) * Add setting to OAuth handlers to override local 2FA settings This PR adds a setting to OAuth and OpenID login sources to allow the source to override local 2FA requirements. Fix #13939 Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix regression from #16544 Signed-off-by: Andrew Thornton <art27@cantab.net> * Add scopes settings Signed-off-by: Andrew Thornton <art27@cantab.net> * fix trace logging in auth_openid Signed-off-by: Andrew Thornton <art27@cantab.net> * add required claim options Signed-off-by: Andrew Thornton <art27@cantab.net> * Move UpdateExternalUser to externalaccount Signed-off-by: Andrew Thornton <art27@cantab.net> * Allow OAuth2/OIDC to set Admin/Restricted status Signed-off-by: Andrew Thornton <art27@cantab.net> * Allow use of the same group claim name for the prohibit login value Signed-off-by: Andrew Thornton <art27@cantab.net> * fixup! Move UpdateExternalUser to externalaccount * as per wxiaoguang Signed-off-by: Andrew Thornton <art27@cantab.net> * add label back in Signed-off-by: Andrew Thornton <art27@cantab.net> * adjust localisation Signed-off-by: Andrew Thornton <art27@cantab.net> * placate lint Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Return nicer error for ForcePrivate (#17971)zeripath2021-12-142-1/+2
|
* Fixed wording. (#17973)KN4CK3R2021-12-141-4/+4
| | | Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* [skip ci] Updated translations via CrowdinGiteaBot2021-12-141-0/+1
|
* Prevent deadlock in create issue (#17970)zeripath2021-12-133-5/+11
|
* Bump swagger-ui-dist from 4.1.2 to 4.1.3 (#17965)dependabot[bot]2021-12-122-8/+8
|
* Improve behavior of "Fork" button (#17288)qwerty2872021-12-135-5/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Improbe behaviour of fork button * Apply suggestions from code review * Remove old lines * Apply suggestions * Fix test * Remove unnecessary or * Update templates/repo/header.tmpl Co-authored-by: silverwind <me@silverwind.io> * Add comment * Fix situation if you can't fork but don't have forks * Fix lint * Apply changes from #17783 * fmt * fmt * Apply tweaks Co-authored by: silverwind <me@silverwind.io> * Rm dupl css * Fix build Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Prefer "Hiragino Kaku Gothic ProN" in system-ui-ja (#17954)rinsuki2021-12-131-1/+1
|
* Some repository refactors (#17950)Lunny Xiao2021-12-1288-1388/+1363
| | | | | | | | | * some repository refactors * remove unnecessary code * Fix test * Remove unnecessary banner
* [skip ci] Updated licenses and gitignoresGiteaBot2021-12-1222-48/+230
|
* Fix markdown URL parsing (#17924)wxiaoguang2021-12-113-75/+127
| | | | Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
* Fix overflow in commit graph (#17947)silverwind2021-12-113-5/+14
| | | | | | | | | | | | | | | | * Fix overflow in commit graph Limit commit message to 50% width. This is rather crude but should work for common use cases with not too-long author names. Fixes: https://github.com/go-gitea/gitea/issues/17944 * Make it work with dynamic width * use span * use explicit none Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Prevent services/mailer/mailer_test.go tests from deleteing data directory ↵zeripath2021-12-103-13/+23
| | | | | | | | | | (#17941) Running `make test-backend` will delete `data/` due to reloading the configuration and resetting the appdatapath. This PR removes this unnecessary config reload but also adds extra code in to the unittest main to prevent its cleanup from deleting the wrong directory. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Move keys to models/asymkey (#17917)Lunny Xiao2021-12-1075-887/+1001
| | | | | | | | | | | | | | | | | | | * Move keys to models/keys * Rename models/keys -> models/asymkey * change the missed package name * Fix package alias * Fix test * Fix docs * Fix test * Fix test * merge