Skip to content

Commit f903dfb

Browse files
authored
Merge branch 'master' into verify-password-for-account-activation
2 parents d4f2257 + 7ed5bf8 commit f903dfb

Some content is hidden

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

71 files changed

+533
-239
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ all: build
152152
.PHONY: help
153153
help:
154154
@echo "Make Routines:"
155-
@echo " - \"\" equivalent to \"build\""
155+
@echo " - \"\" equivalent to \"build\""
156156
@echo " - build build everything"
157157
@echo " - frontend build frontend files"
158158
@echo " - backend build backend files"
@@ -180,7 +180,7 @@ help:
180180
@echo " - revive run revive linter"
181181
@echo " - misspell check for misspellings"
182182
@echo " - vet examines Go source code and reports suspicious constructs"
183-
@echo " - test[\#TestSpecificName] run unit test"
183+
@echo " - test[\#TestSpecificName] run unit test"
184184
@echo " - test-sqlite[\#TestSpecificName] run integration test for sqlite"
185185
@echo " - pr#<index> build and start gitea from a PR with integration test data loaded"
186186

build/update-locales.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ sed -i -r -e '/^[a-zA-Z0-9_.-]+[ ]*=[ ]*".*"$/ {
1010
}' ./options/locale/*.ini
1111

1212
# Remove translation under 25% of en_us
13-
baselines=`wc -l "./options/locale_en-US.ini" | cut -d" " -f1`
13+
baselines=$(wc -l "./options/locale_en-US.ini" | cut -d" " -f1)
1414
baselines=$((baselines / 4))
1515
for filename in ./options/locale/*.ini; do
16-
lines=`wc -l "$filename" | cut -d" " -f1`
16+
lines=$(wc -l "$filename" | cut -d" " -f1)
1717
if [ $lines -lt $baselines ]; then
1818
echo "Removing $filename: $lines/$baselines"
1919
rm "$filename"

cmd/dump.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323

2424
"gitea.com/macaron/session"
2525
archiver "github.com/mholt/archiver/v3"
26-
"github.com/unknwon/com"
2726
"github.com/urfave/cli"
2827
)
2928

@@ -306,7 +305,11 @@ func runDump(ctx *cli.Context) error {
306305
log.Info("Custom dir %s doesn't exist, skipped", setting.CustomPath)
307306
}
308307

309-
if com.IsExist(setting.AppDataPath) {
308+
isExist, err := util.IsExist(setting.AppDataPath)
309+
if err != nil {
310+
log.Error("Unable to check if %s exists. Error: %v", setting.AppDataPath, err)
311+
}
312+
if isExist {
310313
log.Info("Packing data directory...%s", setting.AppDataPath)
311314

312315
var excludes []string
@@ -349,9 +352,15 @@ func runDump(ctx *cli.Context) error {
349352
// yet or not.
350353
if ctx.IsSet("skip-log") && ctx.Bool("skip-log") {
351354
log.Info("Skip dumping log files")
352-
} else if com.IsExist(setting.LogRootPath) {
353-
if err := addRecursive(w, "log", setting.LogRootPath, verbose); err != nil {
354-
fatal("Failed to include log: %v", err)
355+
} else {
356+
isExist, err := util.IsExist(setting.LogRootPath)
357+
if err != nil {
358+
log.Error("Unable to check if %s exists. Error: %v", setting.LogRootPath, err)
359+
}
360+
if isExist {
361+
if err := addRecursive(w, "log", setting.LogRootPath, verbose); err != nil {
362+
fatal("Failed to include log: %v", err)
363+
}
355364
}
356365
}
357366

cmd/web.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ import (
1616
"code.gitea.io/gitea/modules/graceful"
1717
"code.gitea.io/gitea/modules/log"
1818
"code.gitea.io/gitea/modules/setting"
19+
"code.gitea.io/gitea/modules/util"
1920
"code.gitea.io/gitea/routers"
2021
"code.gitea.io/gitea/routers/routes"
2122

2223
context2 "github.com/gorilla/context"
23-
"github.com/unknwon/com"
2424
"github.com/urfave/cli"
2525
"golang.org/x/crypto/acme/autocert"
2626
ini "gopkg.in/ini.v1"
@@ -188,7 +188,11 @@ func setPort(port string) error {
188188
default:
189189
// Save LOCAL_ROOT_URL if port changed
190190
cfg := ini.Empty()
191-
if com.IsFile(setting.CustomConf) {
191+
isFile, err := util.IsFile(setting.CustomConf)
192+
if err != nil {
193+
log.Fatal("Unable to check if %s is a file", err)
194+
}
195+
if isFile {
192196
// Keeps custom settings if there is already something.
193197
if err := cfg.Append(setting.CustomConf); err != nil {
194198
return fmt.Errorf("Failed to load custom conf '%s': %v", setting.CustomConf, err)

contrib/environment-to-ini/environment-to-ini.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212

1313
"code.gitea.io/gitea/modules/log"
1414
"code.gitea.io/gitea/modules/setting"
15+
"code.gitea.io/gitea/modules/util"
1516

16-
"github.com/unknwon/com"
1717
"github.com/urfave/cli"
1818
ini "gopkg.in/ini.v1"
1919
)
@@ -97,7 +97,11 @@ func runEnvironmentToIni(c *cli.Context) error {
9797
setting.SetCustomPathAndConf(providedCustom, providedConf, providedWorkPath)
9898

9999
cfg := ini.Empty()
100-
if com.IsFile(setting.CustomConf) {
100+
isFile, err := util.IsFile(setting.CustomConf)
101+
if err != nil {
102+
log.Fatal("Unable to check if %s is a file. Error: %v", setting.CustomConf, err)
103+
}
104+
if isFile {
101105
if err := cfg.Append(setting.CustomConf); err != nil {
102106
log.Fatal("Failed to load custom conf '%s': %v", setting.CustomConf, err)
103107
}
@@ -145,7 +149,7 @@ func runEnvironmentToIni(c *cli.Context) error {
145149
if len(destination) == 0 {
146150
destination = setting.CustomConf
147151
}
148-
err := cfg.SaveTo(destination)
152+
err = cfg.SaveTo(destination)
149153
if err != nil {
150154
return err
151155
}

custom/conf/app.example.ini

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ SCRIPT_TYPE = bash
2323
; If the charsets have equal confidence, tie-breaking will be done by order in this list
2424
; with charsets earlier in the list chosen in preference to those later.
2525
; Adding "defaults" will place the unused charsets at that position.
26-
DETECTED_CHARSETS_ORDER=UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, UTF-32LE, ISO-8859, windows-1252, ISO-8859, windows-1250, ISO-8859, ISO-8859, ISO-8859, windows-1253, ISO-8859, windows-1255, ISO-8859, windows-1251, windows-1256, KOI8-R, ISO-8859, windows-1254, Shift_JIS, GB18030, EUC-JP, EUC-KR, Big5, ISO-2022, ISO-2022, ISO-2022, IBM424_rtl, IBM424_ltr, IBM420_rtl, IBM420_ltr
26+
DETECTED_CHARSETS_ORDER = UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, UTF-32LE, ISO-8859, windows-1252, ISO-8859, windows-1250, ISO-8859, ISO-8859, ISO-8859, windows-1253, ISO-8859, windows-1255, ISO-8859, windows-1251, windows-1256, KOI8-R, ISO-8859, windows-1254, Shift_JIS, GB18030, EUC-JP, EUC-KR, Big5, ISO-2022, ISO-2022, ISO-2022, IBM424_rtl, IBM424_ltr, IBM420_rtl, IBM420_ltr
2727
; Default ANSI charset to override non-UTF-8 charsets to
2828
ANSI_CHARSET =
2929
; Force every new repository to be private
@@ -65,11 +65,11 @@ PREFIX_ARCHIVE_FILES = true
6565
; Disable the creation of new mirrors. Pre-existing mirrors remain valid.
6666
DISABLE_MIRRORS = false
6767
; The default branch name of new repositories
68-
DEFAULT_BRANCH=master
68+
DEFAULT_BRANCH = master
6969
; Allow adoption of unadopted repositories
70-
ALLOW_ADOPTION_OF_UNADOPTED_REPOSITORIES=false
70+
ALLOW_ADOPTION_OF_UNADOPTED_REPOSITORIES = false
7171
; Allow deletion of unadopted repositories
72-
ALLOW_DELETION_OF_UNADOPTED_REPOSITORIES=false
72+
ALLOW_DELETION_OF_UNADOPTED_REPOSITORIES = false
7373

7474
[repository.editor]
7575
; List of file extensions for which lines should be wrapped in the Monaco editor
@@ -97,25 +97,25 @@ MAX_FILES = 5
9797

9898
[repository.pull-request]
9999
; List of prefixes used in Pull Request title to mark them as Work In Progress
100-
WORK_IN_PROGRESS_PREFIXES=WIP:,[WIP]
100+
WORK_IN_PROGRESS_PREFIXES = WIP:,[WIP]
101101
; List of keywords used in Pull Request comments to automatically close a related issue
102-
CLOSE_KEYWORDS=close,closes,closed,fix,fixes,fixed,resolve,resolves,resolved
102+
CLOSE_KEYWORDS = close,closes,closed,fix,fixes,fixed,resolve,resolves,resolved
103103
; List of keywords used in Pull Request comments to automatically reopen a related issue
104-
REOPEN_KEYWORDS=reopen,reopens,reopened
104+
REOPEN_KEYWORDS = reopen,reopens,reopened
105105
; In the default merge message for squash commits include at most this many commits
106-
DEFAULT_MERGE_MESSAGE_COMMITS_LIMIT=50
106+
DEFAULT_MERGE_MESSAGE_COMMITS_LIMIT = 50
107107
; In the default merge message for squash commits limit the size of the commit messages to this
108-
DEFAULT_MERGE_MESSAGE_SIZE=5120
108+
DEFAULT_MERGE_MESSAGE_SIZE = 5120
109109
; In the default merge message for squash commits walk all commits to include all authors in the Co-authored-by otherwise just use those in the limited list
110-
DEFAULT_MERGE_MESSAGE_ALL_AUTHORS=false
110+
DEFAULT_MERGE_MESSAGE_ALL_AUTHORS = false
111111
; In default merge messages limit the number of approvers listed as Reviewed-by: to this many
112-
DEFAULT_MERGE_MESSAGE_MAX_APPROVERS=10
112+
DEFAULT_MERGE_MESSAGE_MAX_APPROVERS = 10
113113
; In default merge messages only include approvers who are official
114-
DEFAULT_MERGE_MESSAGE_OFFICIAL_APPROVERS_ONLY=true
114+
DEFAULT_MERGE_MESSAGE_OFFICIAL_APPROVERS_ONLY = true
115115

116116
[repository.issue]
117117
; List of reasons why a Pull Request or Issue can be locked
118-
LOCK_REASONS=Too heated,Off-topic,Resolved,Spam
118+
LOCK_REASONS = Too heated,Off-topic,Resolved,Spam
119119

120120
[repository.release]
121121
; Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
@@ -133,7 +133,7 @@ SIGNING_KEY = default
133133
SIGNING_NAME =
134134
SIGNING_EMAIL =
135135
; Sets the default trust model for repositories. Options are: collaborator, committer, collaboratorcommitter
136-
DEFAULT_TRUST_MODEL=collaborator
136+
DEFAULT_TRUST_MODEL = collaborator
137137
; Determines when gitea should sign the initial commit when creating a repository
138138
; Either:
139139
; - never
@@ -158,19 +158,19 @@ MERGES = pubkey, twofa, basesigned, commitssigned
158158
[cors]
159159
; More information about CORS can be found here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#The_HTTP_response_headers
160160
; enable cors headers (disabled by default)
161-
ENABLED=false
161+
ENABLED = false
162162
; scheme of allowed requests
163-
SCHEME=http
163+
SCHEME = http
164164
; list of requesting domains that are allowed
165-
ALLOW_DOMAIN=*
165+
ALLOW_DOMAIN = *
166166
; allow subdomains of headers listed above to request
167-
ALLOW_SUBDOMAIN=false
167+
ALLOW_SUBDOMAIN = false
168168
; list of methods allowed to request
169-
METHODS=GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS
169+
METHODS = GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS
170170
; max time to cache response
171-
MAX_AGE=10m
171+
MAX_AGE = 10m
172172
; allow request with credentials
173-
ALLOW_CREDENTIALS=false
173+
ALLOW_CREDENTIALS = false
174174

175175
[ui]
176176
; Number of repositories that are displayed on one explore page
@@ -456,7 +456,7 @@ ISSUE_INDEXER_QUEUE_CONN_STR = "addrs=127.0.0.1:6379 db=0"
456456
ISSUE_INDEXER_QUEUE_BATCH_NUMBER = 20
457457
; Timeout the indexer if it takes longer than this to start.
458458
; Set to zero to disable timeout.
459-
STARTUP_TIMEOUT=30s
459+
STARTUP_TIMEOUT = 30s
460460

461461
; repo indexer by default disabled, since it uses a lot of disk space
462462
REPO_INDEXER_ENABLED = false
@@ -597,7 +597,7 @@ RESET_PASSWD_CODE_LIVE_MINUTES = 180
597597
REGISTER_EMAIL_CONFIRM = false
598598
; List of domain names that are allowed to be used to register on a Gitea instance
599599
; gitea.io,example.com
600-
EMAIL_DOMAIN_WHITELIST=
600+
EMAIL_DOMAIN_WHITELIST =
601601
; Disallow registration, only allow admins to create accounts.
602602
DISABLE_REGISTRATION = false
603603
; Allow registration only using third-party services, it works only when DISABLE_REGISTRATION is false
@@ -620,7 +620,7 @@ ENABLE_CAPTCHA = false
620620
CAPTCHA_TYPE = image
621621
; Enable recaptcha to use Google's recaptcha service
622622
; Go to https://www.google.com/recaptcha/admin to sign up for a key
623-
RECAPTCHA_SECRET =
623+
RECAPTCHA_SECRET =
624624
RECAPTCHA_SITEKEY =
625625
; For hCaptcha, create an account at https://accounts.hcaptcha.com/login to get your keys
626626
HCAPTCHA_SECRET =
@@ -1117,15 +1117,15 @@ DEFAULT_MAX_BLOB_SIZE = 10485760
11171117
; Enables OAuth2 provider
11181118
ENABLE = true
11191119
; Lifetime of an OAuth2 access token in seconds
1120-
ACCESS_TOKEN_EXPIRATION_TIME=3600
1120+
ACCESS_TOKEN_EXPIRATION_TIME = 3600
11211121
; Lifetime of an OAuth2 refresh token in hours
1122-
REFRESH_TOKEN_EXPIRATION_TIME=730
1122+
REFRESH_TOKEN_EXPIRATION_TIME = 730
11231123
; Check if refresh token got already used
1124-
INVALIDATE_REFRESH_TOKENS=false
1124+
INVALIDATE_REFRESH_TOKENS = false
11251125
; OAuth2 authentication secret for access and refresh tokens, change this yourself to a unique string. CLI generate option is helpful in this case. https://docs.gitea.io/en-us/command-line/#generate
1126-
JWT_SECRET=
1126+
JWT_SECRET =
11271127
; Maximum length of oauth2 token/cookie stored on server
1128-
MAX_TOKEN_LENGTH=32767
1128+
MAX_TOKEN_LENGTH = 32767
11291129

11301130
[i18n]
11311131
LANGS = en-US,zh-CN,zh-HK,zh-TW,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,uk-UA,ja-JP,es-ES,pt-BR,pt-PT,pl-PL,bg-BG,it-IT,fi-FI,tr-TR,cs-CZ,sr-SP,sv-SE,ko-KR

docker/root/etc/s6/gitea/run

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
[[ -f ./setup ]] && source ./setup
33

4-
pushd /app/gitea > /dev/null
5-
exec su-exec $USER /app/gitea/gitea web
4+
pushd /app/gitea >/dev/null
5+
exec su-exec $USER /app/gitea/gitea web
66
popd

docker/root/etc/s6/openssh/run

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
[[ -f ./setup ]] && source ./setup
33

4-
pushd /root > /dev/null
5-
exec su-exec root /usr/sbin/sshd -D -e 2>&1
4+
pushd /root >/dev/null
5+
exec su-exec root /usr/sbin/sshd -D -e 2>&1
66
popd

docs/.editorconfig

Lines changed: 0 additions & 34 deletions
This file was deleted.

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
240240
- `SSH_PORT`: **22**: SSH port displayed in clone URL.
241241
- `SSH_LISTEN_HOST`: **0.0.0.0**: Listen address for the built-in SSH server.
242242
- `SSH_LISTEN_PORT`: **%(SSH\_PORT)s**: Port for the built-in SSH server.
243-
- `SSH_ROOT_PATH`: **~/.ssh**: Root path of SSH directory.
243+
- `SSH_ROOT_PATH`: **~/.ssh**: Root path of SSH directory.
244244
- `SSH_CREATE_AUTHORIZED_KEYS_FILE`: **true**: Gitea will create a authorized_keys file by default when it is not using the internal ssh server. If you intend to use the AuthorizedKeysCommand functionality then you should turn this off.
245245
- `SSH_AUTHORIZED_KEYS_BACKUP`: **true**: Enable SSH Authorized Key Backup when rewriting all keys, default is true.
246246
- `SSH_TRUSTED_USER_CA_KEYS`: **\<empty\>**: Specifies the public keys of certificate authorities that are trusted to sign user certificates for authentication. Multiple keys should be comma separated. E.g.`ssh-<algorithm> <key>` or `ssh-<algorithm> <key1>, ssh-<algorithm> <key2>`. For more information see `TrustedUserCAKeys` in the sshd config man pages. When empty no file will be created and `SSH_AUTHORIZED_PRINCIPALS_ALLOW` will default to `off`.
@@ -294,7 +294,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
294294
- `USER`: **root**: Database username.
295295
- `PASSWD`: **\<empty\>**: Database user password. Use \`your password\` or """your password""" for quoting if you use special characters in the password.
296296
- `SCHEMA`: **\<empty\>**: For PostgreSQL only, schema to use if different from "public". The schema must exist beforehand,
297-
the user must have creation privileges on it, and the user search path must be set to the look into the schema first
297+
the user must have creation privileges on it, and the user search path must be set to the look into the schema first
298298
(e.g. `ALTER USER user SET SEARCH_PATH = schema_name,"$user",public;`).
299299
- `SSL_MODE`: **disable**: SSL/TLS encryption mode for connecting to the database. This option is only applied for PostgreSQL and MySQL.
300300
- Valid values for MySQL:
@@ -318,7 +318,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
318318
- `MAX_OPEN_CONNS` **0**: Database maximum open connections - default is 0, meaning there is no limit.
319319
- `MAX_IDLE_CONNS` **2**: Max idle database connections on connnection pool, default is 2 - this will be capped to `MAX_OPEN_CONNS`.
320320
- `CONN_MAX_LIFETIME` **0 or 3s**: Sets the maximum amount of time a DB connection may be reused - default is 0, meaning there is no limit (except on MySQL where it is 3s - see #6804 & #7071).
321-
321+
322322
Please see #8540 & #8273 for further discussion of the appropriate values for `MAX_OPEN_CONNS`, `MAX_IDLE_CONNS` & `CONN_MAX_LIFETIME` and their
323323
relation to port exhaustion.
324324

@@ -465,7 +465,7 @@ relation to port exhaustion.
465465
- `DEFAULT_ORG_VISIBILITY`: **public**: Set default visibility mode for organisations, either "public", "limited" or "private".
466466
- `DEFAULT_ORG_MEMBER_VISIBLE`: **false** True will make the membership of the users visible when added to the organisation.
467467
- `ALLOW_ONLY_EXTERNAL_REGISTRATION`: **false** Set to true to force registration only using third-party services.
468-
- `NO_REPLY_ADDRESS`: **DOMAIN** Default value for the domain part of the user's email address in the git log if he has set KeepEmailPrivate to true.
468+
- `NO_REPLY_ADDRESS`: **DOMAIN** Default value for the domain part of the user's email address in the git log if he has set KeepEmailPrivate to true.
469469
The user's email will be replaced with a concatenation of the user name in lower case, "@" and NO_REPLY_ADDRESS.
470470

471471
## SSH Minimum Key Sizes (`ssh.minimum_key_sizes`)
@@ -493,7 +493,7 @@ Define allowed algorithms and their minimum key length (use -1 to disable a type
493493
- `HELO_HOSTNAME`: **\<empty\>**: Custom hostname for HELO operation.
494494
- `HOST`: **\<empty\>**: SMTP mail host address and port (example: smtp.gitea.io:587).
495495
- Using opportunistic TLS via STARTTLS on port 587 is recommended per RFC 6409.
496-
- `IS_TLS_ENABLED` : **false** : Forcibly use TLS to connect even if not on a default SMTPS port.
496+
- `IS_TLS_ENABLED` : **false** : Forcibly use TLS to connect even if not on a default SMTPS port.
497497
- Note, if the port ends with `465` SMTPS/SMTP over TLS will be used despite this setting.
498498
- Otherwise if `IS_TLS_ENABLED=false` and the server supports `STARTTLS` this will be used. Thus if `STARTTLS` is preferred you should set `IS_TLS_ENABLED=false`.
499499
- `FROM`: **\<empty\>**: Mail from address, RFC 5322. This can be just an email address, or
@@ -855,7 +855,7 @@ Task queue configuration has been moved to `queue.task`. However, the below conf
855855
## LFS (`lfs`)
856856

857857
Storage configuration for lfs data. It will be derived from default `[storage]` or
858-
`[storage.xxx]` when set `STORAGE_TYPE` to `xxx`. When derived, the default of `PATH`
858+
`[storage.xxx]` when set `STORAGE_TYPE` to `xxx`. When derived, the default of `PATH`
859859
is `data/lfs` and the default of `MINIO_BASE_PATH` is `lfs/`.
860860

861861
- `STORAGE_TYPE`: **local**: Storage type for lfs, `local` for local disk or `minio` for s3 compatible object storage service or other name defined with `[storage.xxx]`

0 commit comments

Comments
 (0)