aboutsummaryrefslogtreecommitdiffstats
path: root/modules
Commit message (Collapse)AuthorAgeFilesLines
* Add config options to hide issue events (#17414)qwerty2872022-01-212-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add config option to hide issue events Adds a config option `HIDE_ISSUE_EVENTS` to hide most issue events (changed labels, milestones, projects...) on the issue detail page. If this is true, only the following events (comment types) are shown: * plain comments * closed/reopned/merged * reviews * Make configurable using a list * Add docs * Add missing newline * Fix merge issues * Allow changes per user settings * Fix lint * Rm old docs * Apply suggestions from code review * Use bitsets * Rm comment * fmt * Fix lint * Use variable/constant to provide key * fmt * fix lint * refactor * Add a prefix for user setting key * Add license comment * Add license comment * Update services/forms/user_form_hidden_comments.go Co-authored-by: Gusted <williamzijl7@hotmail.com> * check len == 0 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Gusted <williamzijl7@hotmail.com> Co-authored-by: 6543 <6543@obermui.de>
* format with gofumpt (#18184)65432022-01-20186-864/+769
| | | | | | | | | | | * gofumpt -w -l . * gofumpt -w -l -extra . * Add linter * manual fix * change make fmt
* Enable deprecation error for v1.17.0 (#18341)Gusted2022-01-209-52/+83
| | | Co-authored-by: Andrew Thornton <art27@cantab.net>
* Refactor Router Logger (#17308)wxiaoguang2022-01-2014-194/+843
| | | | | | Make router logger more friendly, show the related function name/file/line. [BREAKING] This PR substantially changes the logging format of the router logger. If you use this logging for monitoring e.g. fail2ban you will need to update this to match the new format.
* Updated Chroma to v0.10.0 (#18270)Jelle Hulter2022-01-202-32/+30
|
* refactor httplib (#18338)Gusted2022-01-191-285/+7
| | | | | | - Remove a lot of unused code(most if not all were introduced in gogs for webhooks usages). Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Propagate context and ensure git commands run in request context (#17868)zeripath2022-01-1968-446/+504
| | | | | | | | | This PR continues the work in #17125 by progressively ensuring that git commands run within the request context. This now means that the if there is a git repo already open in the context it will be used instead of reopening it. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add MirrorUpdated field to Repository API type (#18267)Peter Gardfjäll2022-01-182-1/+8
| | | | | Add the last update time to the repository api type. Close #18266
* Remove unneeded debug messages to stdout. (#18298)Ben Niemann2022-01-161-4/+0
| | | Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Remove golang vendored directory (#18277)techknowlogick2022-01-143-3/+3
| | | | | | | * rm go vendor * fix drone yaml * add to gitignore
* Support webauthn (#17957)Lunny Xiao2022-01-144-8/+109
| | | | | | | Migrate from U2F to Webauthn Co-authored-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix NPE on try to get tag reference via API (#18245)65432022-01-127-12/+5
| | | | | * fix npe * rm gitRepo from Tag
* Fix source typos (#18227)luzpaz2022-01-102-4/+4
| | | Follow-up to #18219
* Fix various typos (#18219)luzpaz2022-01-1011-16/+16
| | | | | Found via `codespell -q 3 -S ./options/locale,./vendor -L ba,pullrequest,pullrequests,readby,te,unknwon` Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Remove `ioutil` (#18222)Gusted2022-01-101-2/+2
| | | | | | | | | | | | - Don't use `ioutil` package anymore as it doesn't anything special anymore since Go 1.16: ``` // As of Go 1.16, the same functionality is now provided // by package io or package os, and those implementations // should be preferred in new code. ``` Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Sort locales according to their names (#18211)delvh2022-01-081-1/+9
| | | | | * Sort locales according to their names * Fix documentation and sort case insensitive
* Restore setting of ctx.Repo.Mirror (#18205)zeripath2022-01-081-4/+4
| | | | | | | | | | | | | | In #17933 repoAssignment no longer sets the ctx.Repo.Mirror field meaning that attempting change mirror settings results in an NPE. This PR simply restores this. Either we should remove this field or, we should set it. At present it seems simplest to set it instead of going looking in the Data for the value although converting the context to a bag of things may be the correct approach in the future. Fix #18204 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Don't store assets modified time into generated files (#18193)Lunny Xiao2022-01-065-2/+64
|
* Add warning for BIDI characters in page renders and in diffs (#17562)zeripath2022-01-072-0/+432
| | | | | | | | | | | | Fix #17514 Given the comments I've adjusted this somewhat. The numbers of characters detected are increased and include things like the use of U+300 to make à instead of à and non-breaking spaces. There is a button which can be used to escape the content to show it. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Gwyneth Morgan <gwymor@tilde.club> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Enable partial clone by default (#18195)Gusted2022-01-062-0/+7
| | | | | - Enable partial clones(which are by default disabled from git) by default, unless configured otherwise. - Resolves #18190
* Add option to convert CRLF to LF line endings for sendmail (#18075)zeripath2022-01-061-5/+7
| | | | | | | | | | | | | It appears that several versions of sendmail require that the mail is sent to them with LF line endings instead of CRLF endings - which of course they will then convert back to CRLF line endings to comply with the SMTP standard. This PR adds another setting SENDMAIL_CONVERT_CRLF which will pass the message writer through a filter. This will filter out and convert CRLFs to LFs before writing them out to sendmail. Fix #18024 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Team permission allow different unit has different permission (#17811)Lunny Xiao2022-01-054-12/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Team permission allow different unit has different permission * Finish the interface and the logic * Fix lint * Fix translation * align center for table cell content * Fix fixture * merge * Fix test * Add deprecated * Improve code * Add tooltip * Fix swagger * Fix newline * Fix tests * Fix tests * Fix test * Fix test * Max permission of external wiki and issues should be read * Move team units with limited max level below units table * Update label and column names * Some improvements * Fix lint * Some improvements * Fix template variables * Add permission docs * improve doc * Fix fixture * Fix bug * Fix some bug * fix * gofumpt * Integration test for migration (#18124) integrations: basic test for Gitea {dump,restore}-repo This is a first step for integration testing of DumpRepository and RestoreRepository. It: runs a Gitea server, dumps a repo via DumpRepository to the filesystem, restores the repo via RestoreRepository from the filesystem, dumps the restored repository to the filesystem, compares the first and second dump and expects them to be identical The verification is trivial and the goal is to add more tests for each topic of the dump. Signed-off-by: Loïc Dachary <loic@dachary.org> * Team permission allow different unit has different permission * Finish the interface and the logic * Fix lint * Fix translation * align center for table cell content * Fix fixture * merge * Fix test * Add deprecated * Improve code * Add tooltip * Fix swagger * Fix newline * Fix tests * Fix tests * Fix test * Fix test * Max permission of external wiki and issues should be read * Move team units with limited max level below units table * Update label and column names * Some improvements * Fix lint * Some improvements * Fix template variables * Add permission docs * improve doc * Fix fixture * Fix bug * Fix some bug * Fix bug Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Aravinth Manivannan <realaravinth@batsense.net>
* Increase Salt randomness (#18179)Gusted2022-01-042-2/+29
| | | | | | | | | | | - The current implementation of `RandomString` doesn't give you a most-possible unique randomness. It gives you 6*`length` instead of the possible 8*`length` bits(or as `length`x bytes) randomness. This is because `RandomString` is being limited to a max value of 63, this in order to represent the random byte as a letter/digit. - The recommendation of pbkdf2 is to use 64+ bit salt, which the `RandomString` doesn't give with a length of 10, instead of increasing 10 to a higher number, this patch adds a new function called `RandomBytes` which does give you the guarentee of 8*`length` randomness and thus corresponding of `length`x bytes randomness. - Use hexadecimal to store the bytes value in the database, as mentioned, it doesn't play nice in order to convert it to a string. This will always be a length of 32(with `length` being 16). - When we detect on `Authenticate`(source: db) that a user has the old format of salt, re-hash the password such that the user will have it's password hashed with increased salt. Thanks to @zeripath for working out the rouge edges from my first commit 😄. Co-authored-by: lafriks <lauris@nix.lv> Co-authored-by: zeripath <art27@cantab.net>
* Add MP4 as default allowed attachment type (#18170)Gusted2022-01-041-1/+1
|
* Include folders into size cost (#18158)Gusted2022-01-031-2/+2
| | | | | | | | | - Include folders for the disk consumption size, they should be included as they are also saved on the disk :) - Have a more accurate picture of the size of a repo. - Mostly they are the size of the file system's block size. E.g. 4Kb on Linux.
* Refactor auth package (#17962)Lunny Xiao2022-01-025-22/+22
|
* Unify and simplify TrN for i18n (#18141)wxiaoguang2022-01-024-76/+93
| | | | | Refer: https://github.com/go-gitea/gitea/pull/18135#issuecomment-1003246099 Now we have a unique and simple `TrN`, and make the fix of PR #18135 also use the better `TrN` logic.
* Add API to get issue/pull comments and events (timeline) (#17403)qwerty2872022-01-013-0/+199
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add API to get issue/pull comments and events (timeline) Adds an API to get both comments and events in one endpoint with all required data. Closes go-gitea/gitea#13250 * Fix swagger * Don't show code comments (use review api instead) * fmt * Fix comment * Time -> TrackedTime * Use var directly * Add logger * Fix lint * Fix test * Add comments * fmt * [test] get issue directly by ID * Update test * Add description for changed refs * Fix build issues + lint * Fix build * Use string enums * Update swagger * Support `page` and `limit` params * fmt + swagger * Use global slices Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Upgrade bleve from v2.0.6 to v2.3.0 (#18132)Lunny Xiao2022-01-011-1/+1
|
* Handle invalid issues (#18111)Gusted2021-12-281-9/+14
| | | | | | | | | | | | | | | | | | | | | | | * Handle invalid issues - When you hover over a issue reference, and the issue doesn't exist, it will just hang on the loading animation. - This patch fixes that by showing them the pop-up with a "Error occured" message. * Add I18N * refactor * fix comment for lint * fix unit test for i18n * fix unit test for i18n * add comments Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Instead of using routerCtx just escape the url before routing (#18086)zeripath2021-12-251-3/+0
| | | | | | | | | | | | | | | | A consequence of forcibly setting the RoutePath to the escaped url is that the auto routing to endpoints without terminal slashes fails (Causing #18060.) This failure raises the possibility that forcibly setting the RoutePath causes other unexpected behaviors too. Therefore, instead we should simply pre-escape the URL in the process registering handler. Then the request URL will be properly escaped for all the following calls. Fix #17938 Fix #18060 Replace #18062 Replace #17997 Signed-off-by: Andrew Thornton <art27@cantab.net>
* - name: new parameter in CreateForkOption to give the forked repository (#18066)Aravinth Manivannan2021-12-241-0/+2
| | | | | | | | | | | a custom name, intended to be used when there's a name conflict - When a fork request results in a name conflict, HTTP 409: Conflict is returned instead of 500 - API documentation for the above mentioned changes Signed-off-by: realaravinth <realaravinth@batsense.net> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
* Add API to manage repo tranfers (#17963)qwerty2872021-12-232-0/+38
|
* Prevent NPE if gitea uploader fails to open url (#18080)zeripath2021-12-231-1/+4
| | | | | | | | | If http.Get() returns an error return nil and err before attempting to use the broken file. Thanks to walker xiong for spotting this bug. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Do not read or write git reference files directly (#18079)zeripath2021-12-234-41/+29
| | | | | | | | | | Git will and can pack references into packfiles and therefore if you write/read the files directly you will get false results. Instead you should use update-ref and show-ref. To that end I have created three new functions in git/repo_commit.go that will do this correctly. Related #17191 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Migrated Repository will show modifications when possible (#17191)99rgosse2021-12-234-2/+149
| | | | * Read patches to get history
* Quote references to the user table in consistency checks (#18072)zeripath2021-12-221-2/+2
| | | | | | | | Although #17487 ensured that the table was quoted in the join it missed that the query part of the check also needed to be quoted. Fix #17485 Signed-off-by: Andrew Thornton <art27@cantab.net>
* TestRepository_GetTag intermittently panics due to an NPE (#18043)zeripath2021-12-211-1/+7
| | | | | | | | | | | | | | | There are repeated panics in tests due to TestRepository_GetTag failing to run properly. This happens when we attempt to reset the internal repo for a tag which has failed to load. The problem is - the panic that this is causing is preventing us from finding what the real error is. This PR simply moves the failure out so we have a chance to see what really is failing. 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: wxiaoguang <wxiaoguang@gmail.com>
* Reset Session ID on login (#18018)zeripath2021-12-201-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Simplify parameter types (#18006)Gusted2021-12-2034-80/+80
| | | Remove repeated type declarations in function definitions.
* 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>
* 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>
* Improve TestPatch to use git read-tree -m and implement git-merge-one-file ↵zeripath2021-12-191-1/+5
| | | | | | | | | | | | | 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>
* Add option to define refs in issue templates (#17842)qwerty2872021-12-171-0/+1
| | | | Adds a markdown header option `ref` that allows you to set the ref the issue should belong.
* Fix rename notification bug (#18008)Lunny Xiao2021-12-171-2/+0
|
* Use JSON module instead of stdlib json (#18003)Gusted2021-12-171-1/+1
|
* Prevent hang in git cat-file if repository is not a valid repository and ↵zeripath2021-12-165-1/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-161-0/+4
| | | | | | | | | | | | | | 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>
* Make AvatarRenderedSizeFactor configurable and set it to 3 (#17951)silverwind2021-12-164-13/+17
| | | | | | | | | | | | 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>
* 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>