Skip to content

Commit

Permalink
Merge branch 'main' into feature/edit_reviewer
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny authored Sep 8, 2022
2 parents 1d6aea1 + 52c2ef7 commit 7d01c08
Show file tree
Hide file tree
Showing 27 changed files with 795 additions and 328 deletions.
8 changes: 4 additions & 4 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ steps:
- name: checks-backend
image: golang:1.19
commands:
- curl -sL https://deb.nodesource.com/setup_18.x | bash - && apt-get -qqy install nodejs
- make checks-backend
environment:
DEBIAN_FRONTEND: noninteractive
depends_on: [deps-backend]
volumes:
- name: deps
Expand Down Expand Up @@ -554,7 +551,7 @@ steps:

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

---
kind: pipeline
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,10 @@ tidy-check: tidy
.PHONY: go-licenses
go-licenses: assets/go-licenses.json

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

generate-ini-sqlite:
sed -e 's|{{REPO_TEST_DIR}}|${REPO_TEST_DIR}|g' \
Expand Down
578 changes: 364 additions & 214 deletions assets/go-licenses.json

Large diffs are not rendered by default.

74 changes: 74 additions & 0 deletions build/generate-go-licenses.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// Copyright 2022 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

//go:build ignore

package main

import (
"encoding/json"
"io/fs"
"os"
"path/filepath"
"regexp"
"sort"
"strings"
)

// regexp is based on go-license, excluding README and NOTICE
// https://github.com/google/go-licenses/blob/master/licenses/find.go
var licenseRe = regexp.MustCompile(`^(?i)((UN)?LICEN(S|C)E|COPYING).*$`)

type LicenseEntry struct {
Name string `json:"name"`
Path string `json:"path"`
LicenseText string `json:"licenseText"`
}

func main() {
base, out := os.Args[1], os.Args[2]

paths := []string{}
err := filepath.WalkDir(base, func(path string, entry fs.DirEntry, err error) error {
if err != nil {
return err
}
if entry.IsDir() || !licenseRe.MatchString(entry.Name()) {
return nil
}
paths = append(paths, path)
return nil
})
if err != nil {
panic(err)
}

sort.Strings(paths)

entries := []LicenseEntry{}
for _, path := range paths {
licenseText, err := os.ReadFile(path)
if err != nil {
panic(err)
}

path := strings.Replace(path, base+string(os.PathSeparator), "", 1)

entries = append(entries, LicenseEntry{
Name: filepath.Dir(path),
Path: path,
LicenseText: string(licenseText),
})
}

jsonBytes, err := json.MarshalIndent(entries, "", " ")
if err != nil {
panic(err)
}

err = os.WriteFile(out, jsonBytes, 0o644)
if err != nil {
panic(err)
}
}
30 changes: 0 additions & 30 deletions build/generate-go-licenses.js

This file was deleted.

6 changes: 4 additions & 2 deletions docs/content/doc/advanced/logging-documentation.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ menu:

# Logging Configuration

The logging framework has been revamped in Gitea 1.9.0.

**Table of Contents**

{{< toc >}}

## Collecting Logs for Help

To collect logs for help and issue report, see [Support Options]({{< relref "doc/help/seek-help.en-us.md" >}}).

## Log Groups

The fundamental thing to be aware of in Gitea is that there are several
Expand Down
8 changes: 4 additions & 4 deletions docs/content/doc/developers/api-usage.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Note that `/users/:name/tokens` is a special endpoint and requires you
to authenticate using `BasicAuth` and a password, as follows:

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

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

```sh
$ curl --request GET --url https://yourusername:password@gitea.your.host/api/v1/users/<username>/tokens
$ curl --url https://yourusername:password@gitea.your.host/api/v1/users/<username>/tokens
[{"name":"test","sha1":"","token_last_eight:"........":},{"name":"dev","sha1":"","token_last_eight":"........"}]
```
Expand All @@ -70,7 +70,7 @@ is where you'd place the code from your authenticator.
Here is how the request would look like in curl:
```sh
$ curl -H "X-Gitea-OTP: 123456" --request GET --url https://yourusername:yourpassword@gitea.your.host/api/v1/users/yourusername/tokens
$ curl -H "X-Gitea-OTP: 123456" --url https://yourusername:yourpassword@gitea.your.host/api/v1/users/yourusername/tokens
```
You can also create an API key token via your Gitea installation's web
Expand All @@ -96,7 +96,7 @@ Authorization: token 65eaa9c8ef52460d22a93307fe0aee76289dc675
In a `curl` command, for instance, this would look like:
```sh
curl -X POST "http://localhost:4000/api/v1/repos/test1/test1/issues" \
curl "http://localhost:4000/api/v1/repos/test1/test1/issues" \
-H "accept: application/json" \
-H "Authorization: token 65eaa9c8ef52460d22a93307fe0aee76289dc675" \
-H "Content-Type: application/json" -d "{ \"body\": \"testing\", \"title\": \"test 20\"}" -i
Expand Down
4 changes: 2 additions & 2 deletions docs/content/doc/developers/api-usage.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Authorization: token 65eaa9c8ef52460d22a93307fe0aee76289dc675
`curl` 命令为例,它会以如下形式携带在请求中:

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

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

Expand Down
6 changes: 4 additions & 2 deletions docs/content/doc/help/faq.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,9 @@ Gitea requires the system or browser to have one of the supported Emoji fonts in

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

Similarly stdout on docker can be viewed using `docker logs <container>`
Similarly, stdout on docker can be viewed using `docker logs <container>`.

To collect logs for help and issue report, see [Support Options]({{< relref "doc/help/seek-help.en-us.md" >}}).

## Initial logging

Expand All @@ -413,7 +415,7 @@ unchanged in the database schema. This may lead to warning such as:
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
```

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

```
gitea doctor recreate-table user
Expand Down
6 changes: 4 additions & 2 deletions docs/content/doc/help/seek-help.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ menu:

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

```ini
; To show all SQL logs, you can also set LOG_SQL=true in the [database] section
; To show all SQL logs, you can also set LOG_SQL=true in the [database] section
[log]
LEVEL=debug
MODE=console,file
Expand Down
4 changes: 2 additions & 2 deletions docs/content/doc/installation/windows-service.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ Open "Windows Services", search for the service named "gitea", right-click it an
"Run". If everything is OK, Gitea will be reachable on `http://localhost:3000` (or the port
that was configured).

## Adding startup dependancies
## Adding startup dependencies

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

```
sc.exe config gitea depend= mariadb
Expand Down
Loading

0 comments on commit 7d01c08

Please sign in to comment.