Skip to content

Commit fff3972

Browse files
authored
Merge branch 'go-gitea:main' into main
2 parents d7f519e + c81b26b commit fff3972

File tree

23 files changed

+273
-530
lines changed

23 files changed

+273
-530
lines changed

custom/conf/app.example.ini

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,6 +1503,11 @@ ROUTER = console
15031503
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15041504
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15051505
;;
1506+
;; NOTICE: this section is for Gitea 1.18 and later. If you are using Gitea 1.17 or older,
1507+
;; please refer to
1508+
;; https://github.com/go-gitea/gitea/blob/release/v1.17/custom/conf/app.example.ini
1509+
;; https://github.com/go-gitea/gitea/blob/release/v1.17/docs/content/doc/advanced/config-cheat-sheet.en-us.md
1510+
;;
15061511
;ENABLED = false
15071512
;;
15081513
;; Buffer length of channel, keep it as it is if you don't know what it is.
@@ -1516,12 +1521,12 @@ ROUTER = console
15161521
;; - dummy: send email messages to the log as a testing phase.
15171522
;; If your provider does not explicitly say which protocol it uses but does provide a port,
15181523
;; you can set SMTP_PORT instead and this will be inferred.
1519-
;; (Before 1.18, this was controlled via MAILER_TYPE and IS_TLS_ENABLED.)
1524+
;; (Before 1.18, see the notice, this was controlled via MAILER_TYPE and IS_TLS_ENABLED.)
15201525
;PROTOCOL =
15211526
;;
15221527
;; Mail server address, e.g. smtp.gmail.com.
15231528
;; For smtp+unix, this should be a path to a unix socket instead.
1524-
;; (Before 1.18, this was combined with SMTP_PORT as HOST.)
1529+
;; (Before 1.18, see the notice, this was combined with SMTP_PORT as HOST.)
15251530
;SMTP_ADDR =
15261531
;;
15271532
;; Mail server port. Common ports are:

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ The following configuration set `Content-Type: application/vnd.android.package-a
296296
- `MINIMUM_KEY_SIZE_CHECK`: **true**: Indicate whether to check minimum key size with corresponding type.
297297

298298
- `OFFLINE_MODE`: **false**: Disables use of CDN for static files and Gravatar for profile pictures.
299-
- `CERT_FILE`: **https/cert.pem**: Cert file path used for HTTPS. When chaining, the server certificate must come first, then intermediate CA certificates (if any). This is ignored if `ENABLE_ACME=true`. From 1.11 paths are relative to `CUSTOM_PATH`.
300-
- `KEY_FILE`: **https/key.pem**: Key file path used for HTTPS. This is ignored if `ENABLE_ACME=true`. From 1.11 paths are relative to `CUSTOM_PATH`.
299+
- `CERT_FILE`: **https/cert.pem**: Cert file path used for HTTPS. When chaining, the server certificate must come first, then intermediate CA certificates (if any). This is ignored if `ENABLE_ACME=true`. Paths are relative to `CUSTOM_PATH`.
300+
- `KEY_FILE`: **https/key.pem**: Key file path used for HTTPS. This is ignored if `ENABLE_ACME=true`. Paths are relative to `CUSTOM_PATH`.
301301
- `STATIC_ROOT_PATH`: **./**: Upper level of template and static files path.
302302
- `APP_DATA_PATH`: **data** (**/data/gitea** on docker): Default path for application data.
303303
- `STATIC_CACHE_TIME`: **6h**: Web browser cache time for static resources on `custom/`, `public/` and all uploaded avatars. Note that this cache is disabled when `RUN_MODE` is "dev".
@@ -438,11 +438,11 @@ Configuration at `[queue]` will set defaults for queues with overrides for indiv
438438
- `MAX_ATTEMPTS`: **10**: Maximum number of attempts to create the wrapped queue
439439
- `TIMEOUT`: **GRACEFUL_HAMMER_TIME + 30s**: Timeout the creation of the wrapped queue if it takes longer than this to create.
440440
- Queues by default come with a dynamically scaling worker pool. The following settings configure this:
441-
- `WORKERS`: **0** (v1.14 and before: **1**): Number of initial workers for the queue.
441+
- `WORKERS`: **0**: Number of initial workers for the queue.
442442
- `MAX_WORKERS`: **10**: Maximum number of worker go-routines for the queue.
443443
- `BLOCK_TIMEOUT`: **1s**: If the queue blocks for this time, boost the number of workers - the `BLOCK_TIMEOUT` will then be doubled before boosting again whilst the boost is ongoing.
444444
- `BOOST_TIMEOUT`: **5m**: Boost workers will timeout after this long.
445-
- `BOOST_WORKERS`: **1** (v1.14 and before: **5**): This many workers will be added to the worker pool if there is a boost.
445+
- `BOOST_WORKERS`: **1**: This many workers will be added to the worker pool if there is a boost.
446446

447447
Gitea creates the following non-unique queues:
448448

@@ -634,7 +634,7 @@ Define allowed algorithms and their minimum key length (use -1 to disable a type
634634

635635
- `QUEUE_LENGTH`: **1000**: Hook task queue length. Use caution when editing this value.
636636
- `DELIVER_TIMEOUT`: **5**: Delivery timeout (sec) for shooting webhooks.
637-
- `ALLOWED_HOST_LIST`: **external**: Since 1.15.7. Default to `*` for 1.15.x, `external` for 1.16 and later. Webhook can only call allowed hosts for security reasons. Comma separated list.
637+
- `ALLOWED_HOST_LIST`: **external**: Webhook can only call allowed hosts for security reasons. Comma separated list.
638638
- Built-in networks:
639639
- `loopback`: 127.0.0.0/8 for IPv4 and ::1/128 for IPv6, localhost is included.
640640
- `private`: RFC 1918 (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) and RFC 4193 (FC00::/7). Also called LAN/Intranet.
@@ -649,6 +649,12 @@ Define allowed algorithms and their minimum key length (use -1 to disable a type
649649

650650
## Mailer (`mailer`)
651651

652+
⚠️ This section is for Gitea 1.18 and later. If you are using Gitea 1.17 or older,
653+
please refer to
654+
[Gitea 1.17 app.ini example](https://github.com/go-gitea/gitea/blob/release/v1.17/custom/conf/app.example.ini)
655+
and
656+
[Gitea 1.17 configuration document](https://github.com/go-gitea/gitea/blob/release/v1.17/docs/content/doc/advanced/config-cheat-sheet.en-us.md)
657+
652658
- `ENABLED`: **false**: Enable to use a mail service.
653659
- `PROTOCOL`: **\<empty\>**: Mail server protocol. One of "smtp", "smtps", "smtp+startls", "smtp+unix", "sendmail", "dummy". _Before 1.18, this was inferred from a combination of `MAILER_TYPE` and `IS_TLS_ENABLED`._
654660
- SMTP family, if your provider does not explicitly say which protocol it uses but does provide a port, you can set SMTP_PORT instead and this will be inferred.

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@ menu:
1515

1616
# 配置说明
1717

18-
这是针对Gitea配置文件的说明,你可以了解Gitea的强大配置。需要说明的是,你的所有改变请修改 `custom/conf/app.ini` 文件而不是源文件。所有默认值可以通过 [app.example.ini](https://github.com/go-gitea/gitea/blob/master/custom/conf/app.example.ini) 查看到。如果你发现 `%(X)s` 这样的内容,请查看 [ini](https://github.com/go-ini/ini/#recursive-values) 这里的说明。标注了 :exclamation: 的配置项表明除非你真的理解这个配置项的意义,否则最好使用默认值。
18+
这是针对Gitea配置文件的说明,你可以了解Gitea的强大配置。需要说明的是,你的所有改变请修改 `custom/conf/app.ini` 文件而不是源文件。
19+
所有默认值可以通过 [app.example.ini](https://github.com/go-gitea/gitea/blob/master/custom/conf/app.example.ini) 查看到。
20+
如果你发现 `%(X)s` 这样的内容,请查看 [ini](https://github.com/go-ini/ini/#recursive-values) 这里的说明。
21+
标注了 :exclamation: 的配置项表明除非你真的理解这个配置项的意义,否则最好使用默认值。
22+
23+
## ⚠️时效性警告⚠️
24+
25+
此文档的内容可能过于陈旧或者错误,请参考英文文档。
1926

2027
{{< toc >}}
2128

docs/content/doc/features/comparison.en-us.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ _Symbols used in table:_
122122
| AD / LDAP integration ||||||||
123123
| Multiple LDAP / AD server support ||||||||
124124
| LDAP user synchronization ||||||||
125+
| SAML 2.0 service provider | [](https://github.com/go-gitea/gitea/issues/5512) | [](https://github.com/gogs/gogs/issues/1221) ||||||
125126
| OpenId Connect support |||||| ? ||
126127
| OAuth 2.0 integration (external authorization) |||||| ? ||
127128
| Act as OAuth 2.0 provider | [](https://github.com/go-gitea/gitea/pull/5378) |||||||

docs/content/doc/features/comparison.zh-cn.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ _表格中的符号含义:_
120120
| 集成 AD / LDAP ||||||||
121121
| 支持多个 LDAP / AD 服务 ||||||||
122122
| LDAP 用户同步 ||||||||
123+
| SAML 2.0 service provider | [](https://github.com/go-gitea/gitea/issues/5512) | [](https://github.com/gogs/gogs/issues/1221) ||||||
123124
| 支持 OpenId 连接 |||||| ? ||
124125
| 集成 OAuth 2.0(外部授权) |||||| ? ||
125126
| 作为 OAuth 2.0 provider | [](https://github.com/go-gitea/gitea/pull/5378) |||||||

docs/content/doc/features/comparison.zh-tw.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ menu:
121121
| 整合 AD / LDAP ||||||||
122122
| 支援多重 LDAP / AD 伺服器 ||||||||
123123
| 同步 LDAP 使用者 ||||||||
124+
| SAML 2.0 service provider | [](https://github.com/go-gitea/gitea/issues/5512) | [](https://github.com/gogs/gogs/issues/1221) ||||||
124125
| 支援 OpenId Connect |||||| ? ||
125126
| 整合 OAuth 2.0 (外部驗證) |||||| ? ||
126127
| 成為 OAuth 2.0 提供者 | [](https://github.com/go-gitea/gitea/pull/5378) |||||||

modules/web/middleware/binding.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,16 @@ func Validate(errs binding.Errors, data map[string]interface{}, f Form, l transl
136136
case validation.ErrRegexPattern:
137137
data["ErrorMsg"] = trName + l.Tr("form.regex_pattern_error", errs[0].Message)
138138
default:
139-
data["ErrorMsg"] = l.Tr("form.unknown_error") + " " + errs[0].Classification
139+
msg := errs[0].Classification
140+
if msg != "" && errs[0].Message != "" {
141+
msg += ": "
142+
}
143+
144+
msg += errs[0].Message
145+
if msg == "" {
146+
msg = l.Tr("form.unknown_error")
147+
}
148+
data["ErrorMsg"] = trName + ": " + msg
140149
}
141150
return errs
142151
}

options/locale/locale_fi-FI.ini

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ show_only_archived=Näytetään vain arkistoidut
239239
show_only_unarchived=Näytetään vain arkistoimattomat
240240

241241
show_private=Yksityinen
242+
show_both_private_public=Näytetään sekä julkiset että yksityiset
242243
show_only_private=Näytetään vain yksityiset
243244
show_only_public=Näytetään vain julkiset
244245

@@ -661,6 +662,7 @@ template_helper=Tee reposta mallipohja
661662
visibility=Näkyvyys
662663
visibility_description=Vain omistaja tai organisaation jäsenet, jos heillä on oikeudet, voivat nähdä sen.
663664
visibility_helper=Tee reposta yksityinen
665+
visibility_helper_forced=Sivuston ylläpitäjä pakottaa uudet repot olemaan yksityisiä.
664666
fork_repo=Forkkaa repo
665667
fork_from=Forkkaa lähteestä
666668
fork_visibility_helper=Forkatun repon näkyvyyttä ei voi muuttaa.
@@ -1087,6 +1089,7 @@ settings.danger_zone=Vaaravyöhyke
10871089
settings.new_owner_has_same_repo=Uudella omistajalla on jo samanniminen repo. Ole hyvä ja valitse toinen nimi.
10881090
settings.transfer=Siirrä omistajuus
10891091
settings.transfer_form_title=Syötä repon nimi vahvistuksena:
1092+
settings.transfer_notices_3=- Jos arkisto on yksityinen ja se siirretään yksittäiselle käyttäjälle, tämä toiminto varmistaa, että käyttäjällä on ainakin lukuoikeudet (ja muuttaa käyttöoikeuksia tarvittaessa).
10901093
settings.transfer_owner=Uusi omistaja
10911094
settings.wiki_delete=Poista Wiki data
10921095
settings.wiki_delete_desc=Repon wikin data poistaminen on pysyvä eikä voi peruuttaa.
@@ -1140,14 +1143,24 @@ settings.web_hook_name_matrix=Matrix
11401143
settings.web_hook_name_feishu=Feishu
11411144
settings.web_hook_name_larksuite=Lark Suite
11421145
settings.web_hook_name_packagist=Packagist
1143-
settings.deploy_keys=Deploy avaimet
1144-
settings.add_deploy_key=Lisää deploy avain
1146+
settings.deploy_keys=Julkaisuavaimet
1147+
settings.add_deploy_key=Lisää julkaisuavain
1148+
settings.deploy_key_desc=Julkaisuavaimilla on vain-luku oikeudet repoon.
1149+
settings.is_writable_info=Salli tämän julkaisuavaimen <strong>puskea</strong> repoon.
1150+
settings.no_deploy_keys=Julkaisuavaimia ei ole käytössä vielä.
11451151
settings.title=Otsikko
11461152
settings.deploy_key_content=Sisältö
1153+
settings.key_been_used=Julkaisuavain identtisellä sisällöllä on jo käytössä.
1154+
settings.key_name_used=Julkaisuavain samalla nimellä on jo olemassa.
1155+
settings.add_key_success=Julkaisuavain '%s' on lisätty.
1156+
settings.deploy_key_deletion=Poista julkaisuavain
1157+
settings.deploy_key_deletion_desc=Julkaisuavaimen poistaminen kumoaa sen pääsyn tähän repoon. Jatketaanko?
1158+
settings.deploy_key_deletion_success=Julkaisuavain on poistettu.
11471159
settings.branches=Haarat
11481160
settings.protected_branch=Haaran suojaus
11491161
settings.branch_protection=Haaran '<b>%s</b>' suojaus
11501162
settings.protect_this_branch=Ota haaran suojaus käyttöön
1163+
settings.protect_whitelist_deploy_keys=Lisää julkaisuavaimet sallittujen listalle mahdollistaaksesi repohin kirjoituksen.
11511164
settings.protect_whitelist_users=Lista käyttäjistä joilla työntö oikeus:
11521165
settings.protect_whitelist_search_users=Etsi käyttäjiä…
11531166
settings.protect_merge_whitelist_committers_desc=Salli vain listaan merkittyjen käyttäjien ja tiimien yhdistää vetopyynnöt tähän haaraan.
@@ -1171,7 +1184,28 @@ settings.matrix.access_token=Pääsymerkki
11711184
settings.archive.button=Arkistoi repo
11721185
settings.archive.header=Arkistoi tämä repo
11731186
settings.lfs=LFS
1187+
settings.lfs_filelist=LFS-tiedostot tallennettu tähän repoon
1188+
settings.lfs_no_lfs_files=LFS-tiedostoja ei ole tallennettu tähän repoon.
1189+
settings.lfs_findcommits=Etsi commitit
1190+
settings.lfs_lfs_file_no_commits=LFS-tiedostolle ei löytynyt committeja
1191+
settings.lfs_noattribute=Tällä polulla ei ole lukittavaa attribuuttia oletushaarassa
1192+
settings.lfs_delete=Poista LFS-tiedosto OID:lla %s
1193+
settings.lfs_delete_warning=LFS-tiedoston poistaminen voi aiheuttaa 'object does not exists'-virheitä checkouttattaessa. Oletko varma?
1194+
settings.lfs_findpointerfiles=Etsi osoitintiedostoja
1195+
settings.lfs_locks=Lukot
1196+
settings.lfs_invalid_locking_path=Virheellinen polku: %s
1197+
settings.lfs_invalid_lock_directory=Hakemistoa ei voida lukita: %s
1198+
settings.lfs_lock_already_exists=Lukitus on jo olemassa: %s
1199+
settings.lfs_lock_path=Lukittavan tiedostopolku...
1200+
settings.lfs_locks_no_locks=Ei lukkoja
1201+
settings.lfs_lock_file_no_exist=Lukittua tiedostoa ei ole olemassa oletushaarassa
1202+
settings.lfs_force_unlock=Pakota lukituksen avaus
1203+
settings.lfs_pointers.found=Löytyi %d blob osoitinta - %d yhdistettyö, %d yhdistämätöntä (%d puuttuu varastosta)
1204+
settings.lfs_pointers.sha=Blob SHA
11741205
settings.lfs_pointers.oid=OID
1206+
settings.lfs_pointers.inRepo=Repossa
1207+
settings.lfs_pointers.exists=Löytyy varastosta
1208+
settings.lfs_pointers.accessible=Saatavilla käyttäjälle
11751209

11761210
diff.browse_source=Selaa lähdekoodia
11771211
diff.parent=vanhempi
@@ -1388,8 +1422,18 @@ users.allow_git_hook=Voi luoda Git koukkuja
13881422
users.allow_create_organization=Voi luoda organisaatioita
13891423
users.update_profile=Päivitä käyttäjän tili
13901424
users.delete_account=Poista käyttäjän tili
1425+
users.list_status_filter.menu_text=Suodata
1426+
users.list_status_filter.reset=Tyhjennä
1427+
users.list_status_filter.is_active=Aktiivinen
1428+
users.list_status_filter.not_active=Ei-aktiivinen
1429+
users.list_status_filter.is_admin=Ylläpitäjä
1430+
users.list_status_filter.not_admin=Ei ylläpitäjä
13911431
users.list_status_filter.is_restricted=Rajoitettu
13921432
users.list_status_filter.not_restricted=Ei rajoitettu
1433+
users.list_status_filter.is_prohibit_login=Kirjautuminen estetty
1434+
users.list_status_filter.not_prohibit_login=Kirjautuminen sallittu
1435+
users.list_status_filter.is_2fa_enabled=2FA käytössä
1436+
users.list_status_filter.not_2fa_enabled=2FA ei käytössä
13931437

13941438
emails.email_manage_panel=Käyttäjien sähköpostien hallinta
13951439
emails.primary=Ensisijainen

public/img/svg/fontawesome-send.svg

Lines changed: 1 addition & 0 deletions
Loading

routers/api/v1/utils/hook.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"code.gitea.io/gitea/modules/json"
1616
api "code.gitea.io/gitea/modules/structs"
1717
"code.gitea.io/gitea/modules/util"
18-
"code.gitea.io/gitea/routers/utils"
1918
webhook_service "code.gitea.io/gitea/services/webhook"
2019
)
2120

@@ -141,14 +140,15 @@ func addHook(ctx *context.APIContext, form *api.CreateHookOption, orgID, repoID
141140
ctx.Error(http.StatusUnprocessableEntity, "", "Missing config option: channel")
142141
return nil, false
143142
}
143+
channel = strings.TrimSpace(channel)
144144

145-
if !utils.IsValidSlackChannel(channel) {
145+
if !webhook_service.IsValidSlackChannel(channel) {
146146
ctx.Error(http.StatusBadRequest, "", "Invalid slack channel name")
147147
return nil, false
148148
}
149149

150150
meta, err := json.Marshal(&webhook_service.SlackMeta{
151-
Channel: strings.TrimSpace(channel),
151+
Channel: channel,
152152
Username: form.Config["username"],
153153
IconURL: form.Config["icon_url"],
154154
Color: form.Config["color"],

routers/utils/utils.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,6 @@ func RemoveUsernameParameterSuffix(name string) string {
2020
return name
2121
}
2222

23-
// IsValidSlackChannel validates a channel name conforms to what slack expects.
24-
// It makes sure a channel name cannot be empty and invalid ( only an # )
25-
func IsValidSlackChannel(channelName string) bool {
26-
switch len(strings.TrimSpace(channelName)) {
27-
case 0:
28-
return false
29-
case 1:
30-
// Keep default behaviour where a channel name is still
31-
// valid without an #
32-
// But if it contains only an #, it should be regarded as
33-
// invalid
34-
if channelName[0] == '#' {
35-
return false
36-
}
37-
}
38-
39-
return true
40-
}
41-
4223
// SanitizeFlashErrorString will sanitize a flash error string
4324
func SanitizeFlashErrorString(x string) string {
4425
return strings.ReplaceAll(html.EscapeString(x), "\n", "<br>")

routers/utils/utils_test.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,6 @@ func TestRemoveUsernameParameterSuffix(t *testing.T) {
1818
assert.Equal(t, "", RemoveUsernameParameterSuffix(""))
1919
}
2020

21-
func TestIsValidSlackChannel(t *testing.T) {
22-
tt := []struct {
23-
channelName string
24-
expected bool
25-
}{
26-
{"gitea", true},
27-
{" ", false},
28-
{"#", false},
29-
{"gitea ", true},
30-
{" gitea", true},
31-
}
32-
33-
for _, v := range tt {
34-
assert.Equal(t, v.expected, IsValidSlackChannel(v.channelName))
35-
}
36-
}
37-
3821
func TestIsExternalURL(t *testing.T) {
3922
setting.AppURL = "https://try.gitea.io/"
4023
type test struct {

0 commit comments

Comments
 (0)