]> source.dussan.org Git - gitea.git/log
gitea.git
3 years agoSwagger AccessToken fixes (#16574)
zeripath [Sun, 1 Aug 2021 20:44:15 +0000 (21:44 +0100)]
Swagger AccessToken fixes (#16574)

There is a subtle problem with the Swagger definition for AccessTokens which causes
autogeneration of APIs for these endpoints to fail.

This PR corrects these errors.

Ref: https://github.com/zeripath/java-gitea-api/issues/4
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoFix 500 on first wiki page (#16586)
zeripath [Sun, 1 Aug 2021 17:04:32 +0000 (18:04 +0100)]
Fix 500 on first wiki page (#16586)

* Fix 500 on first wiki page

There is a mistake in #16319 and #16487 which means that the first time
a wiki page is created a 500 is reported because the `master` branch is
not in existence in that wiki yet.

This PR simply checks for this error and returns not found.

Fix #16584

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoFix swagger doc by rename repoAddTopíc to repoAddTopic (#16580)
Lars Hvam [Sun, 1 Aug 2021 16:28:05 +0000 (18:28 +0200)]
Fix swagger doc by rename repoAddTopíc to repoAddTopic (#16580)

* Swagger API: rename repoAddTopíc to repoAddTopic

This changes the operationId to only contain 7 bit ascii, note "í" instead of "i"

3 years agoUse node:16.5 for frontend instead of node:16 (#16591)
zeripath [Sun, 1 Aug 2021 14:33:02 +0000 (15:33 +0100)]
Use node:16.5 for frontend  instead of node:16 (#16591)

* Disable frontend testing

Jest does not appear to work on the latest node 16.6.0 and fails with an inscrutable
message.

I have been unable to work out what the problem is. This PR simply disables the
test-frontend part in the makefile.

Another alternative would be to drop node to node 14 - which is the LTS for node.

Signed-off-by: Andrew Thornton <art27@cantab.net>
* actually just tell on 16.5 instead

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Use node 16.5 instead of 16

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 1 Aug 2021 00:07:51 +0000 (00:07 +0000)]
[skip ci] Updated translations via Crowdin

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 31 Jul 2021 00:07:42 +0000 (00:07 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoLock goth/gothic and Re-attempt OAuth2 registration on login if registration failed... 16412/head
zeripath [Thu, 29 Jul 2021 17:53:18 +0000 (18:53 +0100)]
Lock goth/gothic and Re-attempt OAuth2 registration on login if registration failed at startup (#16564)

This PR has two parts:

* Add locking to goth and gothic calls with a RWMutex

The goth and gothic calls are currently unlocked and thus are a cause of multiple potential races

* Reattempt OAuth2 registration on login if registration failed

If OAuth2 registration fails at startup we currently disable the login_source however an alternative approach could be to reattempt registration on login attempt.

Fix #16096

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoPre-fill suggested New File 'name' and 'content' with Query Params (#16556)
AJ ONeal [Thu, 29 Jul 2021 03:39:46 +0000 (21:39 -0600)]
Pre-fill suggested New File 'name' and 'content' with Query Params (#16556)

* feature: add (GitHub-style) querystrings for pre-filling new file content

* docs: add query parameters for new files

3 years agoShow correct text when comparing commits on empty pull request (#16569)
Marty [Thu, 29 Jul 2021 02:32:48 +0000 (04:32 +0200)]
Show correct text when comparing commits on empty pull request (#16569)

* fix

* use own text

* Update templates/repo/commits_table.tmpl

Co-authored-by: marty <m.karkossa@ultraware.nl>
Co-authored-by: zeripath <art27@cantab.net>
3 years agoRename context.Query to context.Form (#16562)
Lunny Xiao [Thu, 29 Jul 2021 01:42:15 +0000 (09:42 +0800)]
Rename context.Query to context.Form (#16562)

3 years agoAdd agit flow support in gitea (#14295)
a1012112796 [Wed, 28 Jul 2021 09:42:56 +0000 (17:42 +0800)]
Add agit flow support in gitea (#14295)

* feature: add agit flow support

ref: https://git-repo.info/en/2020/03/agit-flow-and-git-repo/

example:

```Bash
git checkout -b test
echo "test" >> README.md
git commit -m "test"
git push origin HEAD:refs/for/master -o topic=test
```

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

* simplify code add fix some nits

* update merge help message

* Apply suggestions from code review. Thanks @jiangxin

* add forced-update message

* fix lint

* splite writePktLine

* add refs/for/<target-branch>/<topic-branch> support also

* Add test code add fix api

* fix lint

* fix test

* skip test if git version < 2.29

* try test with git 2.30.1

* fix permission check bug

* fix some nit

* logic implify and test code update

* fix bug

* apply suggestions from code review

* prepare for merge

Signed-off-by: Andrew Thornton <art27@cantab.net>
* fix permission check bug

- test code update
- apply suggestions from code review @zeripath

Signed-off-by: a1012112796 <1012112796@qq.com>
* fix bug when target branch isn't exist

* prevent some special push and fix some nits

* fix lint

* try splite

* Apply suggestions from code review

- fix permission check
- handle user rename

* fix version negotiation

* remane

* fix template

* handle empty repo

* ui: fix  branch link under the title

* fix nits

Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years agoUpgrade levelqueue to v0.4.0 (#16560)
Lunny Xiao [Tue, 27 Jul 2021 15:55:48 +0000 (23:55 +0800)]
Upgrade levelqueue to v0.4.0 (#16560)

Fix #16546

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 27 Jul 2021 00:07:52 +0000 (00:07 +0000)]
[skip ci] Updated translations via Crowdin

3 years agonot show private user's repo in explore view (#16550)
a1012112796 [Mon, 26 Jul 2021 22:02:35 +0000 (06:02 +0800)]
not show private user's repo in explore view (#16550)

after #16069, visibility is also usefull for user,
so this limit is not usefull.

fix #16545

3 years agoFix session bugs (#16552)
6543 [Mon, 26 Jul 2021 20:46:06 +0000 (22:46 +0200)]
Fix session bugs (#16552)

* fix deadlog bug

* Fix models/issue_stopwatch.go

* Update models/issue_stopwatch.go

Co-authored-by: zeripath <art27@cantab.net>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 26 Jul 2021 00:07:41 +0000 (00:07 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoFix add authentication page (#16543)
zeripath [Sun, 25 Jul 2021 07:09:52 +0000 (08:09 +0100)]
Fix add authentication page (#16543)

* Fix add authentication page

There is a regression in #16199 whereby the add authentication page
fails to react to the change in selected type.

This is due to the String() method on the LoginSourceType which is ameliorated
with an Int() function being added.

Following on from this there are a few other related bugs.

Fix #16541

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoHandle too long PR titles correctly (#16517)
zeripath [Sun, 25 Jul 2021 02:59:27 +0000 (03:59 +0100)]
Handle too long PR titles correctly (#16517)

The CompareAndPullRequestPost handler for POST to /compare
incorrectly handles returning errors to the user. For a start
it does not set the necessary markers to switch SimpleMDE
but it also does not immediately return to the form.

This PR fixes this by setting the appropriate values, fixing
the templates and preventing the suggestion of a too long
title.

Fix #16507

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years ago[skip ci] Updated licenses and gitignores
GiteaBot [Sun, 25 Jul 2021 00:07:38 +0000 (00:07 +0000)]
[skip ci] Updated licenses and gitignores

3 years agobump github.com/markbates/goth from v1.67.1 to v1.68.0 (#16538)
6543 [Sat, 24 Jul 2021 17:17:02 +0000 (19:17 +0200)]
bump github.com/markbates/goth from v1.67.1 to v1.68.0 (#16538)

3 years agoAdd an abstract json layout to make it's easier to change json library (#16528)
Lunny Xiao [Sat, 24 Jul 2021 16:03:58 +0000 (00:03 +0800)]
Add an abstract json layout to make it's easier to change json library (#16528)

* Add an abstract json layout to make it's easier to change json library

* Fix import

* Fix import sequence

* Fix blank lines

* Fix blank lines

3 years agoAdd Linode as an installation option in docs (#16529)
techknowlogick [Sat, 24 Jul 2021 14:08:23 +0000 (10:08 -0400)]
Add Linode as an installation option in docs (#16529)

Add Linode as an installation option in docs

Co-authored-by: zeripath <art27@cantab.net>
3 years agoAdd snap to docs (#16530)
techknowlogick [Sat, 24 Jul 2021 13:06:38 +0000 (09:06 -0400)]
Add snap to docs (#16530)

3 years agoswitch to maintained lib (#16532)
techknowlogick [Sat, 24 Jul 2021 11:00:41 +0000 (07:00 -0400)]
switch to maintained lib (#16532)

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Andrew Thornton <art27@cantab.net>
3 years agoRefactor: Move login out of models (#16199)
zeripath [Sat, 24 Jul 2021 10:16:34 +0000 (11:16 +0100)]
Refactor: Move login out of models (#16199)

`models` does far too much. In particular it handles all `UserSignin`.

It shouldn't be responsible for calling LDAP, SMTP or PAM for signing in.

Therefore we should move this code out of `models`.

This code has to depend on `models` - therefore it belongs in `services`.

There is a package in `services` called `auth` and clearly this functionality belongs in there.

Plan:

- [x] Change `auth.Auth` to `auth.Method` - as they represent methods of authentication.
- [x] Move `models.UserSignIn` into `auth`
- [x] Move `models.ExternalUserLogin`
- [x] Move most of the `LoginVia*` methods to `auth` or subpackages
- [x] Move Resynchronize functionality to `auth`
  - Involved some restructuring of `models/ssh_key.go` to reduce the size of this massive file and simplify its files.
- [x] Move the rest of the LDAP functionality in to the ldap subpackage
- [x] Re-factor the login sources to express an interfaces `auth.Source`?
  - I've done this through some smaller interfaces Authenticator and Synchronizable - which would allow us to extend things in future
- [x] Now LDAP is out of models - need to think about modules/auth/ldap and I think all of that functionality might just be moveable
- [x] Similarly a lot Oauth2 functionality need not be in models too and should be moved to services/auth/source/oauth2
  - [x] modules/auth/oauth2/oauth2.go uses xorm... This is naughty - probably need to move this into models.
  - [x] models/oauth2.go - mostly should be in modules/auth/oauth2 or services/auth/source/oauth2
- [x] More simplifications of login_source.go may need to be done
- Allow wiring in of notify registration -  *this can now easily be done - but I think we should do it in another PR*  - see #16178
- More refactors...?
  - OpenID should probably become an auth Method but I think that can be left for another PR
  - Methods should also probably be cleaned up  - again another PR I think.
  - SSPI still needs more refactors.* Rename auth.Auth auth.Method
* Restructure ssh_key.go

- move functions from models/user.go that relate to ssh_key to ssh_key
- split ssh_key.go to try create clearer function domains for allow for
future refactors here.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoMake Mermaid.js limit configurable (#16519)
zeripath [Sat, 24 Jul 2021 04:21:51 +0000 (05:21 +0100)]
Make Mermaid.js limit configurable (#16519)

* Make Mermaid.js limit configurable

Add `MERMAID_MAX_SOURCE_CHARACTERS` to `[markup]` settings
to make the maximum size of a mermaid render configurable.

Fix #16513

Signed-off-by: Andrew Thornton <art27@cantab.net>
* fixup! Make Mermaid.js limit configurable

* Update custom/conf/app.example.ini

Co-authored-by: silverwind <me@silverwind.io>
* Update docs/content/doc/advanced/config-cheat-sheet.en-us.md

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 24 Jul 2021 00:07:49 +0000 (00:07 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoFix issue pasted image missing if no release permission (#16520)
Lunny Xiao [Fri, 23 Jul 2021 18:08:04 +0000 (02:08 +0800)]
Fix issue pasted image missing if no release permission (#16520)

* Fix issue pasted image missing if no release permission

* Update routers/web/web.go

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoFix typo (#16522)
qwerty287 [Fri, 23 Jul 2021 13:05:37 +0000 (15:05 +0200)]
Fix typo (#16522)

3 years agoAdd support for corporate WeChat webhooks (#15910)
lengyuqu [Fri, 23 Jul 2021 04:41:27 +0000 (12:41 +0800)]
Add support for corporate WeChat webhooks (#15910)

* 企业微信webhook

* 企业微信webhook

* 企业微信webhook

* Update templates/admin/hook_new.tmpl

Co-authored-by: a1012112796 <1012112796@qq.com>
* Update services/webhook/wechatwork.go

Co-authored-by: a1012112796 <1012112796@qq.com>
* 修善wechatwork

* 修善wechatwork

* fix

* Update locale_cs-CZ.ini

fix

* fix build

* fix

* fix build

* make webhooks.zh-cn.md

* delet unnecessary blank line

* delet unnecessary blank line

* 企业微信webhook

* 企业微信webhook

* 企业微信webhook

* Update templates/admin/hook_new.tmpl

Co-authored-by: a1012112796 <1012112796@qq.com>
* Update services/webhook/wechatwork.go

Co-authored-by: a1012112796 <1012112796@qq.com>
* 修善wechatwork

* 修善wechatwork

* fix

* fix build

* fix

* fix build

* make webhooks.zh-cn.md

* delet unnecessary blank line

* delet unnecessary blank line

* 企业微信webhook

* 企业微信webhook

* 企业微信webhook

* 企业微信webhook

* 企业微信webhook

* fix

* fix

* 企业微信webhook

* 企业微信webhook

* 企业微信webhook

* fix wechat

* fix wechat

* fix wechat

* fix wechat

* Fix invalid params and typo of email templates (#16394)

Signed-off-by: Meano <meanocat@gmail.com>
* Add LRU mem cache implementation (#16226)

The current default memory cache implementation is unbounded in size and number of
objects cached. This is hardly ideal.

This PR proposes creating a TwoQueue LRU cache as the underlying cache for Gitea.
The cache is limited by the number of objects stored in the cache (rather than size)
for simplicity. The default number of objects is 50000 - which is perhaps too small
as most of our objects cached are going to be much less than 1kB.

It may be worth considering using a different LRU implementation that actively limits
sizes or avoids GC - however, this is just a beginning implementation.

Signed-off-by: Andrew Thornton <art27@cantab.net>
* [skip ci] Updated translations via Crowdin

* Replace `plugins/docker` with `techknowlogick/drone-docker`in ci (#16407)

* plugins/docker -> techknowlogick/drone-docker

* It is multi-arch

* docs: rewrite email setup (#16404)

* Add intro for both the docs page and mailer methods
  * Fix numbering level in SMTP section
  * Recommends implicit TLS

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
* Validate Issue Index before querying DB (#16406)

* Fix external renderer (#16401)

* fix external renderer

* use GBackground context as fallback

* no fallback, return error

Co-authored-by: Lauris BH <lauris@nix.lv>
* Add checkbox to delete pull branch after successful merge (#16049)

* Add checkbox to delete pull branch after successful merge

* Omit DeleteBranchAfterMerge field in json

* Log a warning instead of error when PR head branch deleted

* Add DefaultDeleteBranchAfterMerge to PullRequestConfig

* Add support for delete_branch_after_merge via API

* Fix for API: the branch should be deleted from the HEAD repo

If head and base repo are the same, reuse the already opened ctx.Repo.GitRepo

* Don't delegate to CleanupBranch, only reuse branch deletion code

CleanupBranch contains too much logic that has already been performed by the Merge

* Reuse gitrepo in MergePullRequest

Co-authored-by: Andrew Thornton <art27@cantab.net>
* [skip ci] Updated translations via Crowdin

* Detect encoding changes while parsing diff (#16330)

* Detect encoding changes while parsing diff

* Let branch/tag name be a valid ref to get CI status (#16400)

* fix #16384#

* refactor: move shared helper func to utils package

* extend Tests

* use ctx.Repo.GitRepo if not nil

* fix

* fix

* 企业微信webhook

* 企业微信webhook

* 企业微信webhook

* fix build

* fix build

* Apply suggestions from code review

Co-authored-by: a1012112796 <1012112796@qq.com>
Co-authored-by: myheavily <myheavily>
Co-authored-by: zhaoxin <gitea@fake.local>
Co-authored-by: Meano <Meano@foxmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: GiteaBot <teabot@gitea.io>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Bagas Sanjaya <bagasdotme@gmail.com>
Co-authored-by: Norwin <noerw@users.noreply.github.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Jimmy Praet <jimmy.praet@telenet.be>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 23 Jul 2021 00:07:51 +0000 (00:07 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoChangelog for 1.15.0-rc2 (#16511) (#16515)
zeripath [Thu, 22 Jul 2021 18:20:21 +0000 (19:20 +0100)]
Changelog for 1.15.0-rc2 (#16511) (#16515)

* Changelog for 1.15.0-rc2

Results of `~/go/bin/changelog -m 1.15.0 --after 16422 generate`

We need to release RC2 as there are mulitple problems with alpine 3.14 related to
the seccomp issues on Docker <20.

3 years agoRestore creation of git-daemon-export-ok files (#16508)
zeripath [Thu, 22 Jul 2021 11:53:54 +0000 (12:53 +0100)]
Restore creation of git-daemon-export-ok files (#16508)

Somewhere along the line the creation of git-daemon-export-ok
files disappeared but the updating of these files when
repo visibility changes remained. The problem is that the
current state will create files even when the org or user
is private.

This PR restores creation correctly.

Fix #15521

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 22 Jul 2021 00:07:51 +0000 (00:07 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoupdate `user/repos` api description (#16503)
Patrick Schratz [Wed, 21 Jul 2021 16:49:10 +0000 (18:49 +0200)]
update `user/repos` api description (#16503)

Currently states

> List the repos that the authenticated user owns or has access to

but the endpoint does not list all repos a user has access to, only the ones a user owns

(Also verified and discussed in Discord)

Fixes #16502

3 years agoRestore CORS on git smart http protocol (#16496)
zeripath [Wed, 21 Jul 2021 03:32:35 +0000 (04:32 +0100)]
Restore CORS on git smart http protocol (#16496)

Unfortunately the chi changes have resulted in the CORS headers for the
git smart http protocol going missing.

This is mostly because the OPTIONS method is not being handled by
httpBase anymore.

This PR adds a GetOptions, PostOptions and Options methods to web
handler to allow OPTIONS method requests to still reach the httpBase
function.

Fix #16350
Close #16491

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years agoFix race in log (#16490)
zeripath [Tue, 20 Jul 2021 19:09:29 +0000 (20:09 +0100)]
Fix race in log (#16490)

A race has been detected in #1441 relating to getting log levels.

This PR protects the GetLevel and GetStacktraceLevel calls with a RW mutex.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoMake cancel from CatFileBatch and CatFileBatchCheck wait for the command to end ...
zeripath [Tue, 20 Jul 2021 17:23:01 +0000 (18:23 +0100)]
Make cancel from CatFileBatch and CatFileBatchCheck wait for the command to end (#16479)

Fix #16427 (again!)

* handle sharing violation error code

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
3 years agoAdd TestPrepareWikiFileName (#16487)
6543 [Tue, 20 Jul 2021 13:16:20 +0000 (15:16 +0200)]
Add TestPrepareWikiFileName (#16487)

* Add TestPrepareWikiFileName

* use LsTree as LsFiles is index only

* ajust other tests

Co-authored-by: Andrew Thornton <art27@cantab.net>
3 years agoAdd basic edit ldap auth test & actually fix #16252 (#16465)
zeripath [Tue, 20 Jul 2021 11:30:22 +0000 (12:30 +0100)]
Add basic edit ldap auth test & actually fix #16252 (#16465)

One of the reasons why #16447 was needed and why #16268 was needed in
the first place was because it appears that editing ldap configuration
doesn't get tested.

This PR therefore adds a basic test that will run the edit pipeline.

In doing so it's now clear that #16447 and #16268 aren't actually
solving #16252. It turns out that what actually happens is that is that
the bytes are actually double encoded.

This PR now changes the json unmarshal wrapper to handle this double
encode.

Fix #16252

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoAdd fluid to ui container class to remove margin (#16396)
Stanley Hu [Tue, 20 Jul 2021 06:22:23 +0000 (14:22 +0800)]
Add fluid to ui container class to remove margin (#16396)

3 years agofix: support delete non-urlencoded wiki page (#16482)
Gary Wang [Mon, 19 Jul 2021 16:14:00 +0000 (00:14 +0800)]
fix: support delete non-urlencoded wiki page (#16482)

* fix: support delete non-urlencoded wiki page

* fix: check error

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 19 Jul 2021 00:07:50 +0000 (00:07 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoFix data race in bleve indexer (#16474)
Lunny Xiao [Sun, 18 Jul 2021 19:59:10 +0000 (03:59 +0800)]
Fix data race in bleve indexer (#16474)

* Fix data race in bleve indexer

3 years agodocs: fix various typos and translate to french (#16477)
Antoine Goutenoir [Sun, 18 Jul 2021 16:21:32 +0000 (18:21 +0200)]
docs: fix various typos and translate to french (#16477)

Co-authored-by: 6543 <6543@obermui.de>
3 years agomodules/markup/markdown: fix dropped test error (#16438)
Lars Lehtonen [Sun, 18 Jul 2021 12:09:34 +0000 (05:09 -0700)]
modules/markup/markdown: fix dropped test error (#16438)

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 18 Jul 2021 00:07:50 +0000 (00:07 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoImprove 2FA autofill (#16473)
Jonathan Herlin [Sun, 18 Jul 2021 00:06:22 +0000 (02:06 +0200)]
Improve 2FA autofill (#16473)

This improves the autofill suggestion on mobile devices and some password managers

3 years agoshow tag name on dashboard items list (#16466)
a1012112796 [Sat, 17 Jul 2021 21:21:04 +0000 (05:21 +0800)]
show tag name on dashboard items list (#16466)

fix #16458

Signed-off-by: a1012112796 <1012112796@qq.com>
3 years agoCI: Add unit-test-race (#16470)
6543 [Sat, 17 Jul 2021 20:46:20 +0000 (22:46 +0200)]
CI: Add unit-test-race (#16470)

3 years agoPrevent race in TestPersistableChannelQueue (#16468)
zeripath [Sat, 17 Jul 2021 17:09:56 +0000 (18:09 +0100)]
Prevent race in TestPersistableChannelQueue (#16468)

* Prevent race in TestPersistableChannelQueue

A slight race has become apparent in the TestPersistableChannelQueue.

This PR simply adds locking to prevent the race.

* make print value of "$(GOTESTFLAGS)" on test-backend and unit-test-coverage

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoUpdate notification table with only latest data (#16445)
zeripath [Sat, 17 Jul 2021 16:18:10 +0000 (17:18 +0100)]
Update notification table with only latest data (#16445)

When marking notifications read the results may be returned out of order
or be delayed.  This PR sends a sequence number to gitea so that the
browser can ensure that only the results of the latest notification
change are shown.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoRetry rename on lock induced failures (re-fix) (#16461)
zeripath [Fri, 16 Jul 2021 17:16:04 +0000 (18:16 +0100)]
Retry rename on lock induced failures (re-fix) (#16461)

Unfortunately #16435 asserts the wrong error and should use
os.LinkError not os.PathError.

Fix #16439

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoFrontport v1.14.5 (#16454)
zeripath [Fri, 16 Jul 2021 15:23:45 +0000 (16:23 +0100)]
Frontport v1.14.5 (#16454)

* Frontport v1.14.5

Frontport #16450

Frontport the changelog from v1.14.5

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

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoExtend the fail2ban instructions with a hint on how to make X-Real-IP… (#16446)
dosera [Fri, 16 Jul 2021 09:04:52 +0000 (11:04 +0200)]
Extend the fail2ban instructions with a hint on how to make X-Real-IP… (#16446)

Following the merging of #14959 - Gitea is a lot more strict regarding the interpretation of `X-Real-IP` and `X-Forwarded-For` headers.

This PR updates the fail2ban documentation to include hints to set: `REVERSE_PROXY_TRUSTED_PROXIES` and `REVERSE_PROXY_LIMIT` appropriately.

See discussion in #16443

Co-authored-by: zeripath <art27@cantab.net>
3 years agorevert to use alpine 3.13 (#16451)
techknowlogick [Fri, 16 Jul 2021 01:54:39 +0000 (21:54 -0400)]
revert to use alpine 3.13 (#16451)

Co-authored-by: zeripath <art27@cantab.net>
3 years agoFix crash following ldap authentication update (#16447)
zeripath [Fri, 16 Jul 2021 00:17:51 +0000 (01:17 +0100)]
Fix crash following ldap authentication update (#16447)

Unfortunately #16268 contained a terrible error, whereby there was a double
indirection taken when unmarshalling the source data. This fatally breaks
authentication configuration reading.

Fix #16342

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 16 Jul 2021 00:07:52 +0000 (00:07 +0000)]
[skip ci] Updated translations via Crowdin

3 years agocleanup code `issueFullPattern` in modules/markup (#16419)
Josef Fröhle [Thu, 15 Jul 2021 20:33:56 +0000 (22:33 +0200)]
cleanup code `issueFullPattern` in modules/markup (#16419)

fix #16415

3 years agoUpdate documentation to reflect #15219 (#16442)
zeripath [Thu, 15 Jul 2021 19:49:12 +0000 (20:49 +0100)]
Update documentation to reflect #15219 (#16442)

The move to render custom/public as within /assets in #15219 missed updating
several documentation pages.

This PR updates this documentation.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoadd configuration option to restrict users by default (#16256)
Richard Nienaber [Thu, 15 Jul 2021 19:19:48 +0000 (20:19 +0100)]
add configuration option to restrict users by default (#16256)

* add configuration option to restrict users by default

* default IsRestricted permission only set on sign up

setting this in the model messes with other workflows (e.g. syncing LDAP users) where the IsRestricted permission needs to be explicitly set and not overridden by a config value

* fix formatting

* Apply suggestions from code review

* ensure newly created user is set to restricted

* ensure imports are in the correct order

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoCheck user instead of organization when creating a repo from a template via API ...
Ion Jaureguialzo Sarasola [Thu, 15 Jul 2021 18:19:39 +0000 (20:19 +0200)]
Check user instead of organization when creating a repo from a template via API (#16346)

* Check user instead of organization

* Enforce that only admins can copy a repo to another user

3 years agomicrobadger is no more, rm from readme (#16440)
techknowlogick [Thu, 15 Jul 2021 17:08:20 +0000 (13:08 -0400)]
microbadger is no more, rm from readme (#16440)

* microbadger is no more, rm from readme

* Update README_ZH.md

3 years agoChange @every 24h default schedules to @midnight (#16431) v1.16.0-dev
Jimmy Praet [Thu, 15 Jul 2021 15:55:48 +0000 (17:55 +0200)]
Change @every 24h default schedules to @midnight (#16431)

3 years agoChangelog for v1.15.0-rc1 (#16422) v1.15.0-rc1
6543 [Thu, 15 Jul 2021 15:47:57 +0000 (17:47 +0200)]
Changelog for v1.15.0-rc1 (#16422)

* changelog -m 1.15.0 generate

* enhance changelog

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: techknowlogick <matti@mdranta.net>
* move SECURITY before FEATURES

* move ENHANCEMENTS above BUGFIXES

* as per techknowlogick

* more

* node16

* Apply suggestions from code review

Co-authored-by: Kyle D. <kdumontnu@gmail.com>
* next

* Apply suggestions from code review

* Update CHANGELOG.md

Co-authored-by: Norwin <noerw@users.noreply.github.com>
* Update CHANGELOG.md

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: Kyle D. <kdumontnu@gmail.com>
Co-authored-by: Norwin <noerw@users.noreply.github.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoRetry rename on lock induced failures (#16435)
zeripath [Thu, 15 Jul 2021 15:46:07 +0000 (16:46 +0100)]
Retry rename on lock induced failures (#16435)

* Retry rename on lock induced failures

Due to external locking on Windows it is possible for an
os.Rename to fail if the files or directories are being
used elsewhere.

This PR simply suggests retrying the rename again similar
to how we handle the os.Remove problems.

Fix #16427

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

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 15 Jul 2021 15:07:57 +0000 (15:07 +0000)]
[skip ci] Updated translations via Crowdin

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 15 Jul 2021 10:07:52 +0000 (10:07 +0000)]
[skip ci] Updated translations via Crowdin

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 15 Jul 2021 09:08:09 +0000 (09:08 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoadd note about minimum required version of git installed (#16433)
techknowlogick [Thu, 15 Jul 2021 03:28:49 +0000 (23:28 -0400)]
add note about minimum required version of git installed (#16433)

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 14 Jul 2021 20:07:55 +0000 (20:07 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoChange the release cycle to match actual situations (#16430)
Lunny Xiao [Wed, 14 Jul 2021 18:03:00 +0000 (02:03 +0800)]
Change the release cycle to match actual situations (#16430)

* Change the release cycle to match actual situations

* Update CONTRIBUTING.md

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
3 years agoChange docker tag logic (#16421)
techknowlogick [Wed, 14 Jul 2021 17:08:43 +0000 (13:08 -0400)]
Change docker tag logic (#16421)

* Change docker logic

* Apply suggestions from code review

Co-authored-by: Kyle D. <kdumontnu@gmail.com>
* docs

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Kyle D. <kdumontnu@gmail.com>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 14 Jul 2021 15:07:54 +0000 (15:07 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoSecond attempt at preventing zombies (#16326)
zeripath [Wed, 14 Jul 2021 14:43:13 +0000 (15:43 +0100)]
Second attempt at preventing zombies (#16326)

* Second attempt at preventing zombies

* Ensure that the pipes are closed in ssh.go
* Ensure that a cancellable context is passed up in cmd/* http requests
* Make cmd.fail return properly so defers are obeyed
* Ensure that something is sent to stdout in case of blocks here

Signed-off-by: Andrew Thornton <art27@cantab.net>
* placate lint

Signed-off-by: Andrew Thornton <art27@cantab.net>
* placate lint 2

Signed-off-by: Andrew Thornton <art27@cantab.net>
* placate lint 3

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

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Apply suggestions from code review

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 14 Jul 2021 14:07:52 +0000 (14:07 +0000)]
[skip ci] Updated translations via Crowdin

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 14 Jul 2021 13:08:17 +0000 (13:08 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoUse TrN helper for email templates (#16425)
6543 [Wed, 14 Jul 2021 13:06:09 +0000 (15:06 +0200)]
Use TrN helper for email templates (#16425)

* Add TrN helper

* use TrN

* a nit

3 years agoMake gpg resource string more readable (#16423)
delvh [Wed, 14 Jul 2021 10:50:39 +0000 (12:50 +0200)]
Make gpg resource string more readable (#16423)

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 14 Jul 2021 00:07:53 +0000 (00:07 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoFix activation of primary email addresses (#16385)
Meano [Tue, 13 Jul 2021 20:59:27 +0000 (04:59 +0800)]
Fix activation of primary email addresses (#16385)

* fix: primary email cannot be activated

* Primary email should be activated together with user account when
'RegisterEmailConfirm' is enabled.

* To fix the existing error state. When 'RegisterEmailConfirm' is enabled, the
admin should have permission to modify the activations status of user email.
And the user should be allowed to send activation to primary email.

* Only judge whether email is primary from email_address table.

* Improve logging and refactor isEmailActive

Co-authored-by: zeripath <art27@cantab.net>
3 years agoReturn updated repository when changing repository using API (#16420)
6543 [Tue, 13 Jul 2021 19:31:59 +0000 (21:31 +0200)]
Return updated repository when changing repository using API (#16420)

3 years agoLoad issue/PR context popup data only when needed (#15955)
Lauris BH [Tue, 13 Jul 2021 18:09:19 +0000 (21:09 +0300)]
Load issue/PR context popup data only when needed (#15955)

* Load issue/PR context popup data only when needed

* Add SVG icon Vue component

* Remove unneeded check

3 years agoSupport HTTP/2 in Let's Encrypt (#16371)
Stanley Hu [Tue, 13 Jul 2021 17:17:46 +0000 (01:17 +0800)]
Support HTTP/2 in Let's Encrypt (#16371)

Modify the tlsConfig.NextProtos for Let's Encrypt and built-in HTTPS server in order to support HTTP/2.

Co-authored-by: 6543 <6543@obermui.de>
3 years agofix calculation for finalPage in repo-search component (#16382)
6543 [Tue, 13 Jul 2021 14:05:27 +0000 (16:05 +0200)]
fix calculation for finalPage in repo-search component (#16382)

Co-authored-by: Jan Naahs <jan.naahs@naahstea.de>
3 years agoAdd option to provide signature for a token to verify key ownership (#14054)
zeripath [Tue, 13 Jul 2021 13:28:07 +0000 (14:28 +0100)]
Add option to provide signature for a token to verify key ownership (#14054)

* Add option to provide signed token to verify key ownership

Currently we will only allow a key to be matched to a user if it matches
an activated email address. This PR provides a different mechanism - if
the user provides a signature for automatically generated token (based
on the timestamp, user creation time, user ID, username and primary
email.

* Ensure verified keys can act for all active emails for the user

* Add code to mark keys as verified

* Slight UI adjustments

* Slight UI adjustments 2

* Simplify signature verification slightly

* fix postgres test

* add api routes

* handle swapped primary-keys

* Verify the no-reply address for verified keys

* Only add email addresses that are activated to keys

* Fix committer shortcut properly

* Restructure gpg_keys.go

* Use common Verification Token code

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoFix archive error when rename repo or user (#16399)
Lunny Xiao [Tue, 13 Jul 2021 12:16:31 +0000 (20:16 +0800)]
Fix archive error when rename repo or user (#16399)

Use repo id instead of full name to generate archive path

3 years agoLet branch/tag name be a valid ref to get CI status (#16400)
6543 [Tue, 13 Jul 2021 07:14:14 +0000 (09:14 +0200)]
Let branch/tag name be a valid ref to get CI status (#16400)

* fix #16384#

* refactor: move shared helper func to utils package

* extend Tests

* use ctx.Repo.GitRepo if not nil

3 years agoDetect encoding changes while parsing diff (#16330)
Jimmy Praet [Tue, 13 Jul 2021 01:13:52 +0000 (03:13 +0200)]
Detect encoding changes while parsing diff (#16330)

* Detect encoding changes while parsing diff

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 13 Jul 2021 00:07:51 +0000 (00:07 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoAdd checkbox to delete pull branch after successful merge (#16049)
Jimmy Praet [Mon, 12 Jul 2021 23:26:25 +0000 (01:26 +0200)]
Add checkbox to delete pull branch after successful merge (#16049)

* Add checkbox to delete pull branch after successful merge

* Omit DeleteBranchAfterMerge field in json

* Log a warning instead of error when PR head branch deleted

* Add DefaultDeleteBranchAfterMerge to PullRequestConfig

* Add support for delete_branch_after_merge via API

* Fix for API: the branch should be deleted from the HEAD repo

If head and base repo are the same, reuse the already opened ctx.Repo.GitRepo

* Don't delegate to CleanupBranch, only reuse branch deletion code

CleanupBranch contains too much logic that has already been performed by the Merge

* Reuse gitrepo in MergePullRequest

Co-authored-by: Andrew Thornton <art27@cantab.net>
3 years agoFix external renderer (#16401)
6543 [Mon, 12 Jul 2021 21:13:59 +0000 (23:13 +0200)]
Fix external renderer (#16401)

* fix external renderer

* use GBackground context as fallback

* no fallback, return error

Co-authored-by: Lauris BH <lauris@nix.lv>
3 years agoValidate Issue Index before querying DB (#16406)
Norwin [Mon, 12 Jul 2021 20:22:27 +0000 (20:22 +0000)]
Validate Issue Index before querying DB (#16406)

3 years agodocs: rewrite email setup (#16404)
Bagas Sanjaya [Mon, 12 Jul 2021 20:05:40 +0000 (03:05 +0700)]
docs: rewrite email setup (#16404)

* Add intro for both the docs page and mailer methods
  * Fix numbering level in SMTP section
  * Recommends implicit TLS

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
3 years agoReplace `plugins/docker` with `techknowlogick/drone-docker`in ci (#16407)
6543 [Mon, 12 Jul 2021 19:20:44 +0000 (21:20 +0200)]
Replace `plugins/docker` with `techknowlogick/drone-docker`in ci (#16407)

* plugins/docker -> techknowlogick/drone-docker

* It is multi-arch

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 12 Jul 2021 00:24:54 +0000 (00:24 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoAdd LRU mem cache implementation (#16226)
zeripath [Sat, 10 Jul 2021 21:54:15 +0000 (22:54 +0100)]
Add LRU mem cache implementation (#16226)

The current default memory cache implementation is unbounded in size and number of
objects cached. This is hardly ideal.

This PR proposes creating a TwoQueue LRU cache as the underlying cache for Gitea.
The cache is limited by the number of objects stored in the cache (rather than size)
for simplicity. The default number of objects is 50000 - which is perhaps too small
as most of our objects cached are going to be much less than 1kB.

It may be worth considering using a different LRU implementation that actively limits
sizes or avoids GC - however, this is just a beginning implementation.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoFix invalid params and typo of email templates (#16394)
Meano [Sat, 10 Jul 2021 17:40:14 +0000 (01:40 +0800)]
Fix invalid params and typo of email templates (#16394)

Signed-off-by: Meano <meanocat@gmail.com>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 10 Jul 2021 00:24:52 +0000 (00:24 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoAdded documentation about 413 errors with an nginx solution (#15313)
Avahe Kellenberger [Sat, 10 Jul 2021 00:16:07 +0000 (20:16 -0400)]
Added documentation about 413 errors with an nginx solution (#15313)

* Added documentation about 413 errors with an nginx solution.

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Norwin <noerw@users.noreply.github.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>