Skip to content

Commit 9b78b24

Browse files
committed
Merge remote-tracking branch 'upstream/main'
* upstream/main: (34 commits) Fix formatted link for PR review notifications to matrix (go-gitea#21319) Show private data in feeds (go-gitea#21369) Add nicer error handling on template compile errors (go-gitea#21350) Fix some typos and update db transaction demo in backend guideline (go-gitea#21322) Refactor parseTreeEntries, speed up tree list (go-gitea#21368) Add GET and DELETE endpoints for Docker blob uploads (go-gitea#21367) Make external issue tracker regexp configurable via API (go-gitea#21338) Add new CSS variables --color-accent and --color-small-accent (go-gitea#21305) Set SemverCompatible to false for Conan packages (go-gitea#21275) Parse OAuth Authorization header when request omits client secret (go-gitea#21351) Disable Firefox E2E tests (go-gitea#21363) Add redirect of /upgrade/ to /upgrade-from-gitea/ on docs site (go-gitea#21330) Update to go-enry v2.8.3 (go-gitea#21360) Update go to 1.19 (go-gitea#21361) SessionUser protection against nil pointer dereference (go-gitea#21358) Fix and improve incorrect error messages (go-gitea#21342) Fix default theme-auto selector when nologin (go-gitea#21346) Add `stat` to `ToCommit` function for speed (go-gitea#21337) Fix typo in API comment document (go-gitea#21347) Update comment about repository.DISABLED_REPO_UNITS in app.example.ini (go-gitea#21343) ...
2 parents 6ca2711 + f0aed82 commit 9b78b24

File tree

94 files changed

+1424
-1038
lines changed

Some content is hidden

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

94 files changed

+1424
-1038
lines changed

.drone.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ steps:
573573
- name: test-e2e
574574
image: mcr.microsoft.com/playwright:v1.24.0-focal
575575
commands:
576-
- curl -sLO https://go.dev/dl/go1.18.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.18.linux-amd64.tar.gz
576+
- curl -sLO https://go.dev/dl/go1.19.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.19.linux-amd64.tar.gz
577577
- groupadd --gid 1001 gitea && useradd -m --gid 1001 --uid 1001 gitea
578578
- apt-get -qq update && apt-get -qqy install build-essential
579579
- export TEST_PGSQL_SCHEMA=''

assets/go-licenses.json

+4-4
Large diffs are not rendered by default.

cmd/web.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func setPort(port string) error {
203203
defaultLocalURL += ":" + setting.HTTPPort + "/"
204204

205205
// Save LOCAL_ROOT_URL if port changed
206-
setting.CreateOrAppendToCustomConf(func(cfg *ini.File) {
206+
setting.CreateOrAppendToCustomConf("server.LOCAL_ROOT_URL", func(cfg *ini.File) {
207207
cfg.Section("server").Key("LOCAL_ROOT_URL").SetValue(defaultLocalURL)
208208
})
209209
}

custom/conf/app.example.ini

+9-4
Original file line numberDiff line numberDiff line change
@@ -379,14 +379,19 @@ LOG_SQL = false ; if unset defaults to true
379379
;; Whether the installer is disabled (set to true to disable the installer)
380380
INSTALL_LOCK = false
381381
;;
382-
;; Global secret key that will be used - if blank will be regenerated.
382+
;; Global secret key that will be used
383+
;; This key is VERY IMPORTANT. If you lose it, the data encrypted by it (like 2FA secret) can't be decrypted anymore.
383384
SECRET_KEY =
384385
;;
386+
;; Alternative location to specify secret key, instead of this file; you cannot specify both this and SECRET_KEY, and must pick one
387+
;; This key is VERY IMPORTANT. If you lose it, the data encrypted by it (like 2FA secret) can't be decrypted anymore.
388+
;SECRET_KEY_URI = file:/etc/gitea/secret_key
389+
;;
385390
;; Secret used to validate communication within Gitea binary.
386391
INTERNAL_TOKEN=
387392
;;
388-
;; Instead of defining internal token in the configuration, this configuration option can be used to give Gitea a path to a file that contains the internal token (example value: file:/etc/gitea/internal_token)
389-
;INTERNAL_TOKEN_URI = ;e.g. /etc/gitea/internal_token
393+
;; Alternative location to specify internal token, instead of this file; you cannot specify both this and INTERNAL_TOKEN, and must pick one
394+
;INTERNAL_TOKEN_URI = file:/etc/gitea/internal_token
390395
;;
391396
;; How long to remember that a user is logged in before requiring relogin (in days)
392397
;LOGIN_REMEMBER_DAYS = 7
@@ -882,7 +887,7 @@ ROUTER = console
882887
;USE_COMPAT_SSH_URI = false
883888
;;
884889
;; Close issues as long as a commit on any branch marks it as fixed
885-
;; Comma separated list of globally disabled repo units. Allowed values: repo.issues, repo.ext_issues, repo.pulls, repo.wiki, repo.ext_wiki
890+
;; Comma separated list of globally disabled repo units. Allowed values: repo.issues, repo.ext_issues, repo.pulls, repo.wiki, repo.ext_wiki, repo.projects
886891
;DISABLED_REPO_UNITS =
887892
;;
888893
;; Comma separated list of default repo units. Allowed values: repo.code, repo.releases, repo.issues, repo.pulls, repo.wiki, repo.projects.

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,8 @@ Certain queues have defaults that override the defaults set in `[queue]` (this o
494494
## Security (`security`)
495495

496496
- `INSTALL_LOCK`: **false**: Controls access to the installation page. When set to "true", the installation page is not accessible.
497-
- `SECRET_KEY`: **\<random at every install\>**: Global secret key. This should be changed.
497+
- `SECRET_KEY`: **\<random at every install\>**: Global secret key. This key is VERY IMPORTANT, if you lost it, the data encrypted by it (like 2FA secret) can't be decrypted anymore.
498+
- `SECRET_KEY_URI`: **<empty>**: Instead of defining SECRET_KEY, this option can be used to use the key stored in a file (example value: `file:/etc/gitea/secret_key`). It shouldn't be lost like SECRET_KEY.
498499
- `LOGIN_REMEMBER_DAYS`: **7**: Cookie lifetime, in days.
499500
- `COOKIE_USERNAME`: **gitea\_awesome**: Name of the cookie used to store the current username.
500501
- `COOKIE_REMEMBER_NAME`: **gitea\_incredible**: Name of cookie used to store authentication
@@ -520,7 +521,7 @@ Certain queues have defaults that override the defaults set in `[queue]` (this o
520521
- `ONLY_ALLOW_PUSH_IF_GITEA_ENVIRONMENT_SET`: **true**: Set to `false` to allow local users to push to gitea-repositories without setting up the Gitea environment. This is not recommended and if you want local users to push to Gitea repositories you should set the environment appropriately.
521522
- `IMPORT_LOCAL_PATHS`: **false**: Set to `false` to prevent all users (including admin) from importing local path on server.
522523
- `INTERNAL_TOKEN`: **\<random at every install if no uri set\>**: Secret used to validate communication within Gitea binary.
523-
- `INTERNAL_TOKEN_URI`: **<empty>**: Instead of defining internal token in the configuration, this configuration option can be used to give Gitea a path to a file that contains the internal token (example value: `file:/etc/gitea/internal_token`)
524+
- `INTERNAL_TOKEN_URI`: **<empty>**: Instead of defining INTERNAL_TOKEN in the configuration, this configuration option can be used to give Gitea a path to a file that contains the internal token (example value: `file:/etc/gitea/internal_token`)
524525
- `PASSWORD_HASH_ALGO`: **pbkdf2**: The hash algorithm to use \[argon2, pbkdf2, scrypt, bcrypt\], argon2 will spend more memory than others.
525526
- `CSRF_COOKIE_HTTP_ONLY`: **true**: Set false to allow JavaScript to read CSRF cookie.
526527
- `MIN_PASSWORD_LENGTH`: **6**: Minimum password length for new users.

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

+14-18
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,18 @@ Some actions should allow for rollback when database record insertion/update/del
6767
So services must be allowed to create a database transaction. Here is some example,
6868

6969
```go
70-
// servcies/repository/repo.go
71-
func CreateXXXX() error {\
72-
ctx, committer, err := db.TxContext()
73-
if err != nil {
74-
return err
75-
}
76-
defer committer.Close()
77-
78-
// do something, if return err, it will rollback automatically when `committer.Close()` is invoked.
79-
if err := issues.UpdateIssue(ctx, repoID); err != nil {
80-
// ...
81-
}
82-
83-
// ......
84-
85-
return committer.Commit()
70+
// services/repository/repository.go
71+
func CreateXXXX() error {
72+
return db.WithTx(func(ctx context.Context) error {
73+
e := db.GetEngine(ctx)
74+
// do something, if err is returned, it will rollback automatically
75+
if err := issues.UpdateIssue(ctx, repoID); err != nil {
76+
// ...
77+
return err
78+
}
79+
// ...
80+
return nil
81+
})
8682
}
8783
```
8884

@@ -94,14 +90,14 @@ If the function will be used in the transaction, just let `context.Context` as t
9490
func UpdateIssue(ctx context.Context, repoID int64) error {
9591
e := db.GetEngine(ctx)
9692

97-
// ......
93+
// ...
9894
}
9995
```
10096

10197
### Package Name
10298

10399
For the top level package, use a plural as package name, i.e. `services`, `models`, for sub packages, use singular,
104-
i.e. `servcies/user`, `models/repository`.
100+
i.e. `services/user`, `models/repository`.
105101

106102
### Import Alias
107103

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ menu:
2121

2222
## Background
2323

24-
Gitea uses [Less CSS](https://lesscss.org), [Fomantic-UI](https://fomantic-ui.com/introduction/getting-started.html) (based on [jQuery](https://api.jquery.com)) and [Vue2](https://vuejs.org/v2/guide/) for its frontend.
24+
Gitea uses [Less CSS](https://lesscss.org), [Fomantic-UI](https://fomantic-ui.com/introduction/getting-started.html) (based on [jQuery](https://api.jquery.com)) and [Vue3](https://vuejs.org/) for its frontend.
2525

2626
The HTML pages are rendered by [Go HTML Template](https://pkg.go.dev/html/template).
2727

@@ -44,7 +44,7 @@ We recommend [Google HTML/CSS Style Guide](https://google.github.io/styleguide/h
4444
4. jQuery events across different features could use their own namespaces if there are potential conflicts.
4545
5. CSS styling for classes provided by frameworks should not be overwritten. Always use new class-names with 2-3 feature related keywords to overwrite framework styles.
4646
6. The backend can pass complex data to the frontend by using `ctx.PageData["myModuleData"] = map[]{}`
47-
7. Simple pages and SEO-related pages use Go HTML Template render to generate static Fomantic-UI HTML output. Complex pages can use Vue2 (or Vue3 in future).
47+
7. Simple pages and SEO-related pages use Go HTML Template render to generate static Fomantic-UI HTML output. Complex pages can use Vue3.
4848

4949
### Framework Usage
5050

@@ -97,6 +97,6 @@ However, there are still some special cases, so the current guideline is:
9797

9898
A lot of legacy code already existed before this document's written. It's recommended to refactor legacy code to follow the guidelines.
9999

100-
### Vue2/Vue3 and JSX
100+
### Vue3 and JSX
101101

102-
Gitea is using Vue2 now, we plan to upgrade to Vue3. We decided not to introduce JSX to keep the HTML and the JavaScript code separated.
102+
Gitea is using Vue3 now. We decided not to introduce JSX to keep the HTML and the JavaScript code separated.

docs/content/doc/installation/from-binary.en-us.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ chown root:git /etc/gitea
9797
chmod 770 /etc/gitea
9898
```
9999

100-
**NOTE:** `/etc/gitea` is temporarily set with write permissions for user `git` so that the web installer can write the configuration file. After the installation is finished, it is recommended to set permissions to read-only using:
101-
102-
```sh
103-
chmod 750 /etc/gitea
104-
chmod 640 /etc/gitea/app.ini
105-
```
100+
> **NOTE:** `/etc/gitea` is temporarily set with write permissions for user `git` so that the web installer can write the configuration file. After the installation is finished, it is recommended to set permissions to read-only using:
101+
>
102+
> ```sh
103+
> chmod 750 /etc/gitea
104+
> chmod 640 /etc/gitea/app.ini
105+
> ```
106106
107107
If you don't want the web installer to be able to write to the config file, it is possible to make the config file read-only for the Gitea user (owner/group `root:git`, mode `0640`) however you will need to edit your config file manually to:
108108

docs/content/doc/upgrade/from-gitea.en-us.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
date: "2021-09-02T16:00:00+08:00"
33
title: "Upgrade from an old Gitea"
4+
aliases:
5+
- /en-us/upgrade/
46
slug: "upgrade-from-gitea"
57
weight: 10
68
toc: false

docs/content/page/index.en-us.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ You can try it out using [the online demo](https://try.gitea.io/).
287287
- UI frameworks:
288288
- [jQuery](https://jquery.com)
289289
- [Fomantic UI](https://fomantic-ui.com)
290-
- [Vue2](https://vuejs.org)
290+
- [Vue3](https://vuejs.org)
291291
- and various components (see package.json)
292292
- Editors:
293293
- [CodeMirror](https://codemirror.net)

docs/content/page/index.fr-fr.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ Le but de ce projet est de fournir de la manière la plus simple, la plus rapide
258258
- Interface graphique :
259259
- [jQuery](https://jquery.com)
260260
- [Fomantic UI](https://fomantic-ui.com)
261-
- [Vue2](https://vuejs.org)
261+
- [Vue3](https://vuejs.org)
262262
- [CodeMirror](https://codemirror.net)
263263
- [EasyMDE](https://github.com/Ionaru/easy-markdown-editor)
264264
- [Monaco Editor](https://microsoft.github.io/monaco-editor)

docs/content/page/index.zh-cn.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Gitea的首要目标是创建一个极易安装,运行非常快速,安装和
5252
- UI 框架:
5353
- [jQuery](https://jquery.com)
5454
- [Fomantic UI](https://fomantic-ui.com)
55-
- [Vue2](https://vuejs.org)
55+
- [Vue3](https://vuejs.org)
5656
- 更多组件参见 package.json
5757
- 编辑器:
5858
- [CodeMirror](https://codemirror.net)

docs/content/page/index.zh-tw.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ Gitea 是從 [Gogs](http://gogs.io) Fork 出來的,請閱讀部落格文章 [G
271271
- UI 元件:
272272
- [jQuery](https://jquery.com)
273273
- [Fomantic UI](https://fomantic-ui.com)
274-
- [Vue2](https://vuejs.org)
274+
- [Vue3](https://vuejs.org)
275275
- [CodeMirror](https://codemirror.net)
276276
- [EasyMDE](https://github.com/Ionaru/easy-markdown-editor)
277277
- [Monaco Editor](https://microsoft.github.io/monaco-editor)

docs/static/_redirects

+4
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ https://gitea-docs.netlify.com/* https://docs.gitea.io/:splat 302!
1010
/en-us/ci-cd/ /en-us/integrations/ 302!
1111
/en-us/third-party-tools/ /en-us/integrations/ 302!
1212
/en-us/make/ /en-us/hacking-on-gitea/ 302!
13+
/en-us/upgrade/ /en-us/upgrade-from-gitea/ 302!
14+
/fr-fr/upgrade/ /fr-fr/upgrade-from-gitea/ 302!
15+
/zh-cn/upgrade/ /zh-cn/upgrade-from-gitea/ 302!
16+
/zh-tw/upgrade/ /zh-tw/upgrade-from-gitea/ 302!

0 commit comments

Comments
 (0)