]> source.dussan.org Git - gitea.git/log
gitea.git
3 years agoOnly write config in environment-to-ini if there are changes (#15861) (#15868)
zeripath [Sat, 15 May 2021 12:07:16 +0000 (13:07 +0100)]
Only write config in environment-to-ini if there are changes (#15861) (#15868)

Backport #15861

* Only write config in environment-to-ini if there are changes

Only write the new config in environment-to-ini if there are changes or the
destination is not the same as the customconf.

Fix #15719
Fix #15857

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoReturn go-get info on subdirs (#15642) (#15871)
zeripath [Sat, 15 May 2021 11:06:02 +0000 (12:06 +0100)]
Return go-get info on subdirs (#15642) (#15871)

Backport #15642

This PR is an alternative to #15628 and makes the go get handler a
handler.

Fix #15625

Close #15628

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoAdd timeout to writing to responses (#15831) (#15872)
zeripath [Fri, 14 May 2021 16:42:27 +0000 (17:42 +0100)]
Add timeout to writing to responses (#15831) (#15872)

Backport #15831

In #15826 it has become apparent that there are a few occasions when a response can
hang during writing, and because there is no timeout go will happily just block
interminably. This PR adds a fixed 5 second timeout to all writes to a connection.

Fix #15826

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoFix LFS commit finder not working (#15856) (#15874)
KN4CK3R [Fri, 14 May 2021 15:39:59 +0000 (17:39 +0200)]
Fix LFS commit finder not working (#15856) (#15874)

* Create a copy of the sha bytes.

Co-authored-by: Andrew Thornton <art27@cantab.net>
3 years agoStop calling WriteHeader in Write (#15862) (#15873)
zeripath [Fri, 14 May 2021 14:38:35 +0000 (15:38 +0100)]
Stop calling WriteHeader in Write (#15862) (#15873)

Backport #15862

Fixes http: superfluous response.WriteHeader call from code.gitea.io/gitea/modules/context.(*Response).WriteHeader (response.go:67)

* Looking again we don't need this writeHeader as all of our downstream
implementations will always do it for us

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoOnly offer hostcertificates if they exist (#15849) (#15853)
zeripath [Thu, 13 May 2021 15:12:41 +0000 (16:12 +0100)]
Only offer hostcertificates if they exist (#15849) (#15853)

Backport #15849

A common bug report is the otherwise harmless sshd logging:

```
Could not load host certificate "/data/ssh/ssh_host_ed25519_cert": No such file or directory
```

This PR simply checks if these files exist before creation of sshd_config and if
they do not exist, doesn't add a reference to them.

Fix #14110 amongst others.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: 6543 <6543@obermui.de>
3 years agofix truncate utf8 string (#15828) (#15854)
zeripath [Thu, 13 May 2021 14:10:29 +0000 (15:10 +0100)]
fix truncate utf8 string (#15828) (#15854)

Backport #15828

* fix truncate utf8 string.

* revoke truncated user info.

Co-authored-by: yan <sxty32@gmail.com>
3 years agoFix bound address/port for caddy's certmagic library (#15758) (#15848)
zeripath [Wed, 12 May 2021 22:36:46 +0000 (23:36 +0100)]
Fix bound address/port for caddy's certmagic library (#15758) (#15848)

Backport #15758

* Fix bound address/port for caddy's certmagic library

* Fix bug

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Blake Miner <miner.blake@gmail.com>
3 years agochange s3 bucket name (#15847)
techknowlogick [Wed, 12 May 2021 20:12:36 +0000 (16:12 -0400)]
change s3 bucket name (#15847)

3 years agoUpgrade unrolled/render to v1.1.1 (#15845) (#15846)
zeripath [Wed, 12 May 2021 19:54:50 +0000 (20:54 +0100)]
Upgrade unrolled/render to v1.1.1 (#15845) (#15846)

Backport #15845

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years agoTagger can be empty, as can Commit and Author - tolerate this (#15835) (#15839)
zeripath [Wed, 12 May 2021 19:09:16 +0000 (20:09 +0100)]
Tagger can be empty, as can Commit and Author - tolerate this (#15835) (#15839)

Backport #15835

Unfortunately some old repositories can have tags with empty Tagger, Commit
or Author. Go-Git variants will always have empty values for these whereas
the native git variant leaves them at nil. The simplest solution is just to
always have these set to empty Signatures.

v156 migration also makes the incorrect assumption that these cannot be empty.
Therefore add some handling to this and add logging and adjust broken
logging elsewhere in this migration.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoQueue manager FlushAll can loop rapidly - add delay (#15733) (#15840)
zeripath [Wed, 12 May 2021 17:48:11 +0000 (18:48 +0100)]
Queue manager FlushAll can loop rapidly - add delay (#15733) (#15840)

Backport #15733

* Queue manager FlushAll can loop rapidly - add delay

Add delay within FlushAll to prevent rapid loop when workers are busy

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

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoSet autocomplete off on branches selector (#15809) (#15833)
zeripath [Tue, 11 May 2021 22:18:07 +0000 (23:18 +0100)]
Set autocomplete off on branches selector (#15809) (#15833)

Backport #15809

Fix #15782

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoAdd err to log (#15813) (#15824)
John Olheiser [Mon, 10 May 2021 20:38:37 +0000 (15:38 -0500)]
Add err to log (#15813) (#15824)

Signed-off-by: jolheiser <john.olheiser@gmail.com>
3 years agoMove restore repo to internal router and invoke from command to avoid open the same...
Lunny Xiao [Mon, 10 May 2021 13:14:59 +0000 (21:14 +0800)]
Move restore repo to internal router and invoke from command to avoid open the same db file or queues files (#15790) (#15816)

* Move restore repo to internal router and invoke from command to avoid open the same db file or queues files

* Follow @zeripath's review

* set no timeout for resotre repo private request

* make restore repo cancelable

3 years agoTests should use test files (#15801) (#15806)
6543 [Sun, 9 May 2021 17:39:14 +0000 (19:39 +0200)]
Tests should use test files (#15801) (#15806)

3 years agoChangelog v1.14.2 (#15794) v1.14.2
6543 [Sun, 9 May 2021 09:26:49 +0000 (11:26 +0200)]
Changelog v1.14.2 (#15794)

* changelog tool generate

* format & add

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoEnsure that ctx.Written is checked after issues(...) calls (#15797) (#15798)
6543 [Sun, 9 May 2021 08:48:52 +0000 (10:48 +0200)]
Ensure that ctx.Written is checked after issues(...) calls (#15797) (#15798)

Fix issue noted in #15783

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoDisplay conflict-free merge messages for pull requests (#15773) (#15796)
zeripath [Sun, 9 May 2021 02:32:48 +0000 (03:32 +0100)]
Display conflict-free merge messages for pull requests (#15773) (#15796)

Backport #15773

Repositories using external issue tracker tend to use numeric issues in
commits. To prevent conflicts during issue reference parsing or inside
commit hooks, this change respects these configuration and uses the !
character to refer to pull requests in merge commit messages.

For repositories using squash merges, this was already handled.

Signed-off-by: JustusBunsi <61625851+justusbunsi@users.noreply.github.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Steven <61625851+justusbunsi@users.noreply.github.com>
3 years agoExponential Backoff for ByteFIFO (#15724) (#15793)
6543 [Sat, 8 May 2021 18:27:00 +0000 (20:27 +0200)]
Exponential Backoff for ByteFIFO (#15724) (#15793)

This PR is another in the vein of queue improvements. It suggests an
exponential backoff for bytefifo queues to reduce the load from queue
polling. This will mostly be useful for redis queues.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
3 years ago[API] make change repo settings work on empty repos (#15778) (#15789)
6543 [Sat, 8 May 2021 13:14:42 +0000 (15:14 +0200)]
[API] make change repo settings work on empty repos (#15778) (#15789)

* API: Fix #15602

* Add TEST

3 years agoUse pulls in commit graph unless pulls are disabled (#15734 & #15740 & #15774) (...
6543 [Fri, 7 May 2021 19:12:24 +0000 (21:12 +0200)]
Use pulls in commit graph unless pulls are disabled (#15734 & #15740 & #15774) (#15775)

* Commit Graph: Pull-Requests should not link to issues (#15734)

Use `/pulls` and simplify code.

* reverse #15734 partial and comment (#15740)

* reverse & comment

* Update templates/repo/graph/commits.tmpl

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
* Use pulls in commit graph unless pulls are disabled

Fix #15370

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: KN4CK3R <KN4CK3R@users.noreply.github.com>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoSet GIT_DIR correctly if it is not set (#15751) (#15769)
6543 [Fri, 7 May 2021 18:01:25 +0000 (20:01 +0200)]
Set GIT_DIR correctly if it is not set (#15751) (#15769)

* Set GIT_DIR correctly if it is not set

* Expand out templates

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoDefer closing the gitrepo until the end of the wrapped context functions (#15653...
zeripath [Fri, 7 May 2021 16:28:02 +0000 (17:28 +0100)]
Defer closing the gitrepo until the end of the wrapped context functions (#15653) (#15746)

* Defer closing the gitrepo until the end of the wrapped context functions (#15653)

Backport #15653

There was a mistake in #15372 where deferral of gitrepo close occurs before it should.

This PR fixes this.

3 years agoDrop back to use IsAnInteractiveSession for SVC (#15749) (#15762)
zeripath [Fri, 7 May 2021 15:44:35 +0000 (16:44 +0100)]
Drop back to use IsAnInteractiveSession for SVC (#15749) (#15762)

Backport #15749

* Drop back to use IsAnInteractiveSession for SVC

There is an apparent permission change problem when using
IsWindowsService to determine if the SVC manager should be
used.

This PR simply drops back to using IsAnInteractiveSession as
this does not change behaviour.

Fix #15454

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Yes staticcheck I know this is deprecated

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Just leave me alone lint

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoFix bug where repositories appear unadopted (#15757) (#15767)
6543 [Fri, 7 May 2021 15:07:39 +0000 (17:07 +0200)]
Fix bug where repositories appear unadopted (#15757) (#15767)

Fix bug where repositories with capital letters in their names appear unadopted.

Fix #15755

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years agonot show `ref-in-new-issue` pop when issue was disabled (#15761) (#15765)
6543 [Fri, 7 May 2021 14:13:20 +0000 (16:13 +0200)]
not show `ref-in-new-issue` pop when issue was disabled (#15761) (#15765)

fix #15718

Signed-off-by: a1012112796 <1012112796@qq.com>
Co-authored-by: a1012112796 <1012112796@qq.com>
3 years agoIssue list alignment tweaks (#15483) (#15766)
6543 [Fri, 7 May 2021 13:06:19 +0000 (15:06 +0200)]
Issue list alignment tweaks (#15483) (#15766)

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoFix setting version table in dump (#15753) (#15759)
zeripath [Fri, 7 May 2021 12:04:17 +0000 (13:04 +0100)]
Fix setting version table in dump (#15753) (#15759)

Backport #15753

* Fix setting version table in dump

As noted on Discord there is a problem with gitea dump where the version table
is not being dumped correctly.

This is due to a missing pointer in the TableInfo.

This PR fixes this.

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Update models_test.go

3 years agoFix close button change on delete in simplemde area (#15737) (#15747)
zeripath [Thu, 6 May 2021 22:14:15 +0000 (23:14 +0100)]
Fix close button change on delete in simplemde area (#15737) (#15747)

Backport #15737

* Fix close button change on delete in simplemde area

Fix issue with close button changing when deleting in the simplemde textarea.

Signed-off-by: Andrew Thornton <art27@cantab.net>
* apply suggestion

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: 6543 <6543@obermui.de>
3 years agofix some ui bug about draft release (#15137) (#15745)
a1012112796 [Thu, 6 May 2021 19:23:26 +0000 (03:23 +0800)]
fix some ui bug about draft release (#15137) (#15745)

* fix some ui bug about draft release

- should not show draft release in tag list because
  it will't create real tag
- still show draft release without tag and commit message
  for draft release instead of 404 error
- remove tag load for attachement links because it's useless

Signed-off-by: a1012112796 <1012112796@qq.com>
* add test code

* fix test

That's because has added a new release in relaese test database.

* fix dropdown link for draft release

3 years agoFix webkit calendar icon color on arc-green (#15728)
Tomás Warynyca [Wed, 5 May 2021 05:10:01 +0000 (02:10 -0300)]
Fix webkit calendar icon color on arc-green (#15728)

3 years agoOnly log Error on getLastCommitStatus error to let pull list still be visible (#15715)
6543 [Tue, 4 May 2021 12:03:31 +0000 (14:03 +0200)]
Only log Error on getLastCommitStatus error to let pull list still be visible (#15715)

3 years agoMove tooltip down to allow selection of Remove File on error (#15672) (#15714)
Kyle D [Tue, 4 May 2021 06:00:29 +0000 (00:00 -0600)]
Move tooltip down to allow selection of Remove File on error (#15672) (#15714)

3 years agoFix setting redis db path (#15698) (#15708)
zeripath [Mon, 3 May 2021 21:30:30 +0000 (22:30 +0100)]
Fix setting redis db path (#15698) (#15708)

Backport #15698

There is a bug setting the redis db in the common nosql manager whereby the db path
always fails.

This PR fixes this.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoImplement delete release attachments and update release attachments' name (#14130...
Kyle D [Mon, 3 May 2021 17:27:00 +0000 (11:27 -0600)]
Implement delete release attachments and update release attachments' name (#14130) (#15666)

* Implement delete release attachment

* Add attachments on release edit page

* Fix bug

* Finish del release attachments

* Fix frontend lint

* Fix tests

* Support edit release attachments

* Added tests

* Remove the unnecessary parameter isCreate from UpdateReleaseOrCreatReleaseFromTag

* Rename UpdateReleaseOrCreatReleaseFromTag to UpdateRelease

* Fix middle align

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years agoPerformance improvement for last commit cache and show-ref (#15455) (#15701)
zeripath [Mon, 3 May 2021 14:51:41 +0000 (15:51 +0100)]
Performance improvement for last commit cache and show-ref (#15455) (#15701)

Backport #15455

* Improve performance when there are multiple commits in the last commit cache

* read refs directly if we can

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoFix DB session cleanup (#15697) (#15700)
zeripath [Sun, 2 May 2021 09:43:01 +0000 (10:43 +0100)]
Fix DB session cleanup (#15697) (#15700)

Backport #15697

The DB session clean up needs to check expiry not created_unix.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoFixed several activation bugs (#15473) (#15685)
6543 [Sat, 1 May 2021 00:14:36 +0000 (02:14 +0200)]
Fixed several activation bugs (#15473) (#15685)

* Removed unneeded form tag.

* Fixed typo.

* Fixed NPE.

* Use better error page.

* Splitted GET and POST.

Co-authored-by: KN4CK3R <KN4CK3R@users.noreply.github.com>
3 years agoDelete references if repository gets deleted (#15681) (#15684)
6543 [Fri, 30 Apr 2021 22:09:58 +0000 (00:09 +0200)]
Delete references if repository gets deleted (#15681) (#15684)

* Remove DeletedBranch and LFSLocks.

* Sort beans.

Co-authored-by: KN4CK3R <KN4CK3R@users.noreply.github.com>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoFix orphaned objects deletion bug (#15657) (#15683)
6543 [Fri, 30 Apr 2021 21:27:26 +0000 (23:27 +0200)]
Fix orphaned objects deletion bug (#15657) (#15683)

* Fix orphaned objects deletion bug

* extend test

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoDelete protected branch if repository gets removed (#15658) (#15676)
KN4CK3R [Fri, 30 Apr 2021 18:59:42 +0000 (20:59 +0200)]
Delete protected branch if repository gets removed (#15658) (#15676)

* Added missing error parameters.

* Delete protected branch if repository gets removed.

* Added doctor fix.

3 years ago[API] pull notification subject status: add "merged" (#15344) (#15654)
6543 [Wed, 28 Apr 2021 19:24:56 +0000 (21:24 +0200)]
[API] pull notification subject status: add "merged" (#15344) (#15654)

Current subject status can be "", "open" and "closed". This add "merged" to it.

3 years agoRemove spurious set name from eventsource.sharedworker.js (#15643) (#15652)
zeripath [Wed, 28 Apr 2021 17:50:56 +0000 (18:50 +0100)]
Remove spurious set name from eventsource.sharedworker.js (#15643) (#15652)

Backport #15643

Fix #15617

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agonot update updated uinx for `git gc` (#15637) (#15641)
zeripath [Wed, 28 Apr 2021 00:20:47 +0000 (01:20 +0100)]
not update updated uinx for `git gc` (#15637) (#15641)

Backport #15637

fix #15634

Signed-off-by: a1012112796 <1012112796@qq.com>
Co-authored-by: a1012112796 <1012112796@qq.com>
3 years agoFix commit graph author link (#15627) (#15630)
zeripath [Mon, 26 Apr 2021 19:25:51 +0000 (20:25 +0100)]
Fix commit graph author link (#15627) (#15630)

Backport #15627

The author link on the commit graph is incorrect and isn't providing a link to the author.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agofix webhook timeout bug (#15613) (#15621)
Lunny Xiao [Mon, 26 Apr 2021 12:42:12 +0000 (20:42 +0800)]
fix webhook timeout bug (#15613) (#15621)

* Also fix the potential problem in httplib

3 years agoResolve panic on failed interface conversion in migration v156 (#15604) (#15610)
techknowlogick [Sun, 25 Apr 2021 15:58:42 +0000 (11:58 -0400)]
Resolve panic on failed interface conversion in migration v156 (#15604) (#15610)

go panics otherwise with `panic: interface conversion: error is git.ErrNotExist, not *git.ErrNotExist`, thanks to Codeberg/Andi for reporting this.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years agoBump unrolled/render to v1.1.0 (#15581) (#15608)
Nathan Smith [Sun, 25 Apr 2021 06:01:52 +0000 (23:01 -0700)]
Bump unrolled/render to v1.1.0 (#15581) (#15608)

v1.1.0 has improved buffer pooling

3 years agoFix missing storage init (#15589) (#15598)
Lunny Xiao [Fri, 23 Apr 2021 12:56:21 +0000 (20:56 +0800)]
Fix missing storage init (#15589) (#15598)

3 years agoIf the default branch is not present do not report error on stats indexing (follow...
zeripath [Thu, 22 Apr 2021 20:30:18 +0000 (21:30 +0100)]
If the default branch is not present do not report error on stats indexing (follow-up of #15546) (#15583) (#15594)

Backport #15546
Backport #15583

 #15546 doesn't completely fix this problem because the error returned is an ObjectNotExist
error not a BranchNotExist error.

Add test for ErrObjectNotExist too

Fix #15257

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoFix lfs management find (#15537) (#15578)
Lunny Xiao [Thu, 22 Apr 2021 18:32:48 +0000 (02:32 +0800)]
Fix lfs management find (#15537) (#15578)

* Fix lfs management find (#15537)

Fix #15236

* Do not do 40byte conversion within ParseTreeLine
* Missed a to40ByteSHA

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Andrew Thornton <art27@cantab.net>
* Remove space

Co-authored-by: Andrew Thornton <art27@cantab.net>
3 years agoAdd placeholder text to deploy key textarea (#15575) (#15576)
zeripath [Wed, 21 Apr 2021 21:59:50 +0000 (22:59 +0100)]
Add placeholder text to deploy key textarea (#15575) (#15576)

Backport #15575

Add placeholder text to deploy key textarea

Related #15574

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoFix NPE on view commit with notes (#15561) (#15573)
zeripath [Wed, 21 Apr 2021 19:11:43 +0000 (20:11 +0100)]
Fix NPE on view commit with notes (#15561) (#15573)

Backport #15561

Fix #15558

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoProject board improvements (#15429) (#15560)
silverwind [Tue, 20 Apr 2021 19:45:00 +0000 (21:45 +0200)]
Project board improvements (#15429) (#15560)

* Project board improvements

- Fix link colors
- Extract CSS to own file
- Various minor tweaks to make it look better

Fixes: https://github.com/go-gitea/gitea/issues/15424
Fixes: https://github.com/go-gitea/gitea/issues/15506
Fixes: https://github.com/go-gitea/gitea/pull/15511
* fix squashed cards on small view area

* more css fixes, add second row from issue list

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoAdd ETag header (#15370) (#15552)
KN4CK3R [Tue, 20 Apr 2021 16:01:58 +0000 (18:01 +0200)]
Add ETag header (#15370) (#15552)

* Add ETag header.

* Comply with RFC 7232.

* Moved logic into httpcache.go

* Changed name.

* Lint

* Implemented If-None-Match list.

* Fixed missing header on *

* Removed weak etag support.

* Removed * support.

* Added unit test.

* Lint

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoFix bug on commit graph (#15517) (#15530)
Lunny Xiao [Sat, 17 Apr 2021 12:46:30 +0000 (20:46 +0800)]
Fix bug on commit graph (#15517) (#15530)

3 years agoSend size to /avatars if requested (#15459) (#15528)
zeripath [Sat, 17 Apr 2021 11:30:58 +0000 (12:30 +0100)]
Send size to /avatars if requested (#15459) (#15528)

Backport #15459

If an avatar is requested in a particular size ensure that /avatars also gets the size request

Fix #15453

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoPrevent migration 156 failure if tag commit missing (#15519) (#15527)
zeripath [Sat, 17 Apr 2021 10:13:15 +0000 (11:13 +0100)]
Prevent migration 156 failure if tag commit missing (#15519) (#15527)

Backport #15519

It is possible that tag commits could be deleted or missing from repos. This causes
migration 156 to fail and breaks upgrade.

This PR simply logs the failure.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoRepo branch page: label size, PR ref, new PR button alignment (#15363) (#15365)
Mike L [Fri, 16 Apr 2021 05:53:51 +0000 (07:53 +0200)]
Repo branch page: label size, PR ref, new PR button alignment (#15363) (#15365)

3 years agoChangelog v1.14.1 (#15498) v1.14.1
6543 [Fri, 16 Apr 2021 02:19:09 +0000 (04:19 +0200)]
Changelog v1.14.1 (#15498)

* RAW Changelog v1.14.1

* wordings

* Apply suggestions from code review

Co-authored-by: techknowlogick <matti@mdranta.net>
* Update CHANGELOG.md

Co-authored-by: 6543 <6543@obermui.de>
* Update CHANGELOG.md

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoPerformance improvement for list pull requests (#15447) (#15500)
6543 [Thu, 15 Apr 2021 22:14:14 +0000 (00:14 +0200)]
Performance improvement for list pull requests (#15447) (#15500)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years agoFix bug clone wiki (#15499) (#15502)
zeripath [Thu, 15 Apr 2021 19:40:10 +0000 (20:40 +0100)]
Fix bug clone wiki (#15499) (#15502)

Backport #15499

Fix #15494

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
3 years agodump: Add option to skip LFS/attachment files (#15407) (#15492)
zeripath [Thu, 15 Apr 2021 15:41:47 +0000 (16:41 +0100)]
dump: Add option to skip LFS/attachment files (#15407) (#15492)

Backport #15407

* Add option to skip dumping LFS/attachment files

* Fix fmt issues

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Johan Van de Wauw <johan@gisky.be>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
3 years agoEnsure review dismissal only dismisses the correct review (#15477) (#15489)
zeripath [Thu, 15 Apr 2021 15:24:59 +0000 (16:24 +0100)]
Ensure review dismissal only dismisses the correct review (#15477) (#15489)

Backport #15477

Fix #15472

Signed-off-by: Andrew Thornton art27@cantab.net
Co-authored-by: 6543 <6543@obermui.de>
3 years agoUse subdir for URL (#15446) (#15493)
zeripath [Thu, 15 Apr 2021 15:24:30 +0000 (16:24 +0100)]
Use subdir for URL (#15446) (#15493)

Backport #15446

Fixes #15444

Co-authored-by: KN4CK3R <KN4CK3R@users.noreply.github.com>
Co-authored-by: KN4CK3R <KN4CK3R@users.noreply.github.com>
3 years agomigration: github: if rate limit is not enabled, ignore it (#15490) (#15495)
6543 [Thu, 15 Apr 2021 15:24:01 +0000 (17:24 +0200)]
migration: github: if rate limit is not enabled, ignore it (#15490) (#15495)

Co-authored-by: Lauris BH <lauris@nix.lv>
3 years agoUse index of the supported tags to choose user lang (#15452) (#15488)
zeripath [Thu, 15 Apr 2021 14:47:43 +0000 (15:47 +0100)]
Use index of the supported tags to choose user lang (#15452) (#15488)

Backport #15452

Fix #14793.

The previous implementation used the first return value of matcher.Match, which is the chosen language tag but may contain extensions such as de-DE-u-rg-chzzzz.

As mentioned in the documentation of language package, matcher.Match also returns the index of the supported tags, so I think it is better to use it rather than manipulate the returned language tag.

Co-authored-by: Naohisa Murakami <tiqwab.ch90@gmail.com>
3 years agoFix potential copy lfs records failure when fork a repository (#15441) (#15485)
Lunny Xiao [Thu, 15 Apr 2021 14:13:14 +0000 (22:13 +0800)]
Fix potential copy lfs records failure when fork a repository (#15441) (#15485)

3 years agoQuery the DB for the hash before inserting in to email_hash (#15457) (#15491)
zeripath [Thu, 15 Apr 2021 13:29:13 +0000 (14:29 +0100)]
Query the DB for the hash before inserting in to email_hash (#15457) (#15491)

Backport #15457

Some postgres users have logging which logs even failed transactions. So
just query the db before trying to insert.

Fix #15451

Signed-off-by: Andrew Thornton art27@cantab.net
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years agoBuild go-git variants for windows (#15482) (#15487)
zeripath [Thu, 15 Apr 2021 12:21:27 +0000 (13:21 +0100)]
Build go-git variants for windows (#15482) (#15487)

Backport #15482

It appears that there are significant performance problems with the pure git backend
on windows.

Therefore until we can sort this out - provide go-git backend builds.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoLock down build-images dependencies (#15480)
silverwind [Thu, 15 Apr 2021 11:02:57 +0000 (13:02 +0200)]
Lock down build-images dependencies (#15480)

Partial extraction from #15479 for 1.14. Locks down build-images
dependencies and adds missing node_modules dependency.

3 years agoPrevent superfluous response.WriteHeader (#15456) (#15476)
zeripath [Thu, 15 Apr 2021 10:02:42 +0000 (11:02 +0100)]
Prevent superfluous response.WriteHeader (#15456) (#15476)

Backport #15456

This PR simply checks the status before writing the header.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agofix wrong file link in code search page (#15466) (#15486)
a1012112796 [Thu, 15 Apr 2021 09:04:25 +0000 (17:04 +0800)]
fix wrong file link in code search page (#15466) (#15486)

in previous the grenrated link is
``testg/testrepo/src/commit/....``
which is not right.

the right version is ``/testg/testrepo/.......``
(start wiht ``/``)
or ``http://127.0.0.1:3000/xxxxx`` (full link)

to make it hase same result with explore page
I choose the secound style.

fix #15438

Signed-off-by: a1012112796 <1012112796@qq.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoClone panel fixes (#15436)
silverwind [Wed, 14 Apr 2021 21:16:33 +0000 (23:16 +0200)]
Clone panel fixes (#15436)

- Use <button> over <div> for a button
- Fix absent border-right on wiki
- Fix absent border-radius on wiki

3 years agoquick fix (#15464) (#15481)
John Olheiser [Wed, 14 Apr 2021 19:42:30 +0000 (14:42 -0500)]
quick fix (#15464) (#15481)

Signed-off-by: jolheiser <john.olheiser@gmail.com>
3 years agoFix ambiguous argument error on tags (#15432) (#15474)
zeripath [Wed, 14 Apr 2021 18:53:01 +0000 (19:53 +0100)]
Fix ambiguous argument error on tags (#15432) (#15474)

Backport #15432

There is a weird gotcha with GetTagCommitID that because it uses git rev-list
can cause an ambiguous argument error.

This PR simply makes tags use the same code as branches.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agov172 migration adds created_unix field instead of expiry (#15458) (#15463)
techknowlogick [Wed, 14 Apr 2021 06:03:42 +0000 (02:03 -0400)]
v172 migration adds created_unix field instead of expiry (#15458) (#15463)

The Session table must have an Expiry field not a created_unix field - somehow
this migration adds the incorrect named field leading to #15445 reports.

Fix #15445

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoFix repository search (#15428) (#15442)
techknowlogick [Tue, 13 Apr 2021 04:30:28 +0000 (00:30 -0400)]
Fix repository search (#15428) (#15442)

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: KN4CK3R <KN4CK3R@users.noreply.github.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years agoPrevent NPE on avatar direct rendering if federated avatars disabled (#15434) (#15439)
techknowlogick [Tue, 13 Apr 2021 02:50:07 +0000 (22:50 -0400)]
Prevent NPE on avatar direct rendering if federated avatars disabled (#15434) (#15439)

#13649 assumed that direct avatar urls would always be libravatar urls - this leads
to NPEs if federated avatar service is disabled.

Fix #15421

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoFix wiki clone urls (#15430) (#15431)
silverwind [Mon, 12 Apr 2021 21:59:56 +0000 (23:59 +0200)]
Fix wiki clone urls (#15430) (#15431)

Fix wiki clone urls

Regressed by: https://github.com/go-gitea/gitea/commit/9a4050f1e839af1bd072aff9ac5fc69e650747c8
Fixes: https://github.com/go-gitea/gitea/issues/15420
3 years agofix dingtalk icon url (#15426)
Tomás Warynyca [Mon, 12 Apr 2021 15:10:49 +0000 (12:10 -0300)]
fix dingtalk icon url (#15426)

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoStandardise icon on projects PR page (#15387) (#15408)
zeripath [Mon, 12 Apr 2021 08:05:20 +0000 (09:05 +0100)]
Standardise icon on projects PR page (#15387) (#15408)

Backport #15387

Fix #15272

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agouse repo1_bare to test against (#15402) (#15404)
6543 [Sun, 11 Apr 2021 17:48:35 +0000 (19:48 +0200)]
use repo1_bare to test against (#15402) (#15404)

3 years agoUse semantic dropdown for code search query type (#15276) (#15364)
Mike L [Sun, 11 Apr 2021 15:50:03 +0000 (17:50 +0200)]
Use semantic dropdown for code search query type (#15276) (#15364)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoChangelog v1.14.0 (#15360) v1.14.0
6543 [Sun, 11 Apr 2021 04:07:02 +0000 (06:07 +0200)]
Changelog v1.14.0 (#15360)

* clean & merge & update v1.14.0 changelog

* backport v1.13.x changelogs

3 years agoFix delete nonexist oauth application 500 and prevent deadlock (#15384) (#15396)
Lunny Xiao [Sun, 11 Apr 2021 02:57:44 +0000 (10:57 +0800)]
Fix delete nonexist oauth application 500 and prevent deadlock (#15384) (#15396)

* Fix delete nonexist oauth application 500

* Fix test

* Close the session

* Fix more missed sess.Close

* Remove unnecessary blank line

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoAlways set the merge base used to merge the commit (#15352) (#15385)
zeripath [Sat, 10 Apr 2021 12:08:30 +0000 (13:08 +0100)]
Always set the merge base used to merge the commit (#15352) (#15385)

Backport #15352

The issue is that the TestPatch will reset the PR MergeBase - and it is possible for TestPatch to update the MergeBase whilst a merge is ongoing. The ensuing merge will then complete but it doesn't re-set the MergeBase it used to merge the PR.

Fixes the intermittent error in git test.

Signed-off-by: Andrew Thornton art27@cantab.net
3 years agoTurn RepoRef and RepoAssignment back into func(*Context) (#15372) (#15377)
zeripath [Sat, 10 Apr 2021 02:24:40 +0000 (03:24 +0100)]
Turn RepoRef and RepoAssignment back into func(*Context) (#15372) (#15377)

Backport #15372

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years agoDropzone styling improvements (#15291) (#15374)
silverwind [Fri, 9 Apr 2021 23:43:36 +0000 (01:43 +0200)]
Dropzone styling improvements (#15291) (#15374)

* Dropzone styling improvements

- Move all dropzone styles to separate file
- Fix white background in arc-green
- Fix rendering of non-square images and previews

* increase thumbnail quality, set contain in js, replace blur effect with opacity

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoUpgrade to bluemonday 1.0.7 (#15379) (#15380)
zeripath [Fri, 9 Apr 2021 23:41:30 +0000 (00:41 +0100)]
Upgrade to bluemonday 1.0.7 (#15379) (#15380)

* Upgrade to bluemonday 1.0.7 (#15379)

Backport #15379

Fix #15349

Signed-off-by: Andrew Thornton <art27@cantab.net>
* resolve CI

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoMove FCGI req.URL.Path fix-up to the FCGI listener (#15292) (#15361)
zeripath [Fri, 9 Apr 2021 16:45:02 +0000 (17:45 +0100)]
Move FCGI req.URL.Path fix-up to the FCGI listener (#15292) (#15361)

Backport #15292

Simplify the web.go FCGI path by moving the req.URL.Path fix-up to listener

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years ago Fix `admin user list` (#15358) (#15359)
6543 [Fri, 9 Apr 2021 10:39:40 +0000 (12:39 +0200)]
 Fix `admin user list` (#15358)  (#15359)

* Fix `admin user list` (#15358)

* fix routers/api/v1/repo/issue.go

3 years agoFix button border issue (#15351)
silverwind [Fri, 9 Apr 2021 03:38:06 +0000 (05:38 +0200)]
Fix button border issue (#15351)

3 years agoDisable cssnano's colormin plugin (#15348)
silverwind [Fri, 9 Apr 2021 01:54:24 +0000 (03:54 +0200)]
Disable cssnano's colormin plugin (#15348)

It produces odd rgba values which also seem to cause issues in monaco's
color parser where the scoll shadow went red for some reason.

Regression by: https://github.com/go-gitea/gitea/pull/15333

3 years agoShow diff on rename with diff changes (#15338) (#15339)
zeripath [Thu, 8 Apr 2021 19:36:17 +0000 (20:36 +0100)]
Show diff on rename with diff changes (#15338) (#15339)

Backport #15338

More recent versions of git have increased support for detection of renames meaning
that a rename with diff changes is now supported.

Although ParsePatch supports this - our templates do not and the simplest solution
is simply to show the diff.

Fix #15335

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoPrepend AppSubUrl to links for default avatar (#15341) (#15342)
zeripath [Thu, 8 Apr 2021 16:51:10 +0000 (17:51 +0100)]
Prepend AppSubUrl to links for default avatar (#15341) (#15342)

Backport #15341

Fix #15334

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoFix handling of logout event (#15323) (#15337)
zeripath [Thu, 8 Apr 2021 15:28:30 +0000 (16:28 +0100)]
Fix handling of logout event (#15323) (#15337)

Backport #15323

It appears that there is a slight bug in the handling of the data of logout event -
the javascript should be testing the data field of the data field for the logout
instruction.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoMonaco improvements (#15333) (#15345)
silverwind [Thu, 8 Apr 2021 11:24:23 +0000 (13:24 +0200)]
Monaco improvements (#15333) (#15345)

- Create theme at runtime which follows the CSS variables of the site
- Disable a few opinionated Monaco defaults like minimap and word highlights
- Move styles to separate file

3 years agoFix CanCreateRepo check (#15311) (#15321)
6543 [Wed, 7 Apr 2021 20:14:11 +0000 (22:14 +0200)]
Fix CanCreateRepo check (#15311) (#15321)

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>