Skip to content

Commit 7d01c08

Browse files
authored
Merge branch 'main' into feature/edit_reviewer
2 parents 1d6aea1 + 52c2ef7 commit 7d01c08

File tree

27 files changed

+795
-328
lines changed

27 files changed

+795
-328
lines changed

.drone.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,7 @@ steps:
9090
- name: checks-backend
9191
image: golang:1.19
9292
commands:
93-
- curl -sL https://deb.nodesource.com/setup_18.x | bash - && apt-get -qqy install nodejs
9493
- make checks-backend
95-
environment:
96-
DEBIAN_FRONTEND: noninteractive
9794
depends_on: [deps-backend]
9895
volumes:
9996
- name: deps
@@ -554,7 +551,7 @@ steps:
554551

555552
# TODO: We should probably build all dependencies into a test image
556553
- name: test-e2e
557-
image: mcr.microsoft.com/playwright:v1.23.1-focal
554+
image: mcr.microsoft.com/playwright:v1.24.0-focal
558555
commands:
559556
- curl -sLO https://go.dev/dl/go1.18.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.18.linux-amd64.tar.gz
560557
- groupadd --gid 1001 gitea && useradd -m --gid 1001 --uid 1001 gitea
@@ -569,6 +566,9 @@ steps:
569566
TEST_PGSQL_DBNAME: 'testgitea-e2e'
570567
DEBIAN_FRONTEND: noninteractive
571568
depends_on: [build-frontend, deps-backend]
569+
volumes:
570+
- name: deps
571+
path: /go
572572

573573
---
574574
kind: pipeline

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,10 +422,10 @@ tidy-check: tidy
422422
.PHONY: go-licenses
423423
go-licenses: assets/go-licenses.json
424424

425-
assets/go-licenses.json: go.mod go.sum build/generate-go-licenses.js
426-
-$(GO) run $(GO_LICENSES_PACKAGE) save . --force --save_path="$(GO_LICENSE_TMP_DIR)" 2>/dev/null
427-
node build/generate-go-licenses.js "$(GO_LICENSE_TMP_DIR)" "$(GO_LICENSE_FILE)"
428-
@rm -rf "$(GO_LICENSE_TMP_DIR)"
425+
assets/go-licenses.json: go.mod go.sum
426+
-$(GO) run $(GO_LICENSES_PACKAGE) save . --force --save_path=$(GO_LICENSE_TMP_DIR) 2>/dev/null
427+
$(GO) run build/generate-go-licenses.go $(GO_LICENSE_TMP_DIR) $(GO_LICENSE_FILE)
428+
@rm -rf $(GO_LICENSE_TMP_DIR)
429429

430430
generate-ini-sqlite:
431431
sed -e 's|{{REPO_TEST_DIR}}|${REPO_TEST_DIR}|g' \

assets/go-licenses.json

Lines changed: 364 additions & 214 deletions
Large diffs are not rendered by default.

build/generate-go-licenses.go

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// Copyright 2022 The Gitea Authors. All rights reserved.
2+
// Use of this source code is governed by a MIT-style
3+
// license that can be found in the LICENSE file.
4+
5+
//go:build ignore
6+
7+
package main
8+
9+
import (
10+
"encoding/json"
11+
"io/fs"
12+
"os"
13+
"path/filepath"
14+
"regexp"
15+
"sort"
16+
"strings"
17+
)
18+
19+
// regexp is based on go-license, excluding README and NOTICE
20+
// https://github.com/google/go-licenses/blob/master/licenses/find.go
21+
var licenseRe = regexp.MustCompile(`^(?i)((UN)?LICEN(S|C)E|COPYING).*$`)
22+
23+
type LicenseEntry struct {
24+
Name string `json:"name"`
25+
Path string `json:"path"`
26+
LicenseText string `json:"licenseText"`
27+
}
28+
29+
func main() {
30+
base, out := os.Args[1], os.Args[2]
31+
32+
paths := []string{}
33+
err := filepath.WalkDir(base, func(path string, entry fs.DirEntry, err error) error {
34+
if err != nil {
35+
return err
36+
}
37+
if entry.IsDir() || !licenseRe.MatchString(entry.Name()) {
38+
return nil
39+
}
40+
paths = append(paths, path)
41+
return nil
42+
})
43+
if err != nil {
44+
panic(err)
45+
}
46+
47+
sort.Strings(paths)
48+
49+
entries := []LicenseEntry{}
50+
for _, path := range paths {
51+
licenseText, err := os.ReadFile(path)
52+
if err != nil {
53+
panic(err)
54+
}
55+
56+
path := strings.Replace(path, base+string(os.PathSeparator), "", 1)
57+
58+
entries = append(entries, LicenseEntry{
59+
Name: filepath.Dir(path),
60+
Path: path,
61+
LicenseText: string(licenseText),
62+
})
63+
}
64+
65+
jsonBytes, err := json.MarshalIndent(entries, "", " ")
66+
if err != nil {
67+
panic(err)
68+
}
69+
70+
err = os.WriteFile(out, jsonBytes, 0o644)
71+
if err != nil {
72+
panic(err)
73+
}
74+
}

