aboutsummaryrefslogtreecommitdiffstats
path: root/services
Commit message (Collapse)AuthorAgeFilesLines
* Use a variable but a function for IsProd because of a slight performance ↵Lunny Xiao2021-10-201-1/+1
| | | | increment (#17368)
* Fix some lints (#17337)Lunny Xiao2021-10-172-3/+4
| | | Fix some linting problems.
* Make the Mirror Queue a queue (#17326)zeripath2021-10-171-33/+65
| | | | | | | | | Convert the old mirror syncing queue to the more modern queue format. Fix a bug in the from the repo-archive queue PR - the assumption was made that uniqueness could be enforced with by checking equality in a map in channel unique queues - however this only works for primitive types - which was the initial intention but is an imperfect. This is fixed by marshalling the data and placing the martialled data in the unique map instead. The documentation is also updated to add information about the deprecated configuration values. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add buttons to allow loading of incomplete diffs (#16829)zeripath2021-10-153-11/+27
| | | | | | | | | | | | | | | | | This PR adds two buttons to the stats and the end of the diffs list to load the (some of) the remaining incomplete diff sections. Contains #16775 Signed-off-by: Andrew Thornton <art27@cantab.net> ## Screenshots ### Show more button at the end of the diff ![Screenshot from 2021-09-04 11-12-37](https://user-images.githubusercontent.com/1824502/132091009-b1f6113e-2c04-4be5-8a04-b8ecea56887b.png) ### Show more button at the end of the diff stats box ![Screenshot from 2021-09-04 11-14-54](https://user-images.githubusercontent.com/1824502/132091063-86da5a6d-6628-4b82-bea9-3655cd9f40f6.png)
* Upgrade chi to v5 (#17298)Lunny Xiao2021-10-131-1/+1
|
* Save and view issue/comment content history (#16909)wxiaoguang2021-10-101-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * issue content history * Use timeutil.TimeStampNow() for content history time instead of issue/comment.UpdatedUnix (which are not updated in time) * i18n for frontend * refactor * clean up * fix refactor * re-format * temp refactor * follow db refactor * rename IssueContentHistory to ContentHistory, remove empty model tags * fix html * use avatar refactor to generate avatar url * add unit test, keep at most 20 history revisions. * re-format * syntax nit * Add issue content history table * Update models/migrations/v197.go Co-authored-by: 6543 <6543@obermui.de> * fix merge Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lauris BH <lauris@nix.lv>
* Add a simple way to rename branch like gh (#15870)a10121127962021-10-082-0/+51
| | | | | | | | | | - Update default branch if needed - Update protected branch if needed - Update all not merged pull request base branch name - Rename git branch - Record this rename work and auto redirect for old branch on ui Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: delvh <dev.lh@web.de>
* Avatar refactor, move avatar code from `models` to `models.avatars`, remove ↵wxiaoguang2021-10-061-1/+2
| | | | | | | | | | | | | | | | duplicated code (#17123) Why this refactor The goal is to move most files from `models` package to `models.xxx` package. Many models depend on avatar model, so just move this first. And the existing logic is not clear, there are too many function like `AvatarLink`, `RelAvatarLink`, `SizedRelAvatarLink`, `SizedAvatarLink`, `MakeFinalAvatarURL`, `HashedAvatarLink`, etc. This refactor make everything clear: * user.AvatarLink() * user.AvatarLinkWithSize(size) * avatars.GenerateEmailAvatarFastLink(email, size) * avatars.GenerateEmailAvatarFinalLink(email, size) And many duplicated code are deleted in route handler, the handler and the model share the same avatar logic now.
* Add specific event type to header (#17222)John Olheiser2021-10-051-3/+8
| | | | | | | * Add specific event type to header Signed-off-by: jolheiser <john.olheiser@gmail.com> * Change single to type
* Always set a unique Message-ID header. (#17206)KN4CK3R2021-10-012-13/+30
|
* Fix missing repo link in issue/pull assigned emails (#17183)zeripath2021-09-301-0/+6
| | | | | | | | | | | | | There was a mistake in the template file: `templates/mail/issue/assigned.tmpl` where the repourl was generated from a non-existent release instead of the issue. This PR changes this to use the issue but also ensure that the issue repo is loaded. It also slightly improves the English locale string. Fix #17160 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: delvh <dev.lh@web.de>
* Kanban colored boards (#16647)Romain2021-09-291-0/+1
| | | Add a column Color in ProjectBoard and color picker in new / edit project board form.
* Don't return binary file changes in raw PR diffs by default (#17158)Norwin2021-09-271-3/+3
| | | | | | | | * return diffs without binary file content change * ?binary=true option to restore old behaviour Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: zeripath <art27@cantab.net>
* Support direct comparison (git diff a..b) as well merge comparison (a...b) ↵zeripath2021-09-273-6/+11
| | | | | | | | | | | | (#16635) This PR changes the compare page to make the "..." in the between branches a clickable link. This changes the comparison type from "..." to "..". Similarly it makes the initial compare icon clickable to switch the head and base branches. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Allow LDAP Sources to provide Avatars (#16851)zeripath2021-09-265-6/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Allow LDAP Sources to provide Avatars Add setting to LDAP source to allow it to provide an Avatar. Currently this is required to point to the image bytes. Fix #4144 Signed-off-by: Andrew Thornton <art27@cantab.net> * Rename as Avatar Attribute (drop JPEG) Signed-off-by: Andrew Thornton <art27@cantab.net> * Always synchronize avatar if there is change Signed-off-by: Andrew Thornton <art27@cantab.net> * Actually get the avatar from the ldap Signed-off-by: Andrew Thornton <art27@cantab.net> * clean-up Signed-off-by: Andrew Thornton <art27@cantab.net> * use len()>0 rather than != "" Signed-off-by: Andrew Thornton <art27@cantab.net> * slight shortcut in IsUploadAvatarChanged Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Add SkipLocal2FA option to pam and smtp sources (#17078)zeripath2021-09-266-4/+16
| | | | | | | | | | | | | * Add SkipLocal2FA option to other pam and smtp sources Extend #16954 to allow setting skip local 2fa on pam and SMTP authentication sources Signed-off-by: Andrew Thornton <art27@cantab.net> * make SkipLocal2FA omitempty Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
* Fix bundle creation (#17079)Alexey 〒erentyev2021-09-261-2/+4
| | | | | | | Signed-off-by: Alexey Terentyev <axifnx@gmail.com> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Gwyneth Morgan <87623694+gwymor@users.noreply.github.com> Co-authored-by: Gwyneth Morgan <gwymor@tilde.club>
* Move login related structs and functions to models/login (#17093)Lunny Xiao2021-09-2426-82/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Move login related structs and functions to models/login * Fix test * Fix lint * Fix lint * Fix lint of windows * Fix lint * Fix test * Fix test * Only load necessary fixtures when preparing unit tests envs * Fix lint * Fix test * Fix test * Fix error log * Fix error log * Fix error log * remove unnecessary change * fix error log * merge main branch
* DBContext is just a Context (#17100)zeripath2021-09-239-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | * DBContext is just a Context This PR removes some of the specialness from the DBContext and makes it context This allows us to simplify the GetEngine code to wrap around any context in future and means that we can change our loadRepo(e Engine) functions to simply take contexts. Signed-off-by: Andrew Thornton <art27@cantab.net> * fix unit tests Signed-off-by: Andrew Thornton <art27@cantab.net> * another place that needs to set the initial context Signed-off-by: Andrew Thornton <art27@cantab.net> * avoid race Signed-off-by: Andrew Thornton <art27@cantab.net> * change attachment error Signed-off-by: Andrew Thornton <art27@cantab.net>
* refactor: move from io/ioutil to io and os package (#17109)Eng Zer Jun2021-09-227-17/+10
| | | | | | | | | The io/ioutil package has been deprecated as of Go 1.16, see https://golang.org/doc/go1.16#ioutil. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Move db related basic functions to models/db (#17075)Lunny Xiao2021-09-1932-119/+144
| | | | | | | | | | | | | | | | | | | | | | | | | * Move db related basic functions to models/db * Fix lint * Fix lint * Fix test * Fix lint * Fix lint * revert unnecessary change * Fix test * Fix wrong replace string * Use *Context * Correct committer spelling and fix wrong replaced words Co-authored-by: zeripath <art27@cantab.net>
* Open the DingTalk link in browser (#17084)wxiaoguang2021-09-182-13/+28
| | | | | | | | | https://developers.dingtalk.com/document/app/message-link-description To open the link in browser, we should use this URL: `"dingtalk://dingtalkclient/page/link?pc_slide=false&url=" + url.QueryEscape(singleURL)` Otherwise the page is displayed inside DingTalk client, it makes users very difficult to visit non-public URLs in DingTalk webhook messages.
* Make LDAP be able to skip local 2FA (#16954)zeripath2021-09-177-15/+34
| | | | | | This PR extends #16594 to allow LDAP to be able to be set to skip local 2FA too. The technique used here would be extensible to PAM and SMTP sources. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Improve LDAP synchronization efficiency (#16994)zeripath2021-09-152-18/+28
| | | | | | | The current LDAP sync routine has order n^2 efficiency. This change reduces this to order n.log n. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Support unprotected file patterns (#16395)Jimmy Praet2021-09-112-53/+43
| | | | | | | Fixes #16381 Note that changes to unprotected files via the web editor still cannot be pushed directly to the protected branch. I could easily add such support for edits and deletes if needed. But for adding, uploading or renaming unprotected files, it is not trivial. * Extract & Move GetAffectedFiles to modules/git
* Report the associated filter if there is an error in LDAP (#17014)zeripath2021-09-111-2/+2
| | | | | | If there is an error when performing the admin or restricted filter search ensure that the filter and the userDN are reported. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add setting to OAuth handlers to skip local 2FA authentication (#16594)zeripath2021-09-102-0/+2
| | | | | | | | This PR adds a setting to OAuth and OpenID login sources to allow the source to skip local 2FA authentication. Fix #13939 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Use git attributes to determine generated and vendored status for language ↵zeripath2021-09-091-0/+78
| | | | | | | | | | | | | | | | stats and diffs (#16773) Replaces #16262 Replaces #16250 Replaces #14833 This PR first implements a `git check-attr` pipe reader - using `git check-attr --stdin -z --cached` - taking account of the change in the output format in git 1.8.5 and creates a helper function to read a tree into a temporary index file for that pipe reader. It then wires this in to the language stats helper and into the git diff generation. Files which are marked generated will be folded by default. Fixes #14786 Fixes #12653
* Return correct error response for agit force-push (#16989)a10121127962021-09-081-1/+1
| | | | | fix a samll nit for agit `force-push` error response Signed-off-by: a1012112796 <1012112796@qq.com>
* Add repo_id for attachment (#16958)Lunny Xiao2021-09-084-4/+116
| | | | | | | When create a new issue or comment and paste/upload an attachment/image, it will not assign an issue id before submit. So if user give up the creating, the attachments will lost key feature and become dirty content. We don't know if we need to delete the attachment even if the repository deleted. This PR add a repo_id in attachment table so that even if a new upload attachment with no issue_id or release_id but should have repo_id. When deleting a repository, they could also be deleted. Co-authored-by: 6543 <6543@obermui.de>
* Make mirror feature more configurable (#16957)65432021-09-071-0/+13
| | | | | | | | | | | Rename`[repository]` `DISABLE_MIRRORS` to `[mirror]` `DISABLE_NEW_PULL` and add `ENABLED` and `DISABLE_NEW_PUSH` with the below meanings: - `ENABLED`: **true**: Enables the mirror functionality. Set to **false** to disable all mirrors. - `DISABLE_NEW_PULL`: **false**: Disable the creation of **new** mirrors. Pre-existing mirrors remain valid. - `DISABLE_NEW_PUSH`: **false**: Disable the creation of **new** push mirrors. Pre-existing mirrors remain valid. Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: delvh <dev.lh@web.de>
* Prevent panic on diff generation (#16950)zeripath2021-09-051-0/+4
| | | | | | | | The lastLeftIdx should be reset at the same time as creating a new section otherwise it is possible for a second addition to end up attempting to read a nil entry. Fix #16943 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Allow BASIC authentication access to /:owner/:repo/releases/download/* (#16916)zeripath2021-09-024-10/+14
| | | | | | | Duplicate #15987 to allow access to releases download through BASIC authentication. Fix #16914 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add option to update pull request by `rebase` (#16125)a10121127962021-08-312-16/+56
| | | | | * add option to update pull request by `rebase` Signed-off-by: a1012112796 <1012112796@qq.com>
* Test if LFS object is accessible (#16865)KN4CK3R2021-08-311-14/+45
| | | | | | * Test if object is accessible. * Added more logging.
* Repare and Improve GetDiffRangeWithWhitespaceBehavior (#16894)65432021-08-312-23/+14
| | | | | * repare and improve GetDiffRangeWithWhitespaceBehavior * Context with Timeout
* Fix dump and restore respository (#16698)Lunny Xiao2021-08-302-2/+2
| | | | | | | | | | | * Fix dump and restore * return different error message for get commit * Fix missing delete release attachment when deleting repository * Fix ci and add some comments Co-authored-by: zeripath <art27@cantab.net>
* Simplify split diff view generation and remove JS dependency (#16775)zeripath2021-08-291-2/+16
| | | | | | | | | | | Gitea has relied on some slow JS code to match up added and deleted lines on the diff pages. This can cause a considerable slow down on large diff pages. This PR makes a small change meaning that the matching up can occur much more simply. Partial fix #1351 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Refactor the fork service slightly to take ForkRepoOptions (#16744)Kyle Evans2021-08-281-3/+3
| | | | | | | | | | | | | | | | | | | | * Refactor the fork service slightly to take ForkRepoOptions This reduces the number of places we need to change if we want to add other options during fork time. Signed-off-by: Kyle Evans <kevans@FreeBSD.org> * Fix integrations and tests after ForkRepository refactor Signed-off-by: Kyle Evans <kevans@FreeBSD.org> * Update OldRepo -> BaseRepo Signed-off-by: Kyle Evans <kevans@FreeBSD.org> * gofmt pass Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
* Decoupled code from DefaultSigningKey (#16743)KN4CK3R2021-08-272-9/+9
| | | Decoupled code from `DefaultSigningKey`. Makes testing a little bit easier and is cleaner.
* Add EdDSA JWT signing algorithm (#16786)Aliaksandr Mianzhynski2021-08-251-6/+73
| | | | | | | | * Add EdDSA signing algorithm * Fix typo Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Add bundle download for repository (#14538)John Olheiser2021-08-242-7/+19
| | | | | | | | | | | | | | | | | * Add bundle download Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix fmt Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix build tags Signed-off-by: jolheiser <john.olheiser@gmail.com> * Download specific commit Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Fix openidConnect source regression from #16544 (#16759)zeripath2021-08-221-1/+1
| | | | | | | | | Unfortunately there is bug in #16544 meaning that openid connects aren't being matched properly as the capitalisation in that PR is incorrect. This PR changes the capitalisation back to what is expected. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Download lfs in git and web workflow from minio/s3 directly (#16731)Abner2021-08-211-0/+8
|
* Added introspection endpoint. (#16752)KN4CK3R2021-08-202-1/+22
| | | Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Add proxy settings and support for migration and webhook (#16704)Lunny Xiao2021-08-183-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | * Add proxy settings and support for migration and webhook * Fix default value * Add newline for example ini * Add lfs proxy support * Fix lint * Follow @zeripath's review * Fix git clone * Fix test * missgin http requests for proxy * use empty Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
* Use github token URL when fetching oauth token (#16709)techknowlogick2021-08-171-1/+1
| | | Fixes regression from #16544
* Fix spelling of HookProcReceiveResult (#16690)Lunny Xiao2021-08-141-9/+9
|
* [API] generalize list header (#16551)65432021-08-122-3/+11
| | | | | | | | | | | | | * Add info about list endpoints to CONTRIBUTING.md * Let all list endpoints return X-Total-Count header * Add TODOs for GetCombinedCommitStatusByRef * Fix models/issue_stopwatch.go * Rrefactor models.ListDeployKeys * Introduce helper func and use them for SetLinkHeader related func
* Send registration email on user autoregistration (#16523)zeripath2021-08-1210-3/+88
| | | | | | | | | | | When users login and are autoregistered send email notification. Fix #16178 * Protect public functions within the mailer by testing if the mailer is configured Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>