Skip to content

Commit 30efc96

Browse files
committed
Merge branch 'master' into return-login-name
2 parents ecdf8ea + 931c02d commit 30efc96

Some content is hidden

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

64 files changed

+462
-153
lines changed

.drone.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ volumes:
1919

2020
steps:
2121
- name: deps-frontend
22-
image: node:16
22+
image: node:18
2323
pull: always
2424
commands:
2525
- make deps-frontend
@@ -34,7 +34,7 @@ steps:
3434
path: /go
3535

3636
- name: lint-frontend
37-
image: node:16
37+
image: node:18
3838
commands:
3939
- make lint-frontend
4040
depends_on: [deps-frontend]
@@ -82,7 +82,7 @@ steps:
8282
path: /go
8383

8484
- name: checks-frontend
85-
image: node:16
85+
image: node:18
8686
commands:
8787
- make checks-frontend
8888
depends_on: [deps-frontend]
@@ -97,13 +97,13 @@ steps:
9797
path: /go
9898

9999
- name: test-frontend
100-
image: node:16
100+
image: node:18
101101
commands:
102102
- make test-frontend
103103
depends_on: [lint-frontend]
104104

105105
- name: build-frontend
106-
image: node:16
106+
image: node:18
107107
commands:
108108
- make frontend
109109
depends_on: [test-frontend]
@@ -634,7 +634,7 @@ steps:
634634
- git fetch --tags --force
635635

636636
- name: deps-frontend
637-
image: node:16
637+
image: node:18
638638
pull: always
639639
commands:
640640
- make deps-frontend
@@ -652,6 +652,7 @@ steps:
652652
image: techknowlogick/xgo:go-1.18.x
653653
pull: always
654654
commands:
655+
# Upgrade to node 18 once https://github.com/techknowlogick/xgo/issues/163 is resolved
655656
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs
656657
- export PATH=$PATH:$GOPATH/bin
657658
- make release
@@ -753,7 +754,7 @@ steps:
753754
- git fetch --tags --force
754755

755756
- name: deps-frontend
756-
image: node:16
757+
image: node:18
757758
pull: always
758759
commands:
759760
- make deps-frontend
@@ -771,6 +772,7 @@ steps:
771772
image: techknowlogick/xgo:go-1.18.x
772773
pull: always
773774
commands:
775+
# Upgrade to node 18 once https://github.com/techknowlogick/xgo/issues/163 is resolved
774776
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs
775777
- export PATH=$PATH:$GOPATH/bin
776778
- make release

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ help:
201201

202202
.PHONY: go-check
203203
go-check:
204-
$(eval MIN_GO_VERSION_STR := $(shell grep -Eo '^go\s+[0-9]+\.[0-9.]+' go.mod | cut -d' ' -f2))
205-
$(eval MIN_GO_VERSION := $(shell printf "%03d%03d%03d" $(shell echo '$(MIN_GO_VERSION_STR)' | tr '.' ' ')))
206-
$(eval GO_VERSION := $(shell printf "%03d%03d%03d" $(shell $(GO) version | grep -Eo '[0-9]+\.[0-9.]+' | tr '.' ' ');))
204+
$(eval MIN_GO_VERSION_STR := $(shell grep -Eo '^go\s+[0-9]+\.[0-9]+' go.mod | cut -d' ' -f2))
205+
$(eval MIN_GO_VERSION := $(shell printf "%03d%03d" $(shell echo '$(MIN_GO_VERSION_STR)' | tr '.' ' ')))
206+
$(eval GO_VERSION := $(shell printf "%03d%03d" $(shell $(GO) version | grep -Eo '[0-9]+\.[0-9]+' | tr '.' ' ');))
207207
@if [ "$(GO_VERSION)" -lt "$(MIN_GO_VERSION)" ]; then \
208208
echo "Gitea requires Go $(MIN_GO_VERSION_STR) or greater to build. You can get it at https://go.dev/dl/"; \
209209
exit 1; \

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,21 @@
4545
</p>
4646

