]> source.dussan.org Git - gitea.git/log
gitea.git
3 years agoRemove unnecessary goroutine (#16080)
Lunny Xiao [Wed, 9 Jun 2021 19:52:55 +0000 (03:52 +0800)]
Remove unnecessary goroutine (#16080)

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoAdd sso.Group, context.Auth, context.APIAuth to allow auth special routes (#16086)
Lunny Xiao [Wed, 9 Jun 2021 17:53:16 +0000 (01:53 +0800)]
Add sso.Group, context.Auth, context.APIAuth to allow auth special routes (#16086)

* Add sso.Group, context.Auth, context.APIAuth to allow auth special routes

* Remove unnecessary check

* Rename sso -> auth

* remove unused method of Auth interface

3 years agoFix http path bug (#16117)
Lunny Xiao [Wed, 9 Jun 2021 12:53:12 +0000 (20:53 +0800)]
Fix http path bug (#16117)

* Fix http path bug

* Add missed request

* add tests

Co-authored-by: 6543 <6543@obermui.de>
3 years agoRefactor routers directory (#15800)
Lunny Xiao [Tue, 8 Jun 2021 23:33:54 +0000 (07:33 +0800)]
Refactor routers directory (#15800)

* refactor routers directory

* move func used for web and api to common

* make corsHandler a function to prohibit side efects

* rm unused func

Co-authored-by: 6543 <6543@obermui.de>
3 years agoRemove spurious AppSubUrl in serviceworker request. (#16047)
zeripath [Tue, 8 Jun 2021 17:46:13 +0000 (18:46 +0100)]
Remove spurious AppSubUrl in serviceworker request. (#16047)

There is another spurious AppSubUrl placement in the serviceworker registration.
This PR removes it.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoFix `doctor --run check-db-consistency --fix` with label fix (#16094)
Lunny Xiao [Tue, 8 Jun 2021 04:36:23 +0000 (12:36 +0800)]
Fix `doctor --run check-db-consistency --fix` with label fix (#16094)

* Add doctor for wrong label and issue_label data

* Fix labels and issue labels check

* Remove unnecessary functions

3 years agoAlways store primary email address into email_address table and also the state (...
Lunny Xiao [Tue, 8 Jun 2021 03:52:51 +0000 (11:52 +0800)]
Always store primary email address into email_address table and also the state (#15956)

* Always store primary email address into email_address table and also the state

* Add lower_email to not convert email to lower as what's added

* Fix fixture

* Fix tests

* Use BeforeInsert to save lower email

* Fix v180 migration

* fix tests

* Fix test

* Remove wrong submited codes

* Fix test

* Fix test

* Fix test

* Add test for v181 migration

* remove change user's email to lower

* Revert change on user's email column

* Fix lower email

* Fix test

* Fix test

3 years agoFix data URI scramble (#16098)
KN4CK3R [Mon, 7 Jun 2021 16:55:26 +0000 (18:55 +0200)]
Fix data URI scramble (#16098)

* Removed unused method.

* No prefix for data uris.

* Added test to prevent regressions.

3 years agoMerge all deleteBranch as one function and also fix bug when delete branch don't...
Lunny Xiao [Mon, 7 Jun 2021 14:52:59 +0000 (22:52 +0800)]
Merge all deleteBranch as one function and also fix bug when delete branch don't close related PRs (#16067)

* Fix bug when delete branch don't close related PRs

* Merge all deletebranch as one method

* Add missed branch.go

* fix comment

Co-authored-by: Lauris BH <lauris@nix.lv>
3 years agoFixed assert statements. (#16089)
KN4CK3R [Mon, 7 Jun 2021 05:27:09 +0000 (07:27 +0200)]
Fixed assert statements. (#16089)

3 years agoMake commit info cancelable (#16032)
zeripath [Sun, 6 Jun 2021 23:44:58 +0000 (00:44 +0100)]
Make commit info cancelable (#16032)

* Make modules/context.Context a context.Context

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Simplify context calls

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Set the base context for requests to the HammerContext

Signed-off-by: Andrew Thornton <art27@cantab.net>
* pass context into get-last-commit

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Make commit_info cancellable

Signed-off-by: Andrew Thornton <art27@cantab.net>
* use context as context

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoFix regression of renderer (#16091)
Lunny Xiao [Sun, 6 Jun 2021 22:50:07 +0000 (06:50 +0800)]
Fix regression of renderer (#16091)

* Fix regression of renderer

* Fix render setting load twice bug

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 6 Jun 2021 00:11:36 +0000 (00:11 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoRewrite of the LFS server (#15523)
KN4CK3R [Sat, 5 Jun 2021 23:59:27 +0000 (01:59 +0200)]
Rewrite of the LFS server (#15523)

* Restructured code. Moved static checks out of loop.

* Restructured batch api. Add support for individual errors.

* Let router decide if LFS is enabled.

* Renamed methods.

* Return correct status from verify handler.

* Unified media type check in router.

* Changed error code according to spec.

* Moved checks into router.

* Removed invalid v1 api methods.

* Unified methods.

* Display better error messages.

* Added size parameter. Create meta object on upload.

* Use object error on invalid size.

* Skip upload if object exists.

* Moved methods.

* Suppress fields in response.

* Changed error on accept.

* Added tests.

* Use ErrorResponse object.

* Test against message property.

* Add support for the old invalid lfs client.

* Fixed the check because MinIO wraps the error.

* Use individual repositories.

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
3 years agoChange default TMPDIR path in rootless containers (#16077)
Steven [Sat, 5 Jun 2021 22:04:56 +0000 (00:04 +0200)]
Change default TMPDIR path in rootless containers (#16077)

Signed-off-by: Steven Kriegler <61625851+justusbunsi@users.noreply.github.com>
3 years agoFix panic (#16072)
zeripath [Sat, 5 Jun 2021 14:23:22 +0000 (15:23 +0100)]
Fix panic (#16072)

There is an incorrect casting in the wrapped queue.

Fix #16071

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoFix typo and add TODO notice (#16064)
NekoBit [Sat, 5 Jun 2021 13:33:34 +0000 (09:33 -0400)]
Fix typo and add TODO notice (#16064)

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
3 years agoAdd Image Diff for SVG files (#14867)
KN4CK3R [Sat, 5 Jun 2021 12:32:19 +0000 (14:32 +0200)]
Add Image Diff for SVG files (#14867)

* Added type sniffer.

* Switched content detection from base to typesniffer.

* Added GuessContentType to Blob.

* Moved image info logic to client.
Added support for SVG images in diff.

* Restore old blocked svg behaviour.

* Added missing image formats.

* Execute image diff only when container is visible.

* add margin to spinner

* improve BIN tag on image diffs

* Default to render view.

* Show image diff on incomplete diff.

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
3 years agoCopy git data from disk when restore repository (#16066)
Lunny Xiao [Fri, 4 Jun 2021 13:14:20 +0000 (21:14 +0800)]
Copy git data from disk when restore repository (#16066)

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 4 Jun 2021 00:11:34 +0000 (00:11 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoFixed unknown translation key. (#16057)
KN4CK3R [Thu, 3 Jun 2021 22:50:31 +0000 (00:50 +0200)]
Fixed unknown translation key. (#16057)

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 3 Jun 2021 00:11:34 +0000 (00:11 +0000)]
[skip ci] Updated translations via Crowdin

3 years agouse "true" for RACE_ENABLED (#15261)
6543 [Wed, 2 Jun 2021 15:34:11 +0000 (17:34 +0200)]
use "true" for RACE_ENABLED (#15261)

3 years agoFix case change in ownernames (#16045)
zeripath [Wed, 2 Jun 2021 12:03:59 +0000 (13:03 +0100)]
Fix case change in ownernames (#16045)

If you change the case of a username the change needs to be propagated to their
repositories.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoFix bug due to missing MaxStartups and MaxSessions (#16046)
zeripath [Tue, 1 Jun 2021 19:55:17 +0000 (20:55 +0100)]
Fix bug due to missing MaxStartups and MaxSessions (#16046)

Unforunately #16009 makes these settings mandatory. This PR uses the same technique
as used for the certificates to make these settings non-mandatory.

Fix #16044

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoFix language switch for install page (#16043)
a1012112796 [Tue, 1 Jun 2021 19:12:50 +0000 (03:12 +0800)]
Fix language switch for install page (#16043)

Signed-off-by: a1012112796 <1012112796@qq.com>
3 years agoupdate ``.raw-content`` when edit issue/comment content (#16021)
a1012112796 [Tue, 1 Jun 2021 02:22:49 +0000 (10:22 +0800)]
update ``.raw-content`` when edit issue/comment content (#16021)

* update ``.raw-content`` when edit issue/comment content

fix #16000

Signed-off-by: a1012112796 <1012112796@qq.com>
* handle empty content

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoMake sshd_config more flexible regarding connections (#16009)
Dario Louzado [Tue, 1 Jun 2021 01:33:50 +0000 (22:33 -0300)]
Make sshd_config more flexible regarding connections (#16009)

* Make sshd_config more flexible regarding
MaxStartups and MaxSessions.

See https://man.openbsd.org/sshd_config
for more information.

* make property prefix equals
other existing Gitea SSH properties.

Co-authored-by: dlouzado <dlouzado@senado.leg.br>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 1 Jun 2021 00:11:31 +0000 (00:11 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoAdd missing SameSite settings for the i_like_gitea cookie (#16037)
zeripath [Mon, 31 May 2021 18:22:36 +0000 (19:22 +0100)]
Add missing SameSite settings for the i_like_gitea cookie (#16037)

The i_like_gitea cookie appears to be missing the SameSite settings. I think they
were present at some point but may have been removed in a merge.

This PR ensures that they are set.

Fix #15972

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoHide mirror passwords on repo settings page (#16022)
zeripath [Mon, 31 May 2021 10:46:20 +0000 (11:46 +0100)]
Hide mirror passwords on repo settings page (#16022)

This PR simply hides mirror passwords from being displayed on the repo settings page.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoEncrypt migration credentials at rest (#15895)
Norwin [Mon, 31 May 2021 08:25:47 +0000 (08:25 +0000)]
Encrypt migration credentials at rest (#15895)

* encrypt migration credentials in task persistence

Not sure this is the best approach, we could encrypt the entire
`PayloadContent` instead. Also instead of clearing individual fields in
payload content, we could just delete the task once it has
(successfully) finished..?

* remove credentials of past migrations

* only run DB migration for completed tasks

* fix binding

* add omitempty

* never serialize unencrypted credentials

* fix import order

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years agoFix bug in reverse proxy (#16026)
zeripath [Mon, 31 May 2021 06:54:16 +0000 (07:54 +0100)]
Fix bug in reverse proxy (#16026)

Unfortunately go panics you try to cast a nil interface{} as another primitive
therefore you need to check interfaces are not nil before casting.

Fix #16025

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoMake modules/context.Context a context.Context (#16031)
zeripath [Mon, 31 May 2021 06:18:11 +0000 (07:18 +0100)]
Make modules/context.Context a context.Context (#16031)

* Make modules/context.Context a context.Context

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Simplify context calls

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Set the base context for requests to the HammerContext

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 31 May 2021 00:11:22 +0000 (00:11 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoReplace clipboard.js with async clipboard api (#15899)
silverwind [Sun, 30 May 2021 19:15:57 +0000 (21:15 +0200)]
Replace clipboard.js with async clipboard api (#15899)

Use async clipboard api [1] over this dependency, saving around 10kB
bundle size before minify while delivering the same functionality.

The issue comment button works but does not have a popup indication. We
could add some toast-style notifications in the future to fix that but I
think it's out of scope of this PR.

[1] https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/writeText

3 years agoClose the dataRC reader sooner (#16023)
zeripath [Sun, 30 May 2021 16:38:44 +0000 (17:38 +0100)]
Close the dataRC reader sooner (#16023)

Fix #15932

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoImprove assets handler middleware (#15961)
Lunny Xiao [Sun, 30 May 2021 10:25:11 +0000 (18:25 +0800)]
Improve assets handler middleware (#15961)

* Use route to serve assets but not middleware

* Fix build error with bindata tag

* convert path to absolute

* fix build

* reduce function stack

* Add tests for assets

* Remove test for assets because they are not generated

* Use a http function to serve assets

* Still use middleware to serve assets then less middleware stack for assets

* Move serveContent to original position

* remove unnecessary blank line change

* Fix bug for /assets* requests

* clean code

Co-authored-by: zeripath <art27@cantab.net>
3 years agoDon't manipulate input params in email notification (#16011)
Jimmy Praet [Sun, 30 May 2021 09:38:38 +0000 (11:38 +0200)]
Don't manipulate input params in email notification (#16011)

3 years ago[skip ci] Updated licenses and gitignores
GiteaBot [Sun, 30 May 2021 00:11:22 +0000 (00:11 +0000)]
[skip ci] Updated licenses and gitignores

3 years agoFix get tag when migration (#16014)
Lunny Xiao [Sat, 29 May 2021 20:04:58 +0000 (04:04 +0800)]
Fix get tag when migration (#16014)

Co-authored-by: zeripath <art27@cantab.net>
3 years agoUnified custom config creation (#16012)
KN4CK3R [Sat, 29 May 2021 18:44:14 +0000 (20:44 +0200)]
Unified custom config creation (#16012)

* Unified custom config creation.

* Fixed log message.

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoRemove New PR button in PRs (#15998)
Kyle D [Sat, 29 May 2021 14:00:02 +0000 (08:00 -0600)]
Remove New PR button in PRs (#15998)

3 years agofix get OS on some of the windows computers (#16007)
BoYanZh [Sat, 29 May 2021 07:37:21 +0000 (15:37 +0800)]
fix get OS on some of the windows computers (#16007)

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 29 May 2021 00:11:33 +0000 (00:11 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoUpdate queue workers for v1.15 (#15999)
Kyle D [Fri, 28 May 2021 17:33:52 +0000 (11:33 -0600)]
Update queue workers for v1.15 (#15999)

* Update queue workers for v1.15

* update app.example.ini

* update re queue path

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Andrew Thornton <art27@cantab.net>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 28 May 2021 00:11:34 +0000 (00:11 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoAdd links to toggle WIP status (#14677)
Jimmy Praet [Thu, 27 May 2021 20:02:04 +0000 (22:02 +0200)]
Add links to toggle WIP status (#14677)

* Add links to toggle PR WIP status

* Allow PR author to toggle WIP status

* refactors and restyling, remove links from translations

Co-authored-by: Norwin <noerw@users.noreply.github.com>
Co-authored-by: silverwind <me@silverwind.io>
3 years agoAllow Token/Basic auth on raw paths (#15987)
zeripath [Thu, 27 May 2021 18:46:11 +0000 (19:46 +0100)]
Allow Token/Basic auth on raw paths (#15987)

It appears that people have been using token authentication to navigate to raw paths
and recent changes have broken this. Whilst ideally these paths would not be being used
like this - it was not the intention to be a breaking change.

This PR restores access to these paths.

Fix #13772

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoadd permission check for ``GenerateRepository`` (#15946)
a1012112796 [Thu, 27 May 2021 16:08:46 +0000 (00:08 +0800)]
add permission check for ``GenerateRepository`` (#15946)

Signed-off-by: a1012112796 <1012112796@qq.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years agoFix extra curly brace breaking release compare (#15988)
Kyle D [Thu, 27 May 2021 01:07:39 +0000 (19:07 -0600)]
Fix extra curly brace breaking release compare (#15988)

3 years agoFix setting of SameSite on cookies (#15989)
zeripath [Thu, 27 May 2021 01:01:07 +0000 (02:01 +0100)]
Fix setting of SameSite on cookies (#15989)

Fix #15972

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agofollow redirect when fetching theme archive (#15986)
techknowlogick [Wed, 26 May 2021 22:03:39 +0000 (18:03 -0400)]
follow redirect when fetching theme archive (#15986)

3 years agonot show link to migration on repo reate page when it was disabled (#15957)
a1012112796 [Wed, 26 May 2021 16:13:00 +0000 (00:13 +0800)]
not show link to migration on repo reate page when it was disabled (#15957)

* not show link to migration on repo reate page when it was disabled

Signed-off-by: a1012112796 <1012112796@qq.com>
* fix lint

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoUse filepath.ToSlash and Join in indexer defaults and queues (#15971)
zeripath [Wed, 26 May 2021 02:50:35 +0000 (03:50 +0100)]
Use filepath.ToSlash and Join in indexer defaults and queues (#15971)

As revealed by #15964 there is inconsistent use of filepath Join and path Join
for these directories. The best thing to do is to use filepath.Join but then ToSlash
them for consistency.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 26 May 2021 00:04:32 +0000 (00:04 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoRemove branch URL before IssueRefURL (#15968)
fnetX (aka fralix) [Tue, 25 May 2021 20:02:37 +0000 (22:02 +0200)]
Remove branch URL before IssueRefURL (#15968)

Revert change for account / org dashboard where IssueRefURLs do not
contain the full repo URL (case RepoLink is not true)

Co-authored-by: Norwin <noerw@users.noreply.github.com>
Remove trailing whitespace from PR review

3 years agoAdd possibility to make branch in branch page (#15960)
Viktor Yakovchuk [Mon, 24 May 2021 14:57:46 +0000 (17:57 +0300)]
Add possibility to make branch in branch page (#15960)

* Add possibility to make branch in branch page (#15911)

Add possibility to make branch in branch page
in the area next to Download and Delete buttons.
It is a more intuitive place in the interface
compared to what is already there.

Signed-off-by: Viktor Yakovchuk <viktor@yakovchuk.net>
* Update templates/repo/branch/list.tmpl

Co-authored-by: zeripath <art27@cantab.net>
3 years agoChange default queue settings to be low go-routines (#15964)
zeripath [Sun, 23 May 2021 23:23:55 +0000 (00:23 +0100)]
Change default queue settings to be low go-routines (#15964)

This PR suggests a change to the default configuration for queues:

* Use a common DATADIR for the queues
* Set starting workers to 0 and make boost a single worker

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoMake tasklist checkboxes clickable (#15791)
KN4CK3R [Sun, 23 May 2021 14:14:03 +0000 (16:14 +0200)]
Make tasklist checkboxes clickable (#15791)

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lauris BH <lauris@nix.lv>
3 years agoRemove fomantic accordion module (#15951)
silverwind [Sun, 23 May 2021 00:45:39 +0000 (02:45 +0200)]
Remove fomantic accordion module (#15951)

Replace it with native <detail> element. Did some slight restyling on
the release downloads, new behaviour should be exactly the same
otherwise.

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoRemove remaining fontawesome usage in templates (#15952)
silverwind [Sat, 22 May 2021 21:29:46 +0000 (23:29 +0200)]
Remove remaining fontawesome usage in templates (#15952)

Can not remove the dependency yet because easymde depends on it.

3 years agoUpdate pull_request_template.md (#15948)
Ikko Ashimine [Sat, 22 May 2021 14:46:33 +0000 (23:46 +0900)]
Update pull_request_template.md (#15948)

Branch name
- master -> main

3 years agoAdd email headers (#15939)
KN4CK3R [Sat, 22 May 2021 06:47:16 +0000 (08:47 +0200)]
Add email headers (#15939)

* Added additional email headers.

* Added tests.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years agoDouble the avatar size factor (#15941)
silverwind [Sat, 22 May 2021 01:18:43 +0000 (03:18 +0200)]
Double the avatar size factor (#15941)

* Double the avatar size factor

This results on finer Avatar rendering on Hi-DPI display.

* fix test

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 22 May 2021 00:04:28 +0000 (00:04 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoBump `postgres` and `mysql` versions (#15710)
Patrick Schratz [Fri, 21 May 2021 22:11:48 +0000 (00:11 +0200)]
Bump `postgres` and `mysql` versions (#15710)

* bump postgres and mysql DB versions

* posgres test against v10

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoadd a new internal hook to save ssh log (#15787)
a1012112796 [Fri, 21 May 2021 21:37:16 +0000 (05:37 +0800)]
add a new internal hook to save ssh log (#15787)

* add a new internal hook to save ssh log

as title, when a ssh error ocure like #15785.
only when switch ``RUN_MODE`` to dev can we
found which error is ocure. But this way is
not a good idea for production envirment.

this changes try save ssh error mesage to the
log file like other log by a new internal hook.
I think it's usefull for find error message
in production envirment. Thanks.

Signed-off-by: a1012112796 <1012112796@qq.com>
* rename and fix nit

* Update modules/private/hook.go

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agofix default avatar url (#15938)
Norwin [Fri, 21 May 2021 17:03:27 +0000 (17:03 +0000)]
fix default avatar url (#15938)

3 years agoAdd curl to rootless docker image (#15908)
Steven [Fri, 21 May 2021 04:03:41 +0000 (06:03 +0200)]
Add curl to rootless docker image (#15908)

Signed-off-by: JustusBunsi <61625851+justusbunsi@users.noreply.github.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years agoFix layout of milestone view (#15927)
sebastian-sauer [Thu, 20 May 2021 21:53:55 +0000 (23:53 +0200)]
Fix layout of milestone view (#15927)

fix #15047

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoUse node 16 on release tasks too (#15936)
silverwind [Thu, 20 May 2021 20:37:20 +0000 (22:37 +0200)]
Use node 16 on release tasks too (#15936)

Forgot these in https://github.com/go-gitea/gitea/pull/15804.

3 years agoEncrypt LDAP bind password in db with SECRET_KEY (#15547)
zeripath [Thu, 20 May 2021 08:29:57 +0000 (09:29 +0100)]
Encrypt LDAP bind password in db with SECRET_KEY (#15547)

* Encrypt LDAP bind password in db with SECRET_KEY

The LDAP source bind password are currently stored in plaintext in the db
This PR simply encrypts them with the setting.SECRET_KEY.

Fix #15460

Signed-off-by: Andrew Thornton <art27@cantab.net>
* remove ui warning regarding unencrypted password

Co-authored-by: silverwind <me@silverwind.io>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 20 May 2021 00:25:08 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoDisable legal comments in esbuild (#15929)
silverwind [Wed, 19 May 2021 21:46:30 +0000 (23:46 +0200)]
Disable legal comments in esbuild (#15929)

We already serve licenses.txt so we don't need these inline comments
preserved during esbuild minification. Saves around 4kB before gzip.

3 years agoapi: fix overly strict edit pr permissions (#15900)
Norwin [Wed, 19 May 2021 14:48:48 +0000 (14:48 +0000)]
api: fix overly strict edit pr permissions (#15900)

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoFix and restyle menu on code line (#15913)
silverwind [Wed, 19 May 2021 03:16:02 +0000 (05:16 +0200)]
Fix and restyle menu on code line (#15913)

* Fix and restyle menu on code line

* fix multiline and more tweaks

* move to separate files

* remove has-context-menu class

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoRestore token authentication for git http when 2FA active (#15915)
zeripath [Wed, 19 May 2021 02:30:33 +0000 (03:30 +0100)]
Restore token authentication for git http when 2FA active (#15915)

There was a small regression in #15303 whereby token auth
with 2FA active would be disallowed.

This PR fixes this.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 19 May 2021 00:25:09 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoFix typo in hacking-on-gitea.en-us.md (#15918)
Ikko Ashimine [Tue, 18 May 2021 17:35:59 +0000 (02:35 +0900)]
Fix typo in hacking-on-gitea.en-us.md (#15918)

* continously -> continuously
* continous -> continuous

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 18 May 2021 00:25:04 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoUse Wants= over Requires= in systemd file (#15897)
silverwind [Mon, 17 May 2021 13:09:15 +0000 (15:09 +0200)]
Use Wants= over Requires= in systemd file (#15897)

`Requires=` has the behaviour of stopping `gitea.service` when the
database is stopped but not bringing it up again after the database is
started again. Use `Wants=` to define a weak requirement instead,
meaning `gitea.service` will be kept running when the database is
stopped, which is not an issue because gitea will just reconnect later
on.

Fixes: https://github.com/go-gitea/gitea/issues/15866
Co-authored-by: zeripath <art27@cantab.net>
3 years agogit migration: don't prompt interactively for clone credentials (#15902)
Norwin [Mon, 17 May 2021 10:59:31 +0000 (10:59 +0000)]
git migration: don't prompt interactively for clone credentials (#15902)

* don't prompt interactively for clone credentials

* apply GIT_TERMINAL_PROMPT=0 to all git cmds

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 17 May 2021 00:25:05 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoremove unimplemented searchbar from project view (#15901)
Norwin [Mon, 17 May 2021 00:10:30 +0000 (00:10 +0000)]
remove unimplemented searchbar from project view (#15901)

3 years agoIssue sidebar and misc css fixes (#15524)
silverwind [Sun, 16 May 2021 20:18:18 +0000 (22:18 +0200)]
Issue sidebar and misc css fixes (#15524)

- Replace remaining font icons with SVG in issue sidebar
- Rework issue due date display
- Realign avatar in timeline
- Fix font size in repo search and code explore
- Consolidate active button styles
- Fix loading form on arc-green
- Align time tracker buttons vertically

Fixes: https://github.com/go-gitea/gitea/issues/15896
3 years agoUse a special name for update default branch on repository setting (#15893)
Lunny Xiao [Sun, 16 May 2021 18:24:47 +0000 (02:24 +0800)]
Use a special name for update default branch on repository setting (#15893)

3 years agoRework Token API comments (#15162)
Ian Wienand [Sun, 16 May 2021 13:51:53 +0000 (23:51 +1000)]
Rework Token API comments (#15162)

Move the token API discussion into a common section discussing the
generation and listing of the tokens.  Add a note on the display of
the sha1 during creation and listing.

Co-authored-by: Norwin <noerw@users.noreply.github.com>
3 years agoimprove empty notice (#15890)
Lunny Xiao [Sun, 16 May 2021 11:58:26 +0000 (19:58 +0800)]
improve empty notice (#15890)

3 years agoSystemd needs After as well as Require (#15881)
zeripath [Sun, 16 May 2021 08:41:37 +0000 (09:41 +0100)]
Systemd needs After as well as Require (#15881)

If the gitea service is stopped because of the db going down
it needs an `After=db.service` to ensure it is restarted in
addition to the `Requires=db.service` to ensure that the db
is started before gitea is started.

Fix #15866

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years ago[skip ci] Updated licenses and gitignores
GiteaBot [Sun, 16 May 2021 00:25:04 +0000 (00:25 +0000)]
[skip ci] Updated licenses and gitignores

3 years agoMove sans-serif fallback font higher than emoji fonts (#15855)
zeripath [Sun, 16 May 2021 00:12:55 +0000 (01:12 +0100)]
Move sans-serif fallback font higher than emoji fonts (#15855)

The Tor browser does not use the system-ui font and no other fonts in the stack match
its default fonts. In fact it is possible that it will in future only
match generic fonts. This means that all rendering will first try the
emoji fonts before falling back to the sans-serif font for glyphs.

In this case has the emoji fall back fonts for Tor contains empty glyphs
for numbers - in order to protect privacy - and leads to numbers being
rendered as empty glyphs. This is clearly not ideal and whilst we could
use the Arimo font - as I state above I suspect that Tor will eventually
ban detecting this and we should instead move the sans-serif font higher
in the stack so that it matches before the emoji fonts.

Partial fix of #15844

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoGitHub: migrate draft releases too (#15884)
6543 [Sat, 15 May 2021 22:37:17 +0000 (00:37 +0200)]
GitHub: migrate draft releases too (#15884)

* GitHub: migrate draft releases too

* refactor

3 years agoHold the event source when there are no listeners (#15725)
zeripath [Sat, 15 May 2021 21:46:13 +0000 (22:46 +0100)]
Hold the event source when there are no listeners (#15725)

* Hold the event source when there are no listeners

The event source does not need to run when there are no listeners. Therefore
pause it when there are none.

* add some more logging

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoCreate a session on ReverseProxy and ensure that ReverseProxy users cannot change...
zeripath [Sat, 15 May 2021 18:33:13 +0000 (19:33 +0100)]
Create a session on ReverseProxy and ensure that ReverseProxy users cannot change username (#15304)

* Create a session on ReverseProxy and ensure that ReverseProxy users cannot change username

ReverseProxy users should generate a session on reverse proxy username change.

Also prevent ReverseProxy users from changing their username.

Fix #2407

* add testcase

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoPrevent double-login for Git HTTP and LFS and simplify login (#15303)
zeripath [Sat, 15 May 2021 15:32:09 +0000 (16:32 +0100)]
Prevent double-login for Git HTTP and LFS and simplify login (#15303)

* Prevent double-login for Git HTTP and LFS and simplify login

There are a number of inconsistencies with our current methods for
logging in for git and lfs. The first is that there is a double login
process. This is particularly evident in 1.13 where there are no less
than 4 hash checks for basic authentication due to the previous
IsPasswordSet behaviour.

This duplicated code had individual inconsistencies that were not
helpful and caused confusion.

This PR does the following:

* Remove the specific login code from the git and lfs handlers except
for the lfs special bearer token
* Simplify the meaning of DisableBasicAuthentication to allow Token and
Oauth2 sign-in.
* The removal of the specific code from git and lfs means that these
both now have the same login semantics and can - if not
DisableBasicAuthentication - login from external services. Further it
allows Oauth2 token authentication as per our standard mechanisms.
* The change in the recovery handler prevents the service from
re-attempting to login - primarily because this could easily cause a
further panic and it is wasteful.

* add test

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Andrew Thornton <art27@cantab.net>
3 years agoMultiple Queue improvements: LevelDB Wait on empty, shutdown empty shadow level queue...
zeripath [Sat, 15 May 2021 14:22:26 +0000 (15:22 +0100)]
Multiple Queue improvements: LevelDB Wait on empty, shutdown empty shadow level queue, reduce goroutines etc (#15693)

* move shutdownfns, terminatefns and hammerfns out of separate goroutines

Coalesce the shutdownfns etc into a list of functions that get run at shutdown
rather then have them run at goroutines blocked on selects.

This may help reduce the background select/poll load in certain
configurations.

* The LevelDB queues can actually wait on empty instead of polling

Slight refactor to cause leveldb queues to wait on empty instead of polling.

* Shutdown the shadow level queue once it is empty

* Remove bytefifo additional goroutine for readToChan as it can just be run in run

* Remove additional removeWorkers goroutine for workers

* Simplify the AtShutdown and AtTerminate functions and add Channel Flusher

* Add shutdown flusher to CUQ

* move persistable channel shutdown stuff to Shutdown Fn

* Ensure that UPCQ has the correct config

* handle shutdown during the flushing

* reduce risk of race between zeroBoost and addWorkers

* prevent double shutdown

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoFix error message when saving generated LOCAL_ROOT_URL config (#15880)
Naohisa Murakami [Sat, 15 May 2021 10:23:21 +0000 (19:23 +0900)]
Fix error message when saving generated LOCAL_ROOT_URL config (#15880)

3 years agoFix blame row height alignment (#15863)
Norwin [Sat, 15 May 2021 01:15:53 +0000 (01:15 +0000)]
Fix blame row height alignment (#15863)

* fix blame row alignment on firefox

* fix blame row alignment in chrome

* fix blame row alignment in safari

as per @silverwind

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 15 May 2021 00:25:06 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin