Skip to content

Commit c560ddb

Browse files
author
Gusted
authored
Merge branch 'main' into private-comments
2 parents 9b93d30 + c88f2e2 commit c560ddb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+2005
-631
lines changed

CHANGELOG.md

+99
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,105 @@ This changelog goes through all the changes that have been made in each release
44
without substantial changes to our git log; to see the highlights of what has
55
been added to each release, please refer to the [blog](https://blog.gitea.io).
66

7+
## [1.16.4](https://github.com/go-gitea/gitea/releases/tag/v1.16.4) - 2022-03-14
8+
9+
* SECURITY
10+
* Restrict email address validation (#17688) (#19085)
11+
* Fix lfs bug (#19072) (#19080)
12+
* ENHANCEMENTS
13+
* Improve SyncMirrors logging (#19045) (#19050)
14+
* BUGFIXES
15+
* Refactor mirror code & fix `StartToMirror` (#18904) (#19075)
16+
* Update the webauthn_credential_id_sequence in Postgres (#19048) (#19060)
17+
* Prevent 500 when there is an error during new auth source post (#19041) (#19059)
18+
* If rendering has failed due to a net.OpError stop rendering (attempt 2) (#19049) (#19056)
19+
* Fix flag validation (#19046) (#19051)
20+
* Add pam account authorization check (#19040) (#19047)
21+
* Ignore missing comment for user notifications (#18954) (#19043)
22+
* Set `rel="nofollow noindex"` on new issue links (#19023) (#19042)
23+
* Upgrading binding package (#19034) (#19035)
24+
* Don't show context cancelled errors in attribute reader (#19006) (#19027)
25+
* Fix update hint bug (#18996) (#19002)
26+
* MISC
27+
* Fix potential assignee query for repo (#18994) (#18999)
28+
29+
## [1.16.3](https://github.com/go-gitea/gitea/releases/tag/v1.16.3) - 2022-03-02
30+
31+
* SECURITY
32+
* Git backend ignore replace objects (#18979) (#18980)
33+
* ENHANCEMENTS
34+
* Adjust error for already locked db and prevent level db lock on malformed connstr (#18923) (#18938)
35+
* BUGFIXES
36+
* Set max text height to prevent overflow (#18862) (#18977)
37+
* Fix newAttachmentPaths deletion for DeleteRepository() (#18973) (#18974)
38+
* Accounts with WebAuthn only (no TOTP) now exist ... fix code to handle that case (#18897) (#18964)
39+
* Send 404 on `/{org}.gpg` (#18959) (#18962)
40+
* Fix admin user list pagination (#18957) (#18960)
41+
* Fix lfs management setting (#18947) (#18946)
42+
* Fix login with email panic when email is not exist (#18942)
43+
* Update go-org to v1.6.1 (#18932) (#18933)
44+
* Fix `<strong>` html in translation (#18929) (#18931)
45+
* Fix page and missing return on unadopted repos API (#18848) (#18927)
46+
* Allow adminstrator teams members to see other teams (#18918) (#18919)
47+
* Don't treat BOM escape sequence as hidden character. (#18909) (#18910)
48+
* Correctly link URLs to users/repos with dashes, dots or underscores (… (#18908)
49+
* Fix redirect when using lowercase repo name (#18775) (#18902)
50+
* Fix migration v210 (#18893) (#18892)
51+
* Fix team management UI (#18887) (18886)
52+
* BeforeSourcePath should point to base commit (#18880) (#18799)
53+
* TRANSLATION
54+
* Backport locales from master (#18944)
55+
* MISC
56+
* Don't update email for organisation (#18905) (#18906)
57+
58+
## [1.16.2](https://github.com/go-gitea/gitea/releases/tag/v1.16.2) - 2022-02-24
59+
60+
* ENHANCEMENTS
61+
* Show fullname on issue edits and gpg/ssh signing info (#18828)
62+
* Immediately Hammer if second kill is sent (#18823) (#18826)
63+
* Allow mermaid render error to wrap (#18791)
64+
* BUGFIXES
65+
* Fix ldap user sync missed email in email_address table (#18786) (#18876)
66+
* Update assignees check to include any writing team and change org sidebar (#18680) (#18873)
67+
* Don't report signal: killed errors in serviceRPC (#18850) (#18865)
68+
* Fix bug where certain LDAP settings were reverted (#18859)
69+
* Update go-org to 1.6.0 (#18824) (#18839)
70+
* Fix login with email for ldap users (#18800) (#18836)
71+
* Fix bug for get user by email (#18834)
72+
* Fix panic in EscapeReader (#18820) (#18821)
73+
* Fix ldap loginname (#18789) (#18804)
74+
* Remove redundant call to UpdateRepoStats during migration (#18591) (#18794)
75+
* In disk_channel queues synchronously push to disk on shutdown (#18415) (#18788)
76+
* Fix template bug of LFS lock (#18784) (#18787)
77+
* Attempt to fix the webauthn migration again - part 3 (#18770) (#18771)
78+
* Send mail to issue/pr assignee/reviewer also when OnMention is set (#18707) (#18765)
79+
* Fix a broken link in commits_list_small.tmpl (#18763) (#18764)
80+
* Increase the size of the webauthn_credential credential_id field (#18739) (#18756)
81+
* Prevent dangling GetAttribute calls (#18754) (#18755)
82+
* Fix isempty detection of git repository (#18746) (#18750)
83+
* Fix source code line highlighting on external tracker (#18729) (#18740)
84+
* Prevent double encoding of branch names in delete branch (#18714) (#18738)
85+
* Always set PullRequestWorkInProgressPrefixes in PrepareViewPullInfo (#18713) (#18737)
86+
* Fix forked repositories missed tags (#18719) (#18735)
87+
* Fix release typo (#18728) (#18731)
88+
* Separate the details links of commit-statuses in headers (#18661) (#18730)
89+
* Update object repo with the migrated repository (#18684) (#18726)
90+
* Fix bug for version update hint (#18701) (#18705)
91+
* Fix issue with docker-rootless shimming script (#18690) (#18699)
92+
* Let `MinUnitAccessMode` return correct perm (#18675) (#18689)
93+
* Prevent security failure due to bad APP_ID (#18678) (#18682)
94+
* Restart zero worker if there is still work to do (#18658) (#18672)
95+
* If rendering has failed due to a net.OpError stop rendering (#18642) (#18645)
96+
* TESTING
97+
* Ensure git tag tests and others create test repos in tmpdir (#18447) (#18767)
98+
* BUILD
99+
* Reduce CI go module downloads, add make targets (#18708, #18475, #18443) (#18741)
100+
* MISC
101+
* Put buttons back in org dashboard (#18817) (#18825)
102+
* Various Mermaid improvements (#18776) (#18780)
103+
* C preprocessor colors improvement (#18671) (#18696)
104+
* Fix the missing i18n key for update checker (#18646) (#18665)
105+
7106
## [1.16.1](https://github.com/go-gitea/gitea/releases/tag/v1.16.1) - 2022-02-06
8107

9108
* SECURITY

cmd/cmd.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func argsSet(c *cli.Context, args ...string) error {
3131
return errors.New(a + " is not set")
3232
}
3333

34-
if util.IsEmptyString(a) {
34+
if util.IsEmptyString(c.String(a)) {
3535
return errors.New(a + " is required")
3636
}
3737
}

contrib/init/openwrt/gitea

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/sh /etc/rc.common
2+
3+
USE_PROCD=1
4+
5+
# PROCD_DEBUG=1
6+
7+
START=90
8+
STOP=10
9+
10+
PROG=/opt/gitea/gitea
11+
GITEA_WORK_DIR=/opt/gitea
12+
CONF_FILE=$GITEA_WORK_DIR/app.ini
13+
14+
start_service(){
15+
procd_open_instance gitea
16+
procd_set_param env GITEA_WORK_DIR=$GITEA_WORK_DIR
17+
procd_set_param env HOME=$GITEA_WORK_DIR
18+
procd_set_param command $PROG web -c $CONF_FILE
19+
procd_set_param file $CONF_FILE
20+
procd_set_param user git
21+
procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5} # respawn automatically if something died, be careful if you have an alternative process supervisor
22+
procd_close_instance
23+
}
24+
25+
start(){
26+
service_start $PROG
27+
}
28+
29+
stop(){
30+
service_stop $PROG
31+
}
32+
33+
reload(){
34+
service_reload $PROG
35+
}

contrib/update_dependencies.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ grep 'git' go.mod | grep '\.com' | grep -v indirect | grep -v replace | cut -f 2
44
go get -u "$line"
55
make vendor
66
git add .
7-
git commit -S -m "update $line"
7+
git commit -m "update $line"
88
done

contrib/upgrade.sh

+68-24
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#!/usr/bin/env bash
2-
set -euo pipefail
3-
42
# This is an update script for gitea installed via the binary distribution
53
# from dl.gitea.io on linux as systemd service. It performs a backup and updates
64
# Gitea in place.
@@ -13,41 +11,83 @@ set -euo pipefail
1311
# upgrade.sh 1.15.10
1412
# giteahome=/opt/gitea giteaconf=$giteahome/app.ini upgrade.sh
1513

14+
while true; do
15+
case "$1" in
16+
-v | --version ) ver="$2"; shift 2 ;;
17+
-y | --yes ) no_confirm="yes"; shift ;;
18+
--ignore-gpg) ignore_gpg="yes"; shift ;;
19+
-- ) shift; break ;;
20+
* ) break ;;
21+
esac
22+
done
23+
24+
set -euo pipefail
25+
26+
27+
function require {
28+
for exe in "$@"; do
29+
command -v "$exe" &>/dev/null || (echo "missing dependency '$exe'"; exit 1)
30+
done
31+
}
32+
33+
34+
require curl xz sha256sum gpg
35+
36+
if [[ -f /etc/os-release ]]; then
37+
os_release=$(cat /etc/os-release)
38+
39+
if [[ "$os_release" =~ "OpenWrt" ]]; then
40+
sudocmd="su"
41+
service_start="/etc/init.d/gitea start"
42+
service_stop="/etc/init.d/gitea stop"
43+
service_status="/etc/init.d/gitea status"
44+
else
45+
require systemctl
46+
fi
47+
fi
48+
49+
1650
# apply variables from environment
1751
: "${giteabin:="/usr/local/bin/gitea"}"
1852
: "${giteahome:="/var/lib/gitea"}"
1953
: "${giteaconf:="/etc/gitea/app.ini"}"
2054
: "${giteauser:="git"}"
2155
: "${sudocmd:="sudo"}"
2256
: "${arch:="linux-amd64"}"
57+
: "${service_start:="$sudocmd systemctl start gitea"}"
58+
: "${service_stop:="$sudocmd systemctl stop gitea"}"
59+
: "${service_status:="$sudocmd systemctl status gitea"}"
2360
: "${backupopts:=""}" # see `gitea dump --help` for available options
2461

25-
function giteacmd {
26-
"$sudocmd" --user "$giteauser" "$giteabin" --config "$giteaconf" --work-path "$giteahome" "$@"
27-
}
2862

29-
function require {
30-
for exe in "$@"; do
31-
command -v "$exe" &>/dev/null || (echo "missing dependency '$exe'"; exit 1)
32-
done
63+
function giteacmd {
64+
if [[ $sudocmd = "su" ]]; then
65+
"$sudocmd" - "$giteauser" -c "$giteabin" --config "$giteaconf" --work-path "$giteahome" "$@"
66+
else
67+
"$sudocmd" --user "$giteauser" "$giteabin" --config "$giteaconf" --work-path "$giteahome" "$@"
68+
fi
3369
}
34-
require systemctl curl xz sha256sum gpg "$sudocmd"
3570

3671
# select version to install
37-
if [[ -z "${1:-}" ]]; then
72+
if [[ -z "${ver:-}" ]]; then
3873
require jq
3974
giteaversion=$(curl --connect-timeout 10 -sL https://dl.gitea.io/gitea/version.json | jq -r .latest.version)
4075
else
41-
giteaversion="$1"
76+
giteaversion="$ver"
4277
fi
4378

79+
4480
# confirm update
45-
current=$(giteacmd --version | cut --delimiter=' ' --fields=3)
81+
current=$(giteacmd --version | cut -d ' ' -f 3)
4682
[[ "$current" == "$giteaversion" ]] && echo "$current is already installed, stopping." && exit 1
47-
echo "Make sure to read the changelog first: https://github.com/go-gitea/gitea/blob/main/CHANGELOG.md"
48-
echo "Are you ready to update Gitea from ${current} to ${giteaversion}? (y/N)"
49-
read -r confirm
50-
[[ "$confirm" == "y" ]] || [[ "$confirm" == "Y" ]] || exit 1
83+
if [[ -z "${no_confirm:-}" ]]; then
84+
echo "Make sure to read the changelog first: https://github.com/go-gitea/gitea/blob/main/CHANGELOG.md"
85+
echo "Are you ready to update Gitea from ${current} to ${giteaversion}? (y/N)"
86+
read -r confirm
87+
[[ "$confirm" == "y" ]] || [[ "$confirm" == "Y" ]] || exit 1
88+
fi
89+
90+
echo "Upgrading gitea from $current to $giteaversion ..."
5191

5292
pushd "$(pwd)" &>/dev/null
5393
cd "$giteahome" # needed for gitea dump later
@@ -59,9 +99,11 @@ echo "Downloading $binurl..."
5999
curl --connect-timeout 10 --silent --show-error --fail --location -O "$binurl{,.sha256,.asc}"
60100

61101
# validate checksum & gpg signature (exit script if error)
62-
sha256sum --check "${binname}.xz.sha256"
63-
gpg --keyserver keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
64-
gpg --verify "${binname}.xz.asc" "${binname}.xz" || { echo 'Signature does not match'; exit 1; }
102+
sha256sum -c "${binname}.xz.sha256"
103+
if [[ -z "${ignore_gpg:-}" ]]; then
104+
gpg --keyserver keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
105+
gpg --verify "${binname}.xz.asc" "${binname}.xz" || { echo 'Signature does not match'; exit 1; }
106+
fi
65107
rm "${binname}".xz.{sha256,asc}
66108

67109
# unpack binary + make executable
@@ -72,12 +114,14 @@ chmod +x "$binname"
72114
# stop gitea, create backup, replace binary, restart gitea
73115
echo "Stopping gitea at $(date)"
74116
giteacmd manager flush-queues
75-
$sudocmd systemctl stop gitea
117+
$service_stop
76118
echo "Creating backup in $giteahome"
77119
giteacmd dump $backupopts
78120
echo "Updating binary at $giteabin"
79-
mv --force --backup "$binname" "$giteabin"
80-
$sudocmd systemctl start gitea
81-
$sudocmd systemctl status gitea
121+
cp -f "$giteabin" "$giteabin.bak" && mv -f "$binname" "$giteabin"
122+
$service_start
123+
$service_status
124+
125+
echo "Upgrade to $giteaversion successful!"
82126

83127
popd

custom/conf/app.example.ini

+2
Original file line numberDiff line numberDiff line change
@@ -2125,6 +2125,8 @@ PATH =
21252125
;RENDER_COMMAND = "asciidoc --out-file=- -"
21262126
;; Don't pass the file on STDIN, pass the filename as argument instead.
21272127
;IS_INPUT_FILE = false
2128+
; Don't filter html tags and attributes if true
2129+
;DISABLE_SANITIZER = false
21282130

21292131
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
21302132
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

docs/config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ params:
1818
description: Git with a cup of tea
1919
author: The Gitea Authors
2020
website: https://docs.gitea.io
21-
version: 1.16.0
21+
version: 1.16.4
2222
minGoVersion: 1.16
2323
goVersion: 1.17
2424
minNodeVersion: 12.17

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1003,13 +1003,13 @@ IS_INPUT_FILE = false
10031003
command. Multiple extensions needs a comma as splitter.
10041004
- RENDER\_COMMAND: External command to render all matching extensions.
10051005
- IS\_INPUT\_FILE: **false** Input is not a standard input but a file param followed `RENDER_COMMAND`.
1006+
- DISABLE_SANITIZER: **false** Don't filter html tags and attributes if true. Don't change this to true except you know what that means.
10061007

10071008
Two special environment variables are passed to the render command:
10081009
- `GITEA_PREFIX_SRC`, which contains the current URL prefix in the `src` path tree. To be used as prefix for links.
10091010
- `GITEA_PREFIX_RAW`, which contains the current URL prefix in the `raw` path tree. To be used as prefix for image paths.
10101011

1011-
1012-
Gitea supports customizing the sanitization policy for rendered HTML. The example below will support KaTeX output from pandoc.
1012+
If `DISABLE_SANITIZER` is false, Gitea supports customizing the sanitization policy for rendered HTML. The example below will support KaTeX output from pandoc.
10131013

10141014
```ini
10151015
[markup.sanitizer.TeX]

docs/content/doc/advanced/config-cheat-sheet.zh-cn.md

+27
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,33 @@ IS_INPUT_FILE = false
318318
- FILE_EXTENSIONS: 关联的文档的扩展名,多个扩展名用都好分隔。
319319
- RENDER_COMMAND: 工具的命令行命令及参数。
320320
- IS_INPUT_FILE: 输入方式是最后一个参数为文件路径还是从标准输入读取。
321+
- DISABLE_SANITIZER: **false** 如果为 true 则不过滤 HTML 标签和属性。除非你知道这意味着什么,否则不要设置为 true。
322+
323+
以下两个环境变量将会被传递给渲染命令:
324+
325+
- `GITEA_PREFIX_SRC`:包含当前的`src`路径的URL前缀,可以被用于链接的前缀。
326+
- `GITEA_PREFIX_RAW`:包含当前的`raw`路径的URL前缀,可以被用于图片的前缀。
327+
328+
如果 `DISABLE_SANITIZER` 为 false,则 Gitea 支持自定义渲染 HTML 的净化策略。以下例子将用 pandoc 支持 KaTeX 输出。
329+
330+
```ini
331+
[markup.sanitizer.TeX]
332+
; Pandoc renders TeX segments as <span>s with the "math" class, optionally
333+
; with "inline" or "display" classes depending on context.
334+
ELEMENT = span
335+
ALLOW_ATTR = class
336+
REGEXP = ^\s*((math(\s+|$)|inline(\s+|$)|display(\s+|$)))+
337+
ALLOW_DATA_URI_IMAGES = true
338+
```
339+
340+
- `ELEMENT`: 将要被应用到该策略的 HTML 元素,不能为空。
341+
- `ALLOW_ATTR`: 将要被应用到该策略的属性,不能为空。
342+
- `REGEXP`: 正则表达式,用来匹配属性的内容。如果为空,则跟属性内容无关。
343+
- `ALLOW_DATA_URI_IMAGES`: **false** 允许 data uri 图片 (`<img src="data:image/png;base64,..."/>`)。
344+
345+
多个净化规则可以被同时定义,只要section名称最后一位不重复即可。如: `[markup.sanitizer.TeX-2]`
346+
为了针对一种渲染类型进行一个特殊的净化策略,必须使用形如 `[markup.sanitizer.asciidoc.rule-1]` 的方式来命名 seciton。
347+
如果此规则没有匹配到任何渲染类型,它将会被应用到所有的渲染类型。
321348

322349
## Time (`time`)
323350

docs/content/doc/developers/guidelines-backend.md

+12-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ To maintain understandable code and avoid circular dependencies it is important
4242
- `modules/setting`: Store all system configurations read from ini files and has been referenced by everywhere. But they should be used as function parameters when possible.
4343
- `modules/git`: Package to interactive with `Git` command line or Gogit package.
4444
- `public`: Compiled frontend files (javascript, images, css, etc.)
45-
- `routers`: Handling of server requests. As it uses other Gitea packages to serve the request, other packages (models, modules or services) shall not depend on routers.
45+
- `routers`: Handling of server requests. As it uses other Gitea packages to serve the request, other packages (models, modules or services) must not depend on routers.
4646
- `routers/api` Contains routers for `/api/v1` aims to handle RESTful API requests.
4747
- `routers/install` Could only respond when system is in INSTALL mode (INSTALL_LOCK=false).
4848
- `routers/private` will only be invoked by internal sub commands, especially `serv` and `hooks`.
@@ -106,10 +106,20 @@ i.e. `servcies/user`, `models/repository`.
106106
Since there are some packages which use the same package name, it is possible that you find packages like `modules/user`, `models/user`, and `services/user`. When these packages are imported in one Go file, it's difficult to know which package we are using and if it's a variable name or an import name. So, we always recommend to use import aliases. To differ from package variables which are commonly in camelCase, just use **snake_case** for import aliases.
107107
i.e. `import user_service "code.gitea.io/gitea/services/user"`
108108

109+
### Important Gotchas
110+
111+
- Never write `x.Update(exemplar)` without an explicit `WHERE` clause:
112+
- This will cause all rows in the table to be updated with the non-zero values of the exemplar - including IDs.
113+
- You should usually write `x.ID(id).Update(exemplar)`.
114+
- If during a migration you are inserting into a table using `x.Insert(exemplar)` where the ID is preset:
115+
- You will need to ``SET IDENTITY_INSERT `table` ON`` for the MSSQL variant (the migration will fail otherwise)
116+
- However, you will also need to update the id sequence for postgres - the migration will silently pass here but later insertions will fail:
117+
``SELECT setval('table_name_id_seq', COALESCE((SELECT MAX(id)+1 FROM `table_name`), 1), false)``
118+
109119
### Future Tasks
110120

111121
Currently, we are creating some refactors to do the following things:
112122

113123
- Correct that codes which doesn't follow the rules.
114124
- There are too many files in `models`, so we are moving some of them into a sub package `models/xxx`.
115-
- Some `modules` sub packages should be moved to `services` because they depends on `models`.
125+
- Some `modules` sub packages should be moved to `services` because they depend on `models`.

0 commit comments

Comments
 (0)