4747
<p align="center">
48-
<a href="README_ZH.md">View the chinese version of this document</a>
48+
<a href="README_ZH.md">View this document in Chinese</a>
4949
</p>
5050

5151
## Purpose
5252

5353
The goal of this project is to make the easiest, fastest, and most
5454
painless way of setting up a self-hosted Git service.
55-
Using Go, this can be done with an independent binary distribution across
56-
**all platforms** which Go supports, including Linux, macOS, and Windows
57-
on x86, amd64, ARM and PowerPC architectures.
58-
Want to try it before doing anything else?
59-
Do it [with the online demo](https://try.gitea.io/)!
55+
56+
As Gitea is written in Go, it works across **all** the platforms and
57+
architectures that are supported by Go, including Linux, macOS, and
58+
Windows on x86, amd64, ARM and PowerPC architectures.
59+
You can try it out using [the online demo](https://try.gitea.io/).
6060
This project has been
6161
[forked](https://blog.gitea.io/2016/12/welcome-to-gitea/) from
62-
[Gogs](https://gogs.io) since 2016.11 but changed a lot.
62+
[Gogs](https://gogs.io) since November of 2016, but a lot has changed.
6363

6464
## Building
6565

@@ -114,7 +114,7 @@ For more information and instructions about how to install Gitea, please look at
114114
If you have questions that are not covered by the documentation, you can get in contact with us on our [Discord server](https://discord.gg/Gitea) or create a post in the [discourse forum](https://discourse.gitea.io/).
115115

116116
We maintain a list of Gitea-related projects at [gitea/awesome-gitea](https://gitea.com/gitea/awesome-gitea).
117-
The hugo-based documentation theme is hosted at [gitea/theme](https://gitea.com/gitea/theme).
117+
The Hugo-based documentation theme is hosted at [gitea/theme](https://gitea.com/gitea/theme).
118118
The official Gitea CLI is developed at [gitea/tea](https://gitea.com/gitea/tea).
119119

120120
## Authors

README_ZH.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
</p>
4646

4747
<p align="center">
48-
<a href="README.md">View the english version of this document</a>
48+
<a href="README.md">View this document in English</a>
4949
</p>
5050

5151
## 目标

cmd/admin.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ var (
157157
Name: "email,e",
158158
Usage: "Email of the user to delete",
159159
},
160+
cli.BoolFlag{
161+
Name: "purge",
162+
Usage: "Purge user, all their repositories, organizations and comments",
163+
},
160164
},
161165
Action: runDeleteUser,
162166
}
@@ -675,7 +679,7 @@ func runDeleteUser(c *cli.Context) error {
675679
return fmt.Errorf("The user %s does not match the provided id %d", user.Name, c.Int64("id"))
676680
}
677681

678-
return user_service.DeleteUser(user)
682+
return user_service.DeleteUser(ctx, user, c.Bool("purge"))
679683
}
680684

681685
func runGenerateAccessToken(c *cli.Context) error {

cmd/dump_repo.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ package cmd
77
import (
88
"context"
99
"errors"
10+
"fmt"
11+
"os"
1012
"strings"
1113

1214
"code.gitea.io/gitea/modules/convert"
@@ -15,6 +17,7 @@ import (
1517
base "code.gitea.io/gitea/modules/migration"
1618
"code.gitea.io/gitea/modules/setting"
1719
"code.gitea.io/gitea/modules/structs"
20+
"code.gitea.io/gitea/modules/util"
1821
"code.gitea.io/gitea/services/migrations"
1922

2023
"github.com/urfave/cli"
@@ -159,9 +162,23 @@ func runDumpRepository(ctx *cli.Context) error {
159162
}
160163
}
161164

165+
// the repo_dir will be removed if error occurs in DumpRepository
166+
// make sure the directory doesn't exist or is empty, prevent from deleting user files
167+
repoDir := ctx.String("repo_dir")
168+
if exists, err := util.IsExist(repoDir); err != nil {
169+
return fmt.Errorf("unable to stat repo_dir %q: %v", repoDir, err)
170+
} else if exists {
171+
if isDir, _ := util.IsDir(repoDir); !isDir {
172+
return fmt.Errorf("repo_dir %q already exists but it's not a directory", repoDir)
173+
}
174+
if dir, _ := os.ReadDir(repoDir); len(dir) > 0 {
175+
return fmt.Errorf("repo_dir %q is not empty", repoDir)
176+
}
177+
}
178+
162179
if err := migrations.DumpRepository(
163180
context.Background(),
164-
ctx.String("repo_dir"),
181+
repoDir,
165182
ctx.String("owner_name"),
166183
opts,
167184
); err != nil {

custom/conf/app.example.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2232,6 +2232,7 @@ ROUTER = console
22322232
;BLOCKED_DOMAINS =
22332233
;;
22342234
;; Allow private addresses defined by RFC 1918, RFC 1122, RFC 4632 and RFC 4291 (false by default)
2235+
;; If a domain is allowed by ALLOWED_DOMAINS, this option will be ignored.
22352236
;ALLOW_LOCALNETWORKS = false
22362237

22372238
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ Task queue configuration has been moved to `queue.task`. However, the below conf
10831083
- `RETRY_BACKOFF`: **3**: Backoff time per http/https request retry (seconds)
10841084
- `ALLOWED_DOMAINS`: **\<empty\>**: Domains allowlist for migrating repositories, default is blank. It means everything will be allowed. Multiple domains could be separated by commas. Wildcard is supported: `github.com, *.github.com`.
10851085
- `BLOCKED_DOMAINS`: **\<empty\>**: Domains blocklist for migrating repositories, default is blank. Multiple domains could be separated by commas. When `ALLOWED_DOMAINS` is not blank, this option has a higher priority to deny domains. Wildcard is supported.
1086-
- `ALLOW_LOCALNETWORKS`: **false**: Allow private addresses defined by RFC 1918, RFC 1122, RFC 4632 and RFC 4291
1086+
- `ALLOW_LOCALNETWORKS`: **false**: Allow private addresses defined by RFC 1918, RFC 1122, RFC 4632 and RFC 4291. If a domain is allowed by `ALLOWED_DOMAINS`, this option will be ignored.
10871087
- `SKIP_TLS_VERIFY`: **false**: Allow skip tls verify
10881088

10891089
## Federation (`federation`)

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

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ embedded assets. This can be different for older releases.
2424

2525
## Download
2626

27-
Choose the file matching the destination platform from the [downloads page](https://dl.gitea.io/gitea/), copy the URL and replace the URL within the commands below:
27+
Choose the file matching your platform from the [downloads page](https://dl.gitea.io/gitea/), copy the URL and replace the URL within the commands below:
2828

2929
```sh
3030
wget -O gitea https://dl.gitea.io/gitea/{{< version >}}/gitea-{{< version >}}-linux-amd64
@@ -56,7 +56,8 @@ Check that Git is installed on the server. If it is not, install it first. Gitea
5656
git --version
5757
```
5858

59-
Create user to run Gitea (ex. `git`)
59+
Create a user to run Gitea (e.g. `git`)
60+
6061
```sh
6162
adduser \
6263
--system \
@@ -79,62 +80,71 @@ chown root:git /etc/gitea
7980
chmod 770 /etc/gitea
8081
```
8182

82-
**NOTE:** `/etc/gitea` is temporary set with write rights for user `git` so that Web installer could write configuration file. After installation is done, it is recommended to set rights to read-only using:
83-
```
83+
**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:
84+
85+
```sh
8486
chmod 750 /etc/gitea
8587
chmod 640 /etc/gitea/app.ini
8688
```
87-
If you don't want the web installer to be able to write the config file at all, it is also possible to make the config file read-only for the Gitea user (owner/group `root:git`, mode `0640`), and set `INSTALL_LOCK = true`. In that case all database configuration details must be set beforehand in the config file, as well as the `SECRET_KEY` and `INTERNAL_TOKEN` values. See the [command line documentation]({{< relref "doc/usage/command-line.en-us.md" >}}) for information on using `gitea generate secret INTERNAL_TOKEN`.
89+
90+
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:
91+
92+
* Set `INSTALL_LOCK= true`,
93+
* Ensure all database configuration details are set correctly
94+
* Ensure that the `SECRET_KEY` and `INTERNAL_TOKEN` values are set. (You may want to use the `gitea generate secret` to generate these secret keys.)
95+
* Ensure that any other secret keys you need are set.
96+
97+
See the [command line documentation]({{< relref "doc/usage/command-line.en-us.md" >}}) for information on using `gitea generate secret`.
8898

8999
### Configure Gitea's working directory
90100

91-
**NOTE:** If you plan on running Gitea as a Linux service, you can skip this step as the service file allows you to set `WorkingDirectory`. Otherwise, consider setting this environment variable (semi-)permanently so that Gitea consistently uses the correct working directory.
92-
```
101+
**NOTE:** If you plan on running Gitea as a Linux service, you can skip this step, as the service file allows you to set `WorkingDirectory`. Otherwise, consider setting this environment variable (semi-)permanently so that Gitea consistently uses the correct working directory.
102+
103+
```sh
93104
export GITEA_WORK_DIR=/var/lib/gitea/
94105
```
95106

96-
### Copy Gitea binary to global location
107+
### Copy the Gitea binary to a global location
97108

98-
```
109+
```sh
99110
cp gitea /usr/local/bin/gitea
100111
```
101112

102113
## Running Gitea
103114

104-
After the above steps, two options to run Gitea are:
115+
After you complete the above steps, you can run Gitea two ways:
105116

106117
### 1. Creating a service file to start Gitea automatically (recommended)
107118

108119
See how to create [Linux service]({{< relref "run-as-service-in-ubuntu.en-us.md" >}})
109120

110121
### 2. Running from command-line/terminal
111122

112-
```
123+
```sh
113124
GITEA_WORK_DIR=/var/lib/gitea/ /usr/local/bin/gitea web -c /etc/gitea/app.ini
114125
```
115126

116127
## Updating to a new version
117128

118129
You can update to a new version of Gitea by stopping Gitea, replacing the binary at `/usr/local/bin/gitea` and restarting the instance.
119-
The binary file name should not be changed during the update to avoid problems
120-
in existing repositories.
130+
The binary file name should not be changed during the update to avoid problems in existing repositories.
121131

122-
It is recommended you do a [backup]({{< relref "doc/usage/backup-and-restore.en-us.md" >}}) before updating your installation.
132+
It is recommended that you make a [backup]({{< relref "doc/usage/backup-and-restore.en-us.md" >}}) before updating your installation.
123133

124134
If you have carried out the installation steps as described above, the binary should
125135
have the generic name `gitea`. Do not change this, i.e. to include the version number.
126136

127137
### 1. Restarting Gitea with systemd (recommended)
128138

129-
As explained before, we recommend to use systemd as service manager. In this case ```systemctl restart gitea``` should be enough.
139+
As we explained before, we recommend to use systemd as the service manager. In this case, `systemctl restart gitea` should be fine.
130140

131141
### 2. Restarting Gitea without systemd
132142

133-
To restart your Gitea instance, we recommend to use SIGHUP signal. If you know your Gitea PID use ```kill -1 $GITEA_PID``` otherwise you can use ```killall -1 gitea``` or ```pkill -1 gitea```
143+
To restart your Gitea instance, we recommend to use SIGHUP signal. If you know your Gitea PID, use `kill -1 $GITEA_PID`, otherwise you can use `killall -1 gitea`.
134144

135-
To gracefully stop the Gitea instance, a simple ```kill $GITEA_PID``` or ```killall gitea``` is enough.
145+
To gracefully stop the Gitea instance, a simple `kill $GITEA_PID` or `killall gitea` is enough.
136146

137-
**NOTE:** We don't recommend to use SIGKILL signal (know also as `-9`), you may be forcefully stopping some of Gitea internal tasks and it will not gracefully stop (tasks in queues, indexers processes, etc.)
147+
**NOTE:** We don't recommend to use the SIGKILL signal (`-9`); you may be forcefully stopping some of Gitea's internal tasks, and it will not gracefully stop (tasks in queues, indexers, etc.)
138148

139149
See below for troubleshooting instructions to repair broken repositories after
140150
an update of your Gitea version.
@@ -144,31 +154,31 @@ an update of your Gitea version.
144154
### Old glibc versions
145155

146156
Older Linux distributions (such as Debian 7 and CentOS 6) may not be able to load the
147-
Gitea binary, usually producing an error such as ```./gitea: /lib/x86_64-linux-gnu/libc.so.6:
148-
version `GLIBC\_2.14' not found (required by ./gitea)```. This is due to the integrated
157+
Gitea binary, usually producing an error such as `./gitea: /lib/x86_64-linux-gnu/libc.so.6:
158+
version 'GLIBC\_2.14' not found (required by ./gitea)`. This is due to the integrated
149159
SQLite support in the binaries provided by dl.gitea.io. In this situation, it is usually
150-
possible to [install from source]({{< relref "from-source.en-us.md" >}}) without SQLite
151-
support.
160+
possible to [install from source]({{< relref "from-source.en-us.md" >}}), without including
161+
SQLite support.
152162

153163
### Running Gitea on another port
154164

155165
For errors like `702 runWeb()] [E] Failed to start server: listen tcp 0.0.0.0:3000:
156-
bind: address already in use` Gitea needs to be started on another free port. This
166+
bind: address already in use`, Gitea needs to be started on another free port. This
157167
is possible using `./gitea web -p $PORT`. It's possible another instance of Gitea
158168
is already running.
159169

160170
### Running Gitea on Raspbian
161171

162-
As of v1.8, there is a problem with the arm7 version of Gitea and it doesn't run on Raspberry Pi and similar devices.
172+
As of v1.8, there is a problem with the arm7 version of Gitea, and it doesn't run on Raspberry Pis and similar devices.
163173

164-
It is therefore recommended to switch to the arm6 version which has been tested and shown to work on Raspberry Pi and similar devices.
174+
It is recommended to switch to the arm6 version, which has been tested and shown to work on Raspberry Pis and similar devices.
165175

166176
<!---
167177
please remove after fixing the arm7 bug
168178
--->
169179
### Git error after updating to a new version of Gitea
170180

171-
If the binary file name has been changed during the update to a new version of Gitea,
181+
If during the update, the binary file name has been changed to a new version of Gitea,
172182
Git Hooks in existing repositories will not work any more. In that case, a Git
173183
error will be displayed when pushing to the repository.
174184

@@ -181,9 +191,9 @@ binary.
181191

182192
To solve this, go to the admin options and run the task `Resynchronize pre-receive,
183193
update and post-receive hooks of all repositories` to update all hooks to contain
184-
the new binary path. Please note that this overwrite all Git Hooks including ones
194+
the new binary path. Please note that this overwrites all Git Hooks, including ones
185195
with customizations made.
186196

187-
If you aren't using the built-in to Gitea SSH server you will also need to re-write
197+
If you aren't using the Gitea built-in SSH server, you will also need to re-write
188198
the authorized key file by running the `Update the '.ssh/authorized_keys' file with
189199
Gitea SSH keys.` task in the admin options.

0 commit comments

Comments
 (0)