build/generate-go-licenses.js

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

docs/content/doc/advanced/logging-documentation.en-us.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ menu:
1515

1616
# Logging Configuration
1717

18-
The logging framework has been revamped in Gitea 1.9.0.
19-
2018
**Table of Contents**
2119

2220
{{< toc >}}
2321

22+
## Collecting Logs for Help
23+
24+
To collect logs for help and issue report, see [Support Options]({{< relref "doc/help/seek-help.en-us.md" >}}).
25+
2426
## Log Groups
2527

2628
The fundamental thing to be aware of in Gitea is that there are several

docs/content/doc/developers/api-usage.en-us.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Note that `/users/:name/tokens` is a special endpoint and requires you
4949
to authenticate using `BasicAuth` and a password, as follows:
5050

5151
```sh
52-
$ curl -XPOST -H "Content-Type: application/json" -k -d '{"name":"test"}' -u username:password https://gitea.your.host/api/v1/users/<username>/tokens
52+
$ curl -H "Content-Type: application/json" -d '{"name":"test"}' -u username:password https://gitea.your.host/api/v1/users/<username>/tokens
5353
{"id":1,"name":"test","sha1":"9fcb1158165773dd010fca5f0cf7174316c3e37d","token_last_eight":"16c3e37d"}
5454
```
5555

@@ -58,7 +58,7 @@ plain-text. It will not be displayed when listing tokens with a `GET`
5858
request; e.g.
5959

6060
```sh
61-
$ curl --request GET --url https://yourusername:password@gitea.your.host/api/v1/users/<username>/tokens
61+
$ curl --url https://yourusername:password@gitea.your.host/api/v1/users/<username>/tokens
6262
[{"name":"test","sha1":"","token_last_eight:"........":},{"name":"dev","sha1":"","token_last_eight":"........"}]
6363
```
6464
@@ -70,7 +70,7 @@ is where you'd place the code from your authenticator.
7070
Here is how the request would look like in curl:
7171
7272
```sh
73-
$ curl -H "X-Gitea-OTP: 123456" --request GET --url https://yourusername:yourpassword@gitea.your.host/api/v1/users/yourusername/tokens
73+
$ curl -H "X-Gitea-OTP: 123456" --url https://yourusername:yourpassword@gitea.your.host/api/v1/users/yourusername/tokens
7474
```
7575
7676
You can also create an API key token via your Gitea installation's web
@@ -96,7 +96,7 @@ Authorization: token 65eaa9c8ef52460d22a93307fe0aee76289dc675
9696
In a `curl` command, for instance, this would look like:
9797
9898
```sh
99-
curl -X POST "http://localhost:4000/api/v1/repos/test1/test1/issues" \
99+
curl "http://localhost:4000/api/v1/repos/test1/test1/issues" \
100100
-H "accept: application/json" \
101101
-H "Authorization: token 65eaa9c8ef52460d22a93307fe0aee76289dc675" \
102102
-H "Content-Type: application/json" -d "{ \"body\": \"testing\", \"title\": \"test 20\"}" -i

docs/content/doc/developers/api-usage.zh-cn.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Authorization: token 65eaa9c8ef52460d22a93307fe0aee76289dc675
4646
`curl` 命令为例,它会以如下形式携带在请求中:
4747

4848
```
49-
curl -X POST "http://localhost:4000/api/v1/repos/test1/test1/issues" \
49+
curl "http://localhost:4000/api/v1/repos/test1/test1/issues" \
5050
-H "accept: application/json" \
5151
-H "Authorization: token 65eaa9c8ef52460d22a93307fe0aee76289dc675" \
5252
-H "Content-Type: application/json" -d "{ \"body\": \"testing\", \"title\": \"test 20\"}" -i
@@ -62,7 +62,7 @@ curl -X POST "http://localhost:4000/api/v1/repos/test1/test1/issues" \
6262
### 使用 Basic authentication 认证:
6363

