]> source.dussan.org Git - gitea.git/log
gitea.git
2 years agoUse default values when provided values are empty (#20318)
Gusted [Wed, 13 Jul 2022 05:33:31 +0000 (05:33 +0000)]
Use default values when provided values are empty (#20318)

* Use default values when provided values are empty

- When provided values are empty like `:3000` would imply that host is
empty, use the default value.
- Resolves #20316

* Update database.go

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoAdd tests for the host checking logic, clarify the behaviors (#20328)
wxiaoguang [Wed, 13 Jul 2022 01:07:16 +0000 (09:07 +0800)]
Add tests for the host checking logic, clarify the behaviors (#20328)

Before, the combination of AllowedDomains/BlockedDomains/AllowLocalNetworks is confusing.

This PR adds tests for the logic, clarify the behaviors.

2 years agoChangelog for 1.16.9 (update) (#20341) (#20343)
6543 [Tue, 12 Jul 2022 22:27:35 +0000 (00:27 +0200)]
Changelog for 1.16.9 (update) (#20341) (#20343)

* Changelog for 1.16.9 (update)

2 years agoFix various typos (#20338)
luzpaz [Tue, 12 Jul 2022 21:32:37 +0000 (17:32 -0400)]
Fix various typos (#20338)

* Fix various typos

Found via `codespell -q 3 -S ./options/locale,./options/license,./public/vendor -L actived,allways,attachements,ba,befores,commiter,pullrequest,pullrequests,readby,splitted,te,unknwon`

Co-authored-by: zeripath <art27@cantab.net>
2 years agoCorrectly handle draft releases without a tag (#20314)
Chongyi Zheng [Tue, 12 Jul 2022 12:57:38 +0000 (08:57 -0400)]
Correctly handle draft releases without a tag (#20314)

Fixes #20313.

`errors.Is(err, git.ErrNotExist{})` is not working

2 years agoAdd write check for creating Commit status (#20332)
Gusted [Tue, 12 Jul 2022 12:51:06 +0000 (12:51 +0000)]
Add write check for creating Commit status (#20332)

- Add write code checks for creating new commit status
- Regression #5314

Co-authored-by: zeripath <art27@cantab.net>
2 years agoRemove blue text on migrate page (#20273)
silverwind [Tue, 12 Jul 2022 09:04:15 +0000 (11:04 +0200)]
Remove blue text on migrate page (#20273)

* Remove blue text on migrate page

* remove Safe

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoUpdated dead link to Madeleine.js source (#20322)
BurritoVoid [Tue, 12 Jul 2022 03:51:14 +0000 (23:51 -0400)]
Updated dead link to Madeleine.js source (#20322)

2 years ago[skip ci] Updated translations via Crowdin
silverwind [Tue, 12 Jul 2022 00:10:13 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAdd spectral linter for Swagger (#20321)
silverwind [Mon, 11 Jul 2022 23:07:16 +0000 (01:07 +0200)]
Add spectral linter for Swagger (#20321)

[spectral](https://github.com/stoplightio/spectral) lints
openapi/swagger files for mistakes of which it has identified a few and
which I've fixed.

I had to put it into `lint-frontend` because it depends on node_modules
so can not run on Drone during the backend target. I plan to refactor
these targets later to `lint-js` and `lint-go` so that they are
categorized based on the tool dependencies.

2 years agoStore read access in access for team repo's (#20275)
Gusted [Mon, 11 Jul 2022 11:48:43 +0000 (11:48 +0000)]
Store read access in access for team repo's (#20275)

- Currently when a Team has read access to a organization's non-private
repository, their access won't be stored in the database. This caused
issue for code that rely on read access being stored. So from now-on if
we see that the repository is owned by a organization don't increase the
minMode to write permission.
- Resolves #20083

2 years ago[skip ci] Updated translations via Crowdin
Gusted [Mon, 11 Jul 2022 00:10:08 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoVertical align avatar at middle (#20302)
Gusted [Sun, 10 Jul 2022 18:49:13 +0000 (18:49 +0000)]
Vertical align avatar at middle (#20302)

- Currently the avatar in the navbar is being vertically aligned to the
top, this caused that the icon besides it isn't being at the middle of
the avatar. Use the `vm` helper class to force the `vertical-align` to
be `middle`.
- Resolves #20292

2 years agoChanged scroll to auto for some UI elements. (#20294)
KN4CK3R [Sun, 10 Jul 2022 12:58:26 +0000 (14:58 +0200)]
Changed scroll to auto for some UI elements. (#20294)

Addition to: Show scrollbar when necessary #20142
Fixes the "empty" scrollbars with Firefox.

2 years agoAdd hint to GNUPGHOME environment variable (#20134)
Steven Kriegler [Sun, 10 Jul 2022 09:04:46 +0000 (11:04 +0200)]
Add hint to GNUPGHOME environment variable (#20134)

* Add hint for GNUPGHOME environment variable

With #19732, the default location for the `.gnupg` folder has changed. To mitigate this breaking change, users can specify the home directory for gnupg via `$GNUPGHOME` environment variable to keep using their current location.

* Update docs/content/doc/advanced/signing.en-us.md

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
2 years agoRefactor SSH init code, fix directory creation for TrustedUserCAKeys file (#20299)
wxiaoguang [Sun, 10 Jul 2022 06:50:26 +0000 (14:50 +0800)]
Refactor SSH init code, fix directory creation for TrustedUserCAKeys file (#20299)

* Refactor SSH init code, fix directory creation for TrustedUserCAKeys file

* Update modules/ssh/init.go

Co-authored-by: zeripath <art27@cantab.net>
* fix lint copyright

* Update modules/ssh/init.go

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
Gusted [Sun, 10 Jul 2022 00:10:33 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoUse dedicated draft PR icon when possible (#20303)
Gusted [Sat, 9 Jul 2022 22:17:04 +0000 (00:17 +0200)]
Use dedicated draft PR icon when possible (#20303)

* Use dedicated draft PR icon when possible

- Currently the generic pull-request icon is used for draft PR's. This
patch changes that by using the dedicated icon for this.
- Resolves #20296

* Use draft title

2 years agoUpdate goldmark (#20300)
Gusted [Sat, 9 Jul 2022 18:58:22 +0000 (20:58 +0200)]
Update goldmark (#20300)

Update goldmark to v1.4.13 to fix a issue with quotes after a empty
list item(See https://github.com/yuin/goldmark/issues/313) and
downstream issue https://codeberg.org/Codeberg/Community/issues/645

2 years agoDo not create empty ".ssh" directory when loading config (#20289)
wxiaoguang [Sat, 9 Jul 2022 14:32:18 +0000 (22:32 +0800)]
Do not create empty ".ssh" directory when loading config (#20289)

Creating the directory automatically is not correct.
In other places for ssh key writing (RewriteAllPrincipalKeys / appendAuthorizedKeysToFile, etc), the directory will still be created when updating the keys.
This PR will resolve the confusing and annoying problem: the dummy and empty ".ssh" directory in new git home.

2 years agoImplement sync push mirror on commit (#19411)
Chongyi Zheng [Fri, 8 Jul 2022 19:45:12 +0000 (15:45 -0400)]
Implement sync push mirror on commit (#19411)

Support synchronizing with the push mirrors whenever new commits are pushed or synced from pull mirror.

Related Issues: #18220

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoUse git.HOME_PATH for Git HOME directory (#20114)
wxiaoguang [Fri, 8 Jul 2022 08:09:07 +0000 (16:09 +0800)]
Use git.HOME_PATH for Git HOME directory (#20114)

* Add git.HOME_PATH

* add legacy file check

* Apply suggestions from code review

Co-authored-by: zeripath <art27@cantab.net>
* pass env GNUPGHOME to git command, move the existing .gitconfig to new home, make the fix for 1.17rc more clear.

* set git.HOME_PATH for docker images to default HOME

* Revert "set git.HOME_PATH for docker images to default HOME"

This reverts commit f120101ddc267cef74e4f4b92c783d5fc8e275a1.

* force Gitea to use a stable GNUPGHOME directory

* extra check to ensure only process dir or symlink for legacy files

* refactor variable name

* The legacy dir check (for 1.17-rc1) could be removed with 1.18 release, since users should have upgraded from 1.17-rc to 1.17-stable

* Update modules/git/git.go

Co-authored-by: Steven Kriegler <61625851+justusbunsi@users.noreply.github.com>
* remove initFixGitHome117rc

* Update git.go

* Update docs/content/doc/advanced/config-cheat-sheet.en-us.md

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Steven Kriegler <61625851+justusbunsi@users.noreply.github.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoAdd tooltip to repo icons in explore page (#20241)
Baoshuo Ren [Thu, 7 Jul 2022 20:17:41 +0000 (04:17 +0800)]
Add tooltip to repo icons in explore page (#20241)

* Add label to repo icons in explore page

Co-authored-by: silverwind <me@silverwind.io>
2 years agoFix NPE when using non-numeric (#20277)
Gusted [Thu, 7 Jul 2022 15:46:49 +0000 (17:46 +0200)]
Fix NPE when using non-numeric (#20277)

- This code is only valid when `refNumeric` exist(otherwise we didn't find
such numeric PR and can skip that check) and give a free-pas to the  "BEFORE" check when
`ref` is nil.
- Resolves #20109

2 years agoModify milestone search keywords to be case insensitive (#20266)
Tyrone Yeh [Wed, 6 Jul 2022 21:05:12 +0000 (05:05 +0800)]
Modify milestone search keywords to be case insensitive (#20266)

Milestone search keywords are now sensitive, this modification is changed to insensitive

2 years agoFix toolip on mobile notification bell (#20270)
zeripath [Wed, 6 Jul 2022 21:03:52 +0000 (22:03 +0100)]
Fix toolip on mobile notification bell (#20270)

Unfortunately there is a bug in #20108 where the translation call was
not updated to use `.locale` from `.i18n`.

This PR updates the template to use `.locale`.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoAllow RSA 2047 bit keys (#20272)
zeripath [Wed, 6 Jul 2022 20:49:27 +0000 (21:49 +0100)]
Allow RSA 2047 bit keys (#20272)

Unfortunately it appears that 2048 bit RSA keys can occasionally be created in such
a way that they appear to have 2047 bit length. This PR simply changes our defaults to
allow these.

Fix #20249

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoRefix notification bell placement (#20251)
zeripath [Wed, 6 Jul 2022 17:33:10 +0000 (18:33 +0100)]
Refix notification bell placement (#20251)

The use of `m-4 text black` for the notification bell results in this
icon being shifted upwards. Instead we should use the `item` class but
adjust `not-mobile` and `mobile-only` to make their `display: none`
settings `!important`.

(As an aside: This is probably one of the only times we should use
`!important` in our less files and the rest should be avoided or
removed.)

Ref #20069
Revert #20236

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoBump mermaid from 9.1.1 to 9.1.2 (#20256)
dependabot[bot] [Wed, 6 Jul 2022 01:41:54 +0000 (09:41 +0800)]
Bump mermaid from 9.1.1 to 9.1.2 (#20256)

Bumps [mermaid](https://github.com/knsv/mermaid) from 9.1.1 to 9.1.2.
- [Release notes](https://github.com/knsv/mermaid/releases)
- [Changelog](https://github.com/mermaid-js/mermaid/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/knsv/mermaid/compare/9.1.1...9.1.2)

---
updated-dependencies:
- dependency-name: mermaid
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2 years agoEscapeFilter the group dn membership (#20200)
zeripath [Tue, 5 Jul 2022 15:59:27 +0000 (16:59 +0100)]
EscapeFilter the group dn membership (#20200)

The uid provided to the group filter must be properly escaped using the provided
ldap.EscapeFilter function.

Fix #20181

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoOnly show Followers that current user can access (#20220)
zeripath [Tue, 5 Jul 2022 15:47:45 +0000 (16:47 +0100)]
Only show Followers that current user can access (#20220)

Users who are following or being followed by a user should only be
displayed if the viewing user can see them.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoInit popup for new code comment (#20234)
Gusted [Tue, 5 Jul 2022 12:28:31 +0000 (14:28 +0200)]
Init popup for new code comment (#20234)

- Initialize the popup for the tooltip inside the new code comment.
- This works and is good enough to have this issue fixed for 1.17

Fix #20068

2 years agoBypass Firefox (iOS) bug (#20244)
wxiaoguang [Tue, 5 Jul 2022 12:27:13 +0000 (20:27 +0800)]
Bypass Firefox (iOS) bug (#20244)

* https://github.com/go-gitea/gitea/issues/20240

At the moment, Firefox (iOS) (10x) has an engine bug. See https://github.com/go-gitea/gitea/issues/20240
If a script inserts a newly created (and content changed) element into DOM, there will be a nonsense error event reporting: Script error: line 0, col 0.

This PR ignores such nonsense error event.

Fix #20240

2 years agoAdjust max-widths for the repository file table (#20243)
zeripath [Tue, 5 Jul 2022 11:33:05 +0000 (12:33 +0100)]
Adjust max-widths for the repository file table (#20243)

Adjust the max-widths for the repository file table to allow for nicer
resizing of the names and commit messages.

Fix #20040

Signed-off-by: Andrew Thornton <art27@cantab.net>
## Screenshots

## MediaXL
![Screenshot from 2022-07-05 10-22-12](https://user-images.githubusercontent.com/1824502/177295867-7ba8cf60-8f61-4227-892f-e5a0477e4146.png)

## MediaLg
![Screenshot from 2022-07-05 10-24-37](https://user-images.githubusercontent.com/1824502/177296301-e066e206-10f7-4a15-a68b-0f772a95f369.png)

## MediaMd
![Screenshot from 2022-07-05 10-23-03](https://user-images.githubusercontent.com/1824502/177295965-69397649-16ca-456a-bc0c-ed507fcb7f44.png)

## MediaSm
![Screenshot from 2022-07-05 10-26-44](https://user-images.githubusercontent.com/1824502/177296700-ca2a853b-c47b-4592-baf4-4bc08a7e1c9c.png)

2 years agoDisplay full name (#20171)
Baekjun Kim [Tue, 5 Jul 2022 11:30:05 +0000 (06:30 -0500)]
Display full name (#20171)

The setting `DEFAULT_SHOW_FULL_NAME` promises to use the user's full name everywhere it can be used.

Unfortunately the function `*user_model.User.ShortName()` currently uses the `.Name` instead - but this should also use the `.FullName()`.

Therefore we should make `*user_model.User.ShortName()` base its pre-shortened name on the `.FullName()` function.

2 years agoAdjust class for mobile has the problem of double small bells (#20236)
Tyrone Yeh [Tue, 5 Jul 2022 06:12:53 +0000 (14:12 +0800)]
Adjust class for mobile has the problem of double small bells (#20236)

* Adjust class for mobile has the problem of double small bells

* Update templates/base/head_navbar.tmpl

Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
2 years agoAdjust template for #20069 smallbell (#20108)
Tyrone Yeh [Mon, 4 Jul 2022 14:44:34 +0000 (22:44 +0800)]
Adjust template for #20069 smallbell (#20108)

* Adjust template for #20069 smallbell

* Adjust notification Unread Count variable to global and count bell position with mobile

* Adjust bell icon style

* Adjust smallbell to middle

* Avoid using inline styles

* move notificationUnreadCount to a general code block, reduce changed lines

* Solved conflicts

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoAdd integration tests for the Gitea migration form (#20121)
Aravinth Manivannan [Mon, 4 Jul 2022 12:36:24 +0000 (18:06 +0530)]
Add integration tests for the Gitea migration form (#20121)

* tests: integration tests for the Gitea migration form

* use a mix of ` and " instead of backslash

https://github.com/go-gitea/gitea/pull/20121#discussion_r906729415

Co-authored-by: Loïc Dachary <loic@dachary.org>
2 years agoAllow dev i18n to be more concurrent (#20159)
zeripath [Mon, 4 Jul 2022 10:17:09 +0000 (11:17 +0100)]
Allow dev i18n to be more concurrent (#20159)

The recent changes to add live-reloading to the i18n translation files made the i18n code totally non-concurrent when using dev. This will make discovering other concurrency related issues far more difficult. This PR fixes these, adds some more comments to the code and slightly restructures a few functions.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoAllow enable LDAP source and disable user sync via CLI (#20206)
Steven Kriegler [Mon, 4 Jul 2022 09:21:14 +0000 (11:21 +0200)]
Allow enable LDAP source and disable user sync via CLI (#20206)

The current `admin auth` CLI for managing authentication source of type
LDAP via BindDN and Simple LDAP does not allow enabling the respective
source, once disabled via `--not-active`.
The same applies to `--synchronize-users` specifially for LDAP via
BindDN.

These changes add two new flags to LDAP related CLI commands:

- `--active` for both LDAP authentication source types
- `--disable-synchronize-users` for LDAP via BindDN

Signed-off-by: justusbunsi <61625851+justusbunsi@users.noreply.github.com>
2 years agoRemove `GO111MODULE` (#20221)
Gusted [Mon, 4 Jul 2022 03:33:55 +0000 (05:33 +0200)]
Remove `GO111MODULE` (#20221)

- Given we use go1.18 for this and don't rely on the Go 1.11 modules
behavior(we use the modern `go run` & `go get` which has the correct
behavior by-default).

2 years agoUpdate Bluemonday to v1.0.19 (#20199)
zeripath [Fri, 1 Jul 2022 18:50:06 +0000 (19:50 +0100)]
Update Bluemonday to v1.0.19 (#20199)

The current version of bluemonday is double escaping attributes.

This PR updates bluemonday to the version that fixes this.

(See: microcosm-cc/bluemonday#143 )

Fix #19860

Signed-off-by: Andrew Thornton art27@cantab.net
2 years agoRefix indices on actions table (#20158)
zeripath [Fri, 1 Jul 2022 16:04:01 +0000 (17:04 +0100)]
Refix indices on actions table (#20158)

Unforunately the previous PR #20035 created indices that were not helpful
for SQLite. This PR adjusts these after testing using the try.gitea.io db.

Fix #20129

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoUpdate default allowed attachment types (#20192)
silverwind [Fri, 1 Jul 2022 13:42:20 +0000 (15:42 +0200)]
Update default allowed attachment types (#20192)

Synced the list to what is allowed on GitHub currently.

2 years agoFix cli command restore-repo: "units" should be splitted to string slice, to match...
wxiaoguang [Fri, 1 Jul 2022 07:47:44 +0000 (15:47 +0800)]
Fix cli command restore-repo: "units" should be splitted to string slice, to match the old behavior and match the dump-repo's behavior (#20183)

2 years ago[skip ci] Updated translations via Crowdin
wxiaoguang [Fri, 1 Jul 2022 00:10:16 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoFix `dump-repo` git init, fix wrong error type for NullDownloader (#20182)
wxiaoguang [Thu, 30 Jun 2022 23:48:25 +0000 (07:48 +0800)]
Fix `dump-repo` git init, fix wrong error type for NullDownloader (#20182)

* Fix `dump-repo` git init

* fix wrong error type for NullDownloader

2 years agoCheck if project has the same repository id with issue when assign project to issue...
Lunny Xiao [Thu, 30 Jun 2022 15:55:08 +0000 (23:55 +0800)]
Check if project has the same repository id with issue when assign project to issue (#20133)

* Check if project has the same repository id with issue when assign project to issue

* Check if issue's repository id match project's repository id

* Add more permission checking

* Remove invalid argument

* Fix errors

* Add generic check

* Remove duplicated check

* Return error + add check for new issues

* Apply suggestions from code review

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: 6543 <6543@obermui.de>
2 years ago[skip ci] Updated translations via Crowdin
wxiaoguang [Thu, 30 Jun 2022 00:10:22 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years ago[skip ci] Updated translations via Crowdin
wxiaoguang [Wed, 29 Jun 2022 00:10:11 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoEnable spellcheck for EasyMDE, use contenteditable mode (#19776)
wxiaoguang [Tue, 28 Jun 2022 17:52:58 +0000 (01:52 +0800)]
Enable spellcheck for EasyMDE, use contenteditable mode (#19776)

Enable spellcheck for EasyMDE, use contenteditable mode.
Rewrite and refactor the ImagePaste code.

2 years ago[skip ci] Updated translations via Crowdin
Gusted [Tue, 28 Jun 2022 00:09:43 +0000 (00:09 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAdd username check to doctor (#20140)
Gusted [Mon, 27 Jun 2022 23:45:50 +0000 (01:45 +0200)]
Add username check to doctor (#20140)

* Add username check to doctor

- Add a new breaking change detector to Gitea's doctor, which checks if
all users still have a valid username according to Gitea. Given from
time-to-time we need to make changes, either due to new routes or due to
security, it's for a instance's admin to check if all users still have a
valid username.

* Fix extra argument

* Apply suggestions from code review

Co-authored-by: Jimmy Praet <jimmy.praet@telenet.be>
* Apply suggestions from code review

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Jimmy Praet <jimmy.praet@telenet.be>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: delvh <dev.lh@web.de>
2 years agoRefactor `i18n` to `locale` (#20153)
Gusted [Mon, 27 Jun 2022 20:58:46 +0000 (22:58 +0200)]
Refactor `i18n` to `locale` (#20153)

* Refactor `i18n` to `locale`

- Currently we're using the `i18n` variable naming for the `locale`
struct. This contains locale's specific information and cannot be used
for general i18n purpose, therefore refactoring it to `locale` makes
more sense.
- Ref: https://github.com/go-gitea/gitea/pull/20096#discussion_r906699200

* Update routers/install/install.go

2 years agoRemove support for sr-SP (#20155)
Gusted [Mon, 27 Jun 2022 19:50:30 +0000 (21:50 +0200)]
Remove support for sr-SP (#20155)

- The language doesn't have >= 25% translation on crowdin and therefor
was automatically removed from Gitea.
- Ref: https://github.com/go-gitea/gitea/commit/f91092453ed0269420ab5161b4742a692dd500fe

2 years agoHide notify mail setting ui if not enabled (#20138)
Lunny Xiao [Mon, 27 Jun 2022 16:59:47 +0000 (00:59 +0800)]
Hide notify mail setting ui if not enabled (#20138)

2 years agoFix custom folder name in customization docs (#20148)
Jorge Ou [Mon, 27 Jun 2022 16:16:51 +0000 (11:16 -0500)]
Fix custom folder name in customization docs (#20148)

2 years agoAdd missing parameter for error in log message (#20144)
Gusted [Mon, 27 Jun 2022 13:52:22 +0000 (15:52 +0200)]
Add missing parameter for error in log message (#20144)

- Adds a `%v` for the last parameter, `err`.

Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2 years agoShow scrollbar when necessary (#20142)
Gusted [Mon, 27 Jun 2022 12:34:20 +0000 (14:34 +0200)]
Show scrollbar when necessary (#20142)

- Firefox on Windows will unconditionally show scrollbars when you
specify `overflow: scroll`. This is bad behavior, as you don't always
need the scrollbar. Changing the scroll value to auto fixes this issue
and only shows the scrollbar when necessary.
- Resolves #20139

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoAdd spacing between the properties of the key (#20145)
Gusted [Mon, 27 Jun 2022 05:20:29 +0000 (07:20 +0200)]
Add spacing between the properties of the key (#20145)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoRemove U2F support (#20141)
Gusted [Mon, 27 Jun 2022 02:20:58 +0000 (04:20 +0200)]
Remove U2F support (#20141)

- Completely remove U2F support from 1.18.0, 1.17.0 will be the last
release that U2F is somewhat supported. Users who used U2F would already
be warned about using U2F for a while now and should hopefully already
be migrated. But starting 1.18 definitely remove it.

2 years agoMake better use of i18n (#20096)
Gusted [Sun, 26 Jun 2022 14:19:22 +0000 (16:19 +0200)]
Make better use of i18n  (#20096)

* Prototyping

* Start work on creating offsets

* Modify tests

* Start prototyping with actual MPH

* Twiddle around

* Twiddle around comments

* Convert templates

* Fix external languages

* Fix latest translation

* Fix some test

* Tidy up code

* Use simple map

* go mod tidy

* Move back to data structure

- Uses less memory by creating for each language a map.

* Apply suggestions from code review

Co-authored-by: delvh <dev.lh@web.de>
* Add some comments

* Fix tests

* Try to fix tests

* Use en-US as defacto fallback

* Use correct slices

* refactor (#4)

* Remove TryTr, add log for missing translation key

* Refactor i18n

- Separate dev and production locale stores.
- Allow for live-reloading in dev mode.

Co-authored-by: zeripath <art27@cantab.net>
* Fix live-reloading & check for errors

* Make linter happy

* live-reload with periodic check (#5)

* Fix tests

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
2 years agoUse neutral language in comments and docs (#20135)
Gusted [Sat, 25 Jun 2022 22:50:12 +0000 (00:50 +0200)]
Use neutral language in comments and docs (#20135)

- Replace `his/her` to `their`, as it's more neutral language.

2 years agoFix remove file on initial comment (#20127)
Gusted [Sat, 25 Jun 2022 19:49:56 +0000 (21:49 +0200)]
Fix remove file on initial comment (#20127)

Store the file uuid(which is returned by Gitea in the upload file
response) onto the file object, so it can be used for the remove feature
to specify this file.

Fix #20115

2 years agoAdd doctor command to write commit-graphs (#20007)
zeripath [Sat, 25 Jun 2022 19:02:29 +0000 (20:02 +0100)]
Add doctor command to write commit-graphs (#20007)

This PR adds a doctor command to write the commit-graphs for the repositories:

`gitea doctor --run check-commit-graphs --fix`

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoAdd sitemap support (#18407)
Daniil Gentili [Sat, 25 Jun 2022 17:06:01 +0000 (19:06 +0200)]
Add sitemap support (#18407)

2 years agoUse new config options (#20125)
Kyle D [Fri, 24 Jun 2022 20:38:19 +0000 (16:38 -0400)]
Use new config options (#20125)

2 years agoRemove depricated queue indexer usage (#20124)
Kyle D [Fri, 24 Jun 2022 19:04:30 +0000 (15:04 -0400)]
Remove depricated queue indexer usage (#20124)

2 years agoDisable status checks in template if none found (#20088)
John Olheiser [Fri, 24 Jun 2022 17:22:08 +0000 (12:22 -0500)]
Disable status checks in template if none found (#20088)

Signed-off-by: jolheiser <john.olheiser@gmail.com>
2 years agoFix typos related to ErrTaskDoesNotExist error (#20118)
Petr Vaněk [Fri, 24 Jun 2022 13:51:37 +0000 (15:51 +0200)]
Fix typos related to ErrTaskDoesNotExist error (#20118)

Fixes: f2a3abc683ad ("Move migrating repository from frontend to backend (#6200)")
2 years agoMove eslintrc/stylelintrc to non-deprecated extensions (#20110)
silverwind [Fri, 24 Jun 2022 12:09:53 +0000 (14:09 +0200)]
Move eslintrc/stylelintrc to non-deprecated extensions (#20110)

2 years agoAllow manager logging to set SQL (#20064)
zeripath [Fri, 24 Jun 2022 10:49:47 +0000 (11:49 +0100)]
Allow manager logging to set SQL (#20064)

This PR adds a new manager command to switch on SQL logging and to turn it off.

```
gitea manager logging log-sql
gitea manager logging log-sql --off
```

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoReplace pubkey with privkey in keys_ssh.tmpl (#20112)
Robert Lützner [Fri, 24 Jun 2022 10:11:13 +0000 (10:11 +0000)]
Replace pubkey with privkey in keys_ssh.tmpl (#20112)

If a user wants to verify an SSH public key from their account they have
to sign the randomly generated token with their private key.

Prior to this change the example command prompted to sign the token with
their public key instead.

Signed-off-by: Robert Lützner <robert.luetzner@pm.me>
2 years agoUpdate security information to add a public gpg key to make sending encrypted message...
Lunny Xiao [Fri, 24 Jun 2022 09:40:01 +0000 (17:40 +0800)]
Update security information to add a public gpg key to make sending encrypted message possible (#20117)

2 years agoImprove log document (#20097)
wxiaoguang [Fri, 24 Jun 2022 02:56:46 +0000 (10:56 +0800)]
Improve log document (#20097)

* Improve log document

* Update docs/content/doc/help/seek-help.en-us.md

Co-authored-by: delvh <dev.lh@web.de>
* Update docs/content/doc/help/seek-help.en-us.md

Co-authored-by: Gusted <williamzijl7@hotmail.com>
* Use different log names to avoid conflicts

* Update seek-help.en-us.md

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoFix wrong login requirement routers (#20101)
Lunny Xiao [Thu, 23 Jun 2022 10:56:39 +0000 (18:56 +0800)]
Fix wrong login requirement routers (#20101)

2 years agoRespect setting.UI.FeedPagingNum (#20094)
Jimmy Praet [Thu, 23 Jun 2022 09:50:37 +0000 (11:50 +0200)]
Respect setting.UI.FeedPagingNum (#20094)

Fixes #20080

2 years ago[skip ci] Updated translations via Crowdin
Lunny Xiao [Thu, 23 Jun 2022 00:10:20 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoUse correct variable for issue count (#20085)
Lunny Xiao [Wed, 22 Jun 2022 16:26:32 +0000 (00:26 +0800)]
Use correct variable for issue count (#20085)

2 years agoFix alias traversal (#20076)
Sandro [Wed, 22 Jun 2022 08:15:49 +0000 (10:15 +0200)]
Fix alias traversal (#20076)

see https://github.com/yandex/gixy/blob/master/docs/en/plugins/aliastraversal.md

Co-authored-by: 6543 <6543@obermui.de>
2 years agoUpdate permissions.en-us.md (#20075)
Jordan Cech [Wed, 22 Jun 2022 00:53:53 +0000 (18:53 -0600)]
Update permissions.en-us.md (#20075)

* Update permissions.en-us.md

A few grammar tweaks to make docs a bit more clear.

* Apply suggestions from code review

Co-authored-by: delvh <dev.lh@web.de>
* Update docs/content/doc/usage/permissions.en-us.md

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: delvh <dev.lh@web.de>
2 years agoChangelog for 1.16.9 (#20059) (#20063)
6543 [Tue, 21 Jun 2022 22:59:02 +0000 (00:59 +0200)]
Changelog for 1.16.9 (#20059) (#20063)

* Changelog for 1.16.9 (#20059)

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
2 years agoRelease page show all tags in compare dropdown (#20070)
6543 [Tue, 21 Jun 2022 17:42:19 +0000 (19:42 +0200)]
Release page show all tags in compare dropdown (#20070)

address #19936

2 years agodocs: Mention file extension for issue_template directory (#20057)
s-hamann [Tue, 21 Jun 2022 14:08:31 +0000 (14:08 +0000)]
docs: Mention file extension for issue_template directory (#20057)

2 years ago[skip ci] Updated translations via Crowdin
SteveTheEngineer [Tue, 21 Jun 2022 00:10:11 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoCatch the error before the response is processed by goth. (#20000)
SteveTheEngineer [Mon, 20 Jun 2022 15:37:54 +0000 (18:37 +0300)]
Catch the error before the response is processed by goth. (#20000)

The code introduced by #18185 gets the error from response after it was processed by goth.

That is incorrect, as goth (and golang.org/x/oauth) doesn't really care about the error, and it sends a token request with an empty authorization code to the server anyway, which always results in a `oauth2: cannot fetch token: 400 Bad Request` error from goth.
It means that unless the "state" parameter is omitted from the error response (which is required to be present, according to [RFC 6749, Section 4.1.2.1](https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2.1)) or the page is reloaded (makes the session invalid), a 500 Internal Server Error page will be displayed.
This fixes it by handling the error before the request is passed to goth.

2 years agoAdjust transaction handling via db.Context (#20031)
Lunny Xiao [Mon, 20 Jun 2022 12:38:58 +0000 (20:38 +0800)]
Adjust transaction handling via db.Context (#20031)

2 years agoAdd more linters to improve code readability (#19989)
Wim [Mon, 20 Jun 2022 10:02:49 +0000 (12:02 +0200)]
Add more linters to improve code readability (#19989)

Add nakedret, unconvert, wastedassign, stylecheck and nolintlint linters to improve code readability

- nakedret - https://github.com/alexkohler/nakedret - nakedret is a Go static analysis tool to find naked returns in functions greater than a specified function length.
- unconvert - https://github.com/mdempsky/unconvert - Remove unnecessary type conversions
- wastedassign - https://github.com/sanposhiho/wastedassign -  wastedassign finds wasted assignment statements.
- notlintlint -  Reports ill-formed or insufficient nolint directives
- stylecheck - https://staticcheck.io/docs/checks/#ST - keep style consistent
  - excluded: [ST1003 - Poorly chosen identifier](https://staticcheck.io/docs/checks/#ST1003) and [ST1005 - Incorrectly formatted error string](https://staticcheck.io/docs/checks/#ST1005)

2 years ago[skip ci] Updated translations via Crowdin
Gusted [Mon, 20 Jun 2022 00:10:43 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoDisable federation by default (#20045)
Gusted [Sun, 19 Jun 2022 23:48:17 +0000 (01:48 +0200)]
Disable federation by default (#20045)

2 years agoRespond with a 401 on git push when password isn't changed yet (#20026)
Wim [Sun, 19 Jun 2022 19:23:00 +0000 (21:23 +0200)]
Respond with a 401 on git push when password isn't changed yet (#20026)

If the user-agent starts with git and user must change password but
hasn't return a 401 with the message.

It must be a 401, git doesn't seem to show the contents of the error message
when we return a 403

Fixes #19090

2 years agoAlter hook_task TEXT fields to LONGTEXT (#20038)
Wim [Sun, 19 Jun 2022 18:47:04 +0000 (20:47 +0200)]
Alter hook_task TEXT fields to LONGTEXT (#20038)

Mysql TEXT has a limit of 64KB, change this to LONGTEXT in mysql only so we can have bigger hook payloads.

Postgresql has unlimited TEXT - https://www.postgresql.org/docs/current/datatype-character.html
Sqlite has unlimited TEXT - https://www.sqlitetutorial.net/sqlite-data-types/#:~:text=The%20maximum%20length%20of%20TEXT,SQLite%20supports%20various%20character%20encodings.

Same issue as #16656 but for hook_task

Fixes #10252, #19679, #3561

2 years agoSimplify and fix migration 216 (#20035)
zeripath [Sun, 19 Jun 2022 18:07:18 +0000 (19:07 +0100)]
Simplify and fix migration 216 (#20035)

There appears to be a strange bug whereby the comment_id index can sometimes be missed
or missing from the action table despite the sync2 that should create it in the earlier
part of this migration. However, looking through the code for Sync2 there is no need
for this pre-code to exist and Sync2 should drop/create the indices as necessary.

I think therefore we should simplify the migration to simply be Sync2.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agouse quoted regexp instead of git fixed-value (#20029)
wxiaoguang [Sun, 19 Jun 2022 11:56:22 +0000 (19:56 +0800)]
use quoted regexp instead of git fixed-value (#20029)

2 years agofix delete pull head ref for DeleteIssue (#20032)
a1012112796 [Sun, 19 Jun 2022 10:05:15 +0000 (18:05 +0800)]
fix delete pull head ref for DeleteIssue (#20032)

* fix delete pull head ref for DeleteIssue

fix #19655

Signed-off-by: a1012112796 <1012112796@qq.com>
* add different help message for delete pull request

Signed-off-by: a1012112796 <1012112796@qq.com>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoUser keypairs and HTTP signatures for ActivityPub federation using go-ap (#19133)
Anthony Wang [Sun, 19 Jun 2022 05:25:12 +0000 (00:25 -0500)]
User keypairs and HTTP signatures for ActivityPub federation using go-ap (#19133)

* go.mod: add go-fed/{httpsig,activity/pub,activity/streams} dependency

go get github.com/go-fed/activity/streams@master
go get github.com/go-fed/activity/pub@master
go get github.com/go-fed/httpsig@master

* activitypub: implement /api/v1/activitypub/user/{username} (#14186)

Return informations regarding a Person (as defined in ActivityStreams
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-person).

Refs: https://github.com/go-gitea/gitea/issues/14186

Signed-off-by: Loïc Dachary <loic@dachary.org>
* activitypub: add the public key to Person (#14186)

Refs: https://github.com/go-gitea/gitea/issues/14186

Signed-off-by: Loïc Dachary <loic@dachary.org>
* activitypub: go-fed conformant Clock instance

Signed-off-by: Loïc Dachary <loic@dachary.org>
* activitypub: signing http client

Signed-off-by: Loïc Dachary <loic@dachary.org>
* activitypub: implement the ReqSignature middleware

Signed-off-by: Loïc Dachary <loic@dachary.org>
* activitypub: hack_16834

Signed-off-by: Loïc Dachary <loic@dachary.org>
* Fix CI checks-backend errors with go mod tidy

Signed-off-by: Anthony Wang <ta180m@pm.me>
* Change 2021 to 2022, properly format package imports

Signed-off-by: Anthony Wang <ta180m@pm.me>
* Run make fmt and make generate-swagger

Signed-off-by: Anthony Wang <ta180m@pm.me>
* Use Gitea JSON library, add assert for pkp

Signed-off-by: Anthony Wang <ta180m@pm.me>
* Run make fmt again, fix err var redeclaration

Signed-off-by: Anthony Wang <ta180m@pm.me>
* Remove LogSQL from ActivityPub person test

Signed-off-by: Anthony Wang <ta180m@pm.me>
* Assert if json.Unmarshal succeeds

Signed-off-by: Anthony Wang <ta180m@pm.me>
* Cleanup, handle invalid usernames for ActivityPub person GET request

Signed-off-by: Anthony Wang <ta180m@pm.me>
* Rename hack_16834 to user_settings

Signed-off-by: Anthony Wang <ta180m@pm.me>
* Use the httplib module instead of http for GET requests

* Clean up whitespace with make fmt

* Use time.RFC1123 and make the http.Client proxy-aware

* Check if digest algo is supported in setting module

* Clean up some variable declarations

* Remove unneeded copy

* Use system timezone instead of setting.DefaultUILocation

* Use named constant for httpsigExpirationTime

* Make pubKey IRI #main-key instead of /#main-key

* Move /#main-key to #main-key in tests

* Implemented Webfinger endpoint.

* Add visible check.

* Add user profile as alias.

* Add actor IRI and remote interaction URL to WebFinger response

* fmt

* Fix lint errors

* Use go-ap instead of go-fed

* Run go mod tidy to fix missing modules in go.mod and go.sum

* make fmt

* Convert remaining code to go-ap

* Clean up go.sum

* Fix JSON unmarshall error

* Fix CI errors by adding @context to Person() and making sure types match

* Correctly decode JSON in api_activitypub_person_test.go

* Force CI rerun

* Fix TestActivityPubPersonInbox segfault

* Fix lint error

* Use @mariusor's suggestions for idiomatic go-ap usage

* Correctly add inbox/outbox IRIs to person

* Code cleanup

* Remove another LogSQL from ActivityPub person test

* Move httpsig algos slice to an init() function

* Add actor IRI and remote interaction URL to WebFinger response

* Update TestWebFinger to check for ActivityPub IRI in aliases

* make fmt

* Force CI rerun

* WebFinger: Add CORS header and fix Href -> Template for remote interactions

The CORS header is needed due to https://datatracker.ietf.org/doc/html/rfc7033#section-5 and fixes some Peertube <-> Gitea federation issues

* make lint-backend

* Make sure Person endpoint has Content-Type application/activity+json and includes PreferredUsername, URL, and Icon

Setting the correct Content-Type is essential for federating with Mastodon

* Use UTC instead of GMT

* Rename pkey to pubKey

* Make sure HTTP request Date in GMT

* make fmt

* dont drop err

* Make sure API responses always refer to username in original case

Copied from what I wrote on #19133 discussion: Handling username case is a very tricky issue and I've already encountered a Mastodon <-> Gitea federation bug due to Gitea considering Ta180m and ta180m to be the same user while Mastodon thinks they are two different users. I think the best way forward is for Gitea to only use the original case version of the username for federation so other AP software don't get confused.

* Move httpsig algs constant slice to modules/setting/federation.go

* Add new federation settings to app.example.ini and config-cheat-sheet

* Return if marshalling error

* Make sure Person IRIs are generated correctly

This commit ensures that if the setting.AppURL is something like "http://127.0.0.1:42567" (like in the integration tests), a trailing slash will be added after that URL.

* If httpsig verification fails, fix Host header and try again

This fixes a very rare bug when Gitea and another AP server (confirmed to happen with Mastodon) are running on the same machine, Gitea fails to verify incoming HTTP signatures. This is because the other AP server creates the sig with the public Gitea domain as the Host. However, when Gitea receives the request, the Host header is instead localhost, so the signature verification fails. Manually changing the host header to the correct value and trying the veification again fixes the bug.

* Revert "If httpsig verification fails, fix Host header and try again"

This reverts commit f53e46c721a037c55facb9200106a6b491bf834c.

The bug was actually caused by nginx messing up the Host header when reverse-proxying since I didn't have the line `proxy_set_header Host $host;` in my nginx config for Gitea.

* Go back to using ap.IRI to generate inbox and outbox IRIs

* use const for key values

* Update routers/web/webfinger.go

* Use ctx.JSON in Person response to make code cleaner

* Revert "Use ctx.JSON in Person response to make code cleaner"

This doesn't work because the ctx.JSON() function already sends the response out and it's too late to edit the headers.

This reverts commit 95aad988975be3393c76094864ed6ba962157e0c.

* Use activitypub.ActivityStreamsContentType for Person response Content Type

* Limit maximum ActivityPub request and response sizes to a configurable setting

* Move setting key constants to models/user/setting_keys.go

* Fix failing ActivityPubPerson integration test by checking the correct field for username

* Add a warning about changing settings that can break federation

* Add better comments

* Don't multiply Federation.MaxSize by 1<<20 twice

* Add more better comments

* Fix failing ActivityPubMissingPerson test

We now use ctx.ContextUser so the message printed out when a user does not exist is slightly different

* make generate-swagger

For some reason I didn't realize that /templates/swagger/v1_json.tmpl was machine-generated by make generate-swagger... I've been editing it by hand for three months! 🤦

* Move getting the RFC 2616 time to a separate function

* More code cleanup

* Update go-ap to fix empty liked collection and removed unneeded HTTP headers

* go mod tidy

* Add ed25519 to httpsig algorithms

* Use go-ap/jsonld to add @context and marshal JSON

* Change Gitea user agent from the default to Gitea/Version

* Use ctx.ServerError and remove all remote interaction code from webfinger.go

2 years agoBacktick table name in generic orphan check (#20019)
Gusted [Sat, 18 Jun 2022 23:26:22 +0000 (01:26 +0200)]
Backtick table name in generic orphan check (#20019)

2 years agoUpdate document to clarify that ALLOWED_DOMAINS/BLOCKED_DOMAINS support wildcard...
wxiaoguang [Sat, 18 Jun 2022 19:23:06 +0000 (03:23 +0800)]
Update document to clarify that ALLOWED_DOMAINS/BLOCKED_DOMAINS support wildcard (#20016)

2 years agoReturn 404 when tag is broken (#20017)
Wim [Sat, 18 Jun 2022 17:08:34 +0000 (19:08 +0200)]
Return 404 when tag is broken (#20017)

Fixes #19979

2 years agoDump should only copy regular files and symlink regular files (#20015) v1.18.0-dev
wxiaoguang [Sat, 18 Jun 2022 14:06:32 +0000 (22:06 +0800)]
Dump should only copy regular files and symlink regular files (#20015)