6464
```
65-
$ curl --request GET --url https://yourusername:yourpassword@gitea.your.host/api/v1/users/yourusername/tokens
65+
$ curl --url https://yourusername:yourpassword@gitea.your.host/api/v1/users/yourusername/tokens
6666
[{"name":"test","sha1":"..."},{"name":"dev","sha1":"..."}]
6767
```
6868

docs/content/doc/help/faq.en-us.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,9 @@ Gitea requires the system or browser to have one of the supported Emoji fonts in
392392

393393
Stdout on systemd goes to the journal by default. Try using `journalctl`, `journalctl -u gitea`, or `journalctl <path-to-gitea-binary>`.
394394

395-
Similarly stdout on docker can be viewed using `docker logs <container>`
395+
Similarly, stdout on docker can be viewed using `docker logs <container>`.
396+
397+
To collect logs for help and issue report, see [Support Options]({{< relref "doc/help/seek-help.en-us.md" >}}).
396398

397399
## Initial logging
398400

@@ -413,7 +415,7 @@ unchanged in the database schema. This may lead to warning such as:
413415
2020/08/02 11:32:29 ...rm/session_schema.go:360:Sync2() [W] Table user Column keep_activity_private db default is , struct default is 0
414416
```
415417

416-
These can safely be ignored but you may able to stop these warnings by getting Gitea to recreate these tables using:
418+
These can safely be ignored, but you are able to stop these warnings by getting Gitea to recreate these tables using:
417419

418420
```
419421
gitea doctor recreate-table user

docs/content/doc/help/seek-help.en-us.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@ menu:
2222

2323
1. Your `app.ini` (with any sensitive data scrubbed as necessary).
2424
2. The Gitea logs, and any other appropriate log files for the situation.
25-
- The logs are likely to be outputted to console. If you need to collect logs from files,
25+
- When using systemd, use `journalctl --lines 1000 --unit gitea` to collect logs.
26+
- When using docker, use `docker logs --tail 1000 <gitea-container>` to collect logs.
27+
- By default, the logs are outputted to console. If you need to collect logs from files,
2628
you could copy the following config into your `app.ini` (remove all other `[log]` sections),
2729
then you can find the `*.log` files in Gitea's log directory (default: `%(GITEA_WORK_DIR)/log`).
2830

2931
```ini
30-
; To show all SQL logs, you can also set LOG_SQL=true in the [database] section
32+
; To show all SQL logs, you can also set LOG_SQL=true in the [database] section
3133
[log]
3234
LEVEL=debug
3335
MODE=console,file

docs/content/doc/installation/windows-service.en-us.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ Open "Windows Services", search for the service named "gitea", right-click it an
4949
"Run". If everything is OK, Gitea will be reachable on `http://localhost:3000` (or the port
5050
that was configured).
5151

52-
## Adding startup dependancies
52+
## Adding startup dependencies
5353

54-
To add a startup dependancy to the Gitea Windows service (eg Mysql, Mariadb), as an Administrator, then run the following command:
54+
To add a startup dependency to the Gitea Windows service (eg Mysql, Mariadb), as an Administrator, then run the following command:
5555

5656
```
5757
sc.exe config gitea depend= mariadb

0 commit comments

Comments
 (0)