forked from NYANDEV/forgejo
Compare commits
335 commits
forgejo
...
soft-fork/
Author | SHA1 | Date | |
---|---|---|---|
|
8c771c8b91 | ||
|
53586e9d60 | ||
|
81f5d5b722 | ||
|
2184a06c1a | ||
|
c4798b08b1 | ||
|
ee87b4e18c | ||
|
bd1946e372 | ||
|
5bfe469821 | ||
|
53276d3e49 | ||
|
e6801df99c | ||
|
67d16c653f | ||
|
d4243578dd | ||
|
6ac353b693 | ||
|
3be10ddc88 | ||
|
37bf5e761a | ||
|
45d8d63621 | ||
|
b4bfaf7d4d | ||
|
1650a26eb5 | ||
|
a9ebf911fa | ||
|
de6ac4bf2a | ||
|
a9030052a7 | ||
|
ed78711e46 | ||
|
c23ab427e1 | ||
|
e3cdb050fa | ||
|
8df6713a6e | ||
|
3ef97932d5 | ||
|
15adec19e7 | ||
|
8e94b715cc | ||
|
b2ec116c60 | ||
|
edfa2c5b78 | ||
|
73ae6b21d1 | ||
|
b83e4f295d | ||
|
95bf09fca0 | ||
|
3b5cc02345 | ||
|
37b73b3337 | ||
|
d2c9fb02dd | ||
|
cdeb55f6e5 | ||
|
0ef7b66018 | ||
|
826b7b979c | ||
|
7dc46ffbaa | ||
|
3a7e0953c1 | ||
|
9da84a36eb | ||
|
8a6a1143a4 | ||
|
b4cd1028d9 | ||
|
d1af0a3e4c | ||
|
a83d597989 | ||
|
c5dee8823c | ||
|
275abd6593 | ||
|
d19d5bc5b8 | ||
|
e7757aa4be | ||
|
e81d38b0f6 | ||
|
f29c52a169 | ||
|
04f9ab1aa9 | ||
|
b369ed579d | ||
|
64cc691b7f | ||
|
1bad05da3d | ||
|
57f520e7e5 | ||
|
e4f200e616 | ||
|
6ecd2e782f | ||
|
2fea93b2d3 | ||
|
0ee51a5221 | ||
|
da1c38dd47 | ||
|
aa984f21fa | ||
|
8f722012f6 | ||
|
cb7ba8969d | ||
|
7eaf7aacde | ||
|
b390b439e1 | ||
|
306b7b5d1d | ||
|
4498a26222 | ||
|
6f57be0025 | ||
|
257287954c | ||
|
7a74957c19 | ||
|
f979569a3d | ||
|
8ceb78caad | ||
|
4dccac3dbf | ||
|
73e70f3c44 | ||
|
499257d81e | ||
|
84fa30e3d5 | ||
|
f1a0b64109 | ||
|
bfdbc626cb | ||
|
3abbf5fc21 | ||
|
d9d3f5234e | ||
|
7d7ba76c08 | ||
|
e76b3f72b2 | ||
|
4bc6bfb476 | ||
|
5999349ce7 | ||
|
e301e26d7a | ||
|
d2efd2bf73 | ||
|
89297c9355 | ||
|
d2328c4051 | ||
|
af5d66b341 | ||
|
912a418920 | ||
|
cc7a4f17e0 | ||
|
5f82011b7c | ||
|
1bbbeb24ef | ||
|
1254a8271e | ||
|
ef3e3afc05 | ||
|
b1094ff28c | ||
|
8044d87c18 | ||
|
1b8e36587e | ||
|
a2f52f3561 | ||
|
65de747b13 | ||
|
7e86dffc35 | ||
|
7297cceda7 | ||
|
077160b838 | ||
|
da4448421e | ||
|
5ccb626cda | ||
|
b00f7c3c54 | ||
|
51fd730147 | ||
|
7117355169 | ||
|
d5f2c9d74d | ||
|
95c2cb4b79 | ||
|
7d717e22a8 | ||
|
dc66ceadac | ||
|
8cd5483e8a | ||
|
2e6e5bc9c9 | ||
|
f134229bf2 | ||
|
3d3c740636 | ||
|
c4f569b9a5 | ||
|
03b6e7900b | ||
|
463e144d97 | ||
|
2b32f8b95f | ||
|
94fbd44bac | ||
|
494e373292 | ||
|
10f93995e9 | ||
|
67a73dd05f | ||
|
893c97dd71 | ||
|
447fa6715c | ||
|
2398a23562 | ||
|
93c7611c32 | ||
|
607801ec41 | ||
|
16d2cf05ab | ||
|
d562b419b6 | ||
|
5482602ba8 | ||
|
37d3e0ec33 | ||
|
29724f31c5 | ||
|
580da8f353 | ||
|
8644993699 | ||
|
f55fe989a4 | ||
|
27dbe97542 | ||
|
abf0386e2e | ||
|
2b10eebed8 | ||
|
695738fb31 | ||
|
cfde557e23 | ||
|
3dbc63777f | ||
|
4aabd8e823 | ||
|
6a5b8eb7b6 | ||
|
a00e473341 | ||
|
4019a6d4b2 | ||
|
0487e39f82 | ||
|
3a7cb1a83b | ||
|
f317186aa6 | ||
|
5b7df68555 | ||
|
833a4b1775 | ||
|
1b8ecd179b | ||
|
085b56302c | ||
|
5066b208de | ||
|
ac658bb92c | ||
|
001d3fb820 | ||
|
8092251133 | ||
|
55239cbab7 | ||
|
df74ee0376 | ||
|
8d88f148d7 | ||
|
7bfab90a8f | ||
|
1a8da2e08f | ||
|
7c180ff8eb | ||
|
c34f7cdb1a | ||
|
fd0baf637d | ||
|
dff3ce089d | ||
|
9836b7db7b | ||
|
d752f0d7d0 | ||
|
669c76c0fd | ||
|
ac57ec5c47 | ||
|
f6dab64412 | ||
|
847f0bb9f3 | ||
|
1886bd6a01 | ||
|
7e07f5c4dc | ||
|
799536db46 | ||
|
c68650a7fb | ||
|
fe7caa05cc | ||
|
026167f854 | ||
|
8abfbe2165 | ||
|
16bfe983c2 | ||
|
503af4b807 | ||
|
8b3dd7de5d | ||
|
a04535e212 | ||
|
a1460333dc | ||
|
d15f20b2d2 | ||
|
863da7d5a1 | ||
|
1cad923b36 | ||
|
edb6ba28f1 | ||
|
494721cc90 | ||
|
d27e693ecf | ||
|
81a995cd84 | ||
|
d977e7ec10 | ||
|
b73d1ac1eb | ||
|
428d26d4a8 | ||
|
a254c26df9 | ||
|
1fed0e1adc | ||
|
88a652fa92 | ||
|
35039b8563 | ||
|
62afc0a727 | ||
|
b6a2323981 | ||
|
f23b587fe7 | ||
|
305cac291d | ||
|
6705b215db | ||
|
a9b4aa4cc4 | ||
|
1faa39b44c | ||
|
780f71c4ca | ||
|
484cb22f14 | ||
|
2a70473af7 | ||
|
a28863bff7 | ||
|
162f2841d0 | ||
|
e7a5429d7a | ||
|
622d21691c | ||
|
774b37b9f8 | ||
|
9dfdfe2389 | ||
|
4439a68911 | ||
|
782c376c8b | ||
|
a3b917151c | ||
|
0732ba32ee | ||
|
726d6a5077 | ||
|
b33cae7a3a | ||
|
854fcb1434 | ||
|
4730ed18f1 | ||
|
937996c74c | ||
|
3f253b3f5a | ||
|
f5a98b0f5b | ||
|
1a97a84023 | ||
|
420d015b76 | ||
|
22911a1ece | ||
|
4b763d8d37 | ||
|
1254fc668a | ||
|
09824025f7 | ||
|
bd1a915bdb | ||
|
cab7044772 | ||
|
68c9f1abd8 | ||
|
301de3ab6b | ||
|
8f8bd3c0cb | ||
|
23a6fa9421 | ||
|
b7c2f48ebf | ||
|
70e31b4aa0 | ||
|
d73846f0b4 | ||
|
527bbf67e8 | ||
|
5feb31f219 | ||
|
31efbafbe3 | ||
|
28af02eea0 | ||
|
c698a6fc5d | ||
|
e5a51eca45 | ||
|
8536dc4b73 | ||
|
0a0f46f299 | ||
|
1543ac9c8d | ||
|
c3c0710412 | ||
|
fa33919e24 | ||
|
b1162495af | ||
|
41655ee878 | ||
|
0d9b44c0e3 | ||
|
e87f36e885 | ||
|
b301cb17a3 | ||
|
e259daeff8 | ||
|
edb618c136 | ||
|
43cf04c031 | ||
|
e9991b1f06 | ||
|
975785dd42 | ||
|
e269e8901f | ||
|
87c31c2ffe | ||
|
54c674c936 | ||
|
2ba58fab22 | ||
|
cd7bd8568c | ||
|
cf80f829b4 | ||
|
ed25e094ab | ||
|
10df304b2f | ||
|
ecae62837c | ||
|
e8e871b44e | ||
|
6be6c19daf | ||
|
61f91bdc7e | ||
|
8ab50be000 | ||
|
dfab6e2d1c | ||
|
2f7bbdf8c9 | ||
|
af4767df5c | ||
|
233a399706 | ||
|
dcf1717793 | ||
|
b1e68f39e7 | ||
|
ee3d9330a8 | ||
|
d1d15306d1 | ||
|
e3b1ebbbfe | ||
|
17ae7e335e | ||
|
1edb57eda9 | ||
|
a2a9b0f977 | ||
|
ff96f804b6 | ||
|
a926994bfe | ||
|
83903535e3 | ||
|
8142408d3a | ||
|
a4158d1904 | ||
|
781019216c | ||
|
1322cd7a58 | ||
|
464bbd747e | ||
|
574182e1eb | ||
|
ef8209a953 | ||
|
9309098eab | ||
|
790a79b04c | ||
|
f8a40dafb9 | ||
|
9843a0b741 | ||
|
085a4debd5 | ||
|
4c1e24864f | ||
|
5d5f907e7f | ||
|
39178b5756 | ||
|
3d8412dd51 | ||
|
ff7057a46d | ||
|
bb8ef28913 | ||
|
13918ad344 | ||
|
7528ce60e7 | ||
|
6c6a7e7d97 | ||
|
111c509287 | ||
|
9d7ef0ad63 | ||
|
9aae54c81f | ||
|
1bc4ffc337 | ||
|
27879bc45e | ||
|
a3694b6989 | ||
|
28625fba5b | ||
|
7c3196ceac | ||
|
80c1264f4b | ||
|
f0340c28f1 | ||
|
5beb29ad35 | ||
|
27e307142b | ||
|
e02e752f68 | ||
|
5ddf67a9c2 | ||
|
4d3e2b23b8 | ||
|
ddf61373f6 | ||
|
b4ed3f07e4 | ||
|
ced94f2e0d | ||
|
aff432b197 | ||
|
0ac3be1482 | ||
|
75eaf99076 | ||
|
e67d60d336 |
867 changed files with 30475 additions and 18797 deletions
243
.drone.yml
243
.drone.yml
|
@ -43,7 +43,7 @@ steps:
|
|||
depends_on: [deps-frontend]
|
||||
|
||||
- name: lint-backend
|
||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
||||
image: gitea/test_env:linux-1.19-amd64 # https://gitea.com/gitea/test-env
|
||||
pull: always
|
||||
commands:
|
||||
- make lint-backend
|
||||
|
@ -57,7 +57,7 @@ steps:
|
|||
path: /go
|
||||
|
||||
- name: lint-backend-windows
|
||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
||||
image: gitea/test_env:linux-1.19-amd64 # https://gitea.com/gitea/test-env
|
||||
commands:
|
||||
- make golangci-lint-windows vet
|
||||
environment:
|
||||
|
@ -72,7 +72,7 @@ steps:
|
|||
path: /go
|
||||
|
||||
- name: lint-backend-gogit
|
||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
||||
image: gitea/test_env:linux-1.19-amd64 # https://gitea.com/gitea/test-env
|
||||
commands:
|
||||
- make lint-backend
|
||||
environment:
|
||||
|
@ -264,13 +264,13 @@ steps:
|
|||
- git update-ref refs/heads/tag_test ${DRONE_COMMIT_SHA}
|
||||
|
||||
- name: prepare-test-env
|
||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
||||
image: gitea/test_env:linux-1.19-amd64 # https://gitea.com/gitea/test-env
|
||||
pull: always
|
||||
commands:
|
||||
- ./build/test-env-prepare.sh
|
||||
|
||||
- name: build
|
||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
||||
image: gitea/test_env:linux-1.19-amd64 # https://gitea.com/gitea/test-env
|
||||
user: gitea
|
||||
commands:
|
||||
- ./build/test-env-check.sh
|
||||
|
@ -285,7 +285,7 @@ steps:
|
|||
path: /go
|
||||
|
||||
- name: unit-test
|
||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
||||
image: gitea/test_env:linux-1.19-amd64 # https://gitea.com/gitea/test-env
|
||||
user: gitea
|
||||
commands:
|
||||
- make unit-test-coverage test-check
|
||||
|
@ -301,7 +301,7 @@ steps:
|
|||
path: /go
|
||||
|
||||
- name: unit-test-gogit
|
||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
||||
image: gitea/test_env:linux-1.19-amd64 # https://gitea.com/gitea/test-env
|
||||
user: gitea
|
||||
commands:
|
||||
- make unit-test-coverage test-check
|
||||
|
@ -317,7 +317,7 @@ steps:
|
|||
path: /go
|
||||
|
||||
- name: test-mysql
|
||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
||||
image: gitea/test_env:linux-1.19-amd64 # https://gitea.com/gitea/test-env
|
||||
user: gitea
|
||||
commands:
|
||||
- make test-mysql-migration integration-test-coverage
|
||||
|
@ -334,7 +334,7 @@ steps:
|
|||
path: /go
|
||||
|
||||
- name: test-mysql8
|
||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
||||
image: gitea/test_env:linux-1.19-amd64 # https://gitea.com/gitea/test-env
|
||||
user: gitea
|
||||
commands:
|
||||
- timeout -s ABRT 50m make test-mysql8-migration test-mysql8
|
||||
|
@ -350,7 +350,7 @@ steps:
|
|||
path: /go
|
||||
|
||||
- name: test-mssql
|
||||
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
|
||||
image: gitea/test_env:linux-1.19-amd64 # https://gitea.com/gitea/test-env
|
||||
user: gitea
|
||||
commands:
|
||||
- make test-mssql-migration test-mssql
|
||||
|
@ -454,13 +454,13 @@ steps:
|
|||
path: /go
|
||||
|
||||
- name: prepare-test-env
|
||||
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
|
||||
image: gitea/test_env:linux-1.19-arm64 # https://gitea.com/gitea/test-env
|
||||
pull: always
|
||||
commands:
|
||||
- ./build/test-env-prepare.sh
|
||||
|
||||
- name: build
|
||||
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
|
||||
image: gitea/test_env:linux-1.19-arm64 # https://gitea.com/gitea/test-env
|
||||
user: gitea
|
||||
commands:
|
||||
- ./build/test-env-check.sh
|
||||
|
@ -475,7 +475,7 @@ steps:
|
|||
path: /go
|
||||
|
||||
- name: test-sqlite
|
||||
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
|
||||
image: gitea/test_env:linux-1.19-arm64 # https://gitea.com/gitea/test-env
|
||||
user: gitea
|
||||
commands:
|
||||
- timeout -s ABRT 50m make test-sqlite-migration test-sqlite
|
||||
|
@ -491,7 +491,7 @@ steps:
|
|||
path: /go
|
||||
|
||||
- name: test-pgsql
|
||||
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
|
||||
image: gitea/test_env:linux-1.19-arm64 # https://gitea.com/gitea/test-env
|
||||
user: gitea
|
||||
commands:
|
||||
- timeout -s ABRT 50m make test-pgsql-migration test-pgsql
|
||||
|
@ -507,81 +507,6 @@ steps:
|
|||
- name: deps
|
||||
path: /go
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: testing-e2e
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
depends_on:
|
||||
- compliance
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- pull_request
|
||||
paths:
|
||||
exclude:
|
||||
- docs/**
|
||||
|
||||
volumes:
|
||||
- name: deps
|
||||
temp: {}
|
||||
|
||||
services:
|
||||
- name: pgsql
|
||||
pull: default
|
||||
image: postgres:10
|
||||
environment:
|
||||
POSTGRES_DB: testgitea-e2e
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_INITDB_ARGS: --encoding=UTF8 --lc-collate='en_US.UTF-8' --lc-ctype='en_US.UTF-8'
|
||||
|
||||
steps:
|
||||
- name: deps-frontend
|
||||
image: node:18
|
||||
pull: always
|
||||
commands:
|
||||
- make deps-frontend
|
||||
|
||||
- name: build-frontend
|
||||
image: node:18
|
||||
commands:
|
||||
- make frontend
|
||||
depends_on: [deps-frontend]
|
||||
|
||||
- name: deps-backend
|
||||
image: golang:1.18
|
||||
pull: always
|
||||
commands:
|
||||
- make deps-backend
|
||||
volumes:
|
||||
- name: deps
|
||||
path: /go
|
||||
|
||||
# TODO: We should probably build all dependencies into a test image
|
||||
- name: test-e2e
|
||||
image: mcr.microsoft.com/playwright:v1.29.2-focal
|
||||
commands:
|
||||
- curl -sLO https://go.dev/dl/go1.20.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.20.linux-amd64.tar.gz
|
||||
- groupadd --gid 1001 gitea && useradd -m --gid 1001 --uid 1001 gitea
|
||||
- apt-get -qq update && apt-get -qqy install build-essential
|
||||
- export TEST_PGSQL_SCHEMA=''
|
||||
- ./build/test-env-prepare.sh
|
||||
- su gitea bash -c "export PATH=$PATH:/usr/local/go/bin && timeout -s ABRT 40m make test-e2e-pgsql"
|
||||
environment:
|
||||
GOPROXY: https://goproxy.io
|
||||
GOSUMDB: sum.golang.org
|
||||
USE_REPO_TEST_DIR: 1
|
||||
TEST_PGSQL_DBNAME: 'testgitea-e2e'
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
depends_on: [build-frontend, deps-backend]
|
||||
volumes:
|
||||
- name: deps
|
||||
path: /go
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
name: update_translations
|
||||
|
@ -963,26 +888,17 @@ trigger:
|
|||
- docs/**
|
||||
|
||||
steps:
|
||||
- name: lint-docs
|
||||
image: node:18
|
||||
commands:
|
||||
- make deps-frontend
|
||||
- make lint-frontend
|
||||
|
||||
- name: build-docs
|
||||
image: golang:1.20
|
||||
commands:
|
||||
- cd docs
|
||||
- make trans-copy clean build
|
||||
|
||||
- name: publish-docs
|
||||
image: techknowlogick/drone-netlify:latest
|
||||
pull: always
|
||||
settings:
|
||||
path: docs/public/
|
||||
site_id: d2260bae-7861-4c02-8646-8f6440b12672
|
||||
environment:
|
||||
NETLIFY_TOKEN:
|
||||
from_secret: netlify_token
|
||||
when:
|
||||
branch:
|
||||
- main
|
||||
event:
|
||||
- push
|
||||
- bash scripts/trans-copy.sh
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
|
@ -1016,7 +932,7 @@ steps:
|
|||
- git fetch --tags --force
|
||||
|
||||
- name: publish
|
||||
image: techknowlogick/drone-docker:latest
|
||||
image: plugins/docker:latest
|
||||
pull: always
|
||||
settings:
|
||||
auto_tag: true
|
||||
|
@ -1028,13 +944,17 @@ steps:
|
|||
from_secret: docker_password
|
||||
username:
|
||||
from_secret: docker_username
|
||||
environment:
|
||||
PLUGIN_MIRROR:
|
||||
from_secret: plugin_mirror
|
||||
DOCKER_BUILDKIT: 1
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
- name: publish-rootless
|
||||
image: techknowlogick/drone-docker:latest
|
||||
image: plugins/docker:latest
|
||||
settings:
|
||||
dockerfile: Dockerfile.rootless
|
||||
auto_tag: true
|
||||
|
@ -1046,6 +966,10 @@ steps:
|
|||
from_secret: docker_password
|
||||
username:
|
||||
from_secret: docker_username
|
||||
environment:
|
||||
PLUGIN_MIRROR:
|
||||
from_secret: plugin_mirror
|
||||
DOCKER_BUILDKIT: 1
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
|
@ -1080,7 +1004,7 @@ steps:
|
|||
- git fetch --tags --force
|
||||
|
||||
- name: publish
|
||||
image: techknowlogick/drone-docker:latest
|
||||
image: plugins/docker:latest
|
||||
pull: always
|
||||
settings:
|
||||
tags: ${DRONE_TAG##v}-linux-amd64
|
||||
|
@ -1091,13 +1015,17 @@ steps:
|
|||
from_secret: docker_password
|
||||
username:
|
||||
from_secret: docker_username
|
||||
environment:
|
||||
PLUGIN_MIRROR:
|
||||
from_secret: plugin_mirror
|
||||
DOCKER_BUILDKIT: 1
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
- name: publish-rootless
|
||||
image: techknowlogick/drone-docker:latest
|
||||
image: plugins/docker:latest
|
||||
settings:
|
||||
dockerfile: Dockerfile.rootless
|
||||
tags: ${DRONE_TAG##v}-linux-amd64-rootless
|
||||
|
@ -1108,6 +1036,10 @@ steps:
|
|||
from_secret: docker_password
|
||||
username:
|
||||
from_secret: docker_username
|
||||
environment:
|
||||
PLUGIN_MIRROR:
|
||||
from_secret: plugin_mirror
|
||||
DOCKER_BUILDKIT: 1
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
|
@ -1142,11 +1074,11 @@ steps:
|
|||
- git fetch --tags --force
|
||||
|
||||
- name: publish
|
||||
image: techknowlogick/drone-docker:latest
|
||||
image: plugins/docker:latest
|
||||
pull: always
|
||||
settings:
|
||||
auto_tag: false
|
||||
tags: dev-linux-amd64
|
||||
tags: nightly-linux-amd64
|
||||
repo: gitea/gitea
|
||||
build_args:
|
||||
- GOPROXY=https://goproxy.io
|
||||
|
@ -1154,17 +1086,21 @@ steps:
|
|||
from_secret: docker_password
|
||||
username:
|
||||
from_secret: docker_username
|
||||
environment:
|
||||
PLUGIN_MIRROR:
|
||||
from_secret: plugin_mirror
|
||||
DOCKER_BUILDKIT: 1
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
- name: publish-rootless
|
||||
image: techknowlogick/drone-docker:latest
|
||||
image: plugins/docker:latest
|
||||
settings:
|
||||
dockerfile: Dockerfile.rootless
|
||||
auto_tag: false
|
||||
tags: dev-linux-amd64-rootless
|
||||
tags: nightly-linux-amd64-rootless
|
||||
repo: gitea/gitea
|
||||
build_args:
|
||||
- GOPROXY=https://goproxy.io
|
||||
|
@ -1172,6 +1108,10 @@ steps:
|
|||
from_secret: docker_password
|
||||
username:
|
||||
from_secret: docker_username
|
||||
environment:
|
||||
PLUGIN_MIRROR:
|
||||
from_secret: plugin_mirror
|
||||
DOCKER_BUILDKIT: 1
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
|
@ -1205,11 +1145,11 @@ steps:
|
|||
- git fetch --tags --force
|
||||
|
||||
- name: publish
|
||||
image: techknowlogick/drone-docker:latest
|
||||
image: plugins/docker:latest
|
||||
pull: always
|
||||
settings:
|
||||
auto_tag: false
|
||||
tags: ${DRONE_BRANCH##release/v}-dev-linux-amd64
|
||||
tags: ${DRONE_BRANCH##release/v}-nightly-linux-amd64
|
||||
repo: gitea/gitea
|
||||
build_args:
|
||||
- GOPROXY=https://goproxy.io
|
||||
|
@ -1217,17 +1157,21 @@ steps:
|
|||
from_secret: docker_password
|
||||
username:
|
||||
from_secret: docker_username
|
||||
environment:
|
||||
PLUGIN_MIRROR:
|
||||
from_secret: plugin_mirror
|
||||
DOCKER_BUILDKIT: 1
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
- name: publish-rootless
|
||||
image: techknowlogick/drone-docker:latest
|
||||
image: plugins/docker:latest
|
||||
settings:
|
||||
dockerfile: Dockerfile.rootless
|
||||
auto_tag: false
|
||||
tags: ${DRONE_BRANCH##release/v}-dev-linux-amd64-rootless
|
||||
tags: ${DRONE_BRANCH##release/v}-nightlf-linux-amd64-rootless
|
||||
repo: gitea/gitea
|
||||
build_args:
|
||||
- GOPROXY=https://goproxy.io
|
||||
|
@ -1235,6 +1179,10 @@ steps:
|
|||
from_secret: docker_password
|
||||
username:
|
||||
from_secret: docker_username
|
||||
environment:
|
||||
PLUGIN_MIRROR:
|
||||
from_secret: plugin_mirror
|
||||
DOCKER_BUILDKIT: 1
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
|
@ -1243,7 +1191,7 @@ steps:
|
|||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: docker-linux-arm64-dry-run
|
||||
name: docker-linux-amd64-dry-run
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
|
@ -1261,7 +1209,7 @@ trigger:
|
|||
|
||||
steps:
|
||||
- name: dryrun
|
||||
image: techknowlogick/drone-docker:latest
|
||||
image: plugins/docker:latest
|
||||
pull: always
|
||||
settings:
|
||||
dry_run: true
|
||||
|
@ -1272,6 +1220,7 @@ steps:
|
|||
environment:
|
||||
PLUGIN_MIRROR:
|
||||
from_secret: plugin_mirror
|
||||
DOCKER_BUILDKIT: 1
|
||||
when:
|
||||
event:
|
||||
- pull_request
|
||||
|
@ -1308,7 +1257,7 @@ steps:
|
|||
- git fetch --tags --force
|
||||
|
||||
- name: publish
|
||||
image: techknowlogick/drone-docker:latest
|
||||
image: plugins/docker:latest
|
||||
pull: always
|
||||
settings:
|
||||
auto_tag: true
|
||||
|
@ -1320,13 +1269,17 @@ steps:
|
|||
from_secret: docker_password
|
||||
username:
|
||||
from_secret: docker_username
|
||||
environment:
|
||||
PLUGIN_MIRROR:
|
||||
from_secret: plugin_mirror
|
||||
DOCKER_BUILDKIT: 1
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
- name: publish-rootless
|
||||
image: techknowlogick/drone-docker:latest
|
||||
image: plugins/docker:latest
|
||||
settings:
|
||||
dockerfile: Dockerfile.rootless
|
||||
auto_tag: true
|
||||
|
@ -1338,6 +1291,10 @@ steps:
|
|||
from_secret: docker_password
|
||||
username:
|
||||
from_secret: docker_username
|
||||
environment:
|
||||
PLUGIN_MIRROR:
|
||||
from_secret: plugin_mirror
|
||||
DOCKER_BUILDKIT: 1
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
|
@ -1372,7 +1329,7 @@ steps:
|
|||
- git fetch --tags --force
|
||||
|
||||
- name: publish
|
||||
image: techknowlogick/drone-docker:latest
|
||||
image: plugins/docker:latest
|
||||
pull: always
|
||||
settings:
|
||||
tags: ${DRONE_TAG##v}-linux-arm64
|
||||
|
@ -1383,13 +1340,17 @@ steps:
|
|||
from_secret: docker_password
|
||||
username:
|
||||
from_secret: docker_username
|
||||
environment:
|
||||
PLUGIN_MIRROR:
|
||||
from_secret: plugin_mirror
|
||||
DOCKER_BUILDKIT: 1
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
- name: publish-rootless
|
||||
image: techknowlogick/drone-docker:latest
|
||||
image: plugins/docker:latest
|
||||
settings:
|
||||
dockerfile: Dockerfile.rootless
|
||||
tags: ${DRONE_TAG##v}-linux-arm64-rootless
|
||||
|
@ -1400,6 +1361,10 @@ steps:
|
|||
from_secret: docker_password
|
||||
username:
|
||||
from_secret: docker_username
|
||||
environment:
|
||||
PLUGIN_MIRROR:
|
||||
from_secret: plugin_mirror
|
||||
DOCKER_BUILDKIT: 1
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
|
@ -1434,11 +1399,11 @@ steps:
|
|||
- git fetch --tags --force
|
||||
|
||||
- name: publish
|
||||
image: techknowlogick/drone-docker:latest
|
||||
image: plugins/docker:latest
|
||||
pull: always
|
||||
settings:
|
||||
auto_tag: false
|
||||
tags: dev-linux-arm64
|
||||
tags: nightly-linux-arm64
|
||||
repo: gitea/gitea
|
||||
build_args:
|
||||
- GOPROXY=https://goproxy.io
|
||||
|
@ -1446,17 +1411,21 @@ steps:
|
|||
from_secret: docker_password
|
||||
username:
|
||||
from_secret: docker_username
|
||||
environment:
|
||||
PLUGIN_MIRROR:
|
||||
from_secret: plugin_mirror
|
||||
DOCKER_BUILDKIT: 1
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
- name: publish-rootless
|
||||
image: techknowlogick/drone-docker:latest
|
||||
image: plugins/docker:latest
|
||||
settings:
|
||||
dockerfile: Dockerfile.rootless
|
||||
auto_tag: false
|
||||
tags: dev-linux-arm64-rootless
|
||||
tags: nightly-linux-arm64-rootless
|
||||
repo: gitea/gitea
|
||||
build_args:
|
||||
- GOPROXY=https://goproxy.io
|
||||
|
@ -1464,6 +1433,10 @@ steps:
|
|||
from_secret: docker_password
|
||||
username:
|
||||
from_secret: docker_username
|
||||
environment:
|
||||
PLUGIN_MIRROR:
|
||||
from_secret: plugin_mirror
|
||||
DOCKER_BUILDKIT: 1
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
|
@ -1497,11 +1470,11 @@ steps:
|
|||
- git fetch --tags --force
|
||||
|
||||
- name: publish
|
||||
image: techknowlogick/drone-docker:latest
|
||||
image: plugins/docker:latest
|
||||
pull: always
|
||||
settings:
|
||||
auto_tag: false
|
||||
tags: ${DRONE_BRANCH##release/v}-dev-linux-arm64
|
||||
tags: ${DRONE_BRANCH##release/v}-nightly-linux-arm64
|
||||
repo: gitea/gitea
|
||||
build_args:
|
||||
- GOPROXY=https://goproxy.io
|
||||
|
@ -1509,17 +1482,21 @@ steps:
|
|||
from_secret: docker_password
|
||||
username:
|
||||
from_secret: docker_username
|
||||
environment:
|
||||
PLUGIN_MIRROR:
|
||||
from_secret: plugin_mirror
|
||||
DOCKER_BUILDKIT: 1
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
- name: publish-rootless
|
||||
image: techknowlogick/drone-docker:latest
|
||||
image: plugins/docker:latest
|
||||
settings:
|
||||
dockerfile: Dockerfile.rootless
|
||||
auto_tag: false
|
||||
tags: ${DRONE_BRANCH##release/v}-dev-linux-arm64-rootless
|
||||
tags: ${DRONE_BRANCH##release/v}-nightly-linux-arm64-rootless
|
||||
repo: gitea/gitea
|
||||
build_args:
|
||||
- GOPROXY=https://goproxy.io
|
||||
|
@ -1527,6 +1504,10 @@ steps:
|
|||
from_secret: docker_password
|
||||
username:
|
||||
from_secret: docker_username
|
||||
environment:
|
||||
PLUGIN_MIRROR:
|
||||
from_secret: plugin_mirror
|
||||
DOCKER_BUILDKIT: 1
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
plugins:
|
||||
- stylelint-declaration-strict-value
|
||||
|
||||
ignoreFiles:
|
||||
- "**/*.go"
|
||||
|
||||
overrides:
|
||||
- files: ["**/*.less"]
|
||||
customSyntax: postcss-less
|
||||
- files: ["**/chroma/*", "**/codemirror/*", "**/standalone/*", "**/console/*"]
|
||||
rules:
|
||||
scale-unlimited/declaration-strict-value: null
|
||||
- files: ["**/chroma/*", "**/codemirror/*"]
|
||||
rules:
|
||||
block-no-empty: null
|
||||
|
||||
rules:
|
||||
alpha-value-notation: null
|
||||
|
|
547
CHANGELOG.md
547
CHANGELOG.md
|
@ -4,6 +4,553 @@ This changelog goes through all the changes that have been made in each release
|
|||
without substantial changes to our git log; to see the highlights of what has
|
||||
been added to each release, please refer to the [blog](https://blog.gitea.io).
|
||||
|
||||
## [1.19.4](https://github.com/go-gitea/gitea/releases/tag/v1.19.4) - 2023-07-04
|
||||
|
||||
* SECURITY
|
||||
* Fix open redirect check for more cases (#25143) (#25155)
|
||||
* API
|
||||
* Return `404` in the API if the requested webhooks were not found (#24823) (#24830)
|
||||
* Fix `organization` field being `null` in `GET /api/v1/teams/{id}` (#24694) (#24696)
|
||||
* ENHANCEMENTS
|
||||
* Set `--font-weight-bold` to 600 (#24840)
|
||||
* Make mailer SMTP check have timed context (#24751) (#24759)
|
||||
* Do not select line numbers when selecting text from the action run logs (#24594) (#24596)
|
||||
* BUGFIXES
|
||||
* Fix bug when change user name (#25637) (#25645)
|
||||
* Fix task list checkbox toggle to work with YAML front matter (#25184) (#25236)
|
||||
* Hide limited users if viewed by anonymous ghost (#25214) (#25224)
|
||||
* Add `WithPullRequest` for `actionsNotifier` (#25144) (#25196)
|
||||
* Fix parallelly generating index failure with Mysql (#24567) (#25081)
|
||||
* GitLab migration: Sanitize response for reaction list (#25054) (#25059)
|
||||
* Fix users cannot visit issue attachment bug (#25019) (#25027)
|
||||
* Fix missing reference prefix of commits when sync mirror repository (#24994)
|
||||
* Only validate changed columns when update user (#24867) (#24903)
|
||||
* Make DeleteIssue use correct context (#24885)
|
||||
* Fix topics deleted via API not being deleted in org page (#24825) (#24829)
|
||||
* Fix Actions being enabled accidentally (#24802) (#24810)
|
||||
* Fix missed table name on iterate lfs meta objects (#24768) (#24774)
|
||||
* Fix safari cookie session bug (#24772)
|
||||
* Respect original content when creating secrets (#24745) (#24746)
|
||||
* Fix Pull Mirror out-of-sync bugs (#24732) (#24733)
|
||||
* Fix run list broken when trigger user deleted (#24706) (#24709)
|
||||
* Fix issues list page multiple selection update milestones (#24660) (#24663)
|
||||
* Fix: release page for empty or non-existing target (#24659)
|
||||
* Fix close org projects (#24588) (#24591)
|
||||
* Refresh the refernce of the closed PR when reopening (#24231) (#24587)
|
||||
* Fix the permission of team's `Actions` unit issue (#24536) (#24545)
|
||||
* Bump go.etcd.io/bbolt and blevesearch deps (#23062) (#24519)
|
||||
* Fix new wiki page mirror (#24518)
|
||||
* Match unqualified references when syncing pulls as well (#23070)
|
||||
* DOCS
|
||||
* Change branch name from master to main in some documents' links (#25126) (#25139)
|
||||
* Remove unnecessary content on docs (#24976) (#25001)
|
||||
* Unify doc links to use paths relative to doc folder (#24979) (#25000)
|
||||
* Fix docs documenting invalid `@every` for `OLDER_THAN` cron settings (#24695) (#24698)
|
||||
* MISC
|
||||
* Merge different languages for language stats (#24900) (#24921)
|
||||
* Hiding Secrets options when Actions feature is disabled (#24792)
|
||||
* Improve decryption failure message (#24573) (#24575)
|
||||
* Makefile: Use portable !, not GNUish -not, with find(1). (#24565) (#24572)
|
||||
|
||||
## [1.19.3](https://github.com/go-gitea/gitea/releases/tag/1.19.3) - 2023-05-03
|
||||
|
||||
* SECURITY
|
||||
* Use golang 1.20.4 to fix CVE-2023-24539, CVE-2023-24540, and CVE-2023-29400
|
||||
* ENHANCEMENTS
|
||||
* Enable whitespace rendering on selection in Monaco (#24444) (#24485)
|
||||
* Improve milestone filter on issues page (#22423) (#24440)
|
||||
* BUGFIXES
|
||||
* Fix api error message if fork exists (#24487) (#24493)
|
||||
* Fix user-cards format (#24428) (#24431)
|
||||
* Fix incorrect CurrentUser check for docker rootless (#24435)
|
||||
* Getting the tag list does not require being signed in (#24413) (#24416)
|
||||
|
||||
## [1.19.2](https://github.com/go-gitea/gitea/releases/tag/1.19.2) - 2023-04-26
|
||||
|
||||
* SECURITY
|
||||
* Require repo scope for PATs for private repos and basic authentication (#24362) (#24364)
|
||||
* Only delete secrets belonging to its owner (#24284) (#24286)
|
||||
* API
|
||||
* Fix typo in API route (#24310) (#24332)
|
||||
* Fix access token issue on some public endpoints (#24194) (#24259)
|
||||
* ENHANCEMENTS
|
||||
* Fix broken clone script on an empty archived repo (#24339) (#24348)
|
||||
* Fix Monaco IOS keyboard button (#24341) (#24347)
|
||||
* Don't set meta `theme-color` by default (#24340) (#24346)
|
||||
* Wrap too long push mirror addresses (#21120) (#24334)
|
||||
* Add --font-weight-bold and set previous bold to 601 (#24307) (#24331)
|
||||
* Unify nightly naming across binaries and docker images (#24116) (#24308)
|
||||
* Fix footer display (#24251) (#24269)
|
||||
* Fix label color, fix divider in dropdown (#24215) (#24244)
|
||||
* Vertical widths of containers removed (#24184) (#24211)
|
||||
* Use correct locale key for forks page (#24172) (#24175)
|
||||
* Sort repo topic labels by name (#24123) (#24153)
|
||||
* Highlight selected file in the PR file tree (#23947) (#24126)
|
||||
* BUGFIXES
|
||||
* Fix auth check bug (#24382) (#24387)
|
||||
* Add tags list for repos whose release setting is disabled (#23465) (#24369)
|
||||
* Fix wrong error info in RepoRefForAPI (#24344) (#24351)
|
||||
* Fix no edit/close/delete button in org repo project view page (#24349)
|
||||
* Respect the REGISTER_MANUAL_CONFIRM setting when registering via OIDC (#24035) (#24333)
|
||||
* Remove org users who belong to no teams (#24247) (#24313)
|
||||
* Fix bug when deleting wiki with no code write permission (#24274) (#24295)
|
||||
* Handle canceled workflow as a warning instead of a fail (#24282) (#24292)
|
||||
* Load reviewer for comments when dismissing a review (#24281) (#24288)
|
||||
* Show commit history for closed/merged PRs (#24238) (#24261)
|
||||
* Fix owner team access mode value in team_unit table (#24224)
|
||||
* Fix issue attachment handling (#24202) (#24221)
|
||||
* Fix incorrect CORS default values (#24206) (#24217)
|
||||
* Fix template error in pull request with deleted head repo (#24192) (#24216)
|
||||
* Don't list root repository on compare page if pulls not allowed (#24183) (#24210)
|
||||
* Fix calReleaseNumCommitsBehind (#24148) (#24197)
|
||||
* Fix Org edit page bugs: renaming detection, maxlength (#24161) (#24171)
|
||||
* Update redis library to support redis v7 (#24114) (#24156)
|
||||
* Use 1.18's aria role for dropdown menus (#24144) (#24155)
|
||||
* Fix 2-dot direct compare to use the right base commit (#24133) (#24150)
|
||||
* Fix incorrect server error content in RunnersList (#24118) (#24121)
|
||||
* Fix mismatch between hook events and github event types (#24048) (#24091)
|
||||
* BUILD
|
||||
* Support converting varchar to nvarchar for mssql database (#24105) (#24168)
|
||||
|
||||
## [1.19.1](https://github.com/go-gitea/gitea/releases/tag/v1.19.1) - 2023-04-12
|
||||
|
||||
* BREAKING
|
||||
* Rename actions unit to `repo.actions` and add docs for it (#23733) (#23881)
|
||||
* ENHANCEMENTS
|
||||
* Add card type to org/user level project on creation, edit and view (#24043) (#24066)
|
||||
* Refactor commit status for Actions jobs (#23786) (#24060)
|
||||
* Show errors for KaTeX and mermaid on the preview tab (#24009) (#24019)
|
||||
* Show protected branch rule names again (#23907) (#24018)
|
||||
* Adjust sticky PR header to cover background (#23956) (#23999)
|
||||
* Discolor pull request tab labels (#23950) (#23987)
|
||||
* Treat PRs with agit flow as fork PRs when triggering actions. (#23884) (#23967)
|
||||
* Left-align review comments (#23937)
|
||||
* Fix image border-radius (#23886) (#23930)
|
||||
* Scroll collapsed file into view (#23702) (#23929)
|
||||
* Fix code view (diff) broken layout (#23096) (#23918)
|
||||
* Org pages style fixes (#23901) (#23914)
|
||||
* Fix user profile description rendering (#23882) (#23902)
|
||||
* Fix review box viewport overflow issue (#23800) (#23898)
|
||||
* Prefill input values in OAuth settings as intended (#23829) (#23871)
|
||||
* CSS color tweaks (#23828) (#23842)
|
||||
* Fix incorrect visibility dropdown list in add/edit user page (#23804) (#23833)
|
||||
* Add CSS rules for basic colored labels (#23774) (#23777)
|
||||
* Add creation time in tag list page (#23693) (#23773)
|
||||
* Fix br display for packages curls (#23737) (#23764)
|
||||
* Fix issue due date edit toggle bug (#23723) (#23758)
|
||||
* Improve commit graph page UI alignment (#23751) (#23754)
|
||||
* Use GitHub Actions compatible globbing for `branches`, `tag`, `path` filter (#22804) (#23740)
|
||||
* Redirect to project again after editing it (#23326) (#23739)
|
||||
* Remove row clicking from notification table (#22695) (#23706)
|
||||
* Remove conflicting CSS rules on notifications, improve notifications table (#23565) (#23621)
|
||||
* Fix diff tree height and adjust target file style (#23616)
|
||||
* BUGFIXES
|
||||
* Improve error logging for LFS (#24072) (#24082)
|
||||
* Fix custom mailer template on Windows platform (#24081)
|
||||
* Update the value of `diffEnd` when clicking the `Show More` button in the DiffFileTree (#24069) (#24078)
|
||||
* Make label templates have consistent behavior and priority (#23749)
|
||||
* Fix accidental overwriting of LDAP team memberships (#24050) (#24065)
|
||||
* Fix branch protection priority (#24045) (#24061)
|
||||
* Use actions job link as commit status URL instead of run link (#24023) (#24032)
|
||||
* Add actions support to package auth verification (#23729) (#24028)
|
||||
* Fix protected branch for API (#24013) (#24027)
|
||||
* Do not escape space between PyPI repository URL and package name… (#23981) (#24008)
|
||||
* Fix redirect bug when creating issue from a project (#23971) (#23997)
|
||||
* Set `ref` to fully-formed of the tag when trigger event is `release` (#23944) (#23989)
|
||||
* Use Get/Set instead of Rename when regenerating session ID (#23975) (#23983)
|
||||
* Ensure RSS icon is present on all repo tabs (#23904) (#23973)
|
||||
* Remove `Repository.getFilesChanged` to fix Actions `paths` and `paths-ignore` filter (#23920) (#23969)
|
||||
* Delete deleted release attachments immediately from storage (#23913) (#23958)
|
||||
* Use ghost user if package creator does not exist (#23822) (#23915)
|
||||
* User/Org Feed render description as per web (#23887) (#23906)
|
||||
* Fix `cases.Title` crash for concurrency (#23885) (#23903)
|
||||
* Convert .Source.SkipVerify to $cfg.SkipVerify (#23839) (#23899)
|
||||
* Support "." char as user name for User/Orgs in RSS/ATOM/GPG/KEYS path ... (#23874) (#23878)
|
||||
* Fix JS error when changing PR's target branch (#23862) (#23864)
|
||||
* Fix 500 error if there is a name conflict when editing authentication source (#23832) (#23852)
|
||||
* Fix closed PR also triggers Webhooks and actions (#23782) (#23834)
|
||||
* Fix checks for `needs` in Actions (#23789) (#23831)
|
||||
* Fix "Updating branch by merge" bug in "update_branch_by_merge.tmpl" (#23790) (#23825)
|
||||
* Fix cancel button in the page of project edit not work (#23655) (#23813)
|
||||
* Don't apply the group filter when listing LDAP group membership if it is empty (#23745) (#23788)
|
||||
* Fix profile page email display, respect settings (#23747) (#23756)
|
||||
* Fix project card preview select and template select (#23684) (#23731)
|
||||
* Check LFS/Packages settings in dump and doctor command (#23631) (#23730)
|
||||
* Add git dashes separator to some "log" and "diff" commands (#23606) (#23720)
|
||||
* Create commit status when event is `pull_request_sync` (#23683) (#23691)
|
||||
* Fix incorrect `HookEventType` of pull request review comments (#23650) (#23678)
|
||||
* Fix incorrect `show-modal` and `show-panel` class (#23660) (#23663)
|
||||
* Improve workflow event triggers (#23613) (#23648)
|
||||
* Introduce path Clean/Join helper functions, partially backport&refactor (#23495) (#23607)
|
||||
* Fix pagination on `/notifications/watching` (#23564) (#23603)
|
||||
* Fix submodule is nil panic (#23588) (#23601)
|
||||
* Polyfill the window.customElements (#23592) (#23595)
|
||||
* Avoid too long names for actions (#23162) (#23190)
|
||||
* TRANSLATION
|
||||
* Backport locales (with manual fixes) (#23808, #23634, #24083)
|
||||
* BUILD
|
||||
* Hardcode the path to docker images (#23955) (#23968)
|
||||
* DOCS
|
||||
* Update documentation to explain which projects allow Gitea to host static pages (#23993) (#24058)
|
||||
* Merge `push to create`, `open PR from push`, and `push options` docs articles into one (#23744) (#23959)
|
||||
* Fix code blocks in the cheat sheet (#23664) (#23669)
|
||||
* MISC
|
||||
* Do not crash when parsing an invalid workflow file (#23972) (#23976)
|
||||
* Remove assertion debug code for show/hide refactoring (#23576) (#23868)
|
||||
* Add ONLY_SHOW_RELEVANT_REPOS back, fix explore page bug, make code more strict (#23766) (#23791)
|
||||
* Make minio package support legacy MD5 checksum (#23768) (#23770)
|
||||
* Improve template error reporting (#23396) (#23600)
|
||||
|
||||
## [1.19.0](https://github.com/go-gitea/gitea/releases/tag/v1.19.0) - 2023-03-19
|
||||
|
||||
* BREAKING
|
||||
* Add loading yaml label template files (#22976) (#23232)
|
||||
* Make issue and code search support camel case for Bleve (#22829)
|
||||
* Repositories: by default disable all units except code and pulls on forks (#22541)
|
||||
* Support template for merge message description (#22248)
|
||||
* Remove ONLY_SHOW_RELEVANT_REPOS setting (#21962)
|
||||
* Implement actions (#21937)
|
||||
* Remove deprecated DSA host key from Docker Container (#21522)
|
||||
* Improve valid user name check (#20136)
|
||||
* SECURITY
|
||||
* Return 404 instead of 403 if user can not access the repo (#23155) (#23158)
|
||||
* Support scoped access tokens (#20908)
|
||||
* FEATURES
|
||||
* Add support for commit cross references (#22645)
|
||||
* Scoped labels (#22585)
|
||||
* Add Chef package registry (#22554)
|
||||
* Support asciicast files as new markup (#22448)
|
||||
* cgo cross-compile for freebsd (#22397)
|
||||
* Add cron method to gc LFS MetaObjects (#22385)
|
||||
* Add new captcha: cloudflare turnstile (#22369)
|
||||
* Enable `@<user>`- completion popup on the release description textarea (#22359)
|
||||
* make /{username}.png redirect to user/org avatar (#22356)
|
||||
* Add Conda package registry (#22262)
|
||||
* Support org/user level projects (#22235)
|
||||
* Add Mermaid copy button (#22225)
|
||||
* Add user secrets (#22191)
|
||||
* Secrets storage with SecretKey encrypted (#22142)
|
||||
* Preview images for Issue cards in Project Board view (#22112)
|
||||
* Add support for incoming emails (#22056)
|
||||
* Add Cargo package registry (#21888)
|
||||
* Add option to prohibit fork if user reached maximum limit of repositories (#21848)
|
||||
* Add attention blocks within quote blocks for `Note` and `Warning` (#21711)
|
||||
* Add Feed for Releases and Tags (#21696)
|
||||
* Add package registry cleanup rules (#21658)
|
||||
* Add "Copy" button to file view of raw text (#21629)
|
||||
* Allow disable sitemap (#21617)
|
||||
* Add package registry quota limits (#21584)
|
||||
* Map OIDC groups to Orgs/Teams (#21441)
|
||||
* Keep languages defined in .gitattributes (#21403)
|
||||
* Add Webhook authorization header (#20926)
|
||||
* Supports wildcard protected branch (#20825)
|
||||
* Copy citation file content, in APA and BibTex format, on repo home page (#19999)
|
||||
* API
|
||||
* Match api migration behavior to web behavior (#23552) (#23573)
|
||||
* Purge API comment (#23451) (#23452)
|
||||
* User creation API: allow custom "created" timestamps (#22549)
|
||||
* Add `updated_at` field to PullReview API object (#21812)
|
||||
* Add API management for issue/pull and comment attachments (#21783)
|
||||
* Add API endpoint to get latest release (#21267)
|
||||
* Support system hook API (#14537)
|
||||
* ENHANCEMENTS
|
||||
* Add `.patch` to `attachment.ALLOWED_TYPES` (#23580) (#23582)
|
||||
* Fix sticky header in diff view (#23554) (#23568)
|
||||
* Refactor merge/update git command calls (#23366) (#23544)
|
||||
* Fix review comment context menu clipped bug (#23523) (#23543)
|
||||
* Imrove scroll behavior to hash issuecomment(scroll position, auto expand if file is folded, and on refreshing) (#23513) (#23540)
|
||||
* Increase horizontal page padding (#23507) (#23537)
|
||||
* Use octicon-verified for gpg signatures (#23529) (#23536)
|
||||
* Make time tooltips interactive (#23526) (#23527)
|
||||
* Replace Less with CSS (#23508)
|
||||
* Fix 'View File' button in code search (#23478) (#23483)
|
||||
* Convert GitHub event on actions and fix some pull_request events. (#23037) (#23471)
|
||||
* Support reflogs (#22451) (#23438)
|
||||
* Fix actions frontend bugs (pagination, long name alignment) and small simplify (#23370) (#23436)
|
||||
* Scoped label display and documentation tweaks (#23430) (#23433)
|
||||
* Add missing tabs to org projects page (#22705) (#23412)
|
||||
* Fix and move "Use this template" button (#23398) (#23408)
|
||||
* Handle OpenID discovery URL errors a little nicer when creating/editing sources (#23397) (#23403)
|
||||
* Rename `canWriteUnit` to `canWriteProjects` (#23386) (#23399)
|
||||
* Refactor and tidy-up the merge/update branch code (#22568) (#23365)
|
||||
* Refactor `setting.Database.UseXXX` to methods (#23354) (#23356)
|
||||
* Fix incorrect project links and use symlink icon for org-wide projects (#23325) (#23336)
|
||||
* Fix PR view misalignment caused by long name file (#23321) (#23335)
|
||||
* Scoped labels: don't require holding alt key to remove (#23303) (#23331)
|
||||
* Add context when rendering labels or emojis (#23281) (#23319)
|
||||
* Change interactiveBorder to fix popup preview (#23169) (#23314)
|
||||
* Scoped labels: set aria-disabled on muted Exclusive option for a11y (#23306) (#23311)
|
||||
* update to mermaid v10 (#23178) (#23299)
|
||||
* Fix code wrap for unbroken lines (#23268) (#23293)
|
||||
* Use async await to fix empty quote reply at first time (#23168) (#23256)
|
||||
* Fix switched citation format (#23250) (#23253)
|
||||
* Allow `<video>` in MarkDown (#22892) (#23236)
|
||||
* Order pull request conflict checking by recently updated, for each push (#23220) (#23225)
|
||||
* Fix Fomantic UI's `touchstart` fastclick, always use `click` for click events (#23065) (#23195)
|
||||
* Add word-break to sidebar-item-link (#23146) (#23180)
|
||||
* Add InsecureSkipVerify to Minio Client for Storage (#23166) (#23177)
|
||||
* Fix height for sticky head on large screen on PR page (#23111) (#23123)
|
||||
* Change style to improve whitespaces trimming inside inline markdown code (#23093) (#23120)
|
||||
* Avoid warning for system setting when start up (#23054) (#23116)
|
||||
* Add accessibility to the menu on the navbar (#23059) (#23095)
|
||||
* Improve accessibility for issue comments (#22612) (#23083)
|
||||
* Remove delete button for review comment (#23036)
|
||||
* Remove dashes between organization member avatars on hover (#23034)
|
||||
* Use `gt-relative` class instead of the ambiguous `gt-pr` class (#23008)
|
||||
* handle deprecated settings (#22992)
|
||||
* Add scopes to API to create token and display them (#22989)
|
||||
* Improve PR Review Box UI (#22986)
|
||||
* Improve issues.LoadProject (#22982)
|
||||
* Add all units to the units permission list in org team members sidebar (#22971)
|
||||
* Rename `GetUnits` to `LoadUnits` (#22970)
|
||||
* Rename `repo.GetOwner` to `repo.LoadOwner` (#22967)
|
||||
* Rename "People" to "Members" in organization page and use a better icon (#22960)
|
||||
* Fix avatar misalignment (#22955)
|
||||
* Sort issues and pulls by recently updated in user and organization home (#22925)
|
||||
* Add `title` to PR file tree items (#22918)
|
||||
* First step to refactor the `.hide` to `.gt-hidden` (#22916)
|
||||
* Add tooltip to issue reference (#22913)
|
||||
* Always show the `command line instructions` button even if there are conflicts (#22909)
|
||||
* Fix dark-colored description text in arc-green theme (#22908)
|
||||
* Remove Fomantic-UI's `.hidden` CSS class for menu elements (#22895)
|
||||
* Move helpers to be prefixed with `gt-` (#22879)
|
||||
* Move `IsReadmeFile*` from `modules/markup/` to `modules/util` (#22877)
|
||||
* Highlight focused diff file (#22870)
|
||||
* Add some headings to repo views (#22869)
|
||||
* Fix milestone title font problem (#22863)
|
||||
* Pull Requests: setting to allow edits by maintainers by default, tweak UI (#22862)
|
||||
* Introduce customized HTML elements, fix incorrect AppUrl usages in templates (#22861)
|
||||
* Add `/$count` endpoints for NuGet v2 (#22855)
|
||||
* Remove Fomantic-UI's `.hidden` CSS class for checkbox elements (#22851)
|
||||
* Fix notification and stopwatch empty states (#22845)
|
||||
* Always go full width in PR view (#22844)
|
||||
* Improve AppUrl/ROOT_URL checking (#22836)
|
||||
* Fix style of actions rerun button (#22835)
|
||||
* Fix more HTMLURL in templates (#22831)
|
||||
* Fix inconsistent Filter Project name in issue list (#22827)
|
||||
* include build info in Prometheus metrics (#22819)
|
||||
* Make clone URL use current page's host (#22808)
|
||||
* Refactor legacy strange git operations (#22756)
|
||||
* Improve error report when user passes a private key (#22726)
|
||||
* set user dashboard org visibility to basic (#22706)
|
||||
* Fix diff UI for unexpandable items (#22700)
|
||||
* Remove 'primary' class from tab counter labels (#22687)
|
||||
* Add more events details supports for actions (#22680)
|
||||
* Refactor git command package to improve security and maintainability (#22678)
|
||||
* Use relative url in actions view (#22675)
|
||||
* set user visibility class to basic (#22674)
|
||||
* Add repository setting to enable/disable releases unit (#22671)
|
||||
* Remove label color from global issue filters (#22660)
|
||||
* Fix poor alignment of organization description on organization home page (#22656)
|
||||
* Small refactor for loading PRs (#22652)
|
||||
* Allow setting access token scope by CLI (#22648)
|
||||
* Improve accessibility of navigation bar and footer (#22635)
|
||||
* Fixes accessibility behavior of Watching, Staring and Fork buttons (#22634)
|
||||
* Fixes accessibility of empty repository commit status (#22632)
|
||||
* Pull request yaml template support for including commit body in a field (#22629)
|
||||
* Show migration validation error (#22619)
|
||||
* set org visibility class to basic in header (#22605)
|
||||
* Fix cache-control header clearing comment text when editing issue (#22604)
|
||||
* Add ARIA support for Fomantic UI checkboxes (#22599)
|
||||
* Add templates to customize text when creating and migrating repositories (#22597)
|
||||
* Allow setting `redirect_to` cookie on OAuth login (#22594)
|
||||
* Improve checkbox accessibility a bit by adding the title attribute (#22593)
|
||||
* Allow issue templates to not render title (#22589)
|
||||
* Webhooks: for issue close/reopen action, add commit ID that caused it (#22583)
|
||||
* Fix missing title and filter in issue sidebar project menu (#22557)
|
||||
* Issues: support setting issue template field values with query (#22545)
|
||||
* Issues: add Project filter to issues list and search (#22544)
|
||||
* Pull Requests: add color to approved/reject icon in pull requests list (#22543)
|
||||
* Mute all links in issue timeline (#22533)
|
||||
* Dropzone: Add "Copy link" button for new uploads (#22517)
|
||||
* Support importing comment types (#22510)
|
||||
* Load asciicast css async (#22502)
|
||||
* Move delete user to service (#22478)
|
||||
* Change use of Walk to WalkDir to improve disk performance (#22462)
|
||||
* Add reply hint to mail text (#22459)
|
||||
* fix wrong theme class when logged out if default theme is changed (#22408)
|
||||
* Refactor the setting to make unit test easier (#22405)
|
||||
* Improve utils of slices (#22379)
|
||||
* Use context parameter in models/git (#22367)
|
||||
* Always reuse transaction (#22362)
|
||||
* Fix unstable emoji sort (#22346)
|
||||
* Add context cache as a request level cache (#22294)
|
||||
* Reminder for no more logs to console (#22282)
|
||||
* Support estimated count with multiple schemas (#22276)
|
||||
* Move `convert` package to services (#22264)
|
||||
* Use dynamic package type list (#22263)
|
||||
* Hide file borders on sticky diff box (#22217)
|
||||
* Improve notification and stopwatch styles (#22169)
|
||||
* Fixed Project view .board-column height for tall screens. (#22108)
|
||||
* Use multi reader instead to concat strings (#22099)
|
||||
* Use git command instead of exec.Cmd in blame (#22098)
|
||||
* Fix autofilled text visibility in dark mode (#22088)
|
||||
* Rename almost all Ctx functions (#22071)
|
||||
* Rename actions to operations on UI (#22067)
|
||||
* refactor bind functions based on generics (#22055)
|
||||
* Support disabling database auto migration (#22053)
|
||||
* remove duplicated read file code (#22042)
|
||||
* Use link in UI which returned a relative url but not html_url which contains an absolute url (#21986)
|
||||
* Skip initing disabled storages (#21985)
|
||||
* Add doctor command for full GC of LFS (#21978)
|
||||
* Util type to parse ref name (#21969)
|
||||
* Replace fmt.Sprintf with hex.EncodeToString (#21960)
|
||||
* Use random bytes to generate access token (#21959)
|
||||
* Add index for access_token (#21908)
|
||||
* Move all remaining colors into CSS variables (#21903)
|
||||
* Webhook list enhancements (#21893)
|
||||
* Embed Matrix icon as SVG (#21890)
|
||||
* Remove useless "Cancel" buttons (#21872)
|
||||
* fix(web): keep the pages of the navigation in the center (#21867)
|
||||
* fix(web): reduce page jitter on browsers that support overlay scrollbar (#21850)
|
||||
* Improvements for Content Copy (#21842)
|
||||
* Tweak katex options (#21828)
|
||||
* Show syntax lexer name in file view/blame (#21814)
|
||||
* Remove `href="javascript:;"` in "save topics (Done)" button (#21813)
|
||||
* Render number of commits in repo page in a user friendly way (#21786)
|
||||
* Adjust clone timeout error to suggest increasing timeout (#21769)
|
||||
* Update message of reach_limit_of_creation (#21757)
|
||||
* Allow detect whether it's in a database transaction for a context.Context (#21756)
|
||||
* Add configuration for CORS allowed headers (#21747)
|
||||
* Move svg html render to modules/svg (#21716)
|
||||
* Release and Tag List tweaks (#21712)
|
||||
* Remove template previewer (#21701)
|
||||
* Clean up formatting on install page (#21668)
|
||||
* Configure update checker on installation page (#21655)
|
||||
* Merge db.Iterate and IterateObjects (#21641)
|
||||
* Add option to enable CAPTCHA validation for login (#21638)
|
||||
* Allow disable RSS/Atom feed (#21622)
|
||||
* Use CSS color-scheme instead of invert (#21616)
|
||||
* Localize time units on activity heatmap (#21570)
|
||||
* Fix UI column width, button overflow Fomantic's grid (#21559)
|
||||
* feat: notify doers of a merge when automerging (#21553)
|
||||
* Split migrations folder (#21549)
|
||||
* feat: add button to quickly clear merge message (#21548)
|
||||
* Add `context.Context` to more methods (#21546)
|
||||
* Add index for hook_task table (#21545)
|
||||
* Allow disable code tab (#20805)
|
||||
* BUGFIXES
|
||||
* Fix template error when reference Project (#23584)
|
||||
* Fix dropdown icon misalignment when using fomantic icon (#23558) (#23577)
|
||||
* Fix diff detail buttons wrapping, use tippy for review box (#23271) (#23546)
|
||||
* Handle missing `README` in create repos API (#23387) (#23510)
|
||||
* Disable sending email after push a commit to a closed PR (#23462) (#23492)
|
||||
* Fix aria.js bugs: incorrect role element problem, mobile focus problem, tippy problem (#23450) (#23486)
|
||||
* Fix due date being wrong on issue list (#23475) (#23477)
|
||||
* Remove wrongly added column on migration test fixtures (#23456) (#23470)
|
||||
* Make branches list page operations remember current page (#23420) (#23460)
|
||||
* Fix missing commit status in PR which from forked repo (#23351) (#23453)
|
||||
* Show edit/close/delete button on organization wide repositories (#23388) (#23429)
|
||||
* Preserve file size when creating attachments (#23406) (#23426)
|
||||
* Fix broken Chroma CSS styles (#23174) (#23402)
|
||||
* Fix incorrect NotFound conditions in org/projects.go (#23384) (#23395)
|
||||
* Set `X-Gitea-Debug` header once (#23361) (#23381)
|
||||
* Pass context to avatar for projects view (#23359) (#23378)
|
||||
* Fix panic when getting notes by ref (#23372) (#23377)
|
||||
* Do not recognize text files as audio (#23355) (#23368)
|
||||
* Fix adding of empty class name (#23352) (#23360)
|
||||
* Fix various ImageDiff/SVG bugs (#23312) (#23358)
|
||||
* Fix incorrect display for comment context menu (#23343) (#23344)
|
||||
* Remove unnecessary space on link (#23334) (#23340)
|
||||
* Fix incorrect redirect link of delete org project (#23327) (#23339)
|
||||
* Fix cannot reopen after pushing commits to a closed PR (#23189) (#23324)
|
||||
* Fix broken code editor diff preview (#23307) (#23320)
|
||||
* Support sanitising the URL by removing extra slashes in the URL (#21333) (#23300)
|
||||
* Avoid panic caused by broken payload when creating commit status (#23216) (#23294)
|
||||
* Fill head commit to in payload when notifying push commits for mirroring (#23215) (#23292)
|
||||
* Fix various bugs for "install" page (#23194) (#23286)
|
||||
* Fix GetFilesChangedBetween if the file name may be escaped (#23272) (#23279)
|
||||
* Revert relative links to absolute links in mail templates (#23267) (#23269)
|
||||
* Fix commit retrieval by tag (#21804) (#23266)
|
||||
* Use correct README link to render the README (#23152) (#23264)
|
||||
* Close the temp file when dumping database to make the temp file can be deleted on Windows (#23249) (#23251)
|
||||
* Use the correct selector to hide the checkmark of selected labels on clear (#23224) (#23228)
|
||||
* Fix incorrect checkbox behaviors in the dashboard repolist's filter (#23147) (#23205)
|
||||
* Properly flush unique queues on startup (#23154) (#23201)
|
||||
* Pass `--global` when calling `git config --get`, for consistency with `git config --set` (#23157) (#23199)
|
||||
* Make `gitea serv` respect git binary home (#23138) (#23197)
|
||||
* Change button text for commenting and closing an issue at the same time (#23135) (#23182)
|
||||
* Fix DBConsistency checks on MSSQL (#23132) (#23134)
|
||||
* Show empty repos in Admin Repository Management page (#23114) (#23130)
|
||||
* Redirect to the commit page after applying patch (#23056) (#23127)
|
||||
* Fix nil context in RenderMarkdownToHtml (#23092) (#23108)
|
||||
* Make issue meta dropdown support Enter, confirm before reloading (#23014) (#23102)
|
||||
* Fix SyncOnCommit always return false in API of push_mirrors (#23088) (#23100)
|
||||
* Fix commit name in Apply Patch page (#23086) (#23099)
|
||||
* Fix some more hidden problems (#23074) (#23075)
|
||||
* Bump golang.org/x/net from 0.4.0 to 0.7.0 (#22980)
|
||||
* Get rules by id when editing branch protection rule (#22932)
|
||||
* Fix panic when call api (/repos/{owner}/{repo}/pulls/{index}/files) (#22921)
|
||||
* Increase Content field size of gpg_import_key to MEDIUMTEXT (#22897)
|
||||
* Fix hidden commit status on multiple checks (#22889)
|
||||
* Fix update by rebase being wrongly disabled by protected base branch (#22825)
|
||||
* Make issue title edit buttons focusable and fix incorrect ajax requests (#22807)
|
||||
* Fix rerun button of Actions (#22798)
|
||||
* remove update language in ProfilePost (#22748)
|
||||
* Do not overwrite empty DefaultBranch (#22708)
|
||||
* Fix ref to trigger Actions (#22679)
|
||||
* Fix time to NotifyPullRequestSynchronized (#22650)
|
||||
* Show all projects, not just repo projects and open/closed projects (#22640)
|
||||
* Project links should use parent link methods (#22587)
|
||||
* Fix group filter for ldap source sync (#22506)
|
||||
* Check quota limits for container uploads (#22450)
|
||||
* Fix halfCommitter and WithTx (#22366)
|
||||
* Attempt to fix TestExportUserGPGKeys (#22159)
|
||||
* Fix heatmap first color being unused (#22157)
|
||||
* Fix scroll over mermaid frame (#21925)
|
||||
* Move migration test fixtures to the correct directories (#21901)
|
||||
* fix(web): add `alt` for logo in home page (#21887)
|
||||
* Fix webhook attachment text is not set in review comment (#21763)
|
||||
* Alter package_version.metadata_json to LONGTEXT (#21667)
|
||||
* Ensure that Webhook tasks are not double delivered (#21558)
|
||||
* TESTING
|
||||
* Make CI use a dummy password hasher for all tests (#22983)
|
||||
* Disable test for incoming email (#22686)
|
||||
* Move fuzz tests into tests/fuzz (#22376)
|
||||
* Test views of LFS files (#22196)
|
||||
* Specify ID in `TestAPITeam` (#22192)
|
||||
* verify nodeinfo response by schema (#22137)
|
||||
* Skip GitHub migration tests if the API token is undefined (#21824)
|
||||
* Add a simple test for external renderer (#20033)
|
||||
* TRANSLATION
|
||||
* Use "Title Case" for text "Reference in new issue" (#22936)
|
||||
* BUILD
|
||||
* Wrap unless-check in docker manifests (#23079) (#23081)
|
||||
* Adjust manifest to prevent tagging latest on rcs (#22811)
|
||||
* update to build with go1.20 (#22732)
|
||||
* Add Bash and Zsh completion scripts (#22646)
|
||||
* Add Contributed backport command (#22643)
|
||||
* Remove deprecated packages & staticcheck fixes (#22012)
|
||||
* Update to Alpine 3.17 (#21904)
|
||||
* Fix webpack license warning (#21815)
|
||||
* DOCS
|
||||
* Update documentation for the new YAML label file format (#23020) (#23341)
|
||||
* Update hacking-on-gitea-zh_cn documentation (#23315) (#23323)
|
||||
* Add basic documentation for labels, including scoped labels (#23304) (#23309)
|
||||
* Re-add accidentally removed `hacking-on-gitea.zh-cn.md` (#23297) (#23305)
|
||||
* Fix secrets overview page missing from docs sidebar (#23143) (#23145)
|
||||
* Add some guidelines for refactoring (#22880)
|
||||
* Explain that the no-access team unit does not affect public repositories (#22661)
|
||||
* Fix incorrect Redis URL snippets in the example app.ini (#22573)
|
||||
* docs: add swagger.json file location to FAQ (#22489)
|
||||
* Update index.de-de.md (#22363)
|
||||
* Update Gmail mailer configuration (#22291)
|
||||
* Add missed reverse proxy authentication documentation (#22250)
|
||||
* Add plural definitions for German translations (#21802)
|
||||
* Attempt clarify AppWorkPath etc. (#21656)
|
||||
* Add some documentation to packages (#21648)
|
||||
* MISC
|
||||
* Use `<nav>` instead of `<div>` in the global navbar (#23125) (#23533)
|
||||
* Do not create commit graph for temporary repos (#23219) (#23229)
|
||||
* Update button is shown when a Pull Request is marked WIP - Issue #21740 (#22683)
|
||||
* Add main landmark to templates and adjust titles (#22670)
|
||||
* Fix error on account activation with wrong passwd (#22609)
|
||||
* Update JS dependencies (#22538)
|
||||
* Display unreferenced packages total size in package admin panel (#22498)
|
||||
* Mobile fix for Project view: Add delay to Sortable.js on mobile, to ensure scrolling is possible. (#22152)
|
||||
* Update chroma to v2.4.0 (#22000)
|
||||
* Hide collapse icon in diff with no lines (#21094)
|
||||
|
||||
## [1.18.5](https://github.com/go-gitea/gitea/releases/tag/v1.18.5) - 2023-02-21
|
||||
|
||||
* ENHANCEMENTS
|
||||
|
|
|
@ -108,7 +108,7 @@ You can find more information on how to get started with it on the [Modules Wiki
|
|||
|
||||
We do all translation work inside [Crowdin](https://crowdin.com/project/gitea).
|
||||
The only translation that is maintained in this Git repository is
|
||||
[`en_US.ini`](https://github.com/go-gitea/gitea/blob/master/options/locale/locale_en-US.ini)
|
||||
[`en_US.ini`](https://github.com/go-gitea/gitea/blob/main/options/locale/locale_en-US.ini)
|
||||
and is synced regularly to Crowdin. Once a translation has reached
|
||||
A SATISFACTORY PERCENTAGE it will be synced back into this repo and
|
||||
included in the next released version.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#Build stage
|
||||
FROM golang:1.20-alpine3.17 AS build-env
|
||||
FROM docker.io/library/golang:1.20-alpine3.17 AS build-env
|
||||
|
||||
ARG GOPROXY
|
||||
ENV GOPROXY ${GOPROXY:-direct}
|
||||
|
@ -23,7 +23,7 @@ RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
|
|||
# Begin env-to-ini build
|
||||
RUN go build contrib/environment-to-ini/environment-to-ini.go
|
||||
|
||||
FROM alpine:3.17
|
||||
FROM docker.io/library/alpine:3.17
|
||||
LABEL maintainer="maintainers@gitea.io"
|
||||
|
||||
EXPOSE 22 3000
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#Build stage
|
||||
FROM golang:1.20-alpine3.17 AS build-env
|
||||
FROM docker.io/library/golang:1.20-alpine3.17 AS build-env
|
||||
|
||||
ARG GOPROXY
|
||||
ENV GOPROXY ${GOPROXY:-direct}
|
||||
|
@ -23,7 +23,7 @@ RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
|
|||
# Begin env-to-ini build
|
||||
RUN go build contrib/environment-to-ini/environment-to-ini.go
|
||||
|
||||
FROM alpine:3.17
|
||||
FROM docker.io/library/alpine:3.17
|
||||
LABEL maintainer="maintainers@gitea.io"
|
||||
|
||||
EXPOSE 2222 3000
|
||||
|
|
27
Makefile
27
Makefile
|
@ -77,6 +77,7 @@ ifeq ($(RACE_ENABLED),true)
|
|||
endif
|
||||
|
||||
STORED_VERSION_FILE := VERSION
|
||||
HUGO_VERSION ?= 0.111.3
|
||||
|
||||
ifneq ($(DRONE_TAG),)
|
||||
VERSION ?= $(subst v,,$(DRONE_TAG))
|
||||
|
@ -96,6 +97,11 @@ else
|
|||
endif
|
||||
endif
|
||||
|
||||
# if version = "main" then update version to "nightly"
|
||||
ifeq ($(VERSION),main)
|
||||
VERSION := main-nightly
|
||||
endif
|
||||
|
||||
LDFLAGS := $(LDFLAGS) -X "main.MakeVersion=$(MAKE_VERSION)" -X "main.Version=$(GITEA_VERSION)" -X "main.Tags=$(TAGS)"
|
||||
|
||||
LINUX_ARCHS ?= linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64
|
||||
|
@ -105,7 +111,7 @@ GO_TEST_PACKAGES ?= $(filter-out $(shell $(GO) list code.gitea.io/gitea/models/m
|
|||
|
||||
FOMANTIC_WORK_DIR := web_src/fomantic
|
||||
|
||||
WEBPACK_SOURCES := $(shell find web_src/js web_src/less -type f)
|
||||
WEBPACK_SOURCES := $(shell find web_src/js web_src/css -type f)
|
||||
WEBPACK_CONFIGS := webpack.config.js
|
||||
WEBPACK_DEST := public/js/index.js public/css/index.css
|
||||
WEBPACK_DEST_ENTRIES := public/js public/css public/fonts public/img/webpack public/serviceworker.js
|
||||
|
@ -131,10 +137,10 @@ TEST_TAGS ?= sqlite sqlite_unlock_notify
|
|||
TAR_EXCLUDES := .git data indexers queues log node_modules $(EXECUTABLE) $(FOMANTIC_WORK_DIR)/node_modules $(DIST) $(MAKE_EVIDENCE_DIR) $(AIR_TMP_DIR) $(GO_LICENSE_TMP_DIR)
|
||||
|
||||
GO_DIRS := cmd tests models modules routers build services tools
|
||||
WEB_DIRS := web_src/js web_src/less
|
||||
WEB_DIRS := web_src/js web_src/css
|
||||
|
||||
GO_SOURCES := $(wildcard *.go)
|
||||
GO_SOURCES += $(shell find $(GO_DIRS) -type f -name "*.go" -not -path modules/options/bindata.go -not -path modules/public/bindata.go -not -path modules/templates/bindata.go)
|
||||
GO_SOURCES += $(shell find $(GO_DIRS) -type f -name "*.go" ! -path modules/options/bindata.go ! -path modules/public/bindata.go ! -path modules/templates/bindata.go)
|
||||
GO_SOURCES += $(GENERATED_GO_DEST)
|
||||
GO_SOURCES_NO_BINDATA := $(GO_SOURCES)
|
||||
|
||||
|
@ -340,8 +346,8 @@ lint: lint-frontend lint-backend
|
|||
|
||||
.PHONY: lint-frontend
|
||||
lint-frontend: node_modules
|
||||
npx eslint --color --max-warnings=0 --ext js,vue web_src/js build *.config.js docs/assets/js tests/e2e
|
||||
npx stylelint --color --max-warnings=0 web_src/less
|
||||
npx eslint --color --max-warnings=0 --ext js,vue web_src/js build *.config.js tests/e2e
|
||||
npx stylelint --color --max-warnings=0 web_src/css
|
||||
npx spectral lint -q -F hint $(SWAGGER_SPEC)
|
||||
npx markdownlint docs *.md
|
||||
|
||||
|
@ -745,7 +751,7 @@ generate-go: $(TAGS_PREREQ)
|
|||
|
||||
.PHONY: security-check
|
||||
security-check:
|
||||
go run $(GOVULNCHECK_PACKAGE) -v ./...
|
||||
go run $(GOVULNCHECK_PACKAGE) ./...
|
||||
|
||||
$(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ)
|
||||
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
|
||||
|
@ -811,14 +817,11 @@ release-sources: | $(DIST_DIRS)
|
|||
|
||||
.PHONY: release-docs
|
||||
release-docs: | $(DIST_DIRS) docs
|
||||
tar -czf $(DIST)/release/gitea-docs-$(VERSION).tar.gz -C ./docs/public .
|
||||
tar -czf $(DIST)/release/gitea-docs-$(VERSION).tar.gz -C ./docs .
|
||||
|
||||
.PHONY: docs
|
||||
docs:
|
||||
@hash hugo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||
curl -sL https://github.com/gohugoio/hugo/releases/download/v0.74.3/hugo_0.74.3_Linux-64bit.tar.gz | tar zxf - -C /tmp && mv /tmp/hugo /usr/bin/hugo && chmod +x /usr/bin/hugo; \
|
||||
fi
|
||||
cd docs; make trans-copy clean build-offline;
|
||||
cd docs; bash scripts/trans-copy.sh;
|
||||
|
||||
.PHONY: deps
|
||||
deps: deps-frontend deps-backend
|
||||
|
@ -859,6 +862,8 @@ fomantic:
|
|||
cp -f $(FOMANTIC_WORK_DIR)/theme.config.less $(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui/src/theme.config
|
||||
cp -rf $(FOMANTIC_WORK_DIR)/_site $(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui/src/
|
||||
cd $(FOMANTIC_WORK_DIR) && npx gulp -f node_modules/fomantic-ui/gulpfile.js build
|
||||
# fomantic uses "touchstart" as click event for some browsers, it's not ideal, so we force fomantic to always use "click" as click event
|
||||
$(SED_INPLACE) -e 's/clickEvent[ \t]*=/clickEvent = "click", unstableClickEvent =/g' $(FOMANTIC_WORK_DIR)/build/semantic.js
|
||||
$(SED_INPLACE) -e 's/\r//g' $(FOMANTIC_WORK_DIR)/build/semantic.css $(FOMANTIC_WORK_DIR)/build/semantic.js
|
||||
rm -f $(FOMANTIC_WORK_DIR)/build/*.min.*
|
||||
|
||||
|
|
15
assets/go-licenses.json
generated
15
assets/go-licenses.json
generated
File diff suppressed because one or more lines are too long
1
build.go
1
build.go
|
@ -1,7 +1,6 @@
|
|||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
|
||||
//go:build vendor
|
||||
|
||||
package main
|
||||
|
|
11
cmd/admin.go
11
cmd/admin.go
|
@ -7,6 +7,7 @@ package cmd
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
"text/tabwriter"
|
||||
|
@ -469,11 +470,19 @@ func runAddOauth(c *cli.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
config := parseOAuth2Config(c)
|
||||
if config.Provider == "openidConnect" {
|
||||
discoveryURL, err := url.Parse(config.OpenIDConnectAutoDiscoveryURL)
|
||||
if err != nil || (discoveryURL.Scheme != "http" && discoveryURL.Scheme != "https") {
|
||||
return fmt.Errorf("invalid Auto Discovery URL: %s (this must be a valid URL starting with http:// or https://)", config.OpenIDConnectAutoDiscoveryURL)
|
||||
}
|
||||
}
|
||||
|
||||
return auth_model.CreateSource(&auth_model.Source{
|
||||
Type: auth_model.OAuth2,
|
||||
Name: c.String("name"),
|
||||
IsActive: true,
|
||||
Cfg: parseOAuth2Config(c),
|
||||
Cfg: config,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
var CmdConvert = cli.Command{
|
||||
Name: "convert",
|
||||
Usage: "Convert the database",
|
||||
Description: "A command to convert an existing MySQL database from utf8 to utf8mb4",
|
||||
Description: "A command to convert an existing MySQL database from utf8 to utf8mb4 or MSSQL database from varchar to nvarchar",
|
||||
Action: runConvert,
|
||||
}
|
||||
|
||||
|
@ -35,17 +35,22 @@ func runConvert(ctx *cli.Context) error {
|
|||
log.Info("Log path: %s", setting.Log.RootPath)
|
||||
log.Info("Configuration file: %s", setting.CustomConf)
|
||||
|
||||
if !setting.Database.UseMySQL {
|
||||
fmt.Println("This command can only be used with a MySQL database")
|
||||
return nil
|
||||
switch {
|
||||
case setting.Database.Type.IsMySQL():
|
||||
if err := db.ConvertUtf8ToUtf8mb4(); err != nil {
|
||||
log.Fatal("Failed to convert database from utf8 to utf8mb4: %v", err)
|
||||
return err
|
||||
}
|
||||
fmt.Println("Converted successfully, please confirm your database's character set is now utf8mb4")
|
||||
case setting.Database.Type.IsMSSQL():
|
||||
if err := db.ConvertVarcharToNVarchar(); err != nil {
|
||||
log.Fatal("Failed to convert database from varchar to nvarchar: %v", err)
|
||||
return err
|
||||
}
|
||||
fmt.Println("Converted successfully, please confirm your database's all columns character is NVARCHAR now")
|
||||
default:
|
||||
fmt.Println("This command can only be used with a MySQL or MSSQL database")
|
||||
}
|
||||
|
||||
if err := db.ConvertUtf8ToUtf8mb4(); err != nil {
|
||||
log.Fatal("Failed to convert database from utf8 to utf8mb4: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Println("Converted successfully, please confirm your database's character set is now utf8mb4")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -250,6 +250,8 @@ func runDump(ctx *cli.Context) error {
|
|||
|
||||
if ctx.IsSet("skip-lfs-data") && ctx.Bool("skip-lfs-data") {
|
||||
log.Info("Skip dumping LFS data")
|
||||
} else if !setting.LFS.StartServer {
|
||||
log.Info("LFS isn't enabled. Skip dumping LFS data")
|
||||
} else if err := storage.LFS.IterateObjects(func(objPath string, object storage.Object) error {
|
||||
info, err := object.Stat()
|
||||
if err != nil {
|
||||
|
@ -272,13 +274,14 @@ func runDump(ctx *cli.Context) error {
|
|||
fatal("Failed to create tmp file: %v", err)
|
||||
}
|
||||
defer func() {
|
||||
_ = dbDump.Close()
|
||||
if err := util.Remove(dbDump.Name()); err != nil {
|
||||
log.Warn("Unable to remove temporary file: %s: Error: %v", dbDump.Name(), err)
|
||||
}
|
||||
}()
|
||||
|
||||
targetDBType := ctx.String("database")
|
||||
if len(targetDBType) > 0 && targetDBType != setting.Database.Type {
|
||||
if len(targetDBType) > 0 && targetDBType != setting.Database.Type.String() {
|
||||
log.Info("Dumping database %s => %s...", setting.Database.Type, targetDBType)
|
||||
} else {
|
||||
log.Info("Dumping database...")
|
||||
|
@ -363,6 +366,8 @@ func runDump(ctx *cli.Context) error {
|
|||
|
||||
if ctx.IsSet("skip-package-data") && ctx.Bool("skip-package-data") {
|
||||
log.Info("Skip dumping package data")
|
||||
} else if !setting.Packages.Enabled {
|
||||
log.Info("Packages isn't enabled. Skip dumping package data")
|
||||
} else if err := storage.Packages.IterateObjects(func(objPath string, object storage.Object) error {
|
||||
info, err := object.Stat()
|
||||
if err != nil {
|
||||
|
|
|
@ -72,12 +72,21 @@ var CmdMigrateStorage = cli.Command{
|
|||
cli.StringFlag{
|
||||
Name: "minio-base-path",
|
||||
Value: "",
|
||||
Usage: "Minio storage basepath on the bucket",
|
||||
Usage: "Minio storage base path on the bucket",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "minio-use-ssl",
|
||||
Usage: "Enable SSL for minio",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "minio-insecure-skip-verify",
|
||||
Usage: "Skip SSL verification",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "minio-checksum-algorithm",
|
||||
Value: "",
|
||||
Usage: "Minio checksum algorithm (default/md5)",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -168,13 +177,15 @@ func runMigrateStorage(ctx *cli.Context) error {
|
|||
dstStorage, err = storage.NewMinioStorage(
|
||||
stdCtx,
|
||||
storage.MinioStorageConfig{
|
||||
Endpoint: ctx.String("minio-endpoint"),
|
||||
AccessKeyID: ctx.String("minio-access-key-id"),
|
||||
SecretAccessKey: ctx.String("minio-secret-access-key"),
|
||||
Bucket: ctx.String("minio-bucket"),
|
||||
Location: ctx.String("minio-location"),
|
||||
BasePath: ctx.String("minio-base-path"),
|
||||
UseSSL: ctx.Bool("minio-use-ssl"),
|
||||
Endpoint: ctx.String("minio-endpoint"),
|
||||
AccessKeyID: ctx.String("minio-access-key-id"),
|
||||
SecretAccessKey: ctx.String("minio-secret-access-key"),
|
||||
Bucket: ctx.String("minio-bucket"),
|
||||
Location: ctx.String("minio-location"),
|
||||
BasePath: ctx.String("minio-base-path"),
|
||||
UseSSL: ctx.Bool("minio-use-ssl"),
|
||||
InsecureSkipVerify: ctx.Bool("minio-insecure-skip-verify"),
|
||||
ChecksumAlgorithm: ctx.String("minio-checksum-algorithm"),
|
||||
})
|
||||
default:
|
||||
return fmt.Errorf("unsupported storage type: %s", ctx.String("storage"))
|
||||
|
|
25
cmd/serv.go
25
cmd/serv.go
|
@ -11,6 +11,7 @@ import (
|
|||
"net/url"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -290,17 +291,21 @@ func runServ(c *cli.Context) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Special handle for Windows.
|
||||
if setting.IsWindows {
|
||||
verb = strings.Replace(verb, "-", " ", 1)
|
||||
}
|
||||
|
||||
var gitcmd *exec.Cmd
|
||||
verbs := strings.Split(verb, " ")
|
||||
if len(verbs) == 2 {
|
||||
gitcmd = exec.CommandContext(ctx, verbs[0], verbs[1], repoPath)
|
||||
} else {
|
||||
gitcmd = exec.CommandContext(ctx, verb, repoPath)
|
||||
gitBinPath := filepath.Dir(git.GitExecutable) // e.g. /usr/bin
|
||||
gitBinVerb := filepath.Join(gitBinPath, verb) // e.g. /usr/bin/git-upload-pack
|
||||
if _, err := os.Stat(gitBinVerb); err != nil {
|
||||
// if the command "git-upload-pack" doesn't exist, try to split "git-upload-pack" to use the sub-command with git
|
||||
// ps: Windows only has "git.exe" in the bin path, so Windows always uses this way
|
||||
verbFields := strings.SplitN(verb, "-", 2)
|
||||
if len(verbFields) == 2 {
|
||||
// use git binary with the sub-command part: "C:\...\bin\git.exe", "upload-pack", ...
|
||||
gitcmd = exec.CommandContext(ctx, git.GitExecutable, verbFields[1], repoPath)
|
||||
}
|
||||
}
|
||||
if gitcmd == nil {
|
||||
// by default, use the verb (it has been checked above by allowedCommands)
|
||||
gitcmd = exec.CommandContext(ctx, gitBinVerb, repoPath)
|
||||
}
|
||||
|
||||
process.SetSysProcAttribute(gitcmd)
|
||||
|
|
|
@ -931,10 +931,10 @@ ROUTER = console
|
|||
;USE_COMPAT_SSH_URI = false
|
||||
;;
|
||||
;; Close issues as long as a commit on any branch marks it as fixed
|
||||
;; Comma separated list of globally disabled repo units. Allowed values: repo.issues, repo.ext_issues, repo.pulls, repo.wiki, repo.ext_wiki, repo.projects, repo.packages
|
||||
;; Comma separated list of globally disabled repo units. Allowed values: repo.issues, repo.ext_issues, repo.pulls, repo.wiki, repo.ext_wiki, repo.projects, repo.packages, repo.actions.
|
||||
;DISABLED_REPO_UNITS =
|
||||
;;
|
||||
;; Comma separated list of default new repo units. Allowed values: repo.code, repo.releases, repo.issues, repo.pulls, repo.wiki, repo.projects, repo.packages.
|
||||
;; Comma separated list of default new repo units. Allowed values: repo.code, repo.releases, repo.issues, repo.pulls, repo.wiki, repo.projects, repo.packages, repo.actions.
|
||||
;; Note: Code and Releases can currently not be deactivated. If you specify default repo units you should still list them for future compatibility.
|
||||
;; External wiki and issue tracker can't be enabled by default as it requires additional settings.
|
||||
;; Disabled repo units will not be added to new repositories regardless if it is in the default list.
|
||||
|
@ -1191,10 +1191,9 @@ ROUTER = console
|
|||
;; Number of line of codes shown for a code comment
|
||||
;CODE_COMMENT_LINES = 4
|
||||
;;
|
||||
;; Value of `theme-color` meta tag, used by Android >= 5.0
|
||||
;; An invalid color like "none" or "disable" will have the default style
|
||||
;; More info: https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android
|
||||
;THEME_COLOR_META_TAG = `#6cc644`
|
||||
;; Value of `theme-color` meta tag, used by some mobile browers for chrome and
|
||||
;; out-of-viewport areas. Default is unset which uses body color.
|
||||
;THEME_COLOR_META_TAG =
|
||||
;;
|
||||
;; Max size of files to be displayed (default is 8MiB)
|
||||
;MAX_DISPLAY_FILE_SIZE = 8388608
|
||||
|
@ -1226,6 +1225,10 @@ ROUTER = console
|
|||
;;
|
||||
;; Whether to enable a Service Worker to cache frontend assets
|
||||
;USE_SERVICE_WORKER = false
|
||||
;;
|
||||
;; Whether to only show relevant repos on the explore page when no keyword is specified and default sorting is used.
|
||||
;; A repo is considered irrelevant if it's a fork or if it has no metadata (no description, no icon, no topic).
|
||||
;ONLY_SHOW_RELEVANT_REPOS = false
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
@ -1832,7 +1835,7 @@ ROUTER = console
|
|||
;ENABLED = true
|
||||
;;
|
||||
;; Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
|
||||
;ALLOWED_TYPES = .csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip
|
||||
;ALLOWED_TYPES = .csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.patch,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip
|
||||
;;
|
||||
;; Max size of each file. Defaults to 4MB
|
||||
;MAX_SIZE = 4
|
||||
|
@ -1871,6 +1874,12 @@ ROUTER = console
|
|||
;;
|
||||
;; Minio enabled ssl only available when STORAGE_TYPE is `minio`
|
||||
;MINIO_USE_SSL = false
|
||||
;;
|
||||
;; Minio skip SSL verification available when STORAGE_TYPE is `minio`
|
||||
;MINIO_INSECURE_SKIP_VERIFY = false
|
||||
;;
|
||||
;; Minio checksum algorithm: default (for MinIO or AWS S3) or md5 (for Cloudflare or Backblaze)
|
||||
;MINIO_CHECKSUM_ALGORITHM = default
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
@ -2253,6 +2262,17 @@ ROUTER = console
|
|||
;PULL = 300
|
||||
;GC = 60
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Git Reflog timeout in days
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;[git.reflog]
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;ENABLED = true
|
||||
;EXPIRATION = 90
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;[mirror]
|
||||
|
@ -2552,6 +2572,9 @@ ROUTER = console
|
|||
;;
|
||||
;; Minio enabled ssl only available when STORAGE_TYPE is `minio`
|
||||
;MINIO_USE_SSL = false
|
||||
;;
|
||||
;; Minio skip SSL verification available when STORAGE_TYPE is `minio`
|
||||
;MINIO_INSECURE_SKIP_VERIFY = false
|
||||
|
||||
;[proxy]
|
||||
;; Enable the proxy, all requests to external via HTTP will be affected
|
||||
|
|
|
@ -1,21 +1,20 @@
|
|||
image: gitea/gitea:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}{{#if (hasPrefix "refs/heads/release/v" build.ref)}}{{trimPrefix "refs/heads/release/v" build.ref}}-{{/if}}dev{{/if}}-rootless
|
||||
image: gitea/gitea:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}{{#if (hasPrefix "refs/heads/release/v" build.ref)}}{{trimPrefix "refs/heads/release/v" build.ref}}-{{/if}}nightly{{/if}}-rootless
|
||||
{{#if build.tags}}
|
||||
{{#unless contains "-rc" build.tag}}
|
||||
{{#unless (contains "-rc" build.tag)}}
|
||||
tags:
|
||||
{{#each build.tags}}
|
||||
- {{this}}-rootless
|
||||
{{/each}}
|
||||
- "latest-rootless"
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
manifests:
|
||||
-
|
||||
image: gitea/gitea:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}{{#if (hasPrefix "refs/heads/release/v" build.ref)}}{{trimPrefix "refs/heads/release/v" build.ref}}-{{/if}}dev{{/if}}-linux-amd64-rootless
|
||||
image: gitea/gitea:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}{{#if (hasPrefix "refs/heads/release/v" build.ref)}}{{trimPrefix "refs/heads/release/v" build.ref}}-{{/if}}nightly{{/if}}-linux-amd64-rootless
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: linux
|
||||
-
|
||||
image: gitea/gitea:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}{{#if (hasPrefix "refs/heads/release/v" build.ref)}}{{trimPrefix "refs/heads/release/v" build.ref}}-{{/if}}dev{{/if}}-linux-arm64-rootless
|
||||
image: gitea/gitea:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}{{#if (hasPrefix "refs/heads/release/v" build.ref)}}{{trimPrefix "refs/heads/release/v" build.ref}}-{{/if}}nightly{{/if}}-linux-arm64-rootless
|
||||
platform:
|
||||
architecture: arm64
|
||||
os: linux
|
||||
|
|
|
@ -1,21 +1,20 @@
|
|||
image: gitea/gitea:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}{{#if (hasPrefix "refs/heads/release/v" build.ref)}}{{trimPrefix "refs/heads/release/v" build.ref}}-{{/if}}dev{{/if}}
|
||||
image: gitea/gitea:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}{{#if (hasPrefix "refs/heads/release/v" build.ref)}}{{trimPrefix "refs/heads/release/v" build.ref}}-{{/if}}nightly{{/if}}
|
||||
{{#if build.tags}}
|
||||
{{#unless contains "-rc" build.tag }}
|
||||
{{#unless (contains "-rc" build.tag)}}
|
||||
tags:
|
||||
{{#each build.tags}}
|
||||
- {{this}}
|
||||
{{/each}}
|
||||
- "latest"
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
manifests:
|
||||
-
|
||||
image: gitea/gitea:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}{{#if (hasPrefix "refs/heads/release/v" build.ref)}}{{trimPrefix "refs/heads/release/v" build.ref}}-{{/if}}dev{{/if}}-linux-amd64
|
||||
image: gitea/gitea:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}{{#if (hasPrefix "refs/heads/release/v" build.ref)}}{{trimPrefix "refs/heads/release/v" build.ref}}-{{/if}}nightly{{/if}}-linux-amd64
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: linux
|
||||
-
|
||||
image: gitea/gitea:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}{{#if (hasPrefix "refs/heads/release/v" build.ref)}}{{trimPrefix "refs/heads/release/v" build.ref}}-{{/if}}dev{{/if}}-linux-arm64
|
||||
image: gitea/gitea:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}{{#if (hasPrefix "refs/heads/release/v" build.ref)}}{{trimPrefix "refs/heads/release/v" build.ref}}-{{/if}}nightly{{/if}}-linux-arm64
|
||||
platform:
|
||||
architecture: arm64
|
||||
os: linux
|
||||
|
|
|
@ -2,7 +2,15 @@
|
|||
|
||||
if [ ! -d /data/git/.ssh ]; then
|
||||
mkdir -p /data/git/.ssh
|
||||
chmod 700 /data/git/.ssh
|
||||
fi
|
||||
|
||||
# Set the correct permissions on the .ssh directory and authorized_keys file,
|
||||
# or sshd will refuse to use them and lead to clone/push/pull failures.
|
||||
# It could happen when users have copied their data to a new volume and changed the file permission by accident,
|
||||
# and it would be very hard to troubleshoot unless users know how to check the logs of sshd which is started by s6.
|
||||
chmod 700 /data/git/.ssh
|
||||
if [ -f /data/git/.ssh/authorized_keys ]; then
|
||||
chmod 600 /data/git/.ssh/authorized_keys
|
||||
fi
|
||||
|
||||
if [ ! -f /data/git/.ssh/environment ]; then
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
THEME := themes/gitea
|
||||
PUBLIC := public
|
||||
ARCHIVE := https://dl.gitea.io/theme/master.tar.gz
|
||||
|
||||
HUGO_PACKAGE := github.com/gohugoio/hugo@v0.82.0
|
||||
|
||||
.PHONY: all
|
||||
all: build
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf $(PUBLIC) $(THEME)
|
||||
|
||||
.PHONY: trans-copy
|
||||
trans-copy:
|
||||
bash scripts/trans-copy.sh
|
||||
|
||||
.PHONY: server
|
||||
server: $(THEME)
|
||||
go run $(HUGO_PACKAGE) server
|
||||
|
||||
.PHONY: build
|
||||
build: $(THEME)
|
||||
go run $(HUGO_PACKAGE) --cleanDestinationDir
|
||||
|
||||
.PHONY: build-offline
|
||||
build-offline: $(THEME)
|
||||
go run $(HUGO_PACKAGE) --baseURL="/" --cleanDestinationDir
|
||||
|
||||
.PHONY: update
|
||||
update: $(THEME)
|
||||
|
||||
$(THEME): $(THEME)/theme.toml
|
||||
$(THEME)/theme.toml:
|
||||
mkdir -p $$(dirname $@)
|
||||
curl -L -s $(ARCHIVE) | tar xz -C $$(dirname $@)
|
|
@ -3,36 +3,7 @@
|
|||
[![Join the chat at https://img.shields.io/discord/322538954119184384.svg](https://img.shields.io/discord/322538954119184384.svg)](https://discord.gg/Gitea)
|
||||
[![](https://images.microbadger.com/badges/image/gitea/docs.svg)](http://microbadger.com/images/gitea/docs "Get your own image badge on microbadger.com")
|
||||
|
||||
## Hosting
|
||||
|
||||
These pages are hosted using [netlifycms](https://www.netlifycms.org/) and get
|
||||
automatically updated on every push to the `master` branch.
|
||||
|
||||
## Install
|
||||
|
||||
These pages use the [Hugo](https://gohugo.io/) static site generator.
|
||||
If you are planning to contribute you'll want to download and install Hugo on
|
||||
your local machine.
|
||||
|
||||
The installation of Hugo is out of the scope of this document, so please take
|
||||
the [official install instructions](https://gohugo.io/overview/installing/) to
|
||||
get Hugo up and running.
|
||||
|
||||
## Development
|
||||
|
||||
To generate the website and serve it on [localhost:1313](http://localhost:1313)
|
||||
just execute this command and stop it with `Ctrl+C`:
|
||||
|
||||
```
|
||||
make server
|
||||
```
|
||||
|
||||
When you are done with your changes just create a pull request, after merging
|
||||
the pull request the website will be updated automatically.
|
||||
|
||||
## Contributing
|
||||
|
||||
Fork -> Patch -> Push -> Pull Request
|
||||
https://gitea.com/gitea/gitea-docusaurus
|
||||
|
||||
## Authors
|
||||
|
||||
|
|
|
@ -4,27 +4,7 @@
|
|||
[![Join the chat at https://img.shields.io/discord/322538954119184384.svg](https://img.shields.io/discord/322538954119184384.svg)](https://discord.gg/Gitea)
|
||||
[![](https://images.microbadger.com/badges/image/gitea/docs.svg)](http://microbadger.com/images/gitea/docs "Get your own image badge on microbadger.com")
|
||||
|
||||
## 关于托管方式
|
||||
|
||||
本页面托管在我们 Docker 容器内的基础设施上, 它会在每次推送到 `master` 分支的时候自动更新,如果你想自己管理这个页面,你可以从我们的 Docker 镜像 [gitea/docs](https://hub.docker.com/r/gitea/docs/) 中获取它。
|
||||
|
||||
## 安装 Hugo
|
||||
|
||||
本页面使用了 [Hugo](https://github.com/spf13/hugo) 静态页面生成工具,如果您有维护它的意愿,则需要在本地计算机上下载并安装 Hugo。Hugo 的安装教程不在本文档的讲述范围之内,详情请参见 [官方文档](https://gohugo.io/overview/installing/)。
|
||||
|
||||
## 如何部署
|
||||
|
||||
在 [localhost:1313](http://localhost:1313) 处构建和运行网站的命令如下,如果需要停止可以使用组合键 `Ctrl+C`:
|
||||
|
||||
```
|
||||
make server
|
||||
```
|
||||
|
||||
完成更改后,只需创建一个 Pull Request (PR),该 PR 一经合并网站将自动更新。
|
||||
|
||||
## 如何贡献您的代码
|
||||
|
||||
Fork -> Patch -> Push -> Pull Request
|
||||
https://gitea.com/gitea/gitea-docusaurus
|
||||
|
||||
## 关于我们
|
||||
|
||||
|
|
|
@ -1,174 +0,0 @@
|
|||
/* global Fuse, Mark */
|
||||
|
||||
function ready(fn) {
|
||||
if (document.readyState !== 'loading') {
|
||||
fn();
|
||||
} else {
|
||||
document.addEventListener('DOMContentLoaded', fn);
|
||||
}
|
||||
}
|
||||
|
||||
ready(doSearch);
|
||||
|
||||
const summaryInclude = 60;
|
||||
const fuseOptions = {
|
||||
shouldSort: true,
|
||||
includeMatches: true,
|
||||
matchAllTokens: true,
|
||||
threshold: 0, // for parsing diacritics
|
||||
tokenize: true,
|
||||
location: 0,
|
||||
distance: 100,
|
||||
maxPatternLength: 32,
|
||||
minMatchCharLength: 1,
|
||||
keys: [{
|
||||
name: 'title',
|
||||
weight: 0.8
|
||||
},
|
||||
{
|
||||
name: 'contents',
|
||||
weight: 0.5
|
||||
},
|
||||
{
|
||||
name: 'tags',
|
||||
weight: 0.3
|
||||
},
|
||||
{
|
||||
name: 'categories',
|
||||
weight: 0.3
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
function param(name) {
|
||||
return decodeURIComponent((window.location.search.split(`${name}=`)[1] || '').split('&')[0]).replace(/\+/g, ' ');
|
||||
}
|
||||
|
||||
const searchQuery = param('s');
|
||||
|
||||
function doSearch() {
|
||||
if (searchQuery) {
|
||||
document.getElementById('search-query').value = searchQuery;
|
||||
executeSearch(searchQuery);
|
||||
} else {
|
||||
const para = document.createElement('P');
|
||||
para.textContent = 'Please enter a word or phrase above';
|
||||
document.getElementById('search-results').appendChild(para);
|
||||
}
|
||||
}
|
||||
|
||||
function getJSON(url, fn) {
|
||||
const request = new XMLHttpRequest();
|
||||
request.open('GET', url, true);
|
||||
request.addEventListener('load', () => {
|
||||
if (request.status >= 200 && request.status < 400) {
|
||||
const data = JSON.parse(request.responseText);
|
||||
fn(data);
|
||||
} else {
|
||||
console.error(`Target reached on ${url} with error ${request.status}`);
|
||||
}
|
||||
});
|
||||
request.addEventListener('error', () => {
|
||||
console.error(`Connection error ${request.status}`);
|
||||
});
|
||||
request.send();
|
||||
}
|
||||
|
||||
function executeSearch(searchQuery) {
|
||||
getJSON(`/${document.LANG}/index.json`, (data) => {
|
||||
const pages = data;
|
||||
const fuse = new Fuse(pages, fuseOptions);
|
||||
const result = fuse.search(searchQuery);
|
||||
document.getElementById('search-results').innerHTML = '';
|
||||
if (result.length > 0) {
|
||||
populateResults(result);
|
||||
} else {
|
||||
const para = document.createElement('P');
|
||||
para.textContent = 'No matches found';
|
||||
document.getElementById('search-results').appendChild(para);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function populateResults(result) {
|
||||
for (const [key, value] of result.entries()) {
|
||||
const content = value.item.contents;
|
||||
let snippet = '';
|
||||
const snippetHighlights = [];
|
||||
if (fuseOptions.tokenize) {
|
||||
snippetHighlights.push(searchQuery);
|
||||
for (const mvalue of value.matches) {
|
||||
if (mvalue.key === 'tags' || mvalue.key === 'categories') {
|
||||
snippetHighlights.push(mvalue.value);
|
||||
} else if (mvalue.key === 'contents') {
|
||||
const ind = content.toLowerCase().indexOf(searchQuery.toLowerCase());
|
||||
const start = ind - summaryInclude > 0 ? ind - summaryInclude : 0;
|
||||
const end = ind + searchQuery.length + summaryInclude < content.length ? ind + searchQuery.length + summaryInclude : content.length;
|
||||
snippet += content.substring(start, end);
|
||||
if (ind > -1) {
|
||||
snippetHighlights.push(content.substring(ind, ind + searchQuery.length));
|
||||
} else {
|
||||
snippetHighlights.push(mvalue.value.substring(mvalue.indices[0][0], mvalue.indices[0][1] - mvalue.indices[0][0] + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (snippet.length < 1) {
|
||||
snippet += content.substring(0, summaryInclude * 2);
|
||||
}
|
||||
// pull template from hugo template definition
|
||||
const templateDefinition = document.getElementById('search-result-template').innerHTML;
|
||||
// replace values
|
||||
const output = render(templateDefinition, {
|
||||
key,
|
||||
title: value.item.title,
|
||||
link: value.item.permalink,
|
||||
tags: value.item.tags,
|
||||
categories: value.item.categories,
|
||||
snippet
|
||||
});
|
||||
document.getElementById('search-results').appendChild(htmlToElement(output));
|
||||
|
||||
for (const snipvalue of snippetHighlights) {
|
||||
new Mark(document.getElementById(`summary-${key}`)).mark(snipvalue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function render(templateString, data) {
|
||||
let conditionalMatches, copy;
|
||||
const conditionalPattern = /\$\{\s*isset ([a-zA-Z]*) \s*\}(.*)\$\{\s*end\s*}/g;
|
||||
// since loop below depends on re.lastInxdex, we use a copy to capture any manipulations whilst inside the loop
|
||||
copy = templateString;
|
||||
while ((conditionalMatches = conditionalPattern.exec(templateString)) !== null) {
|
||||
if (data[conditionalMatches[1]]) {
|
||||
// valid key, remove conditionals, leave content.
|
||||
copy = copy.replace(conditionalMatches[0], conditionalMatches[2]);
|
||||
} else {
|
||||
// not valid, remove entire section
|
||||
copy = copy.replace(conditionalMatches[0], '');
|
||||
}
|
||||
}
|
||||
templateString = copy;
|
||||
// now any conditionals removed we can do simple substitution
|
||||
let key, find, re;
|
||||
for (key of Object.keys(data)) {
|
||||
find = `\\$\\{\\s*${key}\\s*\\}`;
|
||||
re = new RegExp(find, 'g');
|
||||
templateString = templateString.replace(re, data[key]);
|
||||
}
|
||||
return templateString;
|
||||
}
|
||||
|
||||
/**
|
||||
* By Mark Amery: https://stackoverflow.com/a/35385518
|
||||
* @param {String} HTML representing a single element
|
||||
* @return {Element}
|
||||
*/
|
||||
function htmlToElement(html) {
|
||||
const template = document.createElement('template');
|
||||
html = html.trim(); // Never return a text node of whitespace as the result
|
||||
template.innerHTML = html;
|
||||
return template.content.firstChild;
|
||||
}
|
364
docs/config.yaml
364
docs/config.yaml
|
@ -1,364 +0,0 @@
|
|||
baseurl: https://docs.gitea.io/
|
||||
languageCode: en-us
|
||||
title: Docs
|
||||
theme: gitea
|
||||
|
||||
defaultContentLanguage: en-us
|
||||
defaultContentLanguageInSubdir: true
|
||||
enableMissingTranslationPlaceholders: true
|
||||
enableEmoji: true
|
||||
|
||||
permalinks:
|
||||
post: /:year/:month/:title/
|
||||
doc: /:slug/
|
||||
page: /:slug/
|
||||
default: /:slug/
|
||||
|
||||
params:
|
||||
description: Git with a cup of tea
|
||||
author: The Gitea Authors
|
||||
website: https://docs.gitea.io
|
||||
version: 1.18.5
|
||||
minGoVersion: 1.19
|
||||
goVersion: 1.20
|
||||
minNodeVersion: 16
|
||||
search: nav
|
||||
repo: "https://github.com/go-gitea/gitea"
|
||||
docContentPath: "docs/content"
|
||||
|
||||
outputs:
|
||||
home:
|
||||
- HTML
|
||||
- RSS
|
||||
- JSON
|
||||
|
||||
menu:
|
||||
page:
|
||||
- name: Website
|
||||
url: https://gitea.io/en-us/
|
||||
weight: 10
|
||||
pre: home
|
||||
- name: Docs
|
||||
url: /en-us/
|
||||
weight: 20
|
||||
pre: question
|
||||
post: active
|
||||
- name: API
|
||||
url: https://try.gitea.io/api/swagger
|
||||
weight: 45
|
||||
pre: plug
|
||||
- name: Blog
|
||||
url: https://blog.gitea.io/
|
||||
weight: 30
|
||||
pre: rss
|
||||
- name: Shop
|
||||
url: https://shop.gitea.io/
|
||||
weight: 40
|
||||
pre: shopping-cart
|
||||
- name: Translation
|
||||
url: https://crowdin.com/project/gitea
|
||||
weight: 41
|
||||
pre: language
|
||||
- name: Downloads
|
||||
url: https://dl.gitea.io/
|
||||
weight: 50
|
||||
pre: download
|
||||
- name: GitHub
|
||||
url: https://github.com/go-gitea/
|
||||
weight: 60
|
||||
pre: github
|
||||
- name: Discord Chat
|
||||
url: https://discord.gg/Gitea
|
||||
weight: 70
|
||||
pre: comment
|
||||
- name: Forum
|
||||
url: https://discourse.gitea.io/
|
||||
weight: 80
|
||||
pre: group
|
||||
|
||||
languages:
|
||||
en-us:
|
||||
weight: 0
|
||||
languageName: English
|
||||
|
||||
zh-cn:
|
||||
weight: 1
|
||||
languageName: 中文(简体)
|
||||
menu:
|
||||
page:
|
||||
- name: 网站
|
||||
url: https://gitea.io/zh-cn/
|
||||
weight: 10
|
||||
pre: home
|
||||
- name: 文档
|
||||
url: /zh-cn/
|
||||
weight: 20
|
||||
pre: question
|
||||
post: active
|
||||
- name: API
|
||||
url: https://try.gitea.io/api/swagger
|
||||
weight: 45
|
||||
pre: plug
|
||||
- name: 博客
|
||||
url: https://blog.gitea.io/
|
||||
weight: 30
|
||||
pre: rss
|
||||
- name: 导入
|
||||
url: https://code.gitea.io/
|
||||
weight: 40
|
||||
pre: code
|
||||
- name: 翻译
|
||||
url: https://crowdin.com/project/gitea
|
||||
weight: 41
|
||||
pre: language
|
||||
- name: 下载
|
||||
url: https://dl.gitea.io/
|
||||
weight: 50
|
||||
pre: download
|
||||
- name: GitHub
|
||||
url: https://github.com/go-gitea/
|
||||
weight: 60
|
||||
pre: github
|
||||
- name: Discord Chat
|
||||
url: https://discord.gg/Gitea
|
||||
weight: 70
|
||||
pre: comment
|
||||
- name: Forum
|
||||
url: https://discourse.gitea.io/
|
||||
weight: 80
|
||||
pre: group
|
||||
|
||||
zh-tw:
|
||||
weight: 2
|
||||
languageName: 中文(繁體)
|
||||
menu:
|
||||
page:
|
||||
- name: 網站
|
||||
url: https://gitea.io/zh-tw/
|
||||
weight: 10
|
||||
pre: home
|
||||
- name: 文件
|
||||
url: /zh-tw/
|
||||
weight: 20
|
||||
pre: question
|
||||
post: active
|
||||
- name: API
|
||||
url: https://try.gitea.io/api/swagger
|
||||
weight: 45
|
||||
pre: plug
|
||||
- name: 部落格
|
||||
url: https://blog.gitea.io/
|
||||
weight: 30
|
||||
pre: rss
|
||||
- name: 商店
|
||||
url: https://shop.gitea.io/
|
||||
weight: 40
|
||||
pre: shopping-cart
|
||||
- name: 翻譯
|
||||
url: https://crowdin.com/project/gitea
|
||||
weight: 41
|
||||
pre: language
|
||||
- name: 下載
|
||||
url: https://dl.gitea.io/
|
||||
weight: 50
|
||||
pre: download
|
||||
- name: GitHub
|
||||
url: https://github.com/go-gitea/
|
||||
weight: 60
|
||||
pre: github
|
||||
- name: Discord 聊天室
|
||||
url: https://discord.gg/Gitea
|
||||
weight: 70
|
||||
pre: comment
|
||||
- name: 討論區
|
||||
url: https://discourse.gitea.io/
|
||||
weight: 80
|
||||
pre: group
|
||||
|
||||
pt-br:
|
||||
weight: 3
|
||||
languageName: Português Brasileiro
|
||||
menu:
|
||||
page:
|
||||
- name: Página inicial
|
||||
url: https://gitea.io/pt-br/
|
||||
weight: 10
|
||||
pre: home
|
||||
- name: Documentação
|
||||
url: /pt-br/
|
||||
weight: 20
|
||||
pre: question
|
||||
post: active
|
||||
- name: API
|
||||
url: https://try.gitea.io/api/swagger
|
||||
weight: 45
|
||||
pre: plug
|
||||
- name: Blog
|
||||
url: https://blog.gitea.io/
|
||||
weight: 30
|
||||
pre: rss
|
||||
- name: Código-fonte
|
||||
url: https://code.gitea.io/
|
||||
weight: 40
|
||||
pre: code
|
||||
- name: Translation
|
||||
url: https://crowdin.com/project/gitea
|
||||
weight: 41
|
||||
pre: language
|
||||
- name: Downloads
|
||||
url: https://dl.gitea.io/
|
||||
weight: 50
|
||||
pre: download
|
||||
- name: GitHub
|
||||
url: https://github.com/go-gitea/
|
||||
weight: 60
|
||||
pre: github
|
||||
- name: Chat no Discord
|
||||
url: https://discord.gg/Gitea
|
||||
weight: 70
|
||||
pre: comment
|
||||
- name: Forum
|
||||
url: https://discourse.gitea.io/
|
||||
weight: 80
|
||||
pre: group
|
||||
|
||||
nl-nl:
|
||||
weight: 4
|
||||
languageName: Nederlands
|
||||
menu:
|
||||
page:
|
||||
- name: Website
|
||||
url: https://gitea.io/nl-nl/
|
||||
weight: 10
|
||||
pre: home
|
||||
- name: Docs
|
||||
url: /nl-nl/
|
||||
weight: 20
|
||||
pre: question
|
||||
post: active
|
||||
- name: API
|
||||
url: https://try.gitea.io/api/swagger
|
||||
weight: 45
|
||||
pre: plug
|
||||
- name: Blog
|
||||
url: https://blog.gitea.io/
|
||||
weight: 30
|
||||
pre: rss
|
||||
- name: Code
|
||||
url: https://code.gitea.io/
|
||||
weight: 40
|
||||
pre: code
|
||||
- name: Translation
|
||||
url: https://crowdin.com/project/gitea
|
||||
weight: 41
|
||||
pre: language
|
||||
- name: Downloads
|
||||
url: https://dl.gitea.io/
|
||||
weight: 50
|
||||
pre: download
|
||||
- name: GitHub
|
||||
url: https://github.com/go-gitea/
|
||||
weight: 60
|
||||
pre: github
|
||||
- name: Discord Chat
|
||||
url: https://discord.gg/Gitea
|
||||
weight: 70
|
||||
pre: comment
|
||||
- name: Forum
|
||||
url: https://discourse.gitea.io/
|
||||
weight: 80
|
||||
pre: group
|
||||
|
||||
fr-fr:
|
||||
weight: 5
|
||||
languageName: Français
|
||||
menu:
|
||||
page:
|
||||
- name: Site
|
||||
url: https://gitea.io/en-us/
|
||||
weight: 10
|
||||
pre: home
|
||||
post: active
|
||||
- name: Documentation
|
||||
url: /fr-fr/
|
||||
weight: 20
|
||||
pre: question
|
||||
- name: API
|
||||
url: https://try.gitea.io/api/swagger
|
||||
weight: 45
|
||||
pre: plug
|
||||
- name: Blog
|
||||
url: https://blog.gitea.io/
|
||||
weight: 30
|
||||
pre: rss
|
||||
- name: Code
|
||||
url: https://code.gitea.io/
|
||||
weight: 40
|
||||
pre: code
|
||||
- name: Translation
|
||||
url: https://crowdin.com/project/gitea
|
||||
weight: 41
|
||||
pre: language
|
||||
- name: Téléchargement
|
||||
url: https://dl.gitea.io/
|
||||
weight: 50
|
||||
pre: download
|
||||
- name: GitHub
|
||||
url: https://github.com/go-gitea/
|
||||
weight: 60
|
||||
pre: github
|
||||
- name: Discord Chat
|
||||
url: https://discord.gg/Gitea
|
||||
weight: 70
|
||||
pre: comment
|
||||
- name: Forum
|
||||
url: https://discourse.gitea.io/
|
||||
weight: 80
|
||||
pre: group
|
||||
|
||||
de-de:
|
||||
weight: 6
|
||||
languageName: Deutsch
|
||||
menu:
|
||||
page:
|
||||
- name: Webseite
|
||||
url: https://gitea.io/en-us/
|
||||
weight: 10
|
||||
pre: home
|
||||
post: active
|
||||
- name: Dokumentation
|
||||
url: /de-de/
|
||||
weight: 20
|
||||
pre: question
|
||||
- name: API
|
||||
url: https://try.gitea.io/api/swagger
|
||||
weight: 45
|
||||
pre: plug
|
||||
- name: Blog
|
||||
url: https://blog.gitea.io/
|
||||
weight: 30
|
||||
pre: rss
|
||||
- name: Code
|
||||
url: https://code.gitea.io/
|
||||
weight: 40
|
||||
pre: code
|
||||
- name: Übersetzung
|
||||
url: https://crowdin.com/project/gitea
|
||||
weight: 41
|
||||
pre: language
|
||||
- name: Downloads
|
||||
url: https://dl.gitea.io/
|
||||
weight: 50
|
||||
pre: download
|
||||
- name: GitHub
|
||||
url: https://github.com/go-gitea/
|
||||
weight: 60
|
||||
pre: github
|
||||
- name: Discord Chat
|
||||
url: https://discord.gg/Gitea
|
||||
weight: 70
|
||||
pre: comment
|
||||
- name: Forum
|
||||
url: https://discourse.gitea.io/
|
||||
weight: 80
|
||||
pre: group
|
14
docs/content/administration.en-us.md
Normal file
14
docs/content/administration.en-us.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
date: "2016-12-01T16:00:00+02:00"
|
||||
title: "Administration"
|
||||
slug: "administration"
|
||||
sidebar_position: 30
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
name: "Administration"
|
||||
sidebar_position: 20
|
||||
collapse: true
|
||||
identifier: "administration"
|
||||
---
|
|
@ -1,13 +1,13 @@
|
|||
---
|
||||
date: "2017-08-23T09:00:00+02:00"
|
||||
title: "Avancé"
|
||||
slug: "advanced"
|
||||
weight: 30
|
||||
slug: "administration"
|
||||
sidebar_position: 30
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
name: "Avancé"
|
||||
weight: 40
|
||||
identifier: "advanced"
|
||||
sidebar_position: 20
|
||||
identifier: "administration"
|
||||
---
|
13
docs/content/administration.zh-cn.md
Normal file
13
docs/content/administration.zh-cn.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
date: "2016-12-01T16:00:00+02:00"
|
||||
title: "运维"
|
||||
slug: "administration"
|
||||
sidebar_position: 30
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
name: "运维"
|
||||
sidebar_position: 20
|
||||
identifier: "administration"
|
||||
---
|
13
docs/content/administration.zh-tw.md
Normal file
13
docs/content/administration.zh-tw.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
date: "2016-12-01T16:00:00+02:00"
|
||||
title: "運維"
|
||||
slug: "administration"
|
||||
sidebar_position: 30
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
name: "運維"
|
||||
sidebar_position: 20
|
||||
identifier: "administration"
|
||||
---
|
|
@ -2,15 +2,15 @@
|
|||
date: "2019-12-28"
|
||||
title: "Adding Legal Pages"
|
||||
slug: adding-legal-pages
|
||||
weight: 9
|
||||
sidebar_position: 110
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "advanced"
|
||||
parent: "administration"
|
||||
name: "Adding Legal Pages"
|
||||
identifier: "adding-legal-pages"
|
||||
weight: 9
|
||||
sidebar_position: 110
|
||||
---
|
||||
|
||||
Some jurisdictions (such as EU), requires certain legal pages (e.g. Privacy Policy) to be added to website. Follow these steps to add them to your Gitea instance.
|
40
docs/content/administration/adding-legal-pages.zh-cn.md
Normal file
40
docs/content/administration/adding-legal-pages.zh-cn.md
Normal file
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
date: "2023-05-23T09:00:00+08:00"
|
||||
title: "添加法律页面"
|
||||
slug: adding-legal-pages
|
||||
sidebar_position: 110
|
||||
toc: false
|
||||
draft: false
|
||||
aliases:
|
||||
- /zh-cn/adding-legal-pages
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "administration"
|
||||
name: "添加法律页面"
|
||||
identifier: "adding-legal-pages"
|
||||
sidebar_position: 110
|
||||
---
|
||||
|
||||
一些法域(例如欧盟)要求在网站上添加特定的法律页面(例如隐私政策)。按照以下步骤将它们添加到你的 Gitea 实例中。
|
||||
|
||||
## 获取页面
|
||||
|
||||
Gitea 源代码附带了示例页面,位于 `contrib/legal` 目录中。将它们复制到 `custom/public/` 目录下。例如,如果要添加隐私政策:
|
||||
|
||||
```
|
||||
wget -O /path/to/custom/public/privacy.html https://raw.githubusercontent.com/go-gitea/gitea/main/contrib/legal/privacy.html.sample
|
||||
```
|
||||
|
||||
现在,你需要编辑该页面以满足你的需求。特别是,你必须更改电子邮件地址、网址以及与 "Your Gitea Instance" 相关的引用,以匹配你的情况。
|
||||
|
||||
请务必不要放置会暗示 Gitea 项目对你的服务器负责的一般服务条款或隐私声明。
|
||||
|
||||
## 使其可见
|
||||
|
||||
创建或追加到 `/path/to/custom/templates/custom/extra_links_footer.tmpl` 文件中:
|
||||
|
||||
```go
|
||||
<a class="item" href="{{AppSubUrl}}/assets/privacy.html">隐私政策</a>
|
||||
```
|
||||
|
||||
重启 Gitea 以查看更改。
|
|
@ -1,15 +1,15 @@
|
|||
---
|
||||
date: "2017-01-01T16:00:00+02:00"
|
||||
title: "Usage: Backup and Restore"
|
||||
title: "Backup and Restore"
|
||||
slug: "backup-and-restore"
|
||||
weight: 11
|
||||
sidebar_position: 11
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "usage"
|
||||
parent: "administration"
|
||||
name: "Backup and Restore"
|
||||
weight: 11
|
||||
sidebar_position: 11
|
||||
identifier: "backup-and-restore"
|
||||
---
|
||||
|
||||
|
@ -18,10 +18,6 @@ menu:
|
|||
Gitea currently has a `dump` command that will save the installation to a ZIP file. This
|
||||
file can be unpacked and used to restore an instance.
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
## Backup Consistency
|
||||
|
||||
To ensure the consistency of the Gitea instance, it must be shutdown during backup.
|
|
@ -1,15 +1,15 @@
|
|||
---
|
||||
date: "2018-06-06T09:33:00+08:00"
|
||||
title: "使用:备份与恢复"
|
||||
title: "备份与恢复"
|
||||
slug: "backup-and-restore"
|
||||
weight: 11
|
||||
sidebar_position: 11
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "usage"
|
||||
parent: "administration"
|
||||
name: "备份与恢复"
|
||||
weight: 11
|
||||
sidebar_position: 11
|
||||
identifier: "backup-and-restore"
|
||||
---
|
||||
|
|
@ -2,14 +2,14 @@
|
|||
date: "2017-01-01T16:00:00+02:00"
|
||||
title: "用法: 備份與還原"
|
||||
slug: "backup-and-restore"
|
||||
weight: 11
|
||||
sidebar_position: 11
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "usage"
|
||||
parent: "administration"
|
||||
name: "備份與還原"
|
||||
weight: 11
|
||||
sidebar_position: 11
|
||||
identifier: "backup-and-restore"
|
||||
---
|
||||
|
|
@ -2,26 +2,22 @@
|
|||
date: "2020-01-25T21:00:00-03:00"
|
||||
title: "Embedded data extraction tool"
|
||||
slug: "cmd-embedded"
|
||||
weight: 40
|
||||
sidebar_position: 20
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "advanced"
|
||||
parent: "administration"
|
||||
name: "Embedded data extraction tool"
|
||||
weight: 40
|
||||
sidebar_position: 20
|
||||
identifier: "cmd-embedded"
|
||||
---
|
||||
|
||||
# Embedded data extraction tool
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
Gitea's executable contains all the resources required to run: templates, images, style-sheets
|
||||
and translations. Any of them can be overridden by placing a replacement in a matching path
|
||||
inside the `custom` directory (see [Customizing Gitea]({{< relref "doc/advanced/customizing-gitea.en-us.md" >}})).
|
||||
inside the `custom` directory (see [Customizing Gitea](administration/customizing-gitea.md)).
|
||||
|
||||
To obtain a copy of the embedded resources ready for editing, the `embedded` command from the CLI
|
||||
can be used from the OS shell interface.
|
||||
|
@ -85,7 +81,7 @@ The default is the current directory.
|
|||
The `--custom` flag tells Gitea to extract the files directly into the `custom` directory.
|
||||
For this to work, the command needs to know the location of the `app.ini` configuration
|
||||
file (`--config`) and, depending of the configuration, be ran from the directory where
|
||||
Gitea normally starts. See [Customizing Gitea]({{< relref "doc/advanced/customizing-gitea.en-us.md" >}}) for details.
|
||||
Gitea normally starts. See [Customizing Gitea](administration/customizing-gitea.md) for details.
|
||||
|
||||
The `--overwrite` flag allows any existing files in the destination directory to be overwritten.
|
||||
|
101
docs/content/administration/cmd-embedded.zh-cn.md
Normal file
101
docs/content/administration/cmd-embedded.zh-cn.md
Normal file
|
@ -0,0 +1,101 @@
|
|||
---
|
||||
date: "2023-05-23T09:00:00+08:00"
|
||||
title: "嵌入资源提取工具"
|
||||
slug: "cmd-embedded"
|
||||
sidebar_position: 20
|
||||
toc: false
|
||||
draft: false
|
||||
aliases:
|
||||
- /zh-cn/cmd-embedded
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "administration"
|
||||
name: "嵌入资源提取工具"
|
||||
sidebar_position: 20
|
||||
identifier: "cmd-embedded"
|
||||
---
|
||||
|
||||
# 嵌入资源提取工具
|
||||
|
||||
Gitea 的可执行文件包含了运行所需的所有资源:模板、图片、样式表和翻译文件。你可以通过在 `custom` 目录下的相应路径中放置替换文件来覆盖其中的任何资源(详见 [自定义 Gitea 配置](administration/customizing-gitea.md))。
|
||||
|
||||
要获取嵌入资源的副本以进行编辑,可以使用 CLI 中的 `embedded` 命令,通过操作系统的 shell 执行。
|
||||
|
||||
**注意:** 嵌入资源提取工具包含在 Gitea 1.12 及以上版本中。
|
||||
|
||||
## 资源列表
|
||||
|
||||
要列出嵌入在 Gitea 可执行文件中的资源,请使用以下语法:
|
||||
|
||||
```sh
|
||||
gitea embedded list [--include-vendored] [patterns...]
|
||||
```
|
||||
|
||||
`--include-vendored` 标志使命令包括被供应的文件,这些文件通常被排除在外;即来自外部库的文件,这些文件是 Gitea 所需的(例如 [octicons](https://octicons.github.com/) 等)。
|
||||
|
||||
可以提供一系列文件搜索模式。Gitea 使用 [gobwas/glob](https://github.com/gobwas/glob) 作为其 glob 语法。以下是一些示例:
|
||||
|
||||
- 列出所有模板文件,无论在哪个虚拟目录下:`**.tmpl`
|
||||
- 列出所有邮件模板文件:`templates/mail/**.tmpl`
|
||||
- 列出 `public/img` 目录下的所有文件:`public/img/**`
|
||||
|
||||
不要忘记为模式使用引号,因为空格、`*` 和其他字符可能对命令行解释器有特殊含义。
|
||||
|
||||
如果未提供模式,则列出所有文件。
|
||||
|
||||
### 示例
|
||||
|
||||
列出所有路径中包含 `openid` 的嵌入文件:
|
||||
|
||||
```sh
|
||||
$ gitea embedded list '**openid**'
|
||||
public/img/auth/openid_connect.svg
|
||||
public/img/openid-16x16.png
|
||||
templates/user/auth/finalize_openid.tmpl
|
||||
templates/user/auth/signin_openid.tmpl
|
||||
templates/user/auth/signup_openid_connect.tmpl
|
||||
templates/user/auth/signup_openid_navbar.tmpl
|
||||
templates/user/auth/signup_openid_register.tmpl
|
||||
templates/user/settings/security_openid.tmpl
|
||||
```
|
||||
|
||||
## 提取资源
|
||||
|
||||
要提取嵌入在 Gitea 可执行文件中的资源,请使用以下语法:
|
||||
|
||||
```sh
|
||||
gitea [--config {file}] embedded extract [--destination {dir}|--custom] [--overwrite|--rename] [--include-vendored] {patterns...}
|
||||
```
|
||||
|
||||
`--config` 选项用于告知 Gitea `app.ini` 配置文件的位置(如果不在默认位置)。此选项仅在使用 `--custom` 标志时使用。
|
||||
|
||||
`--destination` 选项用于指定提取文件的目标目录。默认为当前目录。
|
||||
|
||||
`--custom` 标志告知 Gitea 直接将文件提取到 `custom` 目录中。为使其正常工作,该命令需要知道 `app.ini` 配置文件的位置(通过 `--config` 指定),并且根据配置的不同,需要从 Gitea 通常启动的目录运行。有关详细信息,请参阅 [自定义 Gitea 配置](administration/customizing-gitea.md)。
|
||||
|
||||
`--overwrite` 标志允许覆盖目标目录中的任何现有文件。
|
||||
|
||||
`--rename` 标志告知 Gitea 将目标目录中的任何现有文件重命名为 `filename.bak`。之前的 `.bak` 文件将被覆盖。
|
||||
|
||||
至少需要提供一个文件搜索模式;有关模式的语法和示例,请参阅上述 `list` 子命令。
|
||||
|
||||
### 重要提示
|
||||
|
||||
请确保**只提取需要自定义的文件**。位于 `custom` 目录中的文件不会受到 Gitea 的升级过程的影响。当 Gitea 升级到新版本(通过替换可执行文件)时,许多嵌入文件将发生变化。Gitea 将尊重并使用在 `custom` 目录中找到的任何文件,即使这些文件是旧的和不兼容的。
|
||||
|
||||
### 示例
|
||||
|
||||
将邮件模板提取到临时目录:
|
||||
|
||||
```sh
|
||||
$ mkdir tempdir
|
||||
$ gitea embedded extract --destination tempdir 'templates/mail/**.tmpl'
|
||||
Extracting to tempdir:
|
||||
tempdir/templates/mail/auth/activate.tmpl
|
||||
tempdir/templates/mail/auth/activate_email.tmpl
|
||||
tempdir/templates/mail/auth/register_notify.tmpl
|
||||
tempdir/templates/mail/auth/reset_passwd.tmpl
|
||||
tempdir/templates/mail/issue/assigned.tmpl
|
||||
tempdir/templates/mail/issue/default.tmpl
|
||||
tempdir/templates/mail/notify/collaborator.tmpl
|
||||
```
|
|
@ -1,24 +1,20 @@
|
|||
---
|
||||
date: "2017-01-01T16:00:00+02:00"
|
||||
title: "Usage: Command Line"
|
||||
title: "Command Line"
|
||||
slug: "command-line"
|
||||
weight: 10
|
||||
sidebar_position: 1
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "usage"
|
||||
parent: "administration"
|
||||
name: "Command Line"
|
||||
weight: 10
|
||||
sidebar_position: 1
|
||||
identifier: "command-line"
|
||||
---
|
||||
|
||||
# Command Line
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
## Usage
|
||||
|
||||
`gitea [global options] command [command or global options] [arguments...]`
|
552
docs/content/administration/command-line.zh-cn.md
Normal file
552
docs/content/administration/command-line.zh-cn.md
Normal file
|
@ -0,0 +1,552 @@
|
|||
---
|
||||
date: "2023-05-23T09:00:00+08:00"
|
||||
title: "Gitea 命令行"
|
||||
slug: "command-line"
|
||||
sidebar_position: 1
|
||||
toc: false
|
||||
draft: false
|
||||
aliases:
|
||||
- /zh-cn/command-line
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "administration"
|
||||
name: "Gitea 命令行"
|
||||
sidebar_position: 1
|
||||
identifier: "command-line"
|
||||
---
|
||||
|
||||
# 命令行
|
||||
|
||||
## 用法
|
||||
|
||||
`gitea [全局选项] 命令 [命令或全局选项] [参数...]`
|
||||
|
||||
## 全局选项
|
||||
|
||||
所有全局选项均可被放置在命令级别。
|
||||
|
||||
- `--help`,`-h`:显示帮助文本并退出。可选。
|
||||
- `--version`,`-v`:显示版本信息并退出。可选。 (示例:`Gitea version 1.1.0+218-g7b907ed built with: bindata, sqlite`)。
|
||||
- `--custom-path path`,`-C path`:Gitea 自定义文件夹的路径。可选。 (默认值:`AppWorkPath`/custom 或 `$GITEA_CUSTOM`)。
|
||||
- `--config path`,`-c path`:Gitea 配置文件的路径。可选。 (默认值:`custom`/conf/app.ini)。
|
||||
- `--work-path path`,`-w path`:Gitea 的 `AppWorkPath`。可选。 (默认值:LOCATION_OF_GITEA_BINARY 或 `$GITEA_WORK_DIR`)
|
||||
|
||||
注意:默认的 custom-path、config 和 work-path 也可以在构建时更改(如果需要)。
|
||||
|
||||
## 命令
|
||||
|
||||
### web
|
||||
|
||||
启动服务器:
|
||||
|
||||
- 选项:
|
||||
- `--port number`,`-p number`:端口号。可选。 (默认值:3000)。覆盖配置文件中的设置。
|
||||
- `--install-port number`:运行安装页面的端口号。可选。 (默认值:3000)。覆盖配置文件中的设置。
|
||||
- `--pid path`,`-P path`:Pid 文件的路径。可选。
|
||||
- `--quiet`,`-q`:只在控制台上输出 Fatal 日志,用于在设置日志之前发出的日志。
|
||||
- `--verbose`:在控制台上输出跟踪日志,用于在设置日志之前发出的日志。
|
||||
- 示例:
|
||||
- `gitea web`
|
||||
- `gitea web --port 80`
|
||||
- `gitea web --config /etc/gitea.ini --pid /some/custom/gitea.pid`
|
||||
- 注意:
|
||||
- Gitea 不应以 root 用户身份运行。要绑定到低于 1024 的端口,您可以在 Linux 上使用 setcap 命令:`sudo setcap 'cap_net_bind_service=+ep' /path/to/gitea`。每次更新 Gitea 都需要重新执行此操作。
|
||||
|
||||
### admin
|
||||
|
||||
管理员操作:
|
||||
|
||||
- 命令:
|
||||
- `user`:
|
||||
- `list`:
|
||||
- 选项:
|
||||
- `--admin`:仅列出管理员用户。可选。
|
||||
- 描述:列出所有现有用户。
|
||||
- 示例:
|
||||
- `gitea admin user list`
|
||||
- `delete`:
|
||||
- 选项:
|
||||
- `--email`:要删除的用户的电子邮件。
|
||||
- `--username`:要删除的用户的用户名。
|
||||
- `--id`:要删除的用户的ID。
|
||||
- 必须提供 `--id`、`--username` 或 `--email` 中的一个。如果提供多个,则所有条件必须匹配。
|
||||
- 示例:
|
||||
- `gitea admin user delete --id 1`
|
||||
- `create`:
|
||||
- 选项:
|
||||
- `--name value`:用户名。必填。自 Gitea 1.9.0 版本起,请改用 `--username` 标志。
|
||||
- `--username value`:用户名。必填。Gitea 1.9.0 新增。
|
||||
- `--password value`:密码。必填。
|
||||
- `--email value`:邮箱。必填。
|
||||
- `--admin`:如果提供此选项,将创建一个管理员用户。可选。
|
||||
- `--access-token`:如果提供,将为用户创建访问令牌。可选。(默认值:false)。
|
||||
- `--must-change-password`:如果提供,创建的用户将在初始登录后需要选择一个新密码。可选。(默认值:true)。
|
||||
- `--random-password`:如果提供,将使用随机生成的密码作为创建用户的密码。`--password` 的值将被忽略。可选。
|
||||
- `--random-password-length`:如果提供,将用于配置随机生成密码的长度。可选。(默认值:12)
|
||||
- 示例:
|
||||
- `gitea admin user create --username myname --password asecurepassword --email me@example.com`
|
||||
- `change-password`:
|
||||
- 选项:
|
||||
- `--username value`,`-u value`:用户名。必填。
|
||||
- `--password value`,`-p value`:新密码。必填。
|
||||
- 示例:
|
||||
- `gitea admin user change-password --username myname --password asecurepassword`
|
||||
- `must-change-password`:
|
||||
- 参数:
|
||||
- `[username...]`:需要更改密码的用户
|
||||
- 选项:
|
||||
- `--all`,`-A`:强制所有用户更改密码
|
||||
- `--exclude username`,`-e username`:排除给定的用户。可以多次设置。
|
||||
- `--unset`:撤销对给定用户的强制密码更改
|
||||
- `regenerate`:
|
||||
- 选项:
|
||||
- `hooks`:重新生成所有仓库的 Git Hooks。
|
||||
- `keys`:重新生成 authorized_keys 文件。
|
||||
- 示例:
|
||||
- `gitea admin regenerate hooks`
|
||||
- `gitea admin regenerate keys`
|
||||
- `auth`:
|
||||
- `list`:
|
||||
- 描述:列出所有存在的外部认证源。
|
||||
- 示例:
|
||||
- `gitea admin auth list`
|
||||
- `delete`:
|
||||
- 选项:
|
||||
- `--id`:要删除的源的 ID。必填。
|
||||
- 示例:
|
||||
- `gitea admin auth delete --id 1`
|
||||
- `add-oauth`:
|
||||
- 选项:
|
||||
- `--name`:应用程序名称。
|
||||
- `--provider`:OAuth2 提供者。
|
||||
- `--key`:客户端 ID(Key)。
|
||||
- `--secret`:客户端密钥。
|
||||
- `--auto-discover-url`:OpenID Connect 自动发现 URL(仅在使用 OpenID Connect 作为提供程序时需要)。
|
||||
- `--use-custom-urls`:在 GitLab/GitHub OAuth 端点上使用自定义 URL。
|
||||
- `--custom-tenant-id`:在 OAuth 端点上使用自定义租户 ID。
|
||||
- `--custom-auth-url`:使用自定义授权 URL(GitLab/GitHub 的选项)。
|
||||
- `--custom-token-url`:使用自定义令牌 URL(GitLab/GitHub 的选项)。
|
||||
- `--custom-profile-url`:使用自定义配置文件 URL(GitLab/GitHub 的选项)。
|
||||
- `--custom-email-url`:使用自定义电子邮件 URL(GitHub 的选项)。
|
||||
- `--icon-url`:OAuth2 登录源的自定义图标 URL。
|
||||
- `--skip-local-2fa`:允许源覆盖本地 2FA。(可选)
|
||||
- `--scopes`:请求此 OAuth2 源的附加范围。(可选)
|
||||
- `--required-claim-name`:必须设置的声明名称,以允许用户使用此源登录。(可选)
|
||||
- `--required-claim-value`:必须设置的声明值,以允许用户使用此源登录。(可选)
|
||||
- `--group-claim-name`:提供此源的组名的声明名称。(可选)
|
||||
- `--admin-group`:管理员用户的组声明值。(可选)
|
||||
- `--restricted-group`:受限用户的组声明值。(可选)
|
||||
- `--group-team-map`:组与组织团队之间的 JSON 映射。(可选)
|
||||
- `--group-team-map-removal`:根据组自动激活团队成员资格的删除。(可选)
|
||||
- 示例:
|
||||
- `gitea admin auth add-oauth --name external-github --provider github --key OBTAIN_FROM_SOURCE --secret OBTAIN_FROM_SOURCE`
|
||||
- `update-oauth`:
|
||||
- 选项:
|
||||
- `--id`:要更新的源的 ID。必填。
|
||||
- `--name`:应用程序名称。
|
||||
- `--provider`:OAuth2 提供者。
|
||||
- `--key`:客户端 ID(Key)。
|
||||
- `--secret`:客户端密钥。
|
||||
- `--auto-discover-url`:OpenID Connect 自动发现 URL(仅在使用 OpenID Connect 作为提供程序时需要)。
|
||||
- `--use-custom-urls`:在 GitLab/GitHub OAuth 端点上使用自定义 URL。
|
||||
- `--custom-tenant-id`:在 OAuth 端点上使用自定义租户 ID。
|
||||
- `--custom-auth-url`:使用自定义授权 URL(GitLab/GitHub 的选项)。
|
||||
- `--custom-token-url`:使用自定义令牌 URL(GitLab/GitHub 的选项)。
|
||||
- `--custom-profile-url`:使用自定义配置文件 URL(GitLab/GitHub 的选项)。
|
||||
- `--custom-email-url`:使用自定义电子邮件 URL(GitHub 的选项)。
|
||||
- `--icon-url`:OAuth2 登录源的自定义图标 URL。
|
||||
- `--skip-local-2fa`:允许源覆盖本地 2FA。(可选)
|
||||
- `--scopes`:请求此 OAuth2 源的附加范围。
|
||||
- `--required-claim-name`:必须设置的声明名称,以允许用户使用此源登录。(可选)
|
||||
- `--required-claim-value`:必须设置的声明值,以允许用户使用此源登录。(可选)
|
||||
- `--group-claim-name`:提供此源的组名的声明名称。(可选)
|
||||
- `--admin-group`:管理员用户的组声明值。(可选)
|
||||
- `--restricted-group`:受限用户的组声明值。(可选)
|
||||
- 示例:
|
||||
- `gitea admin auth update-oauth --id 1 --name external-github-updated`
|
||||
- `add-smtp`:
|
||||
- 选项:
|
||||
- `--name`:应用程序名称。必填。
|
||||
- `--auth-type`:SMTP 认证类型(PLAIN/LOGIN/CRAM-MD5)。默认为 PLAIN。
|
||||
- `--host`:SMTP 主机。必填。
|
||||
- `--port`:SMTP 端口。必填。
|
||||
- `--force-smtps`:SMTPS 始终在端口 465 上使用。设置此选项以强制在其他端口上使用 SMTPS。
|
||||
- `--skip-verify`:跳过 TLS 验证。
|
||||
- `--helo-hostname`:发送 HELO 时使用的主机名。留空以发送当前主机名。
|
||||
- `--disable-helo`:禁用 SMTP helo。
|
||||
- `--allowed-domains`:留空以允许所有域。使用逗号(',')分隔多个域。
|
||||
- `--skip-local-2fa`:跳过 2FA 登录。
|
||||
- `--active`:启用此认证源。
|
||||
备注:
|
||||
`--force-smtps`、`--skip-verify`、`--disable-helo`、`--skip-local-2fs` 和 `--active` 选项可以采用以下形式使用:
|
||||
- `--option`、`--option=true` 以启用选项
|
||||
- `--option=false` 以禁用选项
|
||||
如果未指定这些选项,则在 `update-smtp` 中不会更改值,或者在 `add-smtp` 中将使用默认的 `false` 值。
|
||||
- 示例:
|
||||
- `gitea admin auth add-smtp --name ldap --host smtp.mydomain.org --port 587 --skip-verify --active`
|
||||
- `update-smtp`:
|
||||
- 选项:
|
||||
- `--id`:要更新的源的 ID。必填。
|
||||
- 其他选项与 `add-smtp` 共享
|
||||
- 示例:
|
||||
- `gitea admin auth update-smtp --id 1 --host smtp.mydomain.org --port 587 --skip-verify=false`
|
||||
- `gitea admin auth update-smtp --id 1 --active=false`
|
||||
- `add-ldap`:添加新的 LDAP(通过 Bind DN)认证源
|
||||
- 选项:
|
||||
- `--name value`:认证名称。必填。
|
||||
- `--not-active`:停用认证源。
|
||||
- `--security-protocol value`:安全协议名称。必填。
|
||||
- `--skip-tls-verify`:禁用 TLS 验证。
|
||||
- `--host value`:LDAP 服务器的地址。必填。
|
||||
- `--port value`:连接到 LDAP 服务器时使用的端口。必填。
|
||||
- `--user-search-base value`:用户帐户将在其中搜索的 LDAP 基础路径。必填。
|
||||
- `--user-filter value`:声明如何查找试图进行身份验证的用户记录的 LDAP 过滤器。必填。
|
||||
- `--admin-filter value`:指定是否应授予用户管理员特权的 LDAP 过滤器。
|
||||
- `--restricted-filter value`:指定是否应将用户设置为受限状态的 LDAP 过滤器。
|
||||
- `--username-attribute value`:用户 LDAP 记录中包含用户名的属性。
|
||||
- `--firstname-attribute value`:用户 LDAP 记录中包含用户名字的属性。
|
||||
- `--surname-attribute value`:用户 LDAP 记录中包含用户姓氏的属性。
|
||||
- `--email-attribute value`:用户 LDAP 记录中包含用户电子邮件地址的属性。必填。
|
||||
- `--public-ssh-key-attribute value`:用户 LDAP 记录中包含用户公共 SSH 密钥的属性。
|
||||
- `--avatar-attribute value`:用户 LDAP 记录中包含用户头像的属性。
|
||||
- `--bind-dn value`:在搜索用户时绑定到 LDAP 服务器的 DN。
|
||||
- `--bind-password value`:绑定 DN 的密码(如果有)。
|
||||
- `--attributes-in-bind`:在绑定 DN 上下文中获取属性。
|
||||
- `--synchronize-users`:启用用户同步。
|
||||
- `--page-size value`:搜索页面大小。
|
||||
- 示例:
|
||||
- `gitea admin auth add-ldap --name ldap --security-protocol unencrypted --host mydomain.org --port 389 --user-search-base "ou=Users,dc=mydomain,dc=org" --user-filter "(&(objectClass=posixAccount)(|(uid=%[1]s)(mail=%[1]s)))" --email-attribute mail`
|
||||
- `update-ldap`:更新现有的 LDAP(通过 Bind DN)认证源
|
||||
- 选项:
|
||||
- `--id value`:认证源的 ID。必填。
|
||||
- `--name value`:认证名称。
|
||||
- `--not-active`:停用认证源。
|
||||
- `--security-protocol value`:安全协议名称。
|
||||
- `--skip-tls-verify`:禁用 TLS 验证。
|
||||
- `--host value`:LDAP 服务器的地址。
|
||||
- `--port value`:连接到 LDAP 服务器时使用的端口。
|
||||
- `--user-search-base value`:用户帐户将在其中搜索的 LDAP 基础路径。
|
||||
- `--user-filter value`:声明如何查找试图进行身份验证的用户记录的 LDAP 过滤器。
|
||||
- `--admin-filter value`:指定是否应授予用户管理员特权的 LDAP 过滤器。
|
||||
- `--restricted-filter value`:指定是否应将用户设置为受限状态的 LDAP 过滤器。
|
||||
- `--username-attribute value`:用户 LDAP 记录中包含用户名的属性。
|
||||
- `--firstname-attribute value`:用户 LDAP 记录中包含用户名字的属性。
|
||||
- `--surname-attribute value`:用户 LDAP 记录中包含用户姓氏的属性。
|
||||
- `--email-attribute value`:用户 LDAP 记录中包含用户电子邮件地址的属性。
|
||||
- `--public-ssh-key-attribute value`:用户 LDAP 记录中包含用户公共 SSH 密钥的属性。
|
||||
- `--avatar-attribute value`:用户 LDAP 记录中包含用户头像的属性。
|
||||
- `--bind-dn value`:在搜索用户时绑定到 LDAP 服务器的 DN。
|
||||
- `--bind-password value`:绑定 DN 的密码(如果有)。
|
||||
- `--attributes-in-bind`:在绑定 DN 上下文中获取属性。
|
||||
- `--synchronize-users`:启用用户同步。
|
||||
- `--page-size value`:搜索页面大小。
|
||||
- 示例:
|
||||
- `gitea admin auth update-ldap --id 1 --name "my ldap auth source"`
|
||||
- `gitea admin auth update-ldap --id 1 --username-attribute uid --firstname-attribute givenName --surname-attribute sn`
|
||||
- `add-ldap-simple`:添加新的 LDAP(简单身份验证)认证源
|
||||
- 选项:
|
||||
- `--name value`:认证名称。必填。
|
||||
- `--not-active`:停用认证源。
|
||||
- `--security-protocol value`:安全协议名称。必填。
|
||||
- `--skip-tls-verify`:禁用 TLS 验证。
|
||||
- `--host value`:LDAP 服务器的地址。必填。
|
||||
- `--port value`:连接到 LDAP 服务器时使用的端口。必填。
|
||||
- `--user-search-base value`:用户帐户将在其中搜索的 LDAP 基础路径。
|
||||
- `--user-filter value`:声明如何查找试图进行身份验证的用户记录的 LDAP 过滤器。必填。
|
||||
- `--admin-filter value`:指定是否应授予用户管理员特权的 LDAP 过滤器。
|
||||
- `--restricted-filter value`:指定是否应将用户设置为受限状态的 LDAP 过滤器。
|
||||
- `--username-attribute value`:用户 LDAP 记录中包含用户名的属性。
|
||||
- `--firstname-attribute value`:用户 LDAP 记录中包含用户名字的属性。
|
||||
- `--surname-attribute value`:用户 LDAP 记录中包含用户姓氏的属性。
|
||||
- `--email-attribute value`:用户 LDAP 记录中包含用户电子邮件地址的属性。必填。
|
||||
- `--public-ssh-key-attribute value`:用户 LDAP 记录中包含用户公共 SSH 密钥的属性。
|
||||
- `--avatar-attribute value`:用户 LDAP 记录中包含用户头像的属性。
|
||||
- `--user-dn value`:用户的 DN。必填。
|
||||
- 示例:
|
||||
- `gitea admin auth add-ldap-simple --name ldap --security-protocol unencrypted --host mydomain.org --port 389 --user-dn "cn=%s,ou=Users,dc=mydomain,dc=org" --user-filter "(&(objectClass=posixAccount)(cn=%s))" --email-attribute mail`
|
||||
- `update-ldap-simple`:更新现有的 LDAP(简单身份验证)认证源
|
||||
- 选项:
|
||||
- `--id value`:认证源的 ID。必填。
|
||||
- `--name value`:认证名称。
|
||||
- `--not-active`:停用认证源。
|
||||
- `--security-protocol value`:安全协议名称。
|
||||
- `--skip-tls-verify`:禁用 TLS 验证。
|
||||
- `--host value`:LDAP 服务器的地址。
|
||||
- `--port value`:连接到 LDAP 服务器时使用的端口。
|
||||
- `--user-search-base value`:用户帐户将在其中搜索的 LDAP 基础路径。
|
||||
- `--user-filter value`:声明如何查找试图进行身份验证的用户记录的 LDAP 过滤器。
|
||||
- `--admin-filter value`:指定是否应授予用户管理员特权的 LDAP 过滤器。
|
||||
- `--restricted-filter value`:指定是否应将用户设置为受限状态的 LDAP 过滤器。
|
||||
- `--username-attribute value`:用户 LDAP 记录中包含用户名的属性。
|
||||
- `--firstname-attribute value`:用户 LDAP 记录中包含用户名字的属性。
|
||||
- `--surname-attribute value`:用户 LDAP 记录中包含用户姓氏的属性。
|
||||
- `--email-attribute value`:用户 LDAP 记录中包含用户电子邮件地址的属性。
|
||||
- `--public-ssh-key-attribute value`:用户 LDAP 记录中包含用户公共 SSH 密钥的属性。
|
||||
- `--avatar-attribute value`:用户 LDAP 记录中包含用户头像的属性。
|
||||
- `--user-dn value`:用户的 DN。
|
||||
- 示例:
|
||||
- `gitea admin auth update-ldap-simple --id 1 --name "my ldap auth source"`
|
||||
- `gitea admin auth update-ldap-simple --id 1 --username-attribute uid --firstname-attribute givenName --surname-attribute sn`
|
||||
|
||||
### cert
|
||||
|
||||
生成自签名的SSL证书。将输出到当前目录下的`cert.pem`和`key.pem`文件中,并且会覆盖任何现有文件。
|
||||
|
||||
- 选项:
|
||||
- `--host value`:逗号分隔的主机名和IP地址列表,此证书适用于这些主机。支持使用通配符。必填。
|
||||
- `--ecdsa-curve value`:用于生成密钥的ECDSA曲线。可选。有效选项为P224、P256、P384、P521。
|
||||
- `--rsa-bits value`:要生成的RSA密钥的大小。可选。如果设置了--ecdsa-curve,则忽略此选项。(默认值:2048)。
|
||||
- `--start-date value`:证书的创建日期。可选。(格式:`Jan 1 15:04:05 2011`)。
|
||||
- `--duration value`:证书有效期。可选。(默认值:8760h0m0s)
|
||||
- `--ca`:如果提供此选项,则证书将生成自己的证书颁发机构。可选。
|
||||
- 示例:
|
||||
- `gitea cert --host git.example.com,example.com,www.example.com --ca`
|
||||
|
||||
### dump
|
||||
|
||||
将所有文件和数据库导出到一个zip文件中。输出文件将保存在当前目录下,类似于`gitea-dump-1482906742.zip`。
|
||||
|
||||
- 选项:
|
||||
- `--file name`,`-f name`:指定要创建的导出文件的名称。可选。(默认值:gitea-dump-[timestamp].zip)。
|
||||
- `--tempdir path`,`-t path`:指定临时目录的路径。可选。(默认值:/tmp)。
|
||||
- `--skip-repository`,`-R`:跳过仓库的导出。可选。
|
||||
- `--skip-custom-dir`:跳过自定义目录的导出。可选。
|
||||
- `--skip-lfs-data`:跳过LFS数据的导出。可选。
|
||||
- `--skip-attachment-data`:跳过附件数据的导出。可选。
|
||||
- `--skip-package-data`:跳过包数据的导出。可选。
|
||||
- `--skip-log`:跳过日志数据的导出。可选。
|
||||
- `--database`,`-d`:指定数据库的SQL语法。可选。
|
||||
- `--verbose`,`-V`:如果提供此选项,显示附加详细信息。可选。
|
||||
- `--type`:设置导出的格式。可选。(默认值:zip)
|
||||
- 示例:
|
||||
- `gitea dump`
|
||||
- `gitea dump --verbose`
|
||||
|
||||
### generate
|
||||
|
||||
用于在配置文件中生成随机值和令牌。对于自动部署时生成值非常有用。
|
||||
|
||||
- 命令:
|
||||
- `secret`:
|
||||
- 选项:
|
||||
- `INTERNAL_TOKEN`: 用于内部 API 调用身份验证的令牌。
|
||||
- `JWT_SECRET`: 用于 LFS 和 OAUTH2 JWT 身份验证的密钥(LFS_JWT_SECRET 是此选项的别名,用于向后兼容)。
|
||||
- `SECRET_KEY`: 全局密钥。
|
||||
- 示例:
|
||||
- `gitea generate secret INTERNAL_TOKEN`
|
||||
- `gitea generate secret JWT_SECRET`
|
||||
- `gitea generate secret SECRET_KEY`
|
||||
|
||||
### keys
|
||||
|
||||
提供一个 SSHD AuthorizedKeysCommand。需要在 sshd 配置文件中进行配置:
|
||||
|
||||
```ini
|
||||
...
|
||||
# -e 的值和 AuthorizedKeysCommandUser 应与运行 Gitea 的用户名匹配
|
||||
AuthorizedKeysCommandUser git
|
||||
AuthorizedKeysCommand /path/to/gitea keys -e git -u %u -t %t -k %k
|
||||
```
|
||||
|
||||
该命令将返回适用于提供的密钥的合适 authorized_keys 行。您还应在 `app.ini` 的 `[server]` 部分设置值 `SSH_CREATE_AUTHORIZED_KEYS_FILE=false`。
|
||||
|
||||
注意: opensshd 要求 Gitea 程序由 root 拥有,并且不可由组或其他人写入。程序必须使用绝对路径指定。
|
||||
注意: Gitea 必须在运行此命令时处于运行状态才能成功。
|
||||
|
||||
### migrate
|
||||
|
||||
迁移数据库。该命令可用于在首次启动服务器之前运行其他命令。此命令是幂等的。
|
||||
|
||||
### convert
|
||||
|
||||
将现有的 MySQL 数据库从 utf8 转换为 utf8mb4。
|
||||
|
||||
### doctor
|
||||
|
||||
根据给定的配置诊断当前 Gitea 实例的问题。目前有以下检查清单:
|
||||
|
||||
- 检查 OpenSSH 的 authorized_keys 文件是否正确
|
||||
当您的 Gitea 实例支持 OpenSSH 时,当您的 Gitea 实例添加或更改任何公钥时,Gitea 实例的二进制路径将被写入 `authorized_keys` 文件。
|
||||
有时,如果您在升级时移动或重命名了 Gitea 二进制文件,并且您没有在管理面板上运行“使用 Gitea 的 SSH 密钥更新「.ssh/authorized_keys」文件”操作。那么通过 SSH 的所有拉取/推送操作将无法正常工作。
|
||||
此检查将帮助您检查它是否正常工作。
|
||||
|
||||
对于贡献者,如果您想添加更多的检查项,您可以编写一个新的函数,如 `func(ctx *cli.Context) ([]string, error)`,并将其追加到 `doctor.go` 文件中。
|
||||
|
||||
```go
|
||||
var checklist = []check{
|
||||
{
|
||||
title: "Check if OpenSSH authorized_keys file id correct",
|
||||
f: runDoctorLocationMoved,
|
||||
},
|
||||
// more checks please append here
|
||||
}
|
||||
```
|
||||
|
||||
此函数将接收一个命令行上下文,并返回有关问题或错误的详细信息列表。
|
||||
|
||||
#### doctor recreate-table
|
||||
|
||||
有时,在迁移时,旧的列和默认值可能会在数据库模式中保持不变。这可能会导致警告,如下所示:
|
||||
|
||||
```
|
||||
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
|
||||
```
|
||||
|
||||
您可以通过以下方式让 Gitea 重新创建这些表,并将旧数据复制到新表中,并适当设置默认值:
|
||||
|
||||
```
|
||||
gitea doctor recreate-table user
|
||||
```
|
||||
|
||||
您可以使用以下方式让 Gitea 重新创建多个表:
|
||||
|
||||
```
|
||||
gitea doctor recreate-table table1 table2 ...
|
||||
```
|
||||
|
||||
如果您希望 Gitea 重新创建所有表,请直接调用:
|
||||
|
||||
```
|
||||
gitea doctor recreate-table
|
||||
```
|
||||
|
||||
强烈建议在运行这些命令之前备份您的数据库。
|
||||
|
||||
### manager
|
||||
|
||||
管理运行中的服务器操作:
|
||||
|
||||
- 命令:
|
||||
- `shutdown`: 优雅地关闭运行中的进程
|
||||
- `restart`: 优雅地重新启动运行中的进程(对于Windows服务器尚未实现)
|
||||
- `flush-queues`: 刷新运行中的进程中的队列
|
||||
- 选项:
|
||||
- `--timeout value`: 刷新过程的超时时间(默认值: 1m0s)
|
||||
- `--non-blocking`: 设置为true,以在返回之前不等待刷新完成
|
||||
- `logging`: 调整日志命令
|
||||
- 命令:
|
||||
- `pause`: 暂停日志记录
|
||||
- 注意:
|
||||
- 如果日志级别低于此级别,日志级别将被临时提升为INFO。
|
||||
- Gitea将在一定程度上缓冲日志,并在超过该点后丢弃日志。
|
||||
- `resume`: 恢复日志记录
|
||||
- `release-and-reopen`: 使Gitea释放和重新打开用于日志记录的文件和连接(相当于向Gitea发送SIGUSR1信号)。
|
||||
- `remove name`: 删除指定的日志记录器
|
||||
- 选项:
|
||||
- `--group group`, `-g group`: 从中删除子记录器的组(默认为`default`)
|
||||
- `add`: 添加日志记录器
|
||||
- 命令:
|
||||
- `console`: 添加控制台日志记录器
|
||||
- 选项:
|
||||
- `--group value`, `-g value`: 要添加日志记录器的组 - 默认为"default"
|
||||
- `--name value`, `-n value`: 新日志记录器的名称 - 默认为模式
|
||||
- `--level value`, `-l value`: 新日志记录器的日志级别
|
||||
- `--stacktrace-level value`, `-L value`: 堆栈跟踪日志级别
|
||||
- `--flags value`, `-F value`: 日志记录器的标志
|
||||
- `--expression value`, `-e value`: 日志记录器的匹配表达式
|
||||
- `--prefix value`, `-p value`: 日志记录器的前缀
|
||||
- `--color`: 在日志中使用颜色
|
||||
- `--stderr`: 将控制台日志输出到stderr - 仅适用于控制台
|
||||
- `file`: 添加文件日志记录器
|
||||
- 选项:
|
||||
- `--group value`, `-g value`: 要添加日志记录器的组 - 默认为"default"
|
||||
- `--name value`, `-n value`: 新日志记录器的名称 - 默认为模式
|
||||
- `--level value`, `-l value`: 新日志记录器的日志级别
|
||||
- `--stacktrace-level value`, `-L value`: 堆栈跟踪日志级别
|
||||
- `--flags value`, `-F value`: 日志记录器的标志
|
||||
- `--expression value`, `-e value`: 日志记录器的匹配表达式
|
||||
- `--prefix value`, `-p value`: 日志记录器的前缀
|
||||
- `--color`: 在日志中使用颜色
|
||||
- `--filename value`, `-f value`: 日志记录器的文件名
|
||||
- `--rotate`, `-r`: 轮转日志
|
||||
- `--max-size value`, `-s value`: 在轮转之前的最大大小(以字节为单位)
|
||||
- `--daily`, `-d`: 每天轮转日志
|
||||
- `--max-days value`, `-D value`: 保留的每日日志的最大数量
|
||||
- `--compress`, `-z`: 压缩轮转的日志
|
||||
- `--compression-level value`, `-Z value`: 使用的压缩级别
|
||||
- `conn`: 添加网络连接日志记录器
|
||||
- 选项:
|
||||
- `--group value`, `-g value`: 要添加日志记录器的组 - 默认为"default"
|
||||
- `--name value`, `-n value`: 新日志记录器的名称 - 默认为模式
|
||||
- `--level value`, `-l value`: 新日志记录器的日志级别
|
||||
- `--stacktrace-level value`, `-L value`: 堆栈跟踪日志级别
|
||||
- `--flags value`, `-F value`: 日志记录器的标志
|
||||
- `--expression value`, `-e value`: 日志记录器的匹配表达式
|
||||
- `--prefix value`, `-p value`: 日志记录器的前缀
|
||||
- `--color`: 在日志中使用颜色
|
||||
- `--reconnect-on-message`, `-R`: 对于每个消息重新连接主机
|
||||
- `--reconnect`, `-r`: 连接中断时重新连接主机
|
||||
- `--protocol value`, `-P value`: 设置要使用的协议:tcp、unix或udp(默认为tcp)
|
||||
- `--address value`, `-a value`: 要连接到的主机地址和端口(默认为:7020)
|
||||
- `smtp`: 添加SMTP日志记录器
|
||||
- 选项:
|
||||
- `--group value`, `-g value`: 要添加日志记录器的组 - 默认为"default"
|
||||
- `--name value`, `-n value`: 新日志记录器的名称 - 默认为模式
|
||||
- `--level value`, `-l value`: 新日志记录器的日志级别
|
||||
- `--stacktrace-level value`, `-L value`: 堆栈跟踪日志级别
|
||||
- `--flags value`, `-F value`: 日志记录器的标志
|
||||
- `--expression value`, `-e value`: 日志记录器的匹配表达式
|
||||
- `--prefix value`, `-p value`: 日志记录器的前缀
|
||||
- `--color`: 在日志中使用颜色
|
||||
- `--username value`, `-u value`: 邮件服务器用户名
|
||||
- `--password value`, `-P value`: 邮件服务器密码
|
||||
- `--host value`, `-H value`: 邮件服务器主机(默认为: 127.0.0.1:25)
|
||||
- `--send-to value`, `-s value`: 要发送到的电子邮件地址
|
||||
- `--subject value`, `-S value`: 发送电子邮件的主题标题
|
||||
- `processes`: 显示 Gitea 进程和 Goroutine 信息
|
||||
- 选项:
|
||||
- `--flat`: 以平面表格形式显示进程,而不是树形结构
|
||||
- `--no-system`: 不显示系统进程
|
||||
- `--stacktraces`: 显示与进程关联的 Goroutine 的堆栈跟踪
|
||||
- `--json`: 输出为 JSON 格式
|
||||
- `--cancel PID`: 向具有 PID 的进程发送取消命令(仅适用于非系统进程)
|
||||
|
||||
### dump-repo
|
||||
|
||||
`dump-repo` 从 Git/GitHub/Gitea/GitLab 中转储存储库数据:
|
||||
|
||||
- 选项:
|
||||
- `--git_service service`:Git 服务,可以是 `git`、`github`、`gitea`、`gitlab`。如果 `clone_addr` 可以被识别,则可以忽略此选项。
|
||||
- `--repo_dir dir`,`-r dir`:存储数据的存储库目录路径。
|
||||
- `--clone_addr addr`:将被克隆的 URL,目前可以是 git/github/gitea/gitlab 的 http/https URL。例如:https://github.com/lunny/tango.git
|
||||
- `--auth_username lunny`:访问 `clone_addr` 的用户名。
|
||||
- `--auth_password <password>`:访问 `clone_addr` 的密码。
|
||||
- `--auth_token <token>`:访问 `clone_addr` 的个人令牌。
|
||||
- `--owner_name lunny`:如果非空,数据将存储在具有所有者名称的目录中。
|
||||
- `--repo_name tango`:如果非空,数据将存储在具有存储库名称的目录中。
|
||||
- `--units <units>`:要迁移的项目,一个或多个项目应以逗号分隔。允许的项目有 wiki, issues, labels, releases, release_assets, milestones, pull_requests, comments。如果为空,则表示所有项目。
|
||||
|
||||
### restore-repo
|
||||
|
||||
`restore-repo` 从磁盘目录中还原存储库数据:
|
||||
|
||||
- 选项:
|
||||
- `--repo_dir dir`,`-r dir`:还原数据的存储库目录路径。
|
||||
- `--owner_name lunny`:还原目标所有者名称。
|
||||
- `--repo_name tango`:还原目标存储库名称。
|
||||
- `--units <units>`:要还原的项目,一个或多个项目应以逗号分隔。允许的项目有 wiki, issues, labels, releases, release_assets, milestones, pull_requests, comments。如果为空,则表示所有项目。
|
||||
|
||||
### actions generate-runner-token
|
||||
|
||||
生成一个供 Runner 使用的新令牌,用于向服务器注册。
|
||||
|
||||
- 选项:
|
||||
- `--scope {owner}[/{repo}]`,`-s {owner}[/{repo}]`:限制 Runner 的范围,没有范围表示该 Runner 可用于所有仓库,但你也可以将其限制为特定的仓库或所有者。
|
||||
|
||||
要注册全局 Runner:
|
||||
|
||||
```
|
||||
gitea actions generate-runner-token
|
||||
```
|
||||
|
||||
要注册特定组织的 Runner,例如 `org`:
|
||||
|
||||
```
|
||||
gitea actions generate-runner-token -s org
|
||||
```
|
||||
|
||||
要注册特定仓库的 Runner,例如 `username/test-repo`:
|
||||
|
||||
```
|
||||
gitea actions generate-runner-token -s username/test-repo
|
||||
```
|
|
@ -2,14 +2,14 @@
|
|||
date: "2016-12-26T16:00:00+02:00"
|
||||
title: "Config Cheat Sheet"
|
||||
slug: "config-cheat-sheet"
|
||||
weight: 20
|
||||
sidebar_position: 30
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "advanced"
|
||||
parent: "administration"
|
||||
name: "Config Cheat Sheet"
|
||||
weight: 20
|
||||
sidebar_position: 30
|
||||
identifier: "config-cheat-sheet"
|
||||
---
|
||||
|
||||
|
@ -33,8 +33,6 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
|
|||
|
||||
**Note:** A full restart is required for Gitea configuration changes to take effect.
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
## Default Configuration (non-`app.ini` configuration)
|
||||
|
||||
These values are environment-dependent but form the basis of a lot of values. They will be
|
||||
|
@ -80,7 +78,7 @@ In addition there is _`StaticRootPath`_ which can be set as a built-in at build
|
|||
- `SCRIPT_TYPE`: **bash**: The script type this server supports. Usually this is `bash`,
|
||||
but some users report that only `sh` is available.
|
||||
- `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**: Tie-break order of detected charsets - if the detected charsets have equal confidence, charsets earlier in the list will be chosen in preference to those later. Adding `defaults` will place the unnamed charsets at that point.
|
||||
- `ANSI_CHARSET`: **\<empty\>**: Default ANSI charset to override non-UTF-8 charsets to.
|
||||
- `ANSI_CHARSET`: **_empty_**: Default ANSI charset to override non-UTF-8 charsets to.
|
||||
- `FORCE_PRIVATE`: **false**: Force every new repository to be private.
|
||||
- `DEFAULT_PRIVATE`: **last**: Default private when creating a new repository.
|
||||
\[last, private, public\]
|
||||
|
@ -97,14 +95,14 @@ In addition there is _`StaticRootPath`_ which can be set as a built-in at build
|
|||
HTTP protocol.
|
||||
- `USE_COMPAT_SSH_URI`: **false**: Force ssh:// clone url instead of scp-style uri when
|
||||
default SSH port is used.
|
||||
- `ACCESS_CONTROL_ALLOW_ORIGIN`: **\<empty\>**: Value for Access-Control-Allow-Origin header,
|
||||
- `ACCESS_CONTROL_ALLOW_ORIGIN`: **_empty_**: Value for Access-Control-Allow-Origin header,
|
||||
default is not to present. **WARNING**: This maybe harmful to you website if you do not
|
||||
give it a right value.
|
||||
- `DEFAULT_CLOSE_ISSUES_VIA_COMMITS_IN_ANY_BRANCH`: **false**: Close an issue if a commit on a non default branch marks it as closed.
|
||||
- `ENABLE_PUSH_CREATE_USER`: **false**: Allow users to push local repositories to Gitea and have them automatically created for a user.
|
||||
- `ENABLE_PUSH_CREATE_ORG`: **false**: Allow users to push local repositories to Gitea and have them automatically created for an org.
|
||||
- `DISABLED_REPO_UNITS`: **_empty_**: Comma separated list of globally disabled repo units. Allowed values: \[repo.issues, repo.ext_issues, repo.pulls, repo.wiki, repo.ext_wiki, repo.projects\]
|
||||
- `DEFAULT_REPO_UNITS`: **repo.code,repo.releases,repo.issues,repo.pulls,repo.wiki,repo.projects,repo.packages**: Comma separated list of default new repo units. Allowed values: \[repo.code, repo.releases, repo.issues, repo.pulls, repo.wiki, repo.projects\]. Note: Code and Releases can currently not be deactivated. If you specify default repo units you should still list them for future compatibility. External wiki and issue tracker can't be enabled by default as it requires additional settings. Disabled repo units will not be added to new repositories regardless if it is in the default list.
|
||||
- `DISABLED_REPO_UNITS`: **_empty_**: Comma separated list of globally disabled repo units. Allowed values: \[repo.issues, repo.ext_issues, repo.pulls, repo.wiki, repo.ext_wiki, repo.projects, repo.packages, repo.actions\]
|
||||
- `DEFAULT_REPO_UNITS`: **repo.code,repo.releases,repo.issues,repo.pulls,repo.wiki,repo.projects,repo.packages**: Comma separated list of default new repo units. Allowed values: \[repo.code, repo.releases, repo.issues, repo.pulls, repo.wiki, repo.projects, repo.packages, repo.actions\]. Note: Code and Releases can currently not be deactivated. If you specify default repo units you should still list them for future compatibility. External wiki and issue tracker can't be enabled by default as it requires additional settings. Disabled repo units will not be added to new repositories regardless if it is in the default list.
|
||||
- `DEFAULT_FORK_REPO_UNITS`: **repo.code,repo.pulls**: Comma separated list of default forked repo units. The set of allowed values and rules is the same as `DEFAULT_REPO_UNITS`.
|
||||
- `PREFIX_ARCHIVE_FILES`: **true**: Prefix archive files by placing them in a directory named after the repository.
|
||||
- `DISABLE_MIGRATIONS`: **false**: Disable migrating feature.
|
||||
|
@ -146,13 +144,13 @@ In addition there is _`StaticRootPath`_ which can be set as a built-in at build
|
|||
|
||||
- `ENABLED`: **true**: Whether repository file uploads are enabled
|
||||
- `TEMP_PATH`: **data/tmp/uploads**: Path for uploads (content gets deleted on Gitea restart)
|
||||
- `ALLOWED_TYPES`: **\<empty\>**: Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
|
||||
- `ALLOWED_TYPES`: **_empty_**: Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
|
||||
- `FILE_MAX_SIZE`: **3**: Max size of each file in megabytes.
|
||||
- `MAX_FILES`: **5**: Max number of files per upload
|
||||
|
||||
### Repository - Release (`repository.release`)
|
||||
|
||||
- `ALLOWED_TYPES`: **\<empty\>**: Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
|
||||
- `ALLOWED_TYPES`: **_empty_**: Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
|
||||
- `DEFAULT_PAGING_NUM`: **10**: The default paging number of releases user interface
|
||||
- For settings related to file attachments on releases, see the `attachment` section.
|
||||
|
||||
|
@ -220,17 +218,19 @@ The following configuration set `Content-Type: application/vnd.android.package-a
|
|||
- `SHOW_USER_EMAIL`: **true**: Whether the email of the user should be shown in the Explore Users page.
|
||||
- `THEMES`: **auto,gitea,arc-green**: All available themes. Allow users select personalized themes.
|
||||
regardless of the value of `DEFAULT_THEME`.
|
||||
- `THEME_COLOR_META_TAG`: **#6cc644**: Value of `theme-color` meta tag, used by Android >= 5.0. An invalid color like "none" or "disable" will have the default style. More info: https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android
|
||||
- `THEME_COLOR_META_TAG`: **_empty_**: Value of `theme-color` meta tag, used by some mobile browers for chrome and out-of-viewport areas. Default is unset which uses body color.
|
||||
- `MAX_DISPLAY_FILE_SIZE`: **8388608**: Max size of files to be displayed (default is 8MiB)
|
||||
- `REACTIONS`: All available reactions users can choose on issues/prs and comments
|
||||
Values can be emoji alias (:smile:) or a unicode emoji.
|
||||
For custom reactions, add a tightly cropped square image to public/img/emoji/reaction_name.png
|
||||
- `CUSTOM_EMOJIS`: **gitea, codeberg, gitlab, git, github, gogs**: Additional Emojis not defined in the utf8 standard.
|
||||
By default we support Gitea (:gitea:), to add more copy them to public/img/emoji/emoji_name.png and
|
||||
By default, we support Gitea (:gitea:), to add more copy them to public/img/emoji/emoji_name.png and
|
||||
add it to this config.
|
||||
- `DEFAULT_SHOW_FULL_NAME`: **false**: Whether the full name of the users should be shown where possible. If the full name isn't set, the username will be used.
|
||||
- `SEARCH_REPO_DESCRIPTION`: **true**: Whether to search within description at repository search on explore page.
|
||||
- `USE_SERVICE_WORKER`: **false**: Whether to enable a Service Worker to cache frontend assets.
|
||||
- `ONLY_SHOW_RELEVANT_REPOS`: **false** Whether to only show relevant repos on the explore page when no keyword is specified and default sorting is used.
|
||||
A repo is considered irrelevant if it's a fork or if it has no metadata (no description, no icon, no topic).
|
||||
|
||||
### UI - Admin (`ui.admin`)
|
||||
|
||||
|
@ -289,7 +289,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
|
|||
- `ROOT_URL`: **%(PROTOCOL)s://%(DOMAIN)s:%(HTTP\_PORT)s/**:
|
||||
Overwrite the automatically generated public URL.
|
||||
This is useful if the internal and the external URL don't match (e.g. in Docker).
|
||||
- `STATIC_URL_PREFIX`: **\<empty\>**:
|
||||
- `STATIC_URL_PREFIX`: **_empty_**:
|
||||
Overwrite this option to request static resources from a different URL.
|
||||
This includes CSS files, images, JS files and web fonts.
|
||||
Avatar images are dynamic resources and still served by Gitea.
|
||||
|
@ -332,7 +332,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
|
|||
- `SSH_ROOT_PATH`: **~/.ssh**: Root path of SSH directory.
|
||||
- `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.
|
||||
- `SSH_AUTHORIZED_KEYS_BACKUP`: **true**: Enable SSH Authorized Key Backup when rewriting all keys, default is true.
|
||||
- `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`.
|
||||
- `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`.
|
||||
- `SSH_TRUSTED_USER_CA_KEYS_FILENAME`: **`RUN_USER`/.ssh/gitea-trusted-user-ca-keys.pem**: Absolute path of the `TrustedUserCaKeys` file Gitea will manage. If you're running your own ssh server and you want to use the Gitea managed file you'll also need to modify your sshd_config to point to this file. The official docker image will automatically work without further configuration.
|
||||
- `SSH_AUTHORIZED_PRINCIPALS_ALLOW`: **off** or **username, email**: \[off, username, email, anything\]: Specify the principals values that users are allowed to use as principal. When set to `anything` no checks are done on the principal string. When set to `off` authorized principal are not allowed to be set.
|
||||
- `SSH_CREATE_AUTHORIZED_PRINCIPALS_FILE`: **false/true**: Gitea will create a authorized_principals file by default when it is not using the internal ssh server and `SSH_AUTHORIZED_PRINCIPALS_ALLOW` is not `off`.
|
||||
|
@ -362,7 +362,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
|
|||
- `LANDING_PAGE`: **home**: Landing page for unauthenticated users \[home, explore, organizations, login, **custom**\]. Where custom would instead be any URL such as "/org/repo" or even `https://anotherwebsite.com`
|
||||
- `LFS_START_SERVER`: **false**: Enables Git LFS support.
|
||||
- `LFS_CONTENT_PATH`: **%(APP_DATA_PATH)s/lfs**: Default LFS content path. (if it is on local storage.) **DEPRECATED** use settings in `[lfs]`.
|
||||
- `LFS_JWT_SECRET`: **\<empty\>**: LFS authentication secret, change this a unique string.
|
||||
- `LFS_JWT_SECRET`: **_empty_**: LFS authentication secret, change this a unique string.
|
||||
- `LFS_HTTP_AUTH_EXPIRY`: **20m**: LFS authentication validity period in time.Duration, pushes taking longer than this may fail.
|
||||
- `LFS_MAX_FILE_SIZE`: **0**: Maximum allowed LFS file size in bytes (Set to 0 for no limit).
|
||||
- `LFS_LOCKS_PAGING_NUM`: **50**: Maximum number of LFS Locks returned per page.
|
||||
|
@ -371,7 +371,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
|
|||
- `REDIRECTOR_USE_PROXY_PROTOCOL`: **%(USE_PROXY_PROTOCOL)s**: expect PROXY protocol header on connections to https redirector.
|
||||
- `PORT_TO_REDIRECT`: **80**: Port for the http redirection service to listen on. Used when `REDIRECT_OTHER_PORT` is true.
|
||||
- `SSL_MIN_VERSION`: **TLSv1.2**: Set the minimum version of ssl support.
|
||||
- `SSL_MAX_VERSION`: **\<empty\>**: Set the maximum version of ssl support.
|
||||
- `SSL_MAX_VERSION`: **_empty_**: Set the maximum version of ssl support.
|
||||
- `SSL_CURVE_PREFERENCES`: **X25519,P256**: Set the preferred curves,
|
||||
- `SSL_CIPHER_SUITES`: **ecdhe_ecdsa_with_aes_256_gcm_sha384,ecdhe_rsa_with_aes_256_gcm_sha384,ecdhe_ecdsa_with_aes_128_gcm_sha256,ecdhe_rsa_with_aes_128_gcm_sha256,ecdhe_ecdsa_with_chacha20_poly1305,ecdhe_rsa_with_chacha20_poly1305**: Set the preferred cipher suites.
|
||||
- If there is no hardware support for AES suites, by default the ChaCha suites will be preferred over the AES suites.
|
||||
|
@ -407,11 +407,11 @@ The following configuration set `Content-Type: application/vnd.android.package-a
|
|||
- "ecdhe_rsa_with_chacha20_poly1305" is an alias for "ecdhe_rsa_with_chacha20_poly1305_sha256"
|
||||
- "ecdhe_ecdsa_with_chacha20_poly1305" is alias for "ecdhe_ecdsa_with_chacha20_poly1305_sha256"
|
||||
- `ENABLE_ACME`: **false**: Flag to enable automatic certificate management via an ACME capable Certificate Authority (CA) server (default: Lets Encrypt). If enabled, `CERT_FILE` and `KEY_FILE` are ignored, and the CA must resolve `DOMAIN` to this gitea server. Ensure that DNS records are set and either port `80` or port `443` are accessible by the CA server (the public internet by default), and redirected to the appropriate ports `PORT_TO_REDIRECT` or `HTTP_PORT` respectively.
|
||||
- `ACME_URL`: **\<empty\>**: The CA's ACME directory URL, e.g. for a self-hosted [smallstep CA server](https://github.com/smallstep/certificates), it can look like `https://ca.example.com/acme/acme/directory`. If left empty, it defaults to using Let's Encerypt's production CA (check `LETSENCRYPT_ACCEPTTOS` as well).
|
||||
- `ACME_URL`: **_empty_**: The CA's ACME directory URL, e.g. for a self-hosted [smallstep CA server](https://github.com/smallstep/certificates), it can look like `https://ca.example.com/acme/acme/directory`. If left empty, it defaults to using Let's Encerypt's production CA (check `LETSENCRYPT_ACCEPTTOS` as well).
|
||||
- `ACME_ACCEPTTOS`: **false**: This is an explicit check that you accept the terms of service of the ACME provider. The default is Lets Encrypt [terms of service](https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf).
|
||||
- `ACME_DIRECTORY`: **https**: Directory that the certificate manager will use to cache information such as certs and private keys.
|
||||
- `ACME_EMAIL`: **\<empty\>**: Email used for the ACME registration. Usually it is to notify about problems with issued certificates.
|
||||
- `ACME_CA_ROOT`: **\<empty\>**: The CA's root certificate. If left empty, it defaults to using the system's trust chain.
|
||||
- `ACME_EMAIL`: **_empty_**: Email used for the ACME registration. Usually it is to notify about problems with issued certificates.
|
||||
- `ACME_CA_ROOT`: **_empty_**: The CA's root certificate. If left empty, it defaults to using the system's trust chain.
|
||||
- `ALLOW_GRACEFUL_RESTARTS`: **true**: Perform a graceful restart on SIGHUP
|
||||
- `GRACEFUL_HAMMER_TIME`: **60s**: After a restart the parent process will stop accepting new connections and will allow requests to finish before stopping. Shutdown will be forced if it takes longer than this time.
|
||||
- `STARTUP_TIMEOUT`: **0**: Shutsdown the server if startup takes longer than the provided time. On Windows setting this sends a waithint to the SVC host to tell the SVC host startup may take some time. Please note startup is determined by the opening of the listeners - HTTP/HTTPS/SSH. Indexers may take longer to startup and can have their own timeouts.
|
||||
|
@ -422,8 +422,8 @@ The following configuration set `Content-Type: application/vnd.android.package-a
|
|||
- `HOST`: **127.0.0.1:3306**: Database host address and port or absolute path for unix socket \[mysql, postgres\] (ex: /var/run/mysqld/mysqld.sock).
|
||||
- `NAME`: **gitea**: Database name.
|
||||
- `USER`: **root**: Database username.
|
||||
- `PASSWD`: **\<empty\>**: Database user password. Use \`your password\` or """your password""" for quoting if you use special characters in the password.
|
||||
- `SCHEMA`: **\<empty\>**: For PostgreSQL only, schema to use if different from "public". The schema must exist beforehand,
|
||||
- `PASSWD`: **_empty_**: Database user password. Use \`your password\` or """your password""" for quoting if you use special characters in the password.
|
||||
- `SCHEMA`: **_empty_**: For PostgreSQL only, schema to use if different from "public". The schema must exist beforehand,
|
||||
the user must have creation privileges on it, and the user search path must be set to the look into the schema first
|
||||
(e.g. `ALTER USER user SET SEARCH_PATH = schema_name,"$user",public;`).
|
||||
- `SSL_MODE`: **disable**: SSL/TLS encryption mode for connecting to the database. This option is only applied for PostgreSQL and MySQL.
|
||||
|
@ -541,7 +541,7 @@ Certain queues have defaults that override the defaults set in `[queue]` (this o
|
|||
|
||||
- `INSTALL_LOCK`: **false**: Controls access to the installation page. When set to "true", the installation page is not accessible.
|
||||
- `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.
|
||||
- `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.
|
||||
- `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.
|
||||
- `LOGIN_REMEMBER_DAYS`: **7**: Cookie lifetime, in days.
|
||||
- `COOKIE_USERNAME`: **gitea\_awesome**: Name of the cookie used to store the current username.
|
||||
- `COOKIE_REMEMBER_NAME`: **gitea\_incredible**: Name of cookie used to store authentication
|
||||
|
@ -567,7 +567,7 @@ Certain queues have defaults that override the defaults set in `[queue]` (this o
|
|||
- `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.
|
||||
- `IMPORT_LOCAL_PATHS`: **false**: Set to `false` to prevent all users (including admin) from importing local path on server.
|
||||
- `INTERNAL_TOKEN`: **\<random at every install if no uri set\>**: Secret used to validate communication within Gitea binary.
|
||||
- `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`)
|
||||
- `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`)
|
||||
- `PASSWORD_HASH_ALGO`: **pbkdf2**: The hash algorithm to use \[argon2, pbkdf2, pbkdf2_v1, pbkdf2_hi, scrypt, bcrypt\], argon2 and scrypt will spend significant amounts of memory.
|
||||
- Note: The default parameters for `pbkdf2` hashing have changed - the previous settings are available as `pbkdf2_v1` but are not recommended.
|
||||
- The hash functions may be tuned by using `$` after the algorithm:
|
||||
|
@ -598,23 +598,23 @@ Certain queues have defaults that override the defaults set in `[queue]` (this o
|
|||
## Camo (`camo`)
|
||||
|
||||
- `ENABLED`: **false**: Enable media proxy, we support images only at the moment.
|
||||
- `SERVER_URL`: **<empty>**: URL of camo server, it **is required** if camo is enabled.
|
||||
- `HMAC_KEY`: **<empty>**: Provide the HMAC key for encoding URLs, it **is required** if camo is enabled.
|
||||
- `SERVER_URL`: **_empty_**: URL of camo server, it **is required** if camo is enabled.
|
||||
- `HMAC_KEY`: **_empty_**: Provide the HMAC key for encoding URLs, it **is required** if camo is enabled.
|
||||
- `ALLWAYS`: **false**: Set to true to use camo for both HTTP and HTTPS content, otherwise only non-HTTPS URLs are proxied
|
||||
|
||||
## OpenID (`openid`)
|
||||
|
||||
- `ENABLE_OPENID_SIGNIN`: **false**: Allow authentication in via OpenID.
|
||||
- `ENABLE_OPENID_SIGNUP`: **! DISABLE\_REGISTRATION**: Allow registering via OpenID.
|
||||
- `WHITELISTED_URIS`: **\<empty\>**: If non-empty, list of POSIX regex patterns matching
|
||||
- `WHITELISTED_URIS`: **_empty_**: If non-empty, list of POSIX regex patterns matching
|
||||
OpenID URI's to permit.
|
||||
- `BLACKLISTED_URIS`: **\<empty\>**: If non-empty, list of POSIX regex patterns matching
|
||||
- `BLACKLISTED_URIS`: **_empty_**: If non-empty, list of POSIX regex patterns matching
|
||||
OpenID URI's to block.
|
||||
|
||||
## OAuth2 Client (`oauth2_client`)
|
||||
|
||||
- `REGISTER_EMAIL_CONFIRM`: _[service]_ **REGISTER\_EMAIL\_CONFIRM**: Set this to enable or disable email confirmation of OAuth2 auto-registration. (Overwrites the REGISTER\_EMAIL\_CONFIRM setting of the `[service]` section)
|
||||
- `OPENID_CONNECT_SCOPES`: **\<empty\>**: List of additional openid connect scopes. (`openid` is implicitly added)
|
||||
- `OPENID_CONNECT_SCOPES`: **_empty_**: List of additional openid connect scopes. (`openid` is implicitly added)
|
||||
- `ENABLE_AUTO_REGISTRATION`: **false**: Automatically create user accounts for new oauth2 users.
|
||||
- `USERNAME`: **nickname**: The source of the username for new oauth2 accounts:
|
||||
- userid - use the userid / sub attribute
|
||||
|
@ -678,9 +678,9 @@ Certain queues have defaults that override the defaults set in `[queue]` (this o
|
|||
- `ENABLE_TIMETRACKING`: **true**: Enable Timetracking feature.
|
||||
- `DEFAULT_ENABLE_TIMETRACKING`: **true**: Allow repositories to use timetracking by default.
|
||||
- `DEFAULT_ALLOW_ONLY_CONTRIBUTORS_TO_TRACK_TIME`: **true**: Only allow users with write permissions to track time.
|
||||
- `EMAIL_DOMAIN_WHITELIST`: **\<empty\>**: If non-empty, list of domain names that can only be used to register
|
||||
- `EMAIL_DOMAIN_WHITELIST`: **_empty_**: If non-empty, list of domain names that can only be used to register
|
||||
on this instance.
|
||||
- `EMAIL_DOMAIN_BLOCKLIST`: **\<empty\>**: If non-empty, list of domain names that cannot be used to register on this instance
|
||||
- `EMAIL_DOMAIN_BLOCKLIST`: **_empty_**: If non-empty, list of domain names that cannot be used to register on this instance
|
||||
- `SHOW_REGISTRATION_BUTTON`: **! DISABLE\_REGISTRATION**: Show Registration Button
|
||||
- `SHOW_MILESTONES_DASHBOARD_PAGE`: **true** Enable this to show the milestones dashboard page - a view of all the user's milestones
|
||||
- `AUTO_WATCH_NEW_REPOS`: **true**: Enable this to let all organisation users watch new repos when they are created
|
||||
|
@ -724,8 +724,8 @@ Define allowed algorithms and their minimum key length (use -1 to disable a type
|
|||
- Wildcard hosts: `*.mydomain.com`, `192.168.100.*`
|
||||
- `SKIP_TLS_VERIFY`: **false**: Allow insecure certification.
|
||||
- `PAGING_NUM`: **10**: Number of webhook history events that are shown in one page.
|
||||
- `PROXY_URL`: **\<empty\>**: Proxy server URL, support http://, https//, socks://, blank will follow environment http_proxy/https_proxy. If not given, will use global proxy setting.
|
||||
- `PROXY_HOSTS`: **\<empty\>`**: Comma separated list of host names requiring proxy. Glob patterns (*) are accepted; use ** to match all hosts. If not given, will use global proxy setting.
|
||||
- `PROXY_URL`: **_empty_**: Proxy server URL, support http://, https//, socks://, blank will follow environment http_proxy/https_proxy. If not given, will use global proxy setting.
|
||||
- `PROXY_HOSTS`: **_empty_`**: Comma separated list of host names requiring proxy. Glob patterns (*) are accepted; use ** to match all hosts. If not given, will use global proxy setting.
|
||||
|
||||
## Mailer (`mailer`)
|
||||
|
||||
|
@ -736,14 +736,14 @@ and
|
|||
[Gitea 1.17 configuration document](https://github.com/go-gitea/gitea/blob/release/v1.17/docs/content/doc/advanced/config-cheat-sheet.en-us.md)
|
||||
|
||||
- `ENABLED`: **false**: Enable to use a mail service.
|
||||
- `PROTOCOL`: **\<empty\>**: Mail server protocol. One of "smtp", "smtps", "smtp+starttls", "smtp+unix", "sendmail", "dummy". _Before 1.18, this was inferred from a combination of `MAILER_TYPE` and `IS_TLS_ENABLED`._
|
||||
- `PROTOCOL`: **_empty_**: Mail server protocol. One of "smtp", "smtps", "smtp+starttls", "smtp+unix", "sendmail", "dummy". _Before 1.18, this was inferred from a combination of `MAILER_TYPE` and `IS_TLS_ENABLED`._
|
||||
- SMTP family, if your provider does not explicitly say which protocol it uses but does provide a port, you can set SMTP_PORT instead and this will be inferred.
|
||||
- **sendmail** Use the operating system's `sendmail` command instead of SMTP. This is common on Linux systems.
|
||||
- **dummy** Send email messages to the log as a testing phase.
|
||||
- Note that enabling sendmail will ignore all other `mailer` settings except `ENABLED`, `FROM`, `SUBJECT_PREFIX` and `SENDMAIL_PATH`.
|
||||
- Enabling dummy will ignore all settings except `ENABLED`, `SUBJECT_PREFIX` and `FROM`.
|
||||
- `SMTP_ADDR`: **\<empty\>**: Mail server address. e.g. smtp.gmail.com. For smtp+unix, this should be a path to a unix socket instead. _Before 1.18, this was combined with `SMTP_PORT` under the name `HOST`._
|
||||
- `SMTP_PORT`: **\<empty\>**: Mail server port. If no protocol is specified, it will be inferred by this setting. Common ports are listed below. _Before 1.18, this was combined with `SMTP_ADDR` under the name `HOST`._
|
||||
- `SMTP_ADDR`: **_empty_**: Mail server address. e.g. smtp.gmail.com. For smtp+unix, this should be a path to a unix socket instead. _Before 1.18, this was combined with `SMTP_PORT` under the name `HOST`._
|
||||
- `SMTP_PORT`: **_empty_**: Mail server port. If no protocol is specified, it will be inferred by this setting. Common ports are listed below. _Before 1.18, this was combined with `SMTP_ADDR` under the name `HOST`._
|
||||
- 25: insecure SMTP
|
||||
- 465: SMTP Secure
|
||||
- 587: StartTLS
|
||||
|
@ -751,16 +751,16 @@ and
|
|||
- `CLIENT_CERT_FILE`: **custom/mailer/cert.pem**: Client certificate file.
|
||||
- `CLIENT_KEY_FILE`: **custom/mailer/key.pem**: Client key file.
|
||||
- `FORCE_TRUST_SERVER_CERT`: **false**: If set to `true`, completely ignores server certificate validation errors. This option is unsafe. Consider adding the certificate to the system trust store instead.
|
||||
- `USER`: **\<empty\>**: Username of mailing user (usually the sender's e-mail address).
|
||||
- `PASSWD`: **\<empty\>**: Password of mailing user. Use \`your password\` for quoting if you use special characters in the password.
|
||||
- Please note: authentication is only supported when the SMTP server communication is encrypted with TLS (this can be via `STARTTLS`) or SMTP host is localhost. See [Email Setup]({{< relref "doc/usage/email-setup.en-us.md" >}}) for more information.
|
||||
- `USER`: **_empty_**: Username of mailing user (usually the sender's e-mail address).
|
||||
- `PASSWD`: **_empty_**: Password of mailing user. Use \`your password\` for quoting if you use special characters in the password.
|
||||
- Please note: authentication is only supported when the SMTP server communication is encrypted with TLS (this can be via `STARTTLS`) or SMTP host is localhost. See [Email Setup](administration/email-setup.md) for more information.
|
||||
- `ENABLE_HELO`: **true**: Enable HELO operation.
|
||||
- `HELO_HOSTNAME`: **(retrieved from system)**: HELO hostname.
|
||||
- `FROM`: **\<empty\>**: Mail from address, RFC 5322. This can be just an email address, or the "Name" \<email@example.com\> format.
|
||||
- `ENVELOPE_FROM`: **\<empty\>**: Address set as the From address on the SMTP mail envelope. Set to `<>` to send an empty address.
|
||||
- `SUBJECT_PREFIX`: **\<empty\>**: Prefix to be placed before e-mail subject lines.
|
||||
- `FROM`: **_empty_**: Mail from address, RFC 5322. This can be just an email address, or the "Name" \<email@example.com\> format.
|
||||
- `ENVELOPE_FROM`: **_empty_**: Address set as the From address on the SMTP mail envelope. Set to `<>` to send an empty address.
|
||||
- `SUBJECT_PREFIX`: **_empty_**: Prefix to be placed before e-mail subject lines.
|
||||
- `SENDMAIL_PATH`: **sendmail**: The location of sendmail on the operating system (can be command or full path).
|
||||
- `SENDMAIL_ARGS`: **\<empty\>**: Specify any extra sendmail arguments. (NOTE: you should be aware that email addresses can look like options - if your `sendmail` command takes options you must set the option terminator `--`)
|
||||
- `SENDMAIL_ARGS`: **_empty_**: Specify any extra sendmail arguments. (NOTE: you should be aware that email addresses can look like options - if your `sendmail` command takes options you must set the option terminator `--`)
|
||||
- `SENDMAIL_TIMEOUT`: **5m**: default timeout for sending email through sendmail
|
||||
- `SENDMAIL_CONVERT_CRLF`: **true**: Most versions of sendmail prefer LF line endings rather than CRLF line endings. Set this to false if your version of sendmail requires CRLF line endings.
|
||||
- `SEND_BUFFER_LEN`: **100**: Buffer length of mailing queue. **DEPRECATED** use `LENGTH` in `[queue.mailer]`
|
||||
|
@ -769,11 +769,11 @@ and
|
|||
## Incoming Email (`email.incoming`)
|
||||
|
||||
- `ENABLED`: **false**: Enable handling of incoming emails.
|
||||
- `REPLY_TO_ADDRESS`: **\<empty\>**: The email address including the `%{token}` placeholder that will be replaced per user/action. Example: `incoming+%{token}@example.com`. The placeholder must appear in the user part of the address (before the `@`).
|
||||
- `HOST`: **\<empty\>**: IMAP server host.
|
||||
- `PORT`: **\<empty\>**: IMAP server port.
|
||||
- `USERNAME`: **\<empty\>**: Username of the receiving account.
|
||||
- `PASSWORD`: **\<empty\>**: Password of the receiving account.
|
||||
- `REPLY_TO_ADDRESS`: **_empty_**: The email address including the `%{token}` placeholder that will be replaced per user/action. Example: `incoming+%{token}@example.com`. The placeholder must appear in the user part of the address (before the `@`).
|
||||
- `HOST`: **_empty_**: IMAP server host.
|
||||
- `PORT`: **_empty_**: IMAP server port.
|
||||
- `USERNAME`: **_empty_**: Username of the receiving account.
|
||||
- `PASSWORD`: **_empty_**: Password of the receiving account.
|
||||
- `USE_TLS`: **false**: Whether the IMAP server uses TLS.
|
||||
- `SKIP_TLS_VERIFY`: **false**: If set to `true`, completely ignores server certificate validation errors. This option is unsafe.
|
||||
- `MAILBOX`: **INBOX**: The mailbox name where incoming mail will end up.
|
||||
|
@ -785,7 +785,7 @@ and
|
|||
- `ENABLED`: **true**: Enable the cache.
|
||||
- `ADAPTER`: **memory**: Cache engine adapter, either `memory`, `redis`, `twoqueue` or `memcache`. (`twoqueue` represents a size limited LRU cache.)
|
||||
- `INTERVAL`: **60**: Garbage Collection interval (sec), for memory and twoqueue cache only.
|
||||
- `HOST`: **\<empty\>**: Connection string for `redis` and `memcache`. For `twoqueue` sets configuration for the queue.
|
||||
- `HOST`: **_empty_**: Connection string for `redis` and `memcache`. For `twoqueue` sets configuration for the queue.
|
||||
- Redis: `redis://:macaron@127.0.0.1:6379/0?pool_size=100&idle_timeout=180s`
|
||||
- Memcache: `127.0.0.1:9090;127.0.0.1:9091`
|
||||
- TwoQueue LRU cache: `{"size":50000,"recent_ratio":0.25,"ghost_ratio":0.5}` or `50000` representing the maximum number of objects stored in the cache.
|
||||
|
@ -805,7 +805,7 @@ and
|
|||
- `COOKIE_NAME`: **i\_like\_gitea**: The name of the cookie used for the session ID.
|
||||
- `GC_INTERVAL_TIME`: **86400**: GC interval in seconds.
|
||||
- `SESSION_LIFE_TIME`: **86400**: Session life time in seconds, default is 86400 (1 day)
|
||||
- `DOMAIN`: **\<empty\>**: Sets the cookie Domain
|
||||
- `DOMAIN`: **_empty_**: Sets the cookie Domain
|
||||
- `SAME_SITE`: **lax** \[strict, lax, none\]: Set the SameSite setting for the cookie.
|
||||
|
||||
## Picture (`picture`)
|
||||
|
@ -841,7 +841,7 @@ Default templates for project boards:
|
|||
## Issue and pull request attachments (`attachment`)
|
||||
|
||||
- `ENABLED`: **true**: Whether issue and pull request attachments are enabled.
|
||||
- `ALLOWED_TYPES`: **.csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip**: Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
|
||||
- `ALLOWED_TYPES`: **.csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.patch,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip**: Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
|
||||
- `MAX_SIZE`: **4**: Maximum size (MB).
|
||||
- `MAX_FILES`: **5**: Maximum number of attachments that can be uploaded at once.
|
||||
- `STORAGE_TYPE`: **local**: Storage type for attachments, `local` for local disk or `minio` for s3 compatible object storage service, default is `local` or other name defined with `[storage.xxx]`
|
||||
|
@ -854,10 +854,12 @@ Default templates for project boards:
|
|||
- `MINIO_LOCATION`: **us-east-1**: Minio location to create bucket only available when STORAGE_TYPE is `minio`
|
||||
- `MINIO_BASE_PATH`: **attachments/**: Minio base path on the bucket only available when STORAGE_TYPE is `minio`
|
||||
- `MINIO_USE_SSL`: **false**: Minio enabled ssl only available when STORAGE_TYPE is `minio`
|
||||
- `MINIO_INSECURE_SKIP_VERIFY`: **false**: Minio skip SSL verification available when STORAGE_TYPE is `minio`
|
||||
- `MINIO_CHECKSUM_ALGORITHM`: **default**: Minio checksum algorithm: `default` (for MinIO or AWS S3) or `md5` (for Cloudflare or Backblaze)
|
||||
|
||||
## Log (`log`)
|
||||
|
||||
- `ROOT_PATH`: **\<empty\>**: Root path for log files.
|
||||
- `ROOT_PATH`: **_empty_**: Root path for log files.
|
||||
- `MODE`: **console**: Logging mode. For multiple modes, use a comma to separate values. You can configure each mode in per mode log subsections `\[log.modename\]`. By default the file mode will log to `$ROOT_PATH/gitea.log`.
|
||||
- `LEVEL`: **Info**: General log level. \[Trace, Debug, Info, Warn, Error, Critical, Fatal, None\]
|
||||
- `STACKTRACE_LEVEL`: **None**: Default log level at which to log create stack traces. \[Trace, Debug, Info, Warn, Error, Critical, Fatal, None\]
|
||||
|
@ -952,7 +954,7 @@ Default templates for project boards:
|
|||
|
||||
- `SCHEDULE`: **@midnight**: Cron syntax for scheduling repository health check.
|
||||
- `TIMEOUT`: **60s**: Time duration syntax for health check execution timeout.
|
||||
- `ARGS`: **\<empty\>**: Arguments for command `git fsck`, e.g. `--unreachable --tags`. See more on http://git-scm.com/docs/git-fsck
|
||||
- `ARGS`: **_empty_**: Arguments for command `git fsck`, e.g. `--unreachable --tags`. See more on http://git-scm.com/docs/git-fsck
|
||||
|
||||
#### Cron - Repository Statistics Check (`cron.check_repo_stats`)
|
||||
|
||||
|
@ -987,59 +989,59 @@ Default templates for project boards:
|
|||
|
||||
### Extended cron tasks (not enabled by default)
|
||||
|
||||
#### Cron - Garbage collect all repositories ('cron.git_gc_repos')
|
||||
#### Cron - Garbage collect all repositories (`cron.git_gc_repos`)
|
||||
|
||||
- `ENABLED`: **false**: Enable service.
|
||||
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
|
||||
- `SCHEDULE`: **@every 72h**: Cron syntax for scheduling repository archive cleanup, e.g. `@every 1h`.
|
||||
- `TIMEOUT`: **60s**: Time duration syntax for garbage collection execution timeout.
|
||||
- `NOTICE_ON_SUCCESS`: **false**: Set to true to switch on success notices.
|
||||
- `ARGS`: **\<empty\>**: Arguments for command `git gc`, e.g. `--aggressive --auto`. The default value is same with [git] -> GC_ARGS
|
||||
- `ARGS`: **_empty_**: Arguments for command `git gc`, e.g. `--aggressive --auto`. The default value is same with [git] -> GC_ARGS
|
||||
|
||||
#### Cron - Update the '.ssh/authorized_keys' file with Gitea SSH keys ('cron.resync_all_sshkeys')
|
||||
#### Cron - Update the '.ssh/authorized_keys' file with Gitea SSH keys (`cron.resync_all_sshkeys`)
|
||||
|
||||
- `ENABLED`: **false**: Enable service.
|
||||
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
|
||||
- `NOTICE_ON_SUCCESS`: **false**: Set to true to switch on success notices.
|
||||
- `SCHEDULE`: **@every 72h**: Cron syntax for scheduling repository archive cleanup, e.g. `@every 1h`.
|
||||
|
||||
#### Cron - Resynchronize pre-receive, update and post-receive hooks of all repositories ('cron.resync_all_hooks')
|
||||
#### Cron - Resynchronize pre-receive, update and post-receive hooks of all repositories (`cron.resync_all_hooks`)
|
||||
|
||||
- `ENABLED`: **false**: Enable service.
|
||||
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
|
||||
- `NOTICE_ON_SUCCESS`: **false**: Set to true to switch on success notices.
|
||||
- `SCHEDULE`: **@every 72h**: Cron syntax for scheduling repository archive cleanup, e.g. `@every 1h`.
|
||||
|
||||
#### Cron - Reinitialize all missing Git repositories for which records exist ('cron.reinit_missing_repos')
|
||||
#### Cron - Reinitialize all missing Git repositories for which records exist (`cron.reinit_missing_repos`)
|
||||
|
||||
- `ENABLED`: **false**: Enable service.
|
||||
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
|
||||
- `NOTICE_ON_SUCCESS`: **false**: Set to true to switch on success notices.
|
||||
- `SCHEDULE`: **@every 72h**: Cron syntax for scheduling repository archive cleanup, e.g. `@every 1h`.
|
||||
|
||||
#### Cron - Delete all repositories missing their Git files ('cron.delete_missing_repos')
|
||||
#### Cron - Delete all repositories missing their Git files (`cron.delete_missing_repos`)
|
||||
|
||||
- `ENABLED`: **false**: Enable service.
|
||||
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
|
||||
- `NOTICE_ON_SUCCESS`: **false**: Set to true to switch on success notices.
|
||||
- `SCHEDULE`: **@every 72h**: Cron syntax for scheduling repository archive cleanup, e.g. `@every 1h`.
|
||||
|
||||
#### Cron - Delete generated repository avatars ('cron.delete_generated_repository_avatars')
|
||||
#### Cron - Delete generated repository avatars (`cron.delete_generated_repository_avatars`)
|
||||
|
||||
- `ENABLED`: **false**: Enable service.
|
||||
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
|
||||
- `NOTICE_ON_SUCCESS`: **false**: Set to true to switch on success notices.
|
||||
- `SCHEDULE`: **@every 72h**: Cron syntax for scheduling repository archive cleanup, e.g. `@every 1h`.
|
||||
|
||||
#### Cron - Delete all old actions from database ('cron.delete_old_actions')
|
||||
#### Cron - Delete all old actions from database (`cron.delete_old_actions`)
|
||||
|
||||
- `ENABLED`: **false**: Enable service.
|
||||
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
|
||||
- `NOTICE_ON_SUCCESS`: **false**: Set to true to switch on success notices.
|
||||
- `SCHEDULE`: **@every 168h**: Cron syntax to set how often to check.
|
||||
- `OLDER_THAN`: **@every 8760h**: any action older than this expression will be deleted from database, suggest using `8760h` (1 year) because that's the max length of heatmap.
|
||||
- `OLDER_THAN`: **8760h**: any action older than this expression will be deleted from database, suggest using `8760h` (1 year) because that's the max length of heatmap.
|
||||
|
||||
#### Cron - Check for new Gitea versions ('cron.update_checker')
|
||||
#### Cron - Check for new Gitea versions (`cron.update_checker`)
|
||||
|
||||
- `ENABLED`: **true**: Enable service.
|
||||
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
|
||||
|
@ -1047,15 +1049,15 @@ Default templates for project boards:
|
|||
- `SCHEDULE`: **@every 168h**: Cron syntax for scheduling a work, e.g. `@every 168h`.
|
||||
- `HTTP_ENDPOINT`: **https://dl.gitea.io/gitea/version.json**: the endpoint that Gitea will check for newer versions
|
||||
|
||||
#### Cron - Delete all old system notices from database ('cron.delete_old_system_notices')
|
||||
#### Cron - Delete all old system notices from database (`cron.delete_old_system_notices`)
|
||||
|
||||
- `ENABLED`: **false**: Enable service.
|
||||
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
|
||||
- `NO_SUCCESS_NOTICE`: **false**: Set to true to switch off success notices.
|
||||
- `SCHEDULE`: **@every 168h**: Cron syntax to set how often to check.
|
||||
- `OLDER_THAN`: **@every 8760h**: any system notice older than this expression will be deleted from database.
|
||||
- `OLDER_THAN`: **8760h**: any system notice older than this expression will be deleted from database.
|
||||
|
||||
#### Cron - Garbage collect LFS pointers in repositories ('cron.gc_lfs')
|
||||
#### Cron - Garbage collect LFS pointers in repositories (`cron.gc_lfs`)
|
||||
|
||||
- `ENABLED`: **false**: Enable service.
|
||||
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
|
||||
|
@ -1076,7 +1078,7 @@ Default templates for project boards:
|
|||
- `MAX_GIT_DIFF_FILES`: **100**: Max number of files shown in diff view.
|
||||
- `COMMITS_RANGE_SIZE`: **50**: Set the default commits range size
|
||||
- `BRANCHES_RANGE_SIZE`: **20**: Set the default branches range size
|
||||
- `GC_ARGS`: **\<empty\>**: Arguments for command `git gc`, e.g. `--aggressive --auto`. See more on http://git-scm.com/docs/git-gc/
|
||||
- `GC_ARGS`: **_empty_**: Arguments for command `git gc`, e.g. `--aggressive --auto`. See more on http://git-scm.com/docs/git-gc/
|
||||
- `ENABLE_AUTO_GIT_WIRE_PROTOCOL`: **true**: If use Git wire protocol version 2 when Git version >= 2.18, default is true, set to false when you always want Git wire protocol version 1.
|
||||
To enable this for Git over SSH when using a OpenSSH server, add `AcceptEnv GIT_PROTOCOL` to your sshd_config file.
|
||||
- `PULL_REQUEST_PUSH_MESSAGE`: **true**: Respond to pushes to a non-default branch with a URL for creating a Pull Request (if the repository has them enabled)
|
||||
|
@ -1086,6 +1088,11 @@ Default templates for project boards:
|
|||
- `DISABLE_CORE_PROTECT_NTFS`: **false** Set to true to forcibly set `core.protectNTFS` to false.
|
||||
- `DISABLE_PARTIAL_CLONE`: **false** Disable the usage of using partial clones for git.
|
||||
|
||||
## Git - Reflog settings (`git.reflog`)
|
||||
|
||||
- `ENABLED`: **true** Set to true to enable Git to write changes to reflogs in each repo.
|
||||
- `EXPIRATION`: **90** Reflog entry lifetime, in days. Entries are removed opportunistically by Git.
|
||||
|
||||
## Git - Timeout settings (`git.timeout`)
|
||||
|
||||
- `DEFAULT`: **360**: Git operations default timeout seconds.
|
||||
|
@ -1100,7 +1107,7 @@ Default templates for project boards:
|
|||
- `ENABLED`: **false**: Enables /metrics endpoint for prometheus.
|
||||
- `ENABLED_ISSUE_BY_LABEL`: **false**: Enable issue by label metrics with format `gitea_issues_by_label{label="bug"} 2`.
|
||||
- `ENABLED_ISSUE_BY_REPOSITORY`: **false**: Enable issue by repository metrics with format `gitea_issues_by_repository{repository="org/repo"} 5`.
|
||||
- `TOKEN`: **\<empty\>**: You need to specify the token, if you want to include in the authorization the metrics . The same token need to be used in prometheus parameters `bearer_token` or `bearer_token_file`.
|
||||
- `TOKEN`: **_empty_**: You need to specify the token, if you want to include in the authorization the metrics . The same token need to be used in prometheus parameters `bearer_token` or `bearer_token_file`.
|
||||
|
||||
## API (`api`)
|
||||
|
||||
|
@ -1117,7 +1124,7 @@ Default templates for project boards:
|
|||
- `REFRESH_TOKEN_EXPIRATION_TIME`: **730**: Lifetime of an OAuth2 refresh token in hours
|
||||
- `INVALIDATE_REFRESH_TOKENS`: **false**: Check if refresh token has already been used
|
||||
- `JWT_SIGNING_ALGORITHM`: **RS256**: Algorithm used to sign OAuth2 tokens. Valid values: \[`HS256`, `HS384`, `HS512`, `RS256`, `RS384`, `RS512`, `ES256`, `ES384`, `ES512`\]
|
||||
- `JWT_SECRET`: **\<empty\>**: OAuth2 authentication secret for access and refresh tokens, change this to a unique string. This setting is only needed if `JWT_SIGNING_ALGORITHM` is set to `HS256`, `HS384` or `HS512`.
|
||||
- `JWT_SECRET`: **_empty_**: OAuth2 authentication secret for access and refresh tokens, change this to a unique string. This setting is only needed if `JWT_SIGNING_ALGORITHM` is set to `HS256`, `HS384` or `HS512`.
|
||||
- `JWT_SIGNING_PRIVATE_KEY_FILE`: **jwt/private.pem**: Private key file path used to sign OAuth2 tokens. The path is relative to `APP_DATA_PATH`. This setting is only needed if `JWT_SIGNING_ALGORITHM` is set to `RS256`, `RS384`, `RS512`, `ES256`, `ES384` or `ES512`. The file must contain a RSA or ECDSA private key in the PKCS8 format. If no key exists a 4096 bit key will be created for you.
|
||||
- `MAX_TOKEN_LENGTH`: **32767**: Maximum length of token/cookie to accept from OAuth2 provider
|
||||
|
||||
|
@ -1144,7 +1151,7 @@ IS_INPUT_FILE = false
|
|||
|
||||
- ENABLED: **false** Enable markup support; set to **true** to enable this renderer.
|
||||
- NEED\_POSTPROCESS: **true** set to **true** to replace links / sha1 and etc.
|
||||
- FILE\_EXTENSIONS: **\<empty\>** List of file extensions that should be rendered by an external
|
||||
- FILE\_EXTENSIONS: **_empty_** List of file extensions that should be rendered by an external
|
||||
command. Multiple extensions needs a comma as splitter.
|
||||
- RENDER\_COMMAND: External command to render all matching extensions.
|
||||
- IS\_INPUT\_FILE: **false** Input is not a standard input but a file param followed `RENDER_COMMAND`.
|
||||
|
@ -1204,8 +1211,8 @@ Task queue configuration has been moved to `queue.task`. However, the below conf
|
|||
|
||||
- `MAX_ATTEMPTS`: **3**: Max attempts per http/https request on migrations.
|
||||
- `RETRY_BACKOFF`: **3**: Backoff time per http/https request retry (seconds)
|
||||
- `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`.
|
||||
- `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.
|
||||
- `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`.
|
||||
- `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.
|
||||
- `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.
|
||||
- `SKIP_TLS_VERIFY`: **false**: Allow skip tls verify
|
||||
|
||||
|
@ -1268,6 +1275,7 @@ is `data/lfs` and the default of `MINIO_BASE_PATH` is `lfs/`.
|
|||
- `MINIO_LOCATION`: **us-east-1**: Minio location to create bucket only available when `STORAGE_TYPE` is `minio`
|
||||
- `MINIO_BASE_PATH`: **lfs/**: Minio base path on the bucket only available when `STORAGE_TYPE` is `minio`
|
||||
- `MINIO_USE_SSL`: **false**: Minio enabled ssl only available when `STORAGE_TYPE` is `minio`
|
||||
- `MINIO_INSECURE_SKIP_VERIFY`: **false**: Minio skip SSL verification available when STORAGE_TYPE is `minio`
|
||||
|
||||
## Storage (`storage`)
|
||||
|
||||
|
@ -1280,6 +1288,7 @@ Default storage configuration for attachments, lfs, avatars and etc.
|
|||
- `MINIO_BUCKET`: **gitea**: Minio bucket to store the data only available when `STORAGE_TYPE` is `minio`
|
||||
- `MINIO_LOCATION`: **us-east-1**: Minio location to create bucket only available when `STORAGE_TYPE` is `minio`
|
||||
- `MINIO_USE_SSL`: **false**: Minio enabled ssl only available when `STORAGE_TYPE` is `minio`
|
||||
- `MINIO_INSECURE_SKIP_VERIFY`: **false**: Minio skip SSL verification available when STORAGE_TYPE is `minio`
|
||||
|
||||
And you can also define a customize storage like below:
|
||||
|
||||
|
@ -1298,6 +1307,8 @@ MINIO_BUCKET = gitea
|
|||
MINIO_LOCATION = us-east-1
|
||||
; Minio enabled ssl only available when STORAGE_TYPE is `minio`
|
||||
MINIO_USE_SSL = false
|
||||
; Minio skip SSL verification available when STORAGE_TYPE is `minio`
|
||||
MINIO_INSECURE_SKIP_VERIFY = false
|
||||
```
|
||||
|
||||
And used by `[attachment]`, `[lfs]` and etc. as `STORAGE_TYPE`.
|
||||
|
@ -1318,12 +1329,13 @@ is `data/repo-archive` and the default of `MINIO_BASE_PATH` is `repo-archive/`.
|
|||
- `MINIO_LOCATION`: **us-east-1**: Minio location to create bucket only available when `STORAGE_TYPE` is `minio`
|
||||
- `MINIO_BASE_PATH`: **repo-archive/**: Minio base path on the bucket only available when `STORAGE_TYPE` is `minio`
|
||||
- `MINIO_USE_SSL`: **false**: Minio enabled ssl only available when `STORAGE_TYPE` is `minio`
|
||||
- `MINIO_INSECURE_SKIP_VERIFY`: **false**: Minio skip SSL verification available when STORAGE_TYPE is `minio`
|
||||
|
||||
## Proxy (`proxy`)
|
||||
|
||||
- `PROXY_ENABLED`: **false**: Enable the proxy if true, all requests to external via HTTP will be affected, if false, no proxy will be used even environment http_proxy/https_proxy
|
||||
- `PROXY_URL`: **\<empty\>**: Proxy server URL, support http://, https//, socks://, blank will follow environment http_proxy/https_proxy
|
||||
- `PROXY_HOSTS`: **\<empty\>**: Comma separated list of host names requiring proxy. Glob patterns (*) are accepted; use ** to match all hosts.
|
||||
- `PROXY_URL`: **_empty_**: Proxy server URL, support http://, https//, socks://, blank will follow environment http_proxy/https_proxy
|
||||
- `PROXY_HOSTS`: **_empty_**: Comma separated list of host names requiring proxy. Glob patterns (*) are accepted; use ** to match all hosts.
|
||||
|
||||
i.e.
|
||||
|
|
@ -2,21 +2,21 @@
|
|||
date: "2016-12-26T16:00:00+02:00"
|
||||
title: "配置说明"
|
||||
slug: "config-cheat-sheet"
|
||||
weight: 20
|
||||
sidebar_position: 30
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "advanced"
|
||||
parent: "administration"
|
||||
name: "配置说明"
|
||||
weight: 20
|
||||
sidebar_position: 30
|
||||
identifier: "config-cheat-sheet"
|
||||
---
|
||||
|
||||
# 配置说明
|
||||
|
||||
这是针对Gitea配置文件的说明,你可以了解Gitea的强大配置。需要说明的是,你的所有改变请修改 `custom/conf/app.ini` 文件而不是源文件。
|
||||
所有默认值可以通过 [app.example.ini](https://github.com/go-gitea/gitea/blob/master/custom/conf/app.example.ini) 查看到。
|
||||
所有默认值可以通过 [app.example.ini](https://github.com/go-gitea/gitea/blob/main/custom/conf/app.example.ini) 查看到。
|
||||
如果你发现 `%(X)s` 这样的内容,请查看 [ini](https://github.com/go-ini/ini/#recursive-values) 这里的说明。
|
||||
标注了 :exclamation: 的配置项表明除非你真的理解这个配置项的意义,否则最好使用默认值。
|
||||
|
||||
|
@ -24,8 +24,6 @@ menu:
|
|||
|
||||
此文档的内容可能过于陈旧或者错误,请参考英文文档。
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
## Overall (`DEFAULT`)
|
||||
|
||||
- `APP_NAME`: 应用名称,改成你希望的名字。
|
||||
|
@ -45,7 +43,7 @@ menu:
|
|||
|
||||
### Repository - Release (`repository.release`)
|
||||
|
||||
- `ALLOWED_TYPES`: **\<empty\>**: 允许扩展名的列表,用逗号分隔 (`.zip`), mime 类型 (`text/plain`) 或者匹配符号 (`image/*`, `audio/*`, `video/*`). 空值或者 `*/*` 允许所有类型。
|
||||
- `ALLOWED_TYPES`: **_empty_**: 允许扩展名的列表,用逗号分隔 (`.zip`), mime 类型 (`text/plain`) 或者匹配符号 (`image/*`, `audio/*`, `video/*`). 空值或者 `*/*` 允许所有类型。
|
||||
- `DEFAULT_PAGING_NUM`: **10**: 默认的发布版本页面分页。
|
||||
|
||||
## UI (`ui`)
|
||||
|
@ -191,7 +189,7 @@ menu:
|
|||
- `ENABLED`: **true**: 是否启用。
|
||||
- `ADAPTER`: **memory**: 缓存引擎,可以为 `memory`, `redis` 或 `memcache`。
|
||||
- `INTERVAL`: **60**: 只对内存缓存有效,GC间隔,单位秒。
|
||||
- `HOST`: **\<empty\>**: 针对redis和memcache有效,主机地址和端口。
|
||||
- `HOST`: **_empty_**: 针对redis和memcache有效,主机地址和端口。
|
||||
- Redis: `network=tcp,addr=127.0.0.1:6379,password=macaron,db=0,pool_size=100,idle_timeout=180`
|
||||
- Memache: `127.0.0.1:9090;127.0.0.1:9091`
|
||||
- `ITEM_TTL`: **16h**: 缓存项目失效时间,设置为 -1 则禁用缓存。
|
||||
|
@ -381,8 +379,8 @@ ALLOW_DATA_URI_IMAGES = true
|
|||
|
||||
- `MAX_ATTEMPTS`: **3**: 在迁移过程中的 http/https 请求重试次数。
|
||||
- `RETRY_BACKOFF`: **3**: 等待下一次重试的时间,单位秒。
|
||||
- `ALLOWED_DOMAINS`: **\<empty\>**: 迁移仓库的域名白名单,默认为空,表示允许从任意域名迁移仓库,多个域名用逗号分隔。
|
||||
- `BLOCKED_DOMAINS`: **\<empty\>**: 迁移仓库的域名黑名单,默认为空,多个域名用逗号分隔。如果 `ALLOWED_DOMAINS` 不为空,此选项有更高的优先级拒绝这里的域名。
|
||||
- `ALLOWED_DOMAINS`: **_empty_**: 迁移仓库的域名白名单,默认为空,表示允许从任意域名迁移仓库,多个域名用逗号分隔。
|
||||
- `BLOCKED_DOMAINS`: **_empty_**: 迁移仓库的域名黑名单,默认为空,多个域名用逗号分隔。如果 `ALLOWED_DOMAINS` 不为空,此选项有更高的优先级拒绝这里的域名。
|
||||
- `ALLOW_LOCALNETWORKS`: **false**: Allow private addresses defined by RFC 1918
|
||||
- `SKIP_TLS_VERIFY`: **false**: 允许忽略 TLS 认证
|
||||
|
||||
|
@ -431,6 +429,8 @@ MINIO_BUCKET = gitea
|
|||
MINIO_LOCATION = us-east-1
|
||||
; Minio enabled ssl only available when STORAGE_TYPE is `minio`
|
||||
MINIO_USE_SSL = false
|
||||
; Minio skip SSL verification available when STORAGE_TYPE is `minio`
|
||||
MINIO_INSECURE_SKIP_VERIFY = false
|
||||
```
|
||||
|
||||
然后你在 `[attachment]`, `[lfs]` 等中可以把这个名字用作 `STORAGE_TYPE` 的值。
|
||||
|
@ -453,8 +453,8 @@ Repository archive 的存储配置。 如果 `STORAGE_TYPE` 为空,则此配
|
|||
## Proxy (`proxy`)
|
||||
|
||||
- `PROXY_ENABLED`: **false**: 是否启用全局代理。如果为否,则不使用代理,环境变量中的代理也不使用
|
||||
- `PROXY_URL`: **\<empty\>**: 代理服务器地址,支持 http://, https//, socks://,为空则不启用代理而使用环境变量中的 http_proxy/https_proxy
|
||||
- `PROXY_HOSTS`: **\<empty\>**: 逗号分隔的多个需要代理的网址,支持 * 号匹配符号, ** 表示匹配所有网站
|
||||
- `PROXY_URL`: **_empty_**: 代理服务器地址,支持 http://, https//, socks://,为空则不启用代理而使用环境变量中的 http_proxy/https_proxy
|
||||
- `PROXY_HOSTS`: **_empty_**: 逗号分隔的多个需要代理的网址,支持 * 号匹配符号, ** 表示匹配所有网站
|
||||
|
||||
i.e.
|
||||
|
|
@ -2,15 +2,15 @@
|
|||
date: "2017-04-15T14:56:00+02:00"
|
||||
title: "Customizing Gitea"
|
||||
slug: "customizing-gitea"
|
||||
weight: 9
|
||||
sidebar_position: 100
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "advanced"
|
||||
parent: "administration"
|
||||
name: "Customizing Gitea"
|
||||
identifier: "customizing-gitea"
|
||||
weight: 9
|
||||
sidebar_position: 100
|
||||
---
|
||||
|
||||
# Customizing Gitea
|
||||
|
@ -46,10 +46,6 @@ is set under the "Configuration" tab on the site administration page.
|
|||
|
||||
**Note:** Gitea must perform a full restart to see configuration changes.
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
## Serving custom public files
|
||||
|
||||
To make Gitea serve custom public files (like pages and images), use the folder
|
||||
|
@ -84,7 +80,7 @@ directory at the top of this document).
|
|||
Every single page of Gitea can be changed. Dynamic content is generated using [go templates](https://golang.org/pkg/html/template/),
|
||||
which can be modified by placing replacements below the `$GITEA_CUSTOM/templates` directory.
|
||||
|
||||
To obtain any embedded file (including templates), the [`gitea embedded` tool]({{< relref "doc/advanced/cmd-embedded.en-us.md" >}}) can be used. Alternatively, they can be found in the [`templates`](https://github.com/go-gitea/gitea/tree/main/templates) directory of Gitea source (Note: the example link is from the `main` branch. Make sure to use templates compatible with the release you are using).
|
||||
To obtain any embedded file (including templates), the [`gitea embedded` tool](administration/cmd-embedded.md) can be used. Alternatively, they can be found in the [`templates`](https://github.com/go-gitea/gitea/tree/main/templates) directory of Gitea source (Note: the example link is from the `main` branch. Make sure to use templates compatible with the release you are using).
|
||||
|
||||
Be aware that any statement contained inside `{{` and `}}` are Gitea's template syntax and
|
||||
shouldn't be touched without fully understanding these components.
|
||||
|
@ -282,9 +278,22 @@ To add custom .gitignore, add a file with existing [.gitignore rules](https://gi
|
|||
|
||||
### Labels
|
||||
|
||||
To add a custom label set, add a file that follows the [label format](https://github.com/go-gitea/gitea/blob/main/options/label/Default) to `$GITEA_CUSTOM/options/label`
|
||||
Starting with Gitea 1.19, you can add a file that follows the [YAML label format](https://github.com/go-gitea/gitea/blob/main/options/label/Advanced.yaml) to `$GITEA_CUSTOM/options/label`:
|
||||
|
||||
```yaml
|
||||
labels:
|
||||
- name: "foo/bar" # name of the label that will appear in the dropdown
|
||||
exclusive: true # whether to use the exclusive namespace for scoped labels. scoped delimiter is /
|
||||
color: aabbcc # hex colour coding
|
||||
description: Some label # long description of label intent
|
||||
```
|
||||
|
||||
The [legacy file format](https://github.com/go-gitea/gitea/blob/main/options/label/Default) can still be used following the format below, however we strongly recommend using the newer YAML format instead.
|
||||
|
||||
`#hex-color label name ; label description`
|
||||
|
||||
For more information, see the [labels documentation](usage/labels.md).
|
||||
|
||||
### Licenses
|
||||
|
||||
To add a custom license, add a file with the license text to `$GITEA_CUSTOM/options/license`
|
||||
|
@ -341,7 +350,7 @@ To make a custom theme available to all users:
|
|||
|
||||
Community themes are listed in [gitea/awesome-gitea#themes](https://gitea.com/gitea/awesome-gitea#themes).
|
||||
|
||||
The `arc-green` theme source can be found [here](https://github.com/go-gitea/gitea/blob/main/web_src/less/themes/theme-arc-green.less).
|
||||
The `arc-green` theme source can be found [here](https://github.com/go-gitea/gitea/blob/main/web_src/css/themes/theme-arc-green.css).
|
||||
|
||||
If your custom theme is considered a dark theme, set the global css variable `--is-dark-theme` to `true`.
|
||||
This allows Gitea to adjust the Monaco code editor's theme accordingly.
|
|
@ -2,14 +2,14 @@
|
|||
date: "2017-04-15T14:56:00+02:00"
|
||||
title: "自定义 Gitea 配置"
|
||||
slug: "customizing-gitea"
|
||||
weight: 9
|
||||
sidebar_position: 100
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "advanced"
|
||||
parent: "administration"
|
||||
name: "自定义 Gitea 配置"
|
||||
weight: 9
|
||||
sidebar_position: 100
|
||||
identifier: "customizing-gitea"
|
||||
---
|
||||
|
||||
|
@ -22,7 +22,7 @@ Gitea 引用 `custom` 目录中的自定义配置文件来覆盖配置、模板
|
|||
`custom/conf/app.ini` 当中。在发行版中可能会以 `/etc/gitea/` 的形式为 `custom` 设置一个符号链接,查看配置详情请移步:
|
||||
|
||||
- [快速备忘单](https://docs.gitea.io/en-us/config-cheat-sheet/)
|
||||
- [完整配置清单](https://github.com/go-gitea/gitea/blob/master/custom/conf/app.example.ini)
|
||||
- [完整配置清单](https://github.com/go-gitea/gitea/blob/main/custom/conf/app.example.ini)
|
||||
|
||||
如果您在 binary 同目录下无法找到 `custom` 文件夹,请检查您的 `GITEA_CUSTOM`
|
||||
环境变量配置, 因为它可能被配置到了其他地方(可能被一些启动脚本设置指定了目录)。
|
||||
|
@ -65,7 +65,7 @@ Gitea 引用 `custom` 目录中的自定义配置文件来覆盖配置、模板
|
|||
|
||||
同理,您可以将页签添加到 `extra_tabs.tmpl` 中,使用同样的方式来添加页签。它的具体样式需要与
|
||||
`templates/repo/header.tmpl` 中已有的其他选项卡的样式匹配
|
||||
([source in GitHub](https://github.com/go-gitea/gitea/blob/master/templates/repo/header.tmpl))
|
||||
([source in GitHub](https://github.com/go-gitea/gitea/blob/main/templates/repo/header.tmpl))
|
||||
|
||||
### 页面的其他新增内容
|
||||
|
|
@ -1,24 +1,20 @@
|
|||
---
|
||||
date: "2019-10-15T10:10:00+05:00"
|
||||
title: "Usage: Email setup"
|
||||
title: "Email setup"
|
||||
slug: "email-setup"
|
||||
weight: 12
|
||||
sidebar_position: 12
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "usage"
|
||||
parent: "administration"
|
||||
name: "Email setup"
|
||||
weight: 12
|
||||
sidebar_position: 12
|
||||
identifier: "email-setup"
|
||||
---
|
||||
|
||||
# Email setup
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
Gitea has mailer functionality for sending transactional emails (such as registration confirmation). It can be configured to either use Sendmail (or compatible MTAs like Postfix and msmtp) or directly use SMTP server.
|
||||
|
||||
## Using Sendmail
|
||||
|
@ -58,7 +54,7 @@ Restart Gitea for the configuration changes to take effect.
|
|||
|
||||
To send a test email to validate the settings, go to Gitea > Site Administration > Configuration > SMTP Mailer Configuration.
|
||||
|
||||
For the full list of options check the [Config Cheat Sheet]({{< relref "doc/advanced/config-cheat-sheet.en-us.md" >}})
|
||||
For the full list of options check the [Config Cheat Sheet](administration/config-cheat-sheet.md)
|
||||
|
||||
Please note: authentication is only supported when the SMTP server communication is encrypted with TLS or `HOST=localhost`. TLS encryption can be through:
|
||||
|
||||
|
@ -81,7 +77,7 @@ SMTP_ADDR = smtp.gmail.com
|
|||
SMTP_PORT = 465
|
||||
FROM = example.user@gmail.com
|
||||
USER = example.user
|
||||
PASSWD = ***
|
||||
PASSWD = `***`
|
||||
MAILER_TYPE = smtp
|
||||
IS_TLS_ENABLED = true
|
||||
```
|
87
docs/content/administration/email-setup.zh-cn.md
Normal file
87
docs/content/administration/email-setup.zh-cn.md
Normal file
|
@ -0,0 +1,87 @@
|
|||
---
|
||||
date: "2023-05-23T09:00:00+08:00"
|
||||
title: "Email 设置"
|
||||
slug: "email-setup"
|
||||
sidebar_position: 12
|
||||
toc: false
|
||||
draft: false
|
||||
aliases:
|
||||
- /zh-cn/email-setup
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "administration"
|
||||
name: "Email 设置"
|
||||
sidebar_position: 12
|
||||
identifier: "email-setup"
|
||||
---
|
||||
|
||||
# Email 设置
|
||||
|
||||
Gitea 具有邮件功能,用于发送事务性邮件(例如注册确认邮件)。它可以配置为使用 Sendmail(或兼容的 MTA,例如 Postfix 和 msmtp)或直接使用 SMTP 服务器。
|
||||
|
||||
## 使用 Sendmail
|
||||
|
||||
使用 `sendmail` 命令作为邮件传输代理(mailer)。
|
||||
|
||||
注意:对于在官方Gitea Docker镜像中使用,请使用SMTP版本进行配置(请参考下一节)。
|
||||
|
||||
注意:对于面向互联网的网站,请查阅您的 MTA 文档以了解通过TLS发送邮件的说明。同时设置 SPF、DMARC 和 DKIM DNS 记录,以使发送的邮件被各个电子邮件提供商接受为合法邮件。
|
||||
|
||||
```ini
|
||||
[mailer]
|
||||
ENABLED = true
|
||||
FROM = gitea@mydomain.com
|
||||
MAILER_TYPE = sendmail
|
||||
SENDMAIL_PATH = /usr/sbin/sendmail
|
||||
SENDMAIL_ARGS = "--" ; 大多数 "sendmail" 程序都接受选项,使用 "--" 将防止电子邮件地址被解释为选项。
|
||||
```
|
||||
|
||||
## 使用 SMTP
|
||||
|
||||
直接使用 SMTP 服务器作为中继。如果您不想在实例上设置 MTA,但在电子邮件提供商那里有一个帐户,这个选项非常有用。
|
||||
|
||||
```ini
|
||||
[mailer]
|
||||
ENABLED = true
|
||||
FROM = gitea@mydomain.com
|
||||
MAILER_TYPE = smtp
|
||||
SMTP_ADDR = mail.mydomain.com
|
||||
SMTP_PORT = 587
|
||||
IS_TLS_ENABLED = true
|
||||
USER = gitea@mydomain.com
|
||||
PASSWD = `password`
|
||||
```
|
||||
|
||||
重启 Gitea 以使配置更改生效。
|
||||
|
||||
要发送测试邮件以验证设置,请转到 Gitea > 站点管理 > 配置 > SMTP 邮件配置。
|
||||
|
||||
有关所有选项的完整列表,请查看[配置速查表](doc/administration/config-cheat-sheet.zh-cn.md)。
|
||||
|
||||
请注意:只有在使用 TLS 或 `HOST=localhost` 加密 SMTP 服务器通信时才支持身份验证。TLS 加密可以通过以下方式进行:
|
||||
|
||||
- 通过端口 587 的 STARTTLS(也称为 Opportunistic TLS)。初始连接是明文的,但如果服务器支持,则可以升级为 TLS。
|
||||
- 通过默认端口 465 的 SMTPS 连接。连接到服务器从一开始就使用 TLS。
|
||||
- 使用 `IS_TLS_ENABLED=true` 进行强制的 SMTPS 连接。(这两种方式都被称为 Implicit TLS)
|
||||
这是由于 Go 内部库对 STRIPTLS 攻击的保护机制。
|
||||
|
||||
请注意,自2018年起,[RFC8314](https://tools.ietf.org/html/rfc8314#section-3) 推荐使用 Implicit TLS。
|
||||
|
||||
### Gmail
|
||||
|
||||
以下配置应该适用于 Gmail 的 SMTP 服务器:
|
||||
|
||||
```ini
|
||||
[mailer]
|
||||
ENABLED = true
|
||||
HOST = smtp.gmail.com:465 ; 对于 Gitea >= 1.18.0,删除此行
|
||||
SMTP_ADDR = smtp.gmail.com
|
||||
SMTP_PORT = 465
|
||||
FROM = example.user@gmail.com
|
||||
USER = example.user
|
||||
PASSWD = `***`
|
||||
MAILER_TYPE = smtp
|
||||
IS_TLS_ENABLED = true
|
||||
```
|
||||
|
||||
请注意,您需要创建并使用一个 [应用密码](https://support.google.com/accounts/answer/185833?hl=en) 并在您的 Google 帐户上启用 2FA。您将无法直接使用您的 Google 帐户密码。
|
|
@ -2,23 +2,19 @@
|
|||
date: "2017-04-08T11:34:00+02:00"
|
||||
title: "Environment variables"
|
||||
slug: "environment-variables"
|
||||
weight: 20
|
||||
sidebar_position: 10
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "advanced"
|
||||
parent: "administration"
|
||||
name: "Environment variables"
|
||||
weight: 20
|
||||
sidebar_position: 10
|
||||
identifier: "environment-variables"
|
||||
---
|
||||
|
||||
# Environment variables
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
This is an inventory of Gitea environment variables. They change Gitea behaviour.
|
||||
|
||||
Initialize them before Gitea command to be effective, for example:
|
|
@ -2,14 +2,14 @@
|
|||
date: "2017-04-08T11:34:00+02:00"
|
||||
title: "环境变量清单"
|
||||
slug: "environment-variables"
|
||||
weight: 20
|
||||
sidebar_position: 10
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "advanced"
|
||||
parent: "administration"
|
||||
name: "环境变量清单"
|
||||
weight: 20
|
||||
sidebar_position: 10
|
||||
identifier: "environment-variables"
|
||||
---
|
||||
|
|
@ -2,23 +2,19 @@
|
|||
date: "2018-11-23:00:00+02:00"
|
||||
title: "External renderers"
|
||||
slug: "external-renderers"
|
||||
weight: 40
|
||||
sidebar_position: 60
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "advanced"
|
||||
parent: "administration"
|
||||
name: "External renderers"
|
||||
weight: 40
|
||||
sidebar_position: 60
|
||||
identifier: "external-renderers"
|
||||
---
|
||||
|
||||
# Custom files rendering configuration
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
Gitea supports custom file renderings (i.e., Jupyter notebooks, asciidoc, etc.) through external binaries,
|
||||
it is just a matter of:
|
||||
|
||||
|
@ -34,7 +30,7 @@ In order to get file rendering through external binaries, their associated packa
|
|||
If you're using a Docker image, your `Dockerfile` should contain something along this lines:
|
||||
|
||||
```docker
|
||||
FROM gitea/gitea:{{< version >}}
|
||||
FROM gitea/gitea:@version@
|
||||
[...]
|
||||
|
||||
COPY custom/app.ini /data/gitea/conf/app.ini
|
203
docs/content/administration/external-renderers.zh-cn.md
Normal file
203
docs/content/administration/external-renderers.zh-cn.md
Normal file
|
@ -0,0 +1,203 @@
|
|||
---
|
||||
date: "2023-05-23T09:00:00+08:00"
|
||||
title: "外部渲染器"
|
||||
slug: "external-renderers"
|
||||
sidebar_position: 60
|
||||
toc: false
|
||||
draft: false
|
||||
aliases:
|
||||
- /zh-cn/external-renderers
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "administration"
|
||||
name: "外部渲染器"
|
||||
sidebar_position: 60
|
||||
identifier: "external-renderers"
|
||||
---
|
||||
|
||||
# 自定义文件渲染配置
|
||||
|
||||
Gitea 通过外部二进制文件支持自定义文件渲染(例如 Jupyter notebooks、asciidoc 等),只需要进行以下步骤:
|
||||
|
||||
- 安装外部二进制文件
|
||||
- 在您的 `app.ini` 文件中添加一些配置
|
||||
- 重新启动 Gitea 实例
|
||||
|
||||
此功能支持整个文件的渲染。如果您想要在 Markdown 中渲染代码块,您需要使用 JavaScript 进行一些操作。请参阅 [自定义 Gitea 配置](administration/customizing-gitea.md) 页面上的一些示例。
|
||||
|
||||
## 安装外部二进制文件
|
||||
|
||||
为了通过外部二进制文件进行文件渲染,必须安装它们的关联软件包。
|
||||
如果您正在使用 Docker 镜像,则您的 `Dockerfile` 应该包含以下内容:
|
||||
|
||||
```docker
|
||||
FROM gitea/gitea:@version@
|
||||
[...]
|
||||
|
||||
COPY custom/app.ini /data/gitea/conf/app.ini
|
||||
[...]
|
||||
|
||||
RUN apk --no-cache add asciidoctor freetype freetype-dev gcc g++ libpng libffi-dev py-pip python3-dev py3-pip py3-pyzmq
|
||||
# 安装其他您需要的外部渲染器的软件包
|
||||
|
||||
RUN pip3 install --upgrade pip
|
||||
RUN pip3 install -U setuptools
|
||||
RUN pip3 install jupyter docutils
|
||||
# 在上面添加您需要安装的任何其他 Python 软件包
|
||||
```
|
||||
|
||||
## `app.ini` 文件配置
|
||||
|
||||
在您的自定义 `app.ini` 文件中为每个外部渲染器添加一个 `[markup.XXXXX]` 部分:
|
||||
|
||||
```ini
|
||||
[markup.asciidoc]
|
||||
ENABLED = true
|
||||
FILE_EXTENSIONS = .adoc,.asciidoc
|
||||
RENDER_COMMAND = "asciidoctor -s -a showtitle --out-file=- -"
|
||||
; 输入不是标准输入而是文件
|
||||
IS_INPUT_FILE = false
|
||||
|
||||
[markup.jupyter]
|
||||
ENABLED = true
|
||||
FILE_EXTENSIONS = .ipynb
|
||||
RENDER_COMMAND = "jupyter nbconvert --stdin --stdout --to html --template basic"
|
||||
IS_INPUT_FILE = false
|
||||
|
||||
[markup.restructuredtext]
|
||||
ENABLED = true
|
||||
FILE_EXTENSIONS = .rst
|
||||
RENDER_COMMAND = "timeout 30s pandoc +RTS -M512M -RTS -f rst"
|
||||
IS_INPUT_FILE = false
|
||||
```
|
||||
|
||||
如果您的外部标记语言依赖于在生成的 HTML 元素上的额外类和属性,您可能需要启用自定义的清理策略。Gitea 使用 [`bluemonday`](https://godoc.org/github.com/microcosm-cc/bluemonday) 包作为我们的 HTML 清理器。下面的示例可以用于支持从 [`pandoc`](https://pandoc.org/) 输出的服务器端 [KaTeX](https://katex.org/) 渲染结果。
|
||||
|
||||
```ini
|
||||
[markup.sanitizer.TeX]
|
||||
; Pandoc 渲染 TeX 段落为带有 "math" 类的 <span> 元素,根据上下文可能还带有 "inline" 或 "display" 类。
|
||||
; - 请注意,这与我们的 Markdown 解析器中内置的数学支持不同,后者使用 <code> 元素。
|
||||
ELEMENT = span
|
||||
ALLOW_ATTR = class
|
||||
REGEXP = ^\s*((math(\s+|$)|inline(\s+|$)|display(\s+|$)))+
|
||||
|
||||
[markup.markdown]
|
||||
ENABLED = true
|
||||
FILE_EXTENSIONS = .md,.markdown
|
||||
RENDER_COMMAND = pandoc -f markdown -t html --katex
|
||||
```
|
||||
|
||||
您必须在每个部分中定义 `ELEMENT` 和 `ALLOW_ATTR`。
|
||||
|
||||
要定义多个条目,请添加唯一的字母数字后缀(例如,`[markup.sanitizer.1]` 和 `[markup.sanitizer.something]`)。
|
||||
|
||||
要仅为特定的外部渲染器应用清理规则,它们必须使用渲染器名称,例如 `[markup.sanitizer.asciidoc.rule-1]`、`[markup.sanitizer.<renderer>.rule-1]`。
|
||||
|
||||
**注意**:如果规则在渲染器 ini 部分之前定义,或者名称与渲染器不匹配,它将应用于所有渲染器。
|
||||
|
||||
完成配置更改后,请重新启动 Gitea 以使更改生效。
|
||||
|
||||
**注意**:在 Gitea 1.12 之前,存在一个名为 `markup.sanitiser` 的单个部分,其中的键被重新定义为多个规则,但是,这种配置方法存在重大问题,需要通过多个部分进行配置。
|
||||
|
||||
### 示例:HTML
|
||||
|
||||
直接渲染 HTML 文件:
|
||||
|
||||
```ini
|
||||
[markup.html]
|
||||
ENABLED = true
|
||||
FILE_EXTENSIONS = .html,.htm
|
||||
RENDER_COMMAND = cat
|
||||
; 输入不是标准输入,而是文件
|
||||
IS_INPUT_FILE = true
|
||||
|
||||
[markup.sanitizer.html.1]
|
||||
ELEMENT = div
|
||||
ALLOW_ATTR = class
|
||||
|
||||
[markup.sanitizer.html.2]
|
||||
ELEMENT = a
|
||||
ALLOW_ATTR = class
|
||||
```
|
||||
|
||||
请注意:此示例中的配置将允许渲染 HTML 文件,并使用 `cat` 命令将文件内容输出为 HTML。此外,配置中的两个清理规则将允许 `<div>` 和 `<a>` 元素使用 `class` 属性。
|
||||
|
||||
在进行配置更改后,请重新启动 Gitea 以使更改生效。
|
||||
|
||||
### 示例:Office DOCX
|
||||
|
||||
使用 [`pandoc`](https://pandoc.org/) 显示 Office DOCX 文件:
|
||||
|
||||
```ini
|
||||
[markup.docx]
|
||||
ENABLED = true
|
||||
FILE_EXTENSIONS = .docx
|
||||
RENDER_COMMAND = "pandoc --from docx --to html --self-contained --template /path/to/basic.html"
|
||||
|
||||
[markup.sanitizer.docx.img]
|
||||
ALLOW_DATA_URI_IMAGES = true
|
||||
```
|
||||
|
||||
在此示例中,配置将允许显示 Office DOCX 文件,并使用 `pandoc` 命令将文件转换为 HTML 格式。同时,清理规则中的 `ALLOW_DATA_URI_IMAGES` 设置为 `true`,允许使用 Data URI 格式的图片。
|
||||
|
||||
模板文件的内容如下:
|
||||
|
||||
```
|
||||
$body$
|
||||
```
|
||||
|
||||
### 示例:Jupyter Notebook
|
||||
|
||||
使用 [`nbconvert`](https://github.com/jupyter/nbconvert) 显示 Jupyter Notebook 文件:
|
||||
|
||||
```ini
|
||||
[markup.jupyter]
|
||||
ENABLED = true
|
||||
FILE_EXTENSIONS = .ipynb
|
||||
RENDER_COMMAND = "jupyter-nbconvert --stdin --stdout --to html --template basic"
|
||||
|
||||
[markup.sanitizer.jupyter.img]
|
||||
ALLOW_DATA_URI_IMAGES = true
|
||||
```
|
||||
|
||||
在此示例中,配置将允许显示 Jupyter Notebook 文件,并使用 `nbconvert` 命令将文件转换为 HTML 格式。同样,清理规则中的 `ALLOW_DATA_URI_IMAGES` 设置为 `true`,允许使用 Data URI 格式的图片。
|
||||
|
||||
在进行配置更改后,请重新启动 Gitea 以使更改生效。
|
||||
|
||||
## 自定义 CSS
|
||||
|
||||
在 `.ini` 文件中,可以使用 `[markup.XXXXX]` 的格式指定外部渲染器,并且由外部渲染器生成的 HTML 将被包装在一个带有 `markup` 和 `XXXXX` 类的 `<div>` 中。`markup` 类提供了预定义的样式(如果 `XXXXX` 是 `markdown`,则使用 `markdown` 类)。否则,您可以使用这些类来针对渲染的 HTML 内容进行定制样式。
|
||||
|
||||
因此,您可以编写一些 CSS 样式:
|
||||
|
||||
```css
|
||||
.markup.XXXXX html {
|
||||
font-size: 100%;
|
||||
overflow-y: scroll;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-ms-text-size-adjust: 100%;
|
||||
}
|
||||
|
||||
.markup.XXXXX body {
|
||||
color: #444;
|
||||
font-family: Georgia, Palatino, 'Palatino Linotype', Times, 'Times New Roman', serif;
|
||||
font-size: 12px;
|
||||
line-height: 1.7;
|
||||
padding: 1em;
|
||||
margin: auto;
|
||||
max-width: 42em;
|
||||
background: #fefefe;
|
||||
}
|
||||
|
||||
.markup.XXXXX p {
|
||||
color: orangered;
|
||||
}
|
||||
```
|
||||
|
||||
将您的样式表添加到自定义目录中,例如 `custom/public/css/my-style-XXXXX.css`,并使用自定义的头文件 `custom/templates/custom/header.tmpl` 进行导入:
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="{{AppSubUrl}}/assets/css/my-style-XXXXX.css" />
|
||||
```
|
||||
|
||||
通过以上步骤,您可以将自定义的 CSS 样式应用到特定的外部渲染器,使其具有所需的样式效果。
|
|
@ -1,15 +1,15 @@
|
|||
---
|
||||
date: "2018-05-11T11:00:00+02:00"
|
||||
title: "Usage: Setup fail2ban"
|
||||
title: "Setup fail2ban"
|
||||
slug: "fail2ban-setup"
|
||||
weight: 16
|
||||
sidebar_position: 16
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "usage"
|
||||
parent: "administration"
|
||||
name: "Fail2ban setup"
|
||||
weight: 16
|
||||
sidebar_position: 16
|
||||
identifier: "fail2ban-setup"
|
||||
---
|
||||
|
|
@ -2,14 +2,14 @@
|
|||
date: "2022-08-01T00:00:00+00:00"
|
||||
title: "使用: 设置 Fail2ban"
|
||||
slug: "fail2ban-setup"
|
||||
weight: 16
|
||||
sidebar_position: 16
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "usage"
|
||||
parent: "administration"
|
||||
name: "设置 Fail2ban"
|
||||
weight: 16
|
||||
sidebar_position: 16
|
||||
identifier: "fail2ban-setup"
|
||||
---
|
||||
|
|
@ -1,15 +1,15 @@
|
|||
---
|
||||
date: "2019-10-06T08:00:00+05:00"
|
||||
title: "Usage: Git LFS setup"
|
||||
title: "Git LFS setup"
|
||||
slug: "git-lfs-setup"
|
||||
weight: 12
|
||||
sidebar_position: 12
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "usage"
|
||||
parent: "administration"
|
||||
name: "Git LFS setup"
|
||||
weight: 12
|
||||
sidebar_position: 12
|
||||
identifier: "git-lfs-setup"
|
||||
---
|
||||
|
32
docs/content/administration/git-lfs-support.zh-cn.md
Normal file
32
docs/content/administration/git-lfs-support.zh-cn.md
Normal file
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
date: "2023-05-23T09:00:00+08:00"
|
||||
title: "Git LFS 设置"
|
||||
slug: "git-lfs-setup"
|
||||
sidebar_position: 12
|
||||
toc: false
|
||||
draft: false
|
||||
aliases:
|
||||
- /zh-cn/git-lfs-setup
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "administration"
|
||||
name: "Git LFS 设置"
|
||||
sidebar_position: 12
|
||||
identifier: "git-lfs-setup"
|
||||
---
|
||||
|
||||
# 配置 Git 大文件存储(Large File Storage,LFS)
|
||||
|
||||
要使用 Gitea 内置的 LFS 支持,您需要更新 `app.ini` 文件:
|
||||
|
||||
```ini
|
||||
[server]
|
||||
; 启用 git-lfs 支持。true 或 false,默认为 false。
|
||||
LFS_START_SERVER = true
|
||||
|
||||
[lfs]
|
||||
; 存放 LFS 文件的路径,默认为 data/lfs。
|
||||
PATH = /home/gitea/data/lfs
|
||||
```
|
||||
|
||||
**注意**:LFS 服务器支持需要服务器上安装 Git v2.1.2 以上版本。
|
|
@ -1,30 +1,26 @@
|
|||
---
|
||||
date: "2018-06-02T11:00:00+02:00"
|
||||
title: "Usage: HTTPS setup"
|
||||
title: "HTTPS setup"
|
||||
slug: "https-setup"
|
||||
weight: 12
|
||||
sidebar_position: 12
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "usage"
|
||||
parent: "administration"
|
||||
name: "HTTPS setup"
|
||||
weight: 12
|
||||
sidebar_position: 12
|
||||
identifier: "https-setup"
|
||||
---
|
||||
|
||||
# HTTPS setup to encrypt connections to Gitea
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
## Using the built-in server
|
||||
|
||||
Before you enable HTTPS, make sure that you have valid SSL/TLS certificates.
|
||||
You could use self-generated certificates for evaluation and testing. Please run `gitea cert --host [HOST]` to generate a self signed certificate.
|
||||
|
||||
If you are using Apache or nginx on the server, it's recommended to check the [reverse proxy guide]({{< relref "doc/usage/reverse-proxies.en-us.md" >}}).
|
||||
If you are using Apache or nginx on the server, it's recommended to check the [reverse proxy guide](administration/reverse-proxies.md).
|
||||
|
||||
To use Gitea's built-in HTTPS support, you must change your `app.ini` file:
|
||||
|
268
docs/content/administration/logging-config.zh-cn.md
Normal file
268
docs/content/administration/logging-config.zh-cn.md
Normal file
|
@ -0,0 +1,268 @@
|
|||
---
|
||||
date: "2023-05-23T09:00:00+08:00"
|
||||
title: "日志配置"
|
||||
slug: "logging-config"
|
||||
sidebar_position: 40
|
||||
toc: false
|
||||
draft: false
|
||||
aliases:
|
||||
- /zh-cn/logging-configuration
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "administration"
|
||||
name: "日志配置"
|
||||
sidebar_position: 40
|
||||
identifier: "logging-config"
|
||||
---
|
||||
|
||||
# 日志配置
|
||||
|
||||
Gitea 的日志配置主要由以下三种类型的组件组成:
|
||||
|
||||
- `[log]` 部分用于一般配置
|
||||
- `[log.<mode-name>]` 部分用于配置不同的日志输出方式,也称为 "writer mode",模式名称同时也作为 "writer name"
|
||||
- `[log]` 部分还可以包含遵循 `logger.<logger-name>.<CONFIG-KEY>` 模式的子日志记录器的配置
|
||||
|
||||
默认情况下,已经有一个完全功能的日志输出,因此不需要重新定义。
|
||||
|
||||
## `[log]` 部分
|
||||
|
||||
在 Gitea 中,日志设施的配置在 `[log]` 部分及其子部分。
|
||||
|
||||
在顶层的 `[log]` 部分,可以放置以下配置项:
|
||||
|
||||
- `ROOT_PATH`:(默认值:**%(GITEA_WORK_DIR)/log**):日志文件的基本路径。
|
||||
- `MODE`:(默认值:**console**):要用于默认日志记录器的日志输出列表。
|
||||
- `LEVEL`:(默认值:**Info**):要持久化的最严重的日志事件,不区分大小写。可能的值为:`Trace`、`Debug`、`Info`、`Warn`、`Error`、`Fatal`。
|
||||
- `STACKTRACE_LEVEL`:(默认值:**None**):对于此类及更严重的事件,将在记录时打印堆栈跟踪。
|
||||
|
||||
它还可以包含以下子日志记录器:
|
||||
|
||||
- `logger.router.MODE`:(默认值:**,**):用于路由器日志记录器的日志输出列表。
|
||||
- `logger.access.MODE`:(默认值:**_empty_**):用于访问日志记录器的日志输出列表。默认情况下,访问日志记录器被禁用。
|
||||
- `logger.xorm.MODE`:(默认值:**,**):用于 XORM 日志记录器的日志输出列表。
|
||||
|
||||
将子日志记录器的模式设置为逗号(`,`)表示使用默认的全局 `MODE`。
|
||||
|
||||
## 快速示例
|
||||
|
||||
### 默认(空)配置
|
||||
|
||||
空配置等同于默认配置:
|
||||
|
||||
```ini
|
||||
[log]
|
||||
ROOT_PATH = %(GITEA_WORK_DIR)/log
|
||||
MODE = console
|
||||
LEVEL = Info
|
||||
STACKTRACE_LEVEL = None
|
||||
logger.router.MODE = ,
|
||||
logger.xorm.MODE = ,
|
||||
logger.access.MODE =
|
||||
|
||||
; 这是“控制台”模式的配置选项(由上面的 MODE=console 使用)
|
||||
[log.console]
|
||||
MODE = console
|
||||
FLAGS = stdflags
|
||||
PREFIX =
|
||||
COLORIZE = true
|
||||
```
|
||||
|
||||
这等同于将所有日志发送到控制台,并将默认的 Golang 日志也发送到控制台日志中。
|
||||
|
||||
这只是一个示例,默认情况下不需要将其写入配置文件中。
|
||||
|
||||
### 禁用路由日志并将一些访问日志记录到文件中
|
||||
|
||||
禁用路由日志,将访问日志(>=Warn)记录到 `access.log` 中:
|
||||
|
||||
```ini
|
||||
[log]
|
||||
logger.router.MODE =
|
||||
logger.access.MODE = access-file
|
||||
|
||||
[log.access-file]
|
||||
MODE = file
|
||||
LEVEL = Warn
|
||||
FILE_NAME = access.log
|
||||
```
|
||||
|
||||
### 为不同的模式设置不同的日志级别
|
||||
|
||||
将默认日志(>=Warn)记录到 `gitea.log` 中,将错误日志记录到 `file-error.log` 中:
|
||||
|
||||
```ini
|
||||
[log]
|
||||
LEVEL = Warn
|
||||
MODE = file, file-error
|
||||
|
||||
; 默认情况下,"file" 模式会将日志记录到 %(log.ROOT_PATH)/gitea.log,因此我们不需要设置它
|
||||
; [log.file]
|
||||
|
||||
[log.file-error]
|
||||
LEVEL = Error
|
||||
FILE_NAME = file-error.log
|
||||
```
|
||||
|
||||
## 日志输出(模式和写入器)
|
||||
|
||||
Gitea 提供以下日志写入器:
|
||||
|
||||
- `console` - 输出日志到 `stdout`(或 `stderr`,如果已在配置中设置)
|
||||
- `file` - 输出日志到文件
|
||||
- `conn` - 输出日志到套接字(网络或 Unix 套接字)
|
||||
|
||||
### 公共配置
|
||||
|
||||
某些配置适用于所有日志输出模式:
|
||||
|
||||
- `MODE` 是日志输出写入器的模式。它将默认为 ini 部分的模式名称。因此,`[log.console]` 将默认为 `MODE = console`。
|
||||
- `LEVEL` 是此输出将记录的最低日志级别。
|
||||
- `STACKTRACE_LEVEL` 是此输出将打印堆栈跟踪的最低日志级别。
|
||||
- `COLORIZE` 对于 `console`,默认为 `true`,否则默认为 `false`。
|
||||
|
||||
#### `EXPRESSION`
|
||||
|
||||
`EXPRESSION` 表示日志事件必须匹配才能被输出写入器记录的正则表达式。
|
||||
日志消息(去除颜色)或 `longfilename:linenumber:functionname` 必须匹配其中之一。
|
||||
注意:整个消息或字符串不需要完全匹配。
|
||||
|
||||
请注意,此表达式将在写入器的 goroutine 中运行,而不是在日志事件的 goroutine 中运行。
|
||||
|
||||
#### `FLAGS`
|
||||
|
||||
`FLAGS` 表示在每条消息之前打印的前置日志上下文信息。
|
||||
它是一个逗号分隔的字符串集。值的顺序无关紧要。
|
||||
|
||||
默认值为 `stdflags`(= `date,time,medfile,shortfuncname,levelinitial`)。
|
||||
|
||||
可能的值为:
|
||||
|
||||
- `none` 或 `,` - 无标志。
|
||||
- `date` - 当地时区的日期:`2009/01/23`。
|
||||
- `time` - 当地时区的时间:`01:23:23`。
|
||||
- `microseconds` - 微秒精度:`01:23:23.123123`。假定有时间。
|
||||
- `longfile` - 完整的文件名和行号:`/a/b/c/d.go:23`。
|
||||
- `shortfile` - 文件名的最后一个部分和行号:`d.go:23`。
|
||||
- `funcname` - 调用者的函数名:`runtime.Caller()`。
|
||||
- `shortfuncname` - 函数名的最后一部分。覆盖 `funcname`。
|
||||
- `utc` - 如果设置了日期或时间,则使用 UTC 而不是本地时区。
|
||||
- `levelinitial` - 提供的级别的初始字符,放在方括号内,例如 `[I]` 表示 info。
|
||||
- `level` - 在方括号内的级别,例如 `[INFO]`。
|
||||
- `gopid` - 上下文的 Goroutine-PID。
|
||||
- `medfile` - 文件名的最后 20 个字符 - 相当于 `shortfile,longfile`。
|
||||
- `stdflags` - 相当于 `date,time,medfile,shortfuncname,levelinitial`。
|
||||
|
||||
### Console 模式
|
||||
|
||||
在此模式下,日志记录器将将日志消息转发到 Gitea 进程附加的 stdout 和 stderr 流。
|
||||
|
||||
对于 console 模式的日志记录器,如果不在 Windows 上,或者 Windows 终端可以设置为 ANSI 模式,或者是 cygwin 或 Msys 管道,则 `COLORIZE` 默认为 `true`。
|
||||
|
||||
设置:
|
||||
|
||||
- `STDERR`:**false**:日志记录器是否应将日志打印到 `stderr` 而不是 `stdout`。
|
||||
|
||||
### File 模式
|
||||
|
||||
在此模式下,日志记录器将将日志消息保存到文件中。
|
||||
|
||||
设置:
|
||||
|
||||
- `FILE_NAME`:要将日志事件写入的文件,相对于 `ROOT_PATH`,默认为 `%(ROOT_PATH)/gitea.log`。异常情况:访问日志默认为 `%(ROOT_PATH)/access.log`。
|
||||
- `MAX_SIZE_SHIFT`:**28**:单个文件的最大大小位移。28 表示 256Mb。详细信息见下文。
|
||||
- `LOG_ROTATE` **true**:是否轮转日志文件。
|
||||
- `DAILY_ROTATE`:**true**:是否每天旋转日志。
|
||||
- `MAX_DAYS`:**7**:在此天数之后删除旋转的日志文件。
|
||||
- `COMPRESS`:**true**:默认情况下是否使用 gzip 压缩旧的日志文件。
|
||||
- `COMPRESSION_LEVEL`:**-1**:压缩级别。详细信息见下文。
|
||||
|
||||
`MAX_SIZE_SHIFT` 通过将给定次数左移 1 (`1 << x`) 来定义文件的最大大小。
|
||||
在 v1.17.3 版本时的确切行为可以在[这里](https://github.com/go-gitea/gitea/blob/v1.17.3/modules/setting/log.go#L185)中查看。
|
||||
|
||||
`COMPRESSION_LEVEL` 的有用值范围从 1 到(包括)9,其中较高的数字表示更好的压缩。
|
||||
请注意,更好的压缩可能会带来更高的资源使用。
|
||||
必须在前面加上 `-` 符号。
|
||||
|
||||
### Conn 模式
|
||||
|
||||
在此模式下,日志记录器将通过网络套接字发送日志消息。
|
||||
|
||||
设置:
|
||||
|
||||
- `ADDR`:**:7020**:设置要连接的地址。
|
||||
- `PROTOCOL`:**tcp**:设置协议,可以是 "tcp"、"unix" 或 "udp"。
|
||||
- `RECONNECT`:**false**:在连接丢失时尝试重新连接。
|
||||
- `RECONNECT_ON_MSG`:**false**:为每条消息重新连接主机。
|
||||
|
||||
### "Router" 日志记录器
|
||||
|
||||
当 Gitea 的路由处理程序工作时,Router 日志记录器记录以下消息类型:
|
||||
|
||||
- `started` 消息将以 TRACE 级别记录
|
||||
- `polling`/`completed` 路由将以 INFO 级别记录。异常情况:"/assets" 静态资源请求也会以 TRACE 级别记录。
|
||||
- `slow` 路由将以 WARN 级别记录
|
||||
- `failed` 路由将以 WARN 级别记录
|
||||
|
||||
### "XORM" 日志记录器
|
||||
|
||||
为了使 XORM 输出 SQL 日志,还应将 `[database]` 部分中的 `LOG_SQL` 设置为 `true`。
|
||||
|
||||
### "Access" 日志记录器
|
||||
|
||||
"Access" 日志记录器是自 Gitea 1.9 版本以来的新日志记录器。它提供了符合 NCSA Common Log 标准的日志格式。虽然它具有高度可配置性,但在更改其模板时应谨慎。此日志记录器的主要好处是,Gitea 现在可以使用标准日志格式记录访问日志,因此可以使用标准工具进行分析。
|
||||
|
||||
您可以通过使用 `logger.access.MODE = ...` 来启用此日志记录器。
|
||||
|
||||
如果需要,可以通过更改 `ACCESS_LOG_TEMPLATE` 的值来更改 "Access" 日志记录器的格式。
|
||||
|
||||
请注意,访问日志记录器将以 `INFO` 级别记录,将此日志记录器的 `LEVEL` 设置为 `WARN` 或更高级别将导致不记录访问日志。
|
||||
|
||||
#### ACCESS_LOG_TEMPLATE
|
||||
|
||||
此值表示一个 Go 模板。其默认值为
|
||||
|
||||
```tmpl
|
||||
{{.Ctx.RemoteHost}} - {{.Identity}} {{.Start.Format "[02/Jan/2006:15:04:05 -0700]" }} "{{.Ctx.Req.Method}} {{.Ctx.Req.URL.RequestURI}} {{.Ctx.Req.Proto}}" {{.ResponseWriter.Status}} {{.ResponseWriter.Size}} "{{.Ctx.Req.Referer}}" "{{.Ctx.Req.UserAgent}}"`
|
||||
```
|
||||
|
||||
模板接收以下选项:
|
||||
|
||||
- `Ctx` 是 `context.Context`
|
||||
- `Identity` 是 `SignedUserName`,如果用户未登录,则为 "-"
|
||||
- `Start` 是请求的开始时间
|
||||
- `ResponseWriter` 是 `http.ResponseWriter`
|
||||
|
||||
更改此模板时必须小心,因为它在标准的 panic 恢复陷阱之外运行。此模板应该尽可能简单,因为它会为每个请求运行一次。
|
||||
|
||||
## 释放和重新打开、暂停和恢复日志记录
|
||||
|
||||
如果您在 Unix 上运行,您可能希望释放和重新打开日志以使用 `logrotate` 或其他工具。
|
||||
可以通过向运行中的进程发送 `SIGUSR1` 信号或运行 `gitea manager logging release-and-reopen` 命令来强制 Gitea 释放并重新打开其日志文件和连接。
|
||||
|
||||
或者,您可能希望暂停和恢复日志记录 - 可以通过使用 `gitea manager logging pause` 和 `gitea manager logging resume` 命令来实现。请注意,当日志记录暂停时,低于 INFO 级别的日志事件将不会存储,并且只会存储有限数量的事件。在暂停时,日志记录可能会阻塞,尽管是暂时性的,但会大大减慢 Gitea 的运行速度,因此建议仅暂停很短的时间。
|
||||
|
||||
### 在 Gitea 运行时添加和删除日志记录
|
||||
|
||||
可以使用 `gitea manager logging add` 和 `remove` 子命令在 Gitea 运行时添加和删除日志记录。
|
||||
此功能只能调整正在运行的日志系统,不能用于启动未初始化的访问或路由日志记录器。如果您希望启动这些系统,建议调整 app.ini 并(优雅地)重新启动 Gitea 服务。
|
||||
|
||||
这些命令的主要目的是在运行中的系统上轻松添加临时日志记录器,以便调查问题,因为重新启动可能会导致问题消失。
|
||||
|
||||
## 使用 `logrotate` 而不是内置的日志轮转
|
||||
|
||||
Gitea 包含内置的日志轮转功能,对于大多数部署来说应该已经足够了。但是,如果您想使用 `logrotate` 工具:
|
||||
|
||||
- 在 `app.ini` 中将 `LOG_ROTATE` 设置为 `false`,禁用内置的日志轮转。
|
||||
- 安装 `logrotate`。
|
||||
- 根据部署要求配置 `logrotate`,有关配置语法细节,请参阅 `man 8 logrotate`。
|
||||
在 `postrotate/endscript` 块中通过 `kill -USR1` 或 `kill -10` 向 `gitea` 进程本身发送 `USR1` 信号,
|
||||
或者运行 `gitea manager logging release-and-reopen`(使用适当的环境设置)。
|
||||
确保配置适用于由 Gitea 日志记录器生成的所有文件,如上述部分所述。
|
||||
- 始终使用 `logrotate /etc/logrotate.conf --debug` 来测试您的配置。
|
||||
- 如果您正在使用 Docker 并从容器外部运行,您可以使用
|
||||
`docker exec -u $OS_USER $CONTAINER_NAME sh -c 'gitea manager logging release-and-reopen'`
|
||||
或 `docker exec $CONTAINER_NAME sh -c '/bin/s6-svc -1 /etc/s6/gitea/'`,或直接向 Gitea 进程本身发送 `USR1` 信号。
|
||||
|
||||
下一个 `logrotate` 作业将包括您的配置,因此不需要重新启动。
|
||||
您还可以立即使用 `logrotate /etc/logrotate.conf --force` 重新加载 `logrotate`。
|
|
@ -1,15 +1,15 @@
|
|||
---
|
||||
date: "2019-04-02T17:06:00+01:00"
|
||||
title: "Advanced: Logging Configuration"
|
||||
title: "Logging Configuration"
|
||||
slug: "logging-configuration"
|
||||
weight: 55
|
||||
sidebar_position: 40
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "advanced"
|
||||
parent: "administration"
|
||||
name: "Logging Configuration"
|
||||
weight: 55
|
||||
sidebar_position: 40
|
||||
identifier: "logging-configuration"
|
||||
---
|
||||
|
||||
|
@ -23,13 +23,9 @@ The logging configuration of Gitea mainly consists of 3 types of components:
|
|||
|
||||
As mentioned below, there is a fully functional log output by default, so it is not necessary to define one.
|
||||
|
||||
**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" >}}).
|
||||
To collect logs for help and issue report, see [Support Options](help/seek-help.md).
|
||||
|
||||
## The `[log]` section
|
||||
|
|
@ -2,23 +2,19 @@
|
|||
date: "2019-10-23T17:00:00-03:00"
|
||||
title: "Mail templates"
|
||||
slug: "mail-templates"
|
||||
weight: 45
|
||||
sidebar_position: 45
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "advanced"
|
||||
parent: "administration"
|
||||
name: "Mail templates"
|
||||
weight: 45
|
||||
sidebar_position: 45
|
||||
identifier: "mail-templates"
|
||||
---
|
||||
|
||||
# Mail templates
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
To craft the e-mail subject and contents for certain operations, Gitea can be customized by using templates. The templates
|
||||
for these functions are located under the [`custom` directory](https://docs.gitea.io/en-us/customizing-gitea/).
|
||||
Gitea has an internal template that serves as default in case there's no custom alternative.
|
||||
|
@ -39,7 +35,7 @@ Currently, the following notification events make use of templates:
|
|||
| `approve` | The head comment of a approving review for a pull request. |
|
||||
| `reject` | The head comment of a review requesting changes for a pull request. |
|
||||
| `code` | A single comment on the code of a pull request. |
|
||||
| `assigned` | Used was assigned to an issue or pull request. |
|
||||
| `assigned` | User was assigned to an issue or pull request. |
|
||||
| `default` | Any action not included in the above categories, or when the corresponding category template is not present. |
|
||||
|
||||
The path for the template of a particular message type is:
|
261
docs/content/administration/mail-templates.zh-cn.md
Normal file
261
docs/content/administration/mail-templates.zh-cn.md
Normal file
|
@ -0,0 +1,261 @@
|
|||
---
|
||||
date: "2023-05-23T09:00:00+08:00"
|
||||
title: "邮件模板"
|
||||
slug: "mail-templates"
|
||||
sidebar_position: 45
|
||||
toc: false
|
||||
draft: false
|
||||
aliases:
|
||||
- /zh-cn/mail-templates
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "administration"
|
||||
name: "邮件模板"
|
||||
sidebar_position: 45
|
||||
identifier: "mail-templates"
|
||||
---
|
||||
|
||||
# 邮件模板
|
||||
|
||||
为了定制特定操作的电子邮件主题和内容,可以使用模板来自定义 Gitea。这些功能的模板位于 [`custom` 目录](https://docs.gitea.io/en-us/customizing-gitea/) 下。
|
||||
如果没有自定义的替代方案,Gitea 将使用内部模板作为默认模板。
|
||||
|
||||
自定义模板在 Gitea 启动时加载。对它们的更改在 Gitea 重新启动之前不会被识别。
|
||||
|
||||
## 支持模板的邮件通知
|
||||
|
||||
目前,以下通知事件使用模板:
|
||||
|
||||
| 操作名称 | 用途 |
|
||||
| ----------- | ------------------------------------------------------------------------------------------------------------ |
|
||||
| `new` | 创建了新的工单或合并请求。 |
|
||||
| `comment` | 在现有工单或合并请求中创建了新的评论。 |
|
||||
| `close` | 关闭了工单或合并请求。 |
|
||||
| `reopen` | 重新打开了工单或合并请求。 |
|
||||
| `review` | 在合并请求中进行审查的首要评论。 |
|
||||
| `approve` | 对合并请求进行批准的首要评论。 |
|
||||
| `reject` | 对合并请求提出更改请求的审查的首要评论。 |
|
||||
| `code` | 关于合并请求的代码的单个评论。 |
|
||||
| `assigned` | 用户被分配到工单或合并请求。 |
|
||||
| `default` | 未包括在上述类别中的任何操作,或者当对应类别的模板不存在时使用的模板。 |
|
||||
|
||||
特定消息类型的模板路径为:
|
||||
|
||||
```sh
|
||||
custom/templates/mail/{操作类型}/{操作名称}.tmpl
|
||||
```
|
||||
|
||||
其中 `{操作类型}` 是 `issue` 或 `pull`(针对合并请求),`{操作名称}` 是上述列出的操作名称之一。
|
||||
|
||||
例如,有关合并请求中的评论的电子邮件的特定模板是:
|
||||
|
||||
```sh
|
||||
custom/templates/mail/pull/comment.tmpl
|
||||
```
|
||||
|
||||
然而,并不需要为每个操作类型/名称组合创建模板。
|
||||
使用回退系统来选择适当的模板。在此列表中,将使用 _第一个存在的_ 模板:
|
||||
|
||||
- 所需**操作类型**和**操作名称**的特定模板。
|
||||
- 操作类型为 `issue` 和所需**操作名称**的模板。
|
||||
- 所需**操作类型**和操作名称为 `default` 的模板。
|
||||
- 操作类型为` issue` 和操作名称为 `default` 的模板。
|
||||
|
||||
唯一必需的模板是操作类型为 `issue` 操作名称为 `default` 的模板,除非用户在 `custom` 目录中覆盖了它。
|
||||
|
||||
## 模板语法
|
||||
|
||||
邮件模板是 UTF-8 编码的文本文件,需要遵循以下格式之一:
|
||||
|
||||
```
|
||||
用于主题行的文本和宏
|
||||
------------
|
||||
用于邮件正文的文本和宏
|
||||
```
|
||||
|
||||
或者
|
||||
|
||||
```
|
||||
用于邮件正文的文本和宏
|
||||
```
|
||||
|
||||
指定 _主题_ 部分是可选的(因此也是虚线分隔符)。在使用时,_主题_ 和 _邮件正文_ 模板之间的分隔符需要至少三个虚线;分隔符行中不允许使用其他字符。
|
||||
|
||||
_主题_ 和 _邮件正文_ 由 [Golang的模板引擎](https://golang.org/pkg/text/template/) 解析,并提供了为每个通知组装的 _元数据上下文_。上下文包含以下元素:
|
||||
|
||||
| 名称 | 类型 | 可用性 | 用途 |
|
||||
| -------------------- | ------------------ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `.FallbackSubject` | string | 始终可用 | 默认主题行。参见下文。 |
|
||||
| `.Subject` | string | 仅在正文中可用 | 解析后的 _主题_。 |
|
||||
| `.Body` | string | 始终可用 | 工单、合并请求或评论的消息,从 Markdown 解析为 HTML 并进行了清理。请勿与 _邮件正文_ 混淆。 |
|
||||
| `.Link` | string | 始终可用 | 源工单、合并请求或评论的地址。 |
|
||||
| `.Issue` | models.Issue | 始终可用 | 产生通知的工单(或合并请求)。要获取特定于合并请求的数据(例如 `HasMerged`),可以使用 `.Issue.PullRequest`,但需要注意,如果工单 _不是_ 合并请求,则该字段将为 `nil`。 |
|
||||
| `.Comment` | models.Comment | 如果适用 | 如果通知是针对添加到工单或合并请求的评论,则其中包含有关评论的信息。 |
|
||||
| `.IsPull` | bool | 始终可用 | 如果邮件通知与合并请求关联(即 `.Issue.PullRequest` 不为 `nil` ),则为 `true`。 |
|
||||
| `.Repo` | string | 始终可用 | 仓库的名称,包括所有者名称(例如 `mike/stuff`) |
|
||||
| `.User` | models.User | 始终可用 | 事件来源仓库的所有者。要获取用户名(例如 `mike`),可以使用 `.User.Name`。 |
|
||||
| `.Doer` | models.User | 始终可用 | 执行触发通知事件的操作的用户。要获取用户名(例如 `rhonda`),可以使用 `.Doer.Name`。 |
|
||||
| `.IsMention` | bool | 始终可用 | 如果此通知仅是因为在评论中提到了用户而生成的,并且收件人未订阅源,则为 `true`。如果收件人已订阅工单或仓库,则为 `false`。 |
|
||||
| `.SubjectPrefix` | string | 始终可用 | 如果通知是关于除工单或合并请求创建之外的其他内容,则为 `Re:`;否则为空字符串。 |
|
||||
| `.ActionType` | string | 始终可用 | `"issue"` 或 `"pull"`。它将与实际的 _操作类型_ 对应,与选择的模板无关。 |
|
||||
| `.ActionName` | string | 始终可用 | 它将是上述操作类型之一(`new` ,`comment` 等),并与选择的模板对应。 |
|
||||
| `.ReviewComments` | []models.Comment | 始终可用 | 审查中的代码评论列表。评论文本将在 `.RenderedContent` 中,引用的代码将在 `.Patch` 中。 |
|
||||
|
||||
所有名称区分大小写。
|
||||
|
||||
### 模板中的主题部分
|
||||
|
||||
用于邮件主题的模板引擎是 Golang 的 [`text/template`](https://golang.org/pkg/text/template/)。
|
||||
有关语法的详细信息,请参阅链接的文档。
|
||||
|
||||
主题构建的步骤如下:
|
||||
|
||||
- 根据通知类型和可用的模板选择一个模板。
|
||||
- 解析并解析模板(例如,将 `{{.Issue.Index}}` 转换为工单或合并请求的编号)。
|
||||
- 将所有空格字符(例如 `TAB`,`LF` 等)转换为普通空格。
|
||||
- 删除所有前导、尾随和多余的空格。
|
||||
- 将字符串截断为前 256 个字母(字符)。
|
||||
|
||||
如果最终结果为空字符串,**或者**没有可用的主题模板(即所选模板不包含主题部分),将使用Gitea的**内部默认值**。
|
||||
|
||||
内部默认(回退)主题相当于:
|
||||
|
||||
```
|
||||
{{.SubjectPrefix}}[{{.Repo}}] {{.Issue.Title}} (#{{.Issue.Index}})
|
||||
```
|
||||
|
||||
例如:`Re: [mike/stuff] New color palette (#38)`
|
||||
|
||||
即使存在有效的主题模板,Gitea的默认主题也可以在模板的元数据中作为 `.FallbackSubject` 找到。
|
||||
|
||||
### 模板中的邮件正文部分
|
||||
|
||||
用于邮件正文的模板引擎是 Golang 的 [`html/template`](https://golang.org/pkg/html/template/)。
|
||||
有关语法的详细信息,请参阅链接的文档。
|
||||
|
||||
邮件正文在邮件主题之后进行解析,因此还有一个额外的 _元数据_ 字段,即在考虑所有情况之后实际呈现的主题。
|
||||
|
||||
期望的结果是 HTML(包括结构元素,如`<html>`,`<body>`等)。可以通过 `<style>` 块、`class` 和 `style` 属性进行样式设置。但是,`html/template` 会进行一些 [自动转义](https://golang.org/pkg/html/template/#hdr-Contexts),需要考虑这一点。
|
||||
|
||||
不支持附件(例如图像或外部样式表)。但是,也可以引用其他模板,例如以集中方式提供 `<style>` 元素的内容。外部模板必须放置在 `custom/mail` 下,并相对于该目录引用。例如,可以使用 `{{template styles/base}}` 包含 `custom/mail/styles/base.tmpl`。
|
||||
|
||||
邮件以 `Content-Type: multipart/alternative` 发送,因此正文以 HTML 和文本格式发送。通过剥离 HTML 标记来获取文本版本。
|
||||
|
||||
## 故障排除
|
||||
|
||||
邮件的呈现方式直接取决于邮件应用程序的功能。许多邮件客户端甚至不支持 HTML,因此显示生成邮件中包含的文本版本。
|
||||
|
||||
如果模板无法呈现,则只有在发送邮件时才会注意到。
|
||||
如果主题模板失败,将使用默认主题,如果从 _邮件正文_ 中成功呈现了任何内容,则将使用该内容,忽略其他内容。
|
||||
|
||||
如果遇到问题,请检查 [Gitea的日志](https://docs.gitea.io/en-us/logging-configuration/) 以获取错误消息。
|
||||
|
||||
## 示例
|
||||
|
||||
`custom/templates/mail/issue/default.tmpl`:
|
||||
|
||||
```html
|
||||
[{{.Repo}}] @{{.Doer.Name}}
|
||||
{{if eq .ActionName "new"}}
|
||||
创建了
|
||||
{{else if eq .ActionName "comment"}}
|
||||
评论了
|
||||
{{else if eq .ActionName "close"}}
|
||||
关闭了
|
||||
{{else if eq .ActionName "reopen"}}
|
||||
重新打开了
|
||||
{{else}}
|
||||
更新了
|
||||
{{end}}
|
||||
{{if eq .ActionType "issue"}}
|
||||
工单
|
||||
{{else}}
|
||||
合并请求
|
||||
{{end}}
|
||||
#{{.Issue.Index}}: {{.Issue.Title}}
|
||||
------------
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>{{.Subject}}</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{{if .IsMention}}
|
||||
<p>
|
||||
您收到此邮件是因为 @{{.Doer.Name}} 提到了您。
|
||||
</p>
|
||||
{{end}}
|
||||
<p>
|
||||
<p>
|
||||
<a href="{{AppUrl}}/{{.Doer.LowerName}}">@{{.Doer.Name}}</a>
|
||||
{{if not (eq .Doer.FullName "")}}
|
||||
({{.Doer.FullName}})
|
||||
{{end}}
|
||||
{{if eq .ActionName "new"}}
|
||||
创建了
|
||||
{{else if eq .ActionName "close"}}
|
||||
关闭了
|
||||
{{else if eq .ActionName "reopen"}}
|
||||
重新打开了
|
||||
{{else}}
|
||||
更新了
|
||||
{{end}}
|
||||
<a href="{{.Link}}">{{.Repo}}#{{.Issue.Index}}</a>。
|
||||
</p>
|
||||
{{if not (eq .Body "")}}
|
||||
<h3>消息内容:</h3>
|
||||
<hr>
|
||||
{{.Body | Str2html}}
|
||||
{{end}}
|
||||
</p>
|
||||
<hr>
|
||||
<p>
|
||||
<a href="{{.Link}}">在 Gitea 上查看</a>。
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
该模板将生成以下内容:
|
||||
|
||||
### 主题
|
||||
|
||||
> [mike/stuff] @rhonda 在合并请求 #38 上进行了评论:New color palette
|
||||
|
||||
### 邮件正文
|
||||
|
||||
> [@rhonda](#)(Rhonda Myers)更新了 [mike/stuff#38](#)。
|
||||
>
|
||||
> #### 消息内容:
|
||||
>
|
||||
> \_********************************\_********************************
|
||||
>
|
||||
> Mike, I think we should tone down the blues a little.
|
||||
>
|
||||
> \_********************************\_********************************
|
||||
>
|
||||
> [在 Gitea 上查看](#)。
|
||||
|
||||
## 高级用法
|
||||
|
||||
模板系统包含一些函数,可用于进一步处理和格式化消息。以下是其中一些函数的列表:
|
||||
|
||||
| 函数名 | 参数 | 可用于 | 用法 |
|
||||
| ----------------- | ----------- | ------------ | --------------------------------------------------------------------------------- |
|
||||
| `AppUrl` | - | 任何地方 | Gitea 的 URL |
|
||||
| `AppName` | - | 任何地方 | 从 `app.ini` 中设置,通常为 "Gitea" |
|
||||
| `AppDomain` | - | 任何地方 | Gitea 的主机名 |
|
||||
| `EllipsisString` | string, int | 任何地方 | 将字符串截断为指定长度;根据需要添加省略号 |
|
||||
| `Str2html` | string | 仅正文部分 | 通过删除其中的 HTML 标签对文本进行清理 |
|
||||
| `Safe` | string | 仅正文部分 | 将输入作为 HTML 处理;可用于 `.ReviewComments.RenderedContent` 等字段 |
|
||||
|
||||
这些都是 _函数_,而不是元数据,因此必须按以下方式使用:
|
||||
|
||||
```html
|
||||
像这样使用: {{Str2html "Escape<my>text"}}
|
||||
或者这样使用: {{"Escape<my>text" | Str2html}}
|
||||
或者这样使用: {{AppUrl}}
|
||||
但不要像这样使用: {{.AppUrl}}
|
||||
```
|
|
@ -2,23 +2,19 @@
|
|||
date: "2019-09-06T01:35:00-03:00"
|
||||
title: "Repository indexer"
|
||||
slug: "repo-indexer"
|
||||
weight: 45
|
||||
sidebar_position: 45
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "advanced"
|
||||
parent: "administration"
|
||||
name: "Repository indexer"
|
||||
weight: 45
|
||||
sidebar_position: 45
|
||||
identifier: "repo-indexer"
|
||||
---
|
||||
|
||||
# Repository indexer
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
## Setting up the repository indexer
|
||||
|
||||
Gitea can search through the files of the repositories by enabling this function in your [`app.ini`](https://docs.gitea.io/en-us/config-cheat-sheet/):
|
59
docs/content/administration/repo-indexer.zh-cn.md
Normal file
59
docs/content/administration/repo-indexer.zh-cn.md
Normal file
|
@ -0,0 +1,59 @@
|
|||
---
|
||||
date: "2023-05-23T09:00:00+08:00"
|
||||
title: "仓库索引器"
|
||||
slug: "repo-indexer"
|
||||
sidebar_position: 45
|
||||
toc: false
|
||||
draft: false
|
||||
aliases:
|
||||
- /zh-cn/repo-indexer
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "administration"
|
||||
name: "仓库索引器"
|
||||
sidebar_position: 45
|
||||
identifier: "repo-indexer"
|
||||
---
|
||||
|
||||
# 仓库索引器
|
||||
|
||||
## 设置仓库索引器
|
||||
|
||||
通过在您的 [`app.ini`](https://docs.gitea.io/en-us/config-cheat-sheet/) 中启用此功能,Gitea 可以通过仓库的文件进行搜索:
|
||||
|
||||
```ini
|
||||
[indexer]
|
||||
; ...
|
||||
REPO_INDEXER_ENABLED = true
|
||||
REPO_INDEXER_PATH = indexers/repos.bleve
|
||||
MAX_FILE_SIZE = 1048576
|
||||
REPO_INDEXER_INCLUDE =
|
||||
REPO_INDEXER_EXCLUDE = resources/bin/**
|
||||
```
|
||||
|
||||
请记住,索引内容可能会消耗大量系统资源,特别是在首次创建索引或全局更新索引时(例如升级 Gitea 之后)。
|
||||
|
||||
### 按大小选择要索引的文件
|
||||
|
||||
`MAX_FILE_SIZE` 选项将使索引器跳过所有大于指定值的文件。
|
||||
|
||||
### 按路径选择要索引的文件
|
||||
|
||||
Gitea使用 [`gobwas/glob` 库](https://github.com/gobwas/glob) 中的 glob 模式匹配来选择要包含在索引中的文件。
|
||||
|
||||
限制文件列表可以防止索引被派生或无关的文件(例如 lss、sym、map 等)污染,从而使搜索结果更相关。这还有助于减小索引的大小。
|
||||
|
||||
`REPO_INDEXER_EXCLUDE_VENDORED`(默认值为 true)将排除供应商文件不包含在索引中。
|
||||
|
||||
`REPO_INDEXER_INCLUDE`(默认值为空)是一个逗号分隔的 glob 模式列表,用于在索引中**包含**的文件。空列表表示“_包含所有文件_”。
|
||||
`REPO_INDEXER_EXCLUDE`(默认值为空)是一个逗号分隔的 glob 模式列表,用于从索引中**排除**的文件。与该列表匹配的文件将不会被索引。`REPO_INDEXER_EXCLUDE` 优先于 `REPO_INDEXER_INCLUDE`。
|
||||
|
||||
模式匹配工作方式如下:
|
||||
|
||||
- 要匹配所有带有 `.txt` 扩展名的文件,无论在哪个目录中,请使用 `**.txt`。
|
||||
- 要匹配仅在仓库的根级别中具有 `.txt` 扩展名的所有文件,请使用 `*.txt`。
|
||||
- 要匹配 `resources/bin` 目录及其子目录中的所有文件,请使用 `resources/bin/**`。
|
||||
- 要匹配位于 `resources/bin` 目录下的所有文件,请使用 `resources/bin/*`。
|
||||
- 要匹配所有名为 `Makefile` 的文件,请使用 `**Makefile`。
|
||||
- 匹配目录没有效果;模式 `resources/bin` 不会包含/排除该目录中的文件;`resources/bin/**` 会。
|
||||
- 所有文件和模式都规范化为小写,因此 `**Makefile`、`**makefile` 和 `**MAKEFILE` 是等效的。
|
|
@ -1,24 +1,20 @@
|
|||
---
|
||||
date: "2018-05-22T11:00:00+00:00"
|
||||
title: "Usage: Reverse Proxies"
|
||||
title: "Reverse Proxies"
|
||||
slug: "reverse-proxies"
|
||||
weight: 17
|
||||
sidebar_position: 16
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "usage"
|
||||
parent: "administration"
|
||||
name: "Reverse Proxies"
|
||||
weight: 16
|
||||
sidebar_position: 16
|
||||
identifier: "reverse-proxies"
|
||||
---
|
||||
|
||||
# Reverse Proxies
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
## Nginx
|
||||
|
||||
If you want Nginx to serve your Gitea instance, add the following `server` section to the `http` section of `nginx.conf`:
|
||||
|
@ -48,7 +44,7 @@ server {
|
|||
server_name git.example.com;
|
||||
|
||||
# Note: Trailing slash
|
||||
location /git/ {
|
||||
location /git/ {
|
||||
# Note: Trailing slash
|
||||
proxy_pass http://localhost:3000/;
|
||||
proxy_set_header Host $host;
|
||||
|
@ -187,14 +183,6 @@ git.example.com {
|
|||
}
|
||||
```
|
||||
|
||||
If you still use Caddy v1, use:
|
||||
|
||||
```apacheconf
|
||||
git.example.com {
|
||||
proxy / localhost:3000
|
||||
}
|
||||
```
|
||||
|
||||
## Caddy with a sub-path
|
||||
|
||||
In case you already have a site, and you want Gitea to share the domain name, you can setup Caddy to serve Gitea under a sub-path by adding the following to your server block in your Caddyfile:
|
||||
|
@ -208,14 +196,6 @@ git.example.com {
|
|||
}
|
||||
```
|
||||
|
||||
Or, for Caddy v1:
|
||||
|
||||
```apacheconf
|
||||
git.example.com {
|
||||
proxy /git/ localhost:3000
|
||||
}
|
||||
```
|
||||
|
||||
Then set `[server] ROOT_URL = http://git.example.com/git/` in your configuration.
|
||||
|
||||
## IIS
|
|
@ -1,24 +1,20 @@
|
|||
---
|
||||
date: "2018-05-22T11:00:00+00:00"
|
||||
title: "使用:反向代理"
|
||||
title: "反向代理"
|
||||
slug: "reverse-proxies"
|
||||
weight: 17
|
||||
sidebar_position: 16
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "usage"
|
||||
parent: "administration"
|
||||
name: "反向代理"
|
||||
weight: 16
|
||||
sidebar_position: 16
|
||||
identifier: "reverse-proxies"
|
||||
---
|
||||
|
||||
# 反向代理
|
||||
|
||||
**目录**
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
## 使用 Nginx 作为反向代理服务
|
||||
|
||||
如果您想使用 Nginx 作为 Gitea 的反向代理服务,您可以参照以下 `nginx.conf` 配置中 `server` 的 `http` 部分:
|
||||
|
@ -48,7 +44,7 @@ server {
|
|||
server_name git.example.com;
|
||||
|
||||
# 注意: /git/ 最后需要有一个路径符号
|
||||
location /git/ {
|
||||
location /git/ {
|
||||
# 注意: 反向代理后端 URL 的最后需要有一个路径符号
|
||||
proxy_pass http://localhost:3000/;
|
||||
proxy_set_header Host $host;
|
|
@ -1,15 +1,15 @@
|
|||
---
|
||||
date: "2019-12-31T13:55:00+05:00"
|
||||
title: "Advanced: Search Engines Indexation"
|
||||
title: "Search Engines Indexation"
|
||||
slug: "search-engines-indexation"
|
||||
weight: 30
|
||||
sidebar_position: 60
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "advanced"
|
||||
parent: "administration"
|
||||
name: "Search Engines Indexation"
|
||||
weight: 60
|
||||
sidebar_position: 60
|
||||
identifier: "search-engines-indexation"
|
||||
---
|
||||
|
||||
|
@ -21,7 +21,7 @@ If you don't want your repository to be visible for search engines read further.
|
|||
## Block search engines indexation using robots.txt
|
||||
|
||||
To make Gitea serve a custom `robots.txt` (default: empty 404) for top level installations,
|
||||
create a file called `robots.txt` in the [`custom` folder or `CustomPath`]({{< relref "doc/advanced/customizing-gitea.en-us.md" >}})
|
||||
create a file called `robots.txt` in the [`custom` folder or `CustomPath`](administration/customizing-gitea.md)
|
||||
|
||||
Examples on how to configure the `robots.txt` can be found at [https://moz.com/learn/seo/robotstxt](https://moz.com/learn/seo/robotstxt).
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
date: "2023-05-23T09:00:00+08:00"
|
||||
title: "搜索引擎索引"
|
||||
slug: "search-engines-indexation"
|
||||
sidebar_position: 60
|
||||
toc: false
|
||||
draft: false
|
||||
aliases:
|
||||
- /zh-cn/search-engines-indexation
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "administration"
|
||||
name: "搜索引擎索引"
|
||||
sidebar_position: 60
|
||||
identifier: "search-engines-indexation"
|
||||
---
|
||||
|
||||
# Gitea 安装的搜索引擎索引
|
||||
|
||||
默认情况下,您的 Gitea 安装将被搜索引擎索引。
|
||||
如果您不希望您的仓库对搜索引擎可见,请进一步阅读。
|
||||
|
||||
## 使用 robots.txt 阻止搜索引擎索引
|
||||
|
||||
为了使 Gitea 为顶级安装提供自定义的`robots.txt`(默认为空的 404),请在[`custom`文件夹或`CustomPath`](administration/customizing-gitea.md)中创建一个名为 `robots.txt` 的文件。
|
||||
|
||||
有关如何配置 `robots.txt` 的示例,请参考 [https://moz.com/learn/seo/robotstxt](https://moz.com/learn/seo/robotstxt)。
|
||||
|
||||
```txt
|
||||
User-agent: *
|
||||
Disallow: /
|
||||
```
|
||||
|
||||
如果您将Gitea安装在子目录中,则需要在顶级目录中创建或编辑 `robots.txt`。
|
||||
|
||||
```txt
|
||||
User-agent: *
|
||||
Disallow: /gitea/
|
||||
```
|
|
@ -2,23 +2,19 @@
|
|||
date: "2019-08-17T10:20:00+01:00"
|
||||
title: "GPG Commit Signatures"
|
||||
slug: "signing"
|
||||
weight: 20
|
||||
sidebar_position: 50
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "advanced"
|
||||
parent: "administration"
|
||||
name: "GPG Commit Signatures"
|
||||
weight: 20
|
||||
sidebar_position: 50
|
||||
identifier: "signing"
|
||||
---
|
||||
|
||||
# GPG Commit Signatures
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
Gitea will verify GPG commit signatures in the provided tree by
|
||||
checking if the commits are signed by a key within the Gitea database,
|
||||
or if the commit matches the default key for Git.
|
142
docs/content/administration/signing.zh-cn.md
Normal file
142
docs/content/administration/signing.zh-cn.md
Normal file
|
@ -0,0 +1,142 @@
|
|||
---
|
||||
date: "2023-05-23T09:00:00+08:00"
|
||||
title: "GPG 提交签名"
|
||||
slug: "signing"
|
||||
sidebar_position: 50
|
||||
toc: false
|
||||
draft: false
|
||||
aliases:
|
||||
- /zh-cn/signing
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "administration"
|
||||
name: "GPG 提交签名"
|
||||
sidebar_position: 50
|
||||
identifier: "signing"
|
||||
---
|
||||
|
||||
# GPG 提交签名
|
||||
|
||||
Gitea 将通过检查提交是否由 Gitea 数据库中的密钥签名,或者提交是否与 Git 的默认密钥匹配,来验证提供的树中的 GPG 提交签名。
|
||||
|
||||
密钥不会被检查以确定它们是否已过期或撤销。密钥也不会与密钥服务器进行检查。
|
||||
|
||||
如果找不到用于验证提交的密钥,提交将被标记为灰色的未锁定图标。如果提交被标记为红色的未锁定图标,则表示它使用带有 ID 的密钥签名。
|
||||
|
||||
请注意:提交的签署者不必是提交的作者或提交者。
|
||||
|
||||
此功能要求 Git >= 1.7.9,但要实现全部功能,需要 Git >= 2.0.0。
|
||||
|
||||
## 自动签名
|
||||
|
||||
有许多地方 Gitea 会生成提交:
|
||||
|
||||
- 仓库初始化
|
||||
- Wiki 更改
|
||||
- 使用编辑器或 API 进行的 CRUD 操作
|
||||
- 从合并请求进行合并
|
||||
|
||||
根据配置和服务器信任,您可能希望 Gitea 对这些提交进行签名。
|
||||
|
||||
## 安装和生成 Gitea 的 GPG 密钥
|
||||
|
||||
如何安装签名密钥由服务器管理员决定。Gitea 目前使用服务器的 `git` 命令生成所有提交,因此将使用服务器的 `gpg` 进行签名(如果配置了)。管理员应该审查 GPG 的最佳实践 - 特别是可能建议仅安装签名的子密钥,而不是主签名和认证的密钥。
|
||||
|
||||
## 通用配置
|
||||
|
||||
Gitea 的签名配置可以在 `app.ini` 的 `[repository.signing]` 部分找到:
|
||||
|
||||
```ini
|
||||
...
|
||||
[repository.signing]
|
||||
SIGNING_KEY = default
|
||||
SIGNING_NAME =
|
||||
SIGNING_EMAIL =
|
||||
INITIAL_COMMIT = always
|
||||
CRUD_ACTIONS = pubkey, twofa, parentsigned
|
||||
WIKI = never
|
||||
MERGES = pubkey, twofa, basesigned, commitssigned
|
||||
|
||||
...
|
||||
```
|
||||
|
||||
### `SIGNING_KEY`
|
||||
|
||||
首先讨论的选项是 `SIGNING_KEY`。有三个主要选项:
|
||||
|
||||
- `none` - 这将阻止 Gitea 对任何提交进行签名
|
||||
- `default` - Gitea 将使用 `git config` 中配置的默认密钥
|
||||
- `KEYID` - Gitea 将使用具有 ID `KEYID` 的 GPG 密钥对提交进行签名。在这种情况下,您应该提供 `SIGNING_NAME` 和 `SIGNING_EMAIL`,以便显示此密钥的信息。
|
||||
|
||||
`default` 选项将读取 `git config` 中的 `commit.gpgsign` 选项 - 如果设置了该选项,它将使用 `user.signingkey`、`user.name` 和 `user.email` 的结果。
|
||||
|
||||
请注意:通过在 Gitea 的仓库中调整 Git 的 `config` 文件,可以使用 `SIGNING_KEY=default` 为每个仓库提供不同的签名密钥。然而,这显然不是一个理想的用户界面,因此可能会发生更改。
|
||||
|
||||
**自 1.17 起**,Gitea 在自己的主目录 `[git].HOME_PATH`(默认为 `%(APP_DATA_PATH)/home`)中运行 git,并使用自己的配置文件 `{[git].HOME_PATH}/.gitconfig`。
|
||||
如果您有自己定制的 Gitea git 配置,您应该将这些配置设置在系统 git 配置文件中(例如 `/etc/gitconfig`)或者 Gitea 的内部 git 配置文件 `{[git].HOME_PATH}/.gitconfig` 中。
|
||||
与 git 命令相关的主目录文件(如 `.gnupg`)也应该放在 Gitea 的 git 主目录 `[git].HOME_PATH` 中。
|
||||
如果您希望将 `.gnupg` 目录放在 `{[git].HOME_PATH}/` 之外的位置,请考虑设置 `$GNUPGHOME` 环境变量为您首选的位置。
|
||||
|
||||
### `INITIAL_COMMIT`
|
||||
|
||||
此选项确定在创建仓库时,Gitea 是否应该对初始提交进行签名。可能的取值有:
|
||||
|
||||
- `never`:从不签名
|
||||
- `pubkey`:仅在用户拥有公钥时进行签名
|
||||
- `twofa`:仅在用户使用 2FA 登录时进行签名
|
||||
- `always`:始终签名
|
||||
|
||||
除了 `never` 和 `always` 之外的选项可以组合为逗号分隔的列表。如果所有选择的选项都为 true,则提交将被签名。
|
||||
|
||||
### `WIKI`
|
||||
|
||||
此选项确定 Gitea 是否应该对 Wiki 的提交进行签名。可能的取值有:
|
||||
|
||||
- `never`:从不签名
|
||||
- `pubkey`:仅在用户拥有公钥时进行签名
|
||||
- `twofa`:仅在用户使用 2FA 登录时进行签名
|
||||
- `parentsigned`:仅在父提交已签名时进行签名。
|
||||
- `always`:始终签名
|
||||
|
||||
除了 `never` 和 `always` 之外的选项可以组合为逗号分隔的列表。如果所有选择的选项都为 true,则提交将被签名。
|
||||
|
||||
### `CRUD_ACTIONS`
|
||||
|
||||
此选项确定 Gitea 是否应该对 Web 编辑器或 API CRUD 操作的提交进行签名。可能的取值有:
|
||||
|
||||
- `never`:从不签名
|
||||
- `pubkey`:仅在用户拥有公钥时进行签名
|
||||
- `twofa`:仅在用户使用 2FA 登录时进行签名
|
||||
- `parentsigned`:仅在父提交已签名时进行签名。
|
||||
- `always`:始终签名
|
||||
|
||||
除了 `never` 和 `always` 之外的选项可以组合为逗号分隔的列表。如果所有选择的选项都为 true,则更改将被签名。
|
||||
|
||||
### `MERGES`
|
||||
|
||||
此选项确定 Gitea 是否应该对 PR 的合并提交进行签名。可能的选项有:
|
||||
|
||||
- `never`:从不签名
|
||||
- `pubkey`:仅在用户拥有公钥时进行签名
|
||||
- `twofa`:仅在用户使用 2FA 登录时进行签名
|
||||
- `basesigned`:仅在基础仓库中的父提交已签名时进行签名。
|
||||
- `headsigned`:仅在头分支中的头提交已签名时进行签名。
|
||||
- `commitssigned`:仅在头分支中的所有提交到合并点的提交都已签名时进行签名。
|
||||
- `approved`:仅对已批准的合并到受保护分支的提交进行签名。
|
||||
- `always`:始终签名
|
||||
|
||||
除了 `never` 和 `always` 之外的选项可以组合为逗号分隔的列表。如果所有选择的选项都为 true,则合并将被签名。
|
||||
|
||||
## 获取签名密钥的公钥
|
||||
|
||||
用于签署 Gitea 提交的公钥可以通过 API 获取:
|
||||
|
||||
```sh
|
||||
/api/v1/signing-key.gpg
|
||||
```
|
||||
|
||||
在存在特定于仓库的密钥的情况下,可以通过以下方式获取:
|
||||
|
||||
```sh
|
||||
/api/v1/repos/:username/:reponame/signing-key.gpg
|
||||
```
|
13
docs/content/contributing.en-us.md
Normal file
13
docs/content/contributing.en-us.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
date: "2021-01-22T00:00:00+02:00"
|
||||
title: "Contributing"
|
||||
slug: "contributing"
|
||||
sidebar_position: 35
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
name: "Contributing"
|
||||
sidebar_position: 50
|
||||
identifier: "contributing"
|
||||
---
|
|
@ -1,13 +1,13 @@
|
|||
---
|
||||
date: "2021-01-22T00:00:00+02:00"
|
||||
title: "Übersetzung"
|
||||
slug: "translation"
|
||||
weight: 35
|
||||
slug: "contributing"
|
||||
sidebar_position: 35
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
name: "Übersetzung"
|
||||
weight: 50
|
||||
identifier: "translation"
|
||||
sidebar_position: 50
|
||||
identifier: "contributing"
|
||||
---
|
13
docs/content/contributing.zh-tw.md
Normal file
13
docs/content/contributing.zh-tw.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
date: "2021-01-22T00:00:00+02:00"
|
||||
title: "貢獻"
|
||||
slug: "contributing"
|
||||
sidebar_position: 35
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
name: "貢獻"
|
||||
sidebar_position: 50
|
||||
identifier: "contributing"
|
||||
---
|
|
@ -2,23 +2,19 @@
|
|||
date: "2021-11-01T23:41:00+08:00"
|
||||
title: "Guidelines for Backend Development"
|
||||
slug: "guidelines-backend"
|
||||
weight: 20
|
||||
sidebar_position: 20
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "developers"
|
||||
parent: "contributing"
|
||||
name: "Guidelines for Backend"
|
||||
weight: 20
|
||||
sidebar_position: 20
|
||||
identifier: "guidelines-backend"
|
||||
---
|
||||
|
||||
# Guidelines for Backend Development
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
## Background
|
||||
|
||||
Gitea uses Golang as the backend programming language. It uses many third-party packages and also write some itself.
|
||||
|
@ -35,7 +31,7 @@ To maintain understandable code and avoid circular dependencies it is important
|
|||
- `cmd`: All Gitea actual sub commands includes web, doctor, serv, hooks, admin and etc. `web` will start the web service. `serv` and `hooks` will be invoked by Git or OpenSSH. Other sub commands could help to maintain Gitea.
|
||||
- `tests`: Common test utility functions
|
||||
- `tests/integration`: Integration tests, to test back-end regressions
|
||||
- `tests/e2e`: E2e tests, to test test front-end <> back-end compatibility and visual regressions.
|
||||
- `tests/e2e`: E2e tests, to test front-end and back-end compatibility and visual regressions.
|
||||
- `models`: Contains the data structures used by xorm to construct database tables. It also contains functions to query and update the database. Dependencies to other Gitea code should be avoided. You can make exceptions in cases such as logging.
|
||||
- `models/db`: Basic database operations. All other `models/xxx` packages should depend on this package. The `GetEngine` function should only be invoked from `models/`.
|
||||
- `models/fixtures`: Sample data used in unit tests and integration tests. One `yml` file means one table which will be loaded into database when beginning the tests.
|
||||
|
@ -70,7 +66,6 @@ So services must be allowed to create a database transaction. Here is some examp
|
|||
// services/repository/repository.go
|
||||
func CreateXXXX() error {
|
||||
return db.WithTx(func(ctx context.Context) error {
|
||||
e := db.GetEngine(ctx)
|
||||
// do something, if err is returned, it will rollback automatically
|
||||
if err := issues.UpdateIssue(ctx, repoID); err != nil {
|
||||
// ...
|
119
docs/content/contributing/guidelines-backend.zh-cn.md
Normal file
119
docs/content/contributing/guidelines-backend.zh-cn.md
Normal file
|
@ -0,0 +1,119 @@
|
|||
---
|
||||
date: "2023-05-25T23:41:00+08:00"
|
||||
title: "后端开发指南"
|
||||
slug: "guidelines-backend"
|
||||
sidebar_position: 20
|
||||
toc: false
|
||||
draft: false
|
||||
aliases:
|
||||
- /zh-cn/guidelines-backend
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "contributing"
|
||||
name: "后端开发指南"
|
||||
sidebar_position: 20
|
||||
identifier: "guidelines-backend"
|
||||
---
|
||||
|
||||
# 后端开发指南
|
||||
|
||||
## 背景
|
||||
|
||||
Gitea使用Golang作为后端编程语言。它使用了许多第三方包,并且自己也编写了一些包。
|
||||
例如,Gitea使用[Chi](https://github.com/go-chi/chi)作为基本的Web框架。[Xorm](https://xorm.io)是一个用于与数据库交互的ORM框架。
|
||||
因此,管理这些包非常重要。在开始编写后端代码之前,请参考以下准则。
|
||||
|
||||
## 包设计准则
|
||||
|
||||
### 包列表
|
||||
|
||||
为了保持易于理解的代码并避免循环依赖,拥有良好的代码结构是很重要的。Gitea后端分为以下几个部分:
|
||||
|
||||
- `build`:帮助构建Gitea的脚本。
|
||||
- `cmd`:包含所有Gitea的实际子命令,包括web、doctor、serv、hooks、admin等。`web`将启动Web服务。`serv`和`hooks`将被Git或OpenSSH调用。其他子命令可以帮助维护Gitea。
|
||||
- `tests`:常用的测试函数
|
||||
- `tests/integration`:集成测试,用于测试后端回归。
|
||||
- `tests/e2e`:端到端测试,用于测试前端和后端的兼容性和视觉回归。
|
||||
- `models`:包含由xorm用于构建数据库表的数据结构。它还包含查询和更新数据库的函数。应避免与其他Gitea代码的依赖关系。在某些情况下,比如日志记录时可以例外。
|
||||
- `models/db`:基本的数据库操作。所有其他`models/xxx`包都应依赖于此包。`GetEngine`函数只能从models/中调用。
|
||||
- `models/fixtures`:单元测试和集成测试中使用的示例数据。一个`yml`文件表示一个将在测试开始时加载到数据库中的表。
|
||||
- `models/migrations`:存储不同版本之间的数据库迁移。修改数据库结构的PR**必须**包含一个迁移步骤。
|
||||
- `modules`:在Gitea中处理特定功能的不同模块。工作正在进行中:其中一些模块应该移到`services`中,特别是那些依赖于models的模块,因为它们依赖于数据库。
|
||||
- `modules/setting`:存储从ini文件中读取的所有系统配置,并在各处引用。但是在可能的情况下,应将其作为函数参数使用。
|
||||
- `modules/git`:用于与`Git`命令行或Gogit包交互的包。
|
||||
- `public`:编译后的前端文件(JavaScript、图像、CSS等)
|
||||
- `routers`:处理服务器请求。由于它使用其他Gitea包来处理请求,因此其他包(models、modules或services)不能依赖于routers。
|
||||
- `routers/api`:包含`/api/v1`相关路由,用于处理RESTful API请求。
|
||||
- `routers/install`:只能在系统处于安装模式(INSTALL_LOCK=false)时响应。
|
||||
- `routers/private`:仅由内部子命令调用,特别是`serv`和`hooks`。
|
||||
- `routers/web`:处理来自Web浏览器或Git SMART HTTP协议的HTTP请求。
|
||||
- `services`:用于常见路由操作或命令执行的支持函数。使用`models`和`modules`来处理请求。
|
||||
- `templates`:用于生成HTML输出的Golang模板。
|
||||
|
||||
### 包依赖关系
|
||||
|
||||
由于Golang不支持导入循环,我们必须仔细决定包之间的依赖关系。这些包之间有一些级别。以下是理想的包依赖关系方向。
|
||||
|
||||
`cmd` -> `routers` -> `services` -> `models` -> `modules`
|
||||
|
||||
从左到右,左侧的包可以依赖于右侧的包,但右侧的包不能依赖于左侧的包。在同一级别的子包中,可以根据该级别的规则进行依赖。
|
||||
|
||||
**注意事项**
|
||||
|
||||
为什么我们需要在`models`之外使用数据库事务?以及如何使用?
|
||||
某些操作在数据库记录插入/更新/删除失败时应该允许回滚。
|
||||
因此,服务必须能够创建数据库事务。以下是一些示例:
|
||||
|
||||
```go
|
||||
// services/repository/repository.go
|
||||
func CreateXXXX() error {
|
||||
return db.WithTx(func(ctx context.Context) error {
|
||||
// do something, if err is returned, it will rollback automatically
|
||||
if err := issues.UpdateIssue(ctx, repoID); err != nil {
|
||||
// ...
|
||||
return err
|
||||
}
|
||||
// ...
|
||||
return nil
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
在`services`中**不应该**直接使用`db.GetEngine(ctx)`,而是应该在`models/`下编写一个函数。
|
||||
如果该函数将在事务中使用,请将`context.Context`作为函数的第一个参数。
|
||||
|
||||
```go
|
||||
// models/issues/issue.go
|
||||
func UpdateIssue(ctx context.Context, repoID int64) error {
|
||||
e := db.GetEngine(ctx)
|
||||
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
### 包名称
|
||||
|
||||
对于顶层包,请使用复数作为包名,例如`services`、`models`,对于子包,请使用单数,例如`services/user`、`models/repository`。
|
||||
|
||||
### 导入别名
|
||||
|
||||
由于有一些使用相同包名的包,例如`modules/user`、`models/user`和`services/user`,当这些包在一个Go文件中被导入时,很难知道我们使用的是哪个包以及它是变量名还是导入名。因此,我们始终建议使用导入别名。为了与常见的驼峰命名法的包变量区分开,建议使用**snake_case**作为导入别名的命名规则。
|
||||
例如:`import user_service "code.gitea.io/gitea/services/user"`
|
||||
|
||||
### 重要注意事项
|
||||
|
||||
- 永远不要写成`x.Update(exemplar)`,而没有明确的`WHERE`子句:
|
||||
- 这将导致表中的所有行都被使用exemplar的非零值进行更新,包括ID。
|
||||
- 通常应该写成`x.ID(id).Update(exemplar)`。
|
||||
- 如果在迁移过程中使用`x.Insert(exemplar)`向表中插入记录,而ID是预设的:
|
||||
- 对于MSSQL变体,你将需要执行``SET IDENTITY_INSERT `table` ON``(否则迁移将失败)
|
||||
- 对于PostgreSQL,你还需要更新ID序列,否则迁移将悄无声息地通过,但后续的插入将失败:
|
||||
``SELECT setval('table_name_id_seq', COALESCE((SELECT MAX(id)+1 FROM `table_name`), 1), false)``
|
||||
|
||||
### 未来的任务
|
||||
|
||||
目前,我们正在进行一些重构,以完成以下任务:
|
||||
|
||||
- 纠正不符合规则的代码。
|
||||
- `models`中的文件太多了,所以我们正在将其中的一些移动到子包`models/xxx`中。
|
||||
- 由于它们依赖于`models`,因此应将某些`modules`子包移动到`services`中。
|
|
@ -2,32 +2,28 @@
|
|||
date: "2021-10-13T16:00:00+02:00"
|
||||
title: "Guidelines for Frontend Development"
|
||||
slug: "guidelines-frontend"
|
||||
weight: 20
|
||||
sidebar_position: 30
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "developers"
|
||||
parent: "contributing"
|
||||
name: "Guidelines for Frontend"
|
||||
weight: 20
|
||||
sidebar_position: 30
|
||||
identifier: "guidelines-frontend"
|
||||
---
|
||||
|
||||
# Guidelines for Frontend Development
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
## Background
|
||||
|
||||
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.
|
||||
Gitea uses [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.
|
||||
|
||||
The HTML pages are rendered by [Go HTML Template](https://pkg.go.dev/html/template).
|
||||
|
||||
The source files can be found in the following directories:
|
||||
|
||||
* **Less styles:** `web_src/less/`
|
||||
* **CSS styles:** `web_src/css/`
|
||||
* **JavaScript files:** `web_src/js/`
|
||||
* **Vue components:** `web_src/js/components/`
|
||||
* **Go HTML templates:** `templates/`
|
134
docs/content/contributing/guidelines-frontend.zh-cn.md
Normal file
134
docs/content/contributing/guidelines-frontend.zh-cn.md
Normal file
|
@ -0,0 +1,134 @@
|
|||
---
|
||||
date: "2023-05-25T16:00:00+02:00"
|
||||
title: "前端开发指南"
|
||||
slug: "guidelines-frontend"
|
||||
sidebar_position: 20
|
||||
toc: false
|
||||
draft: false
|
||||
aliases:
|
||||
- /zh-cn/guidelines-frontend
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "contributing"
|
||||
name: "前端开发指南"
|
||||
sidebar_position: 20
|
||||
identifier: "guidelines-frontend"
|
||||
---
|
||||
|
||||
# 前端开发指南
|
||||
|
||||
## 背景
|
||||
|
||||
Gitea 在其前端中使用[Fomantic-UI](https://fomantic-ui.com/introduction/getting-started.html)(基于[jQuery](https://api.jquery.com))和 [Vue3](https://vuejs.org/)。
|
||||
|
||||
HTML 页面由[Go HTML Template](https://pkg.go.dev/html/template)渲染。
|
||||
|
||||
源文件可以在以下目录中找到:
|
||||
|
||||
* **CSS 样式**: `web_src/css/`
|
||||
* **JavaScript 文件**: `web_src/js/`
|
||||
* **Vue 组件**: `web_src/js/components/`
|
||||
* **Go HTML 模板**: `templates/`
|
||||
|
||||
## 通用准则
|
||||
|
||||
我们推荐使用[Google HTML/CSS Style Guide](https://google.github.io/styleguide/htmlcssguide.html)和[Google JavaScript Style Guide](https://google.github.io/styleguide/jsguide.html)。
|
||||
|
||||
## Gitea 特定准则:
|
||||
|
||||
1. 每个功能(Fomantic-UI/jQuery 模块)应放在单独的文件/目录中。
|
||||
2. HTML 的 id 和 class 应使用 kebab-case,最好包含2-3个与功能相关的关键词。
|
||||
3. 在 JavaScript 中使用的 HTML 的 id 和 class 应在整个项目中是唯一的,并且应包含2-3个与功能相关的关键词。建议在仅在 JavaScript 中使用的 class 中使用 `js-` 前缀。
|
||||
4. 不应覆盖框架提供的 class 的 CSS 样式。始终使用具有2-3个与功能相关的关键词的新 class 名称来覆盖框架样式。Gitea 中的帮助 CSS 类在 `helpers.less` 中。
|
||||
5. 后端可以通过使用`ctx.PageData["myModuleData"] = map[]{}`将复杂数据传递给前端,但不要将整个模型暴露给前端,以避免泄露敏感数据。
|
||||
6. 简单页面和与 SEO 相关的页面使用 Go HTML 模板渲染生成静态的 Fomantic-UI HTML 输出。复杂页面可以使用 Vue3。
|
||||
7. 明确变量类型,优先使用`elem.disabled = true`而不是`elem.setAttribute('disabled', 'anything')`,优先使用`$el.prop('checked', var === 'yes')`而不是`$el.prop('checked', var)`。
|
||||
8. 使用语义化元素,优先使用`<button class="ui button">`而不是`<div class="ui button">`。
|
||||
9. 避免在 CSS 中使用不必要的`!important`,如果无法避免,添加注释解释为什么需要它。
|
||||
10. 避免在一个事件监听器中混合不同的事件,优先为每个事件使用独立的事件监听器。
|
||||
11. 推荐使用自定义事件名称前缀`ce-`。
|
||||
12. Gitea 的 tailwind-style CSS 类使用`gt-`前缀(`gt-relative`),而 Gitea 自身的私有框架级 CSS 类使用`g-`前缀(`g-modal-confirm`)。
|
||||
|
||||
### 可访问性 / ARIA
|
||||
|
||||
在历史上,Gitea大量使用了可访问性不友好的框架 Fomantic UI。
|
||||
Gitea使用一些补丁使Fomantic UI更具可访问性(参见`aria.js`和`aria.md`),
|
||||
但仍然存在许多问题需要大量的工作和时间来修复。
|
||||
|
||||
### 框架使用
|
||||
|
||||
不建议混合使用不同的框架,这会使代码难以维护。
|
||||
一个 JavaScript 模块应遵循一个主要框架,并遵循该框架的最佳实践。
|
||||
|
||||
推荐的实现方式:
|
||||
|
||||
* Vue + Vanilla JS
|
||||
* Fomantic-UI(jQuery)
|
||||
* Vanilla JS
|
||||
|
||||
不推荐的实现方式:
|
||||
|
||||
* Vue + Fomantic-UI(jQuery)
|
||||
* jQuery + Vanilla JS
|
||||
|
||||
为了保持界面一致,Vue 组件可以使用 Fomantic-UI 的 CSS 类。
|
||||
尽管不建议混合使用不同的框架,
|
||||
但如果混合使用是必要的,并且代码设计良好且易于维护,也可以工作。
|
||||
|
||||
### async 函数
|
||||
|
||||
只有当函数内部存在`await`调用或返回`Promise`时,才将函数标记为`async`。
|
||||
|
||||
不建议使用`async`事件监听器,这可能会导致问题。
|
||||
原因是`await`后的代码在事件分发之外执行。
|
||||
参考:https://github.com/github/eslint-plugin-github/blob/main/docs/rules/async-preventdefault.md
|
||||
|
||||
如果一个事件监听器必须是`async`,应在任何`await`之前使用`e.preventDefault()`,
|
||||
建议将其放在函数的开头。
|
||||
|
||||
如果我们想在非异步上下文中调用`async`函数,
|
||||
建议使用`const _promise = asyncFoo()`来告诉读者
|
||||
这是有意为之的,我们想调用异步函数并忽略Promise。
|
||||
一些 lint 规则和 IDE 也会在未处理返回的 Promise 时发出警告。
|
||||
|
||||
### HTML 属性和 dataset
|
||||
|
||||
禁止使用`dataset`,它的驼峰命名行为使得搜索属性变得困难。
|
||||
然而,仍然存在一些特殊情况,因此当前的准则是:
|
||||
|
||||
* 对于旧代码:
|
||||
* 应将`$.data()`重构为`$.attr()`。
|
||||
* 在极少数情况下,可以使用`$.data()`将一些非字符串数据绑定到元素上,但强烈不推荐使用。
|
||||
|
||||
* 对于新代码:
|
||||
* 不应使用`node.dataset`,而应使用`node.getAttribute`。
|
||||
* 不要将任何用户数据绑定到 DOM 节点上,使用合适的设计模式描述节点和数据之间的关系。
|
||||
|
||||
### 显示/隐藏元素
|
||||
|
||||
* 推荐在Vue组件中使用`v-if`和`v-show`来显示/隐藏元素。
|
||||
* Go 模板代码应使用 Gitea 的 `.gt-hidden` 和 `showElem()/hideElem()/toggleElem()` 来显示/隐藏元素,请参阅`.gt-hidden`的注释以获取更多详细信息。
|
||||
|
||||
### Go HTML 模板中的样式和属性
|
||||
|
||||
建议使用以下方式:
|
||||
|
||||
```html
|
||||
<div class="gt-name1 gt-name2 {{if .IsFoo}}gt-foo{{end}}" {{if .IsFoo}}data-foo{{end}}></div>
|
||||
```
|
||||
|
||||
而不是:
|
||||
|
||||
```html
|
||||
<div class="gt-name1 gt-name2{{if .IsFoo}} gt-foo{{end}}"{{if .IsFoo}} data-foo{{end}}></div>
|
||||
```
|
||||
|
||||
以使代码更易读。
|
||||
|
||||
### 旧代码
|
||||
|
||||
许多旧代码已经存在于本文撰写之前。建议重构旧代码以遵循指南。
|
||||
|
||||
### Vue3 和 JSX
|
||||
|
||||
Gitea 现在正在使用 Vue3。我们决定不引入 JSX,以保持 HTML 代码和 JavaScript 代码分离。
|
|
@ -2,23 +2,19 @@
|
|||
date: "2023-02-14T00:00:00+00:00"
|
||||
title: "Guidelines for Refactoring"
|
||||
slug: "guidelines-refactoring"
|
||||
weight: 20
|
||||
sidebar_position: 40
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "developers"
|
||||
name: "Guidelines for Refactoring"
|
||||
weight: 20
|
||||
identifier: "guidelines-refactoring"
|
||||
sidebar:
|
||||
parent: "contributing"
|
||||
name: "Guidelines for Refactoring"
|
||||
sidebar_position: 40
|
||||
identifier: "guidelines-refactoring"
|
||||
---
|
||||
|
||||
# Guidelines for Refactoring
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
## Background
|
||||
|
||||
Since the first line of code was written at Feb 12, 2014, Gitea has grown to be a large project.
|
49
docs/content/contributing/guidelines-refactoring.zh-cn.md
Normal file
49
docs/content/contributing/guidelines-refactoring.zh-cn.md
Normal file
|
@ -0,0 +1,49 @@
|
|||
---
|
||||
date: "2023-05-25T00:00:00+00:00"
|
||||
title: "重构指南"
|
||||
slug: "guidelines-refactoring"
|
||||
sidebar_position: 20
|
||||
toc: false
|
||||
draft: false
|
||||
aliases:
|
||||
- /zh-cn/guidelines-refactoring
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "contributing"
|
||||
name: "重构指南"
|
||||
sidebar_position: 20
|
||||
identifier: "guidelines-refactoring"
|
||||
---
|
||||
|
||||
# 重构指南
|
||||
|
||||
## 背景
|
||||
|
||||
自2014年2月12日编写了第一行代码以来,Gitea已经发展成为一个庞大的项目。
|
||||
因此,代码库变得越来越大。代码库越大,维护就越困难。
|
||||
存在许多过时的机制,许多框架混合在一起,一些遗留代码可能会导致错误并阻碍新功能的开发。
|
||||
为了使代码库更易于维护,使Gitea变得更好,开发人员应牢记使用现代机制来重构旧代码。
|
||||
|
||||
本文档是关于重构代码库的指南集合。
|
||||
|
||||
## 重构建议
|
||||
|
||||
* 设计更多关于未来的内容,而不仅仅解决当前问题。
|
||||
* 减少模糊性,减少冲突,提高可维护性。
|
||||
* 描述重构,例如:
|
||||
* 为什么需要重构。
|
||||
* 如何解决旧问题。
|
||||
* 重构的优点/缺点是什么。
|
||||
* 只做必要的更改,尽量保留旧逻辑。
|
||||
* 引入一些中间步骤,使重构更容易审查,完整的重构计划可以在几个PR中完成。
|
||||
* 如果存在分歧,应该请TOC(技术监督委员会)参与决策。
|
||||
* 添加必要的测试以确保重构的正确性。
|
||||
* 非错误重构优先在里程碑的开始时进行,这样可以更容易地在发布之前发现问题。
|
||||
|
||||
## 审查和合并建议
|
||||
|
||||
* 重构的PR不应该长时间保持打开状态(通常为7天),应尽快进行审查。
|
||||
* 重构的PR应尽快合并,不应被其他PR阻塞。
|
||||
* 如果TOC没有异议,重构的PR可以在7天后由一名核心成员(非作者)批准后合并。
|
||||
* 如果最终结果良好,容忍一些不完美/临时的步骤。
|
||||
* 如果重构是必要的,容忍一些回归错误,并尽快修复错误。
|
|
@ -1,15 +1,16 @@
|
|||
---
|
||||
date: "2021-01-22T00:00:00+02:00"
|
||||
title: "Übersetzungs Richtlinien"
|
||||
weight: 10
|
||||
toc: true
|
||||
slug: "localization"
|
||||
sidebar_position: 70
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "translation"
|
||||
parent: "contributing"
|
||||
name: "Übersetzungsrichtlinien"
|
||||
weight: 70
|
||||
identifier: "translation-guidelines"
|
||||
sidebar_position: 70
|
||||
identifier: "localization"
|
||||
---
|
||||
|
||||
## Allgemeines
|
|
@ -2,14 +2,14 @@
|
|||
date: "2016-12-01T16:00:00+02:00"
|
||||
title: "Localization"
|
||||
slug: "localization"
|
||||
weight: 10
|
||||
sidebar_position: 70
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "features"
|
||||
parent: "contributing"
|
||||
name: "Localization"
|
||||
weight: 20
|
||||
sidebar_position: 70
|
||||
identifier: "localization"
|
||||
---
|
||||
|
||||
|
@ -18,7 +18,7 @@ menu:
|
|||
Gitea's localization happens through our [Crowdin project](https://crowdin.com/project/gitea).
|
||||
|
||||
For changes to an **English** translation, a pull request can be made that changes the appropriate key in
|
||||
the [english locale](https://github.com/go-gitea/gitea/blob/master/options/locale/locale_en-US.ini).
|
||||
the [english locale](https://github.com/go-gitea/gitea/blob/main/options/locale/locale_en-US.ini).
|
||||
|
||||
For changes to a **non-English** translation, refer to the Crowdin project above.
|
||||
|
||||
|
@ -31,3 +31,7 @@ After a translation has been accepted, it will be reflected in the main reposito
|
|||
At the time of writing, this means that a changed translation may not appear until the following Gitea release.
|
||||
|
||||
If you use a bleeding edge build, it should appear as soon as you update after the change is synced.
|
||||
|
||||
# How to Contribute
|
||||
|
||||
Different Languages have different translation guidelines. Please visit the respective page for more information.
|
34
docs/content/contributing/localization.zh-cn.md
Normal file
34
docs/content/contributing/localization.zh-cn.md
Normal file
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
date: "2016-12-01T16:00:00+02:00"
|
||||
title: "本地化"
|
||||
slug: "localization"
|
||||
sidebar_position: 70
|
||||
toc: false
|
||||
draft: false
|
||||
aliases:
|
||||
- /zh-cn/localization
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "contributing"
|
||||
name: "本地化"
|
||||
sidebar_position: 70
|
||||
identifier: "localization"
|
||||
---
|
||||
|
||||
# 本地化
|
||||
|
||||
Gitea的本地化是通过我们的[Crowdin项目](https://crowdin.com/project/gitea)进行的。
|
||||
|
||||
对于对**英语翻译**的更改,可以发出pull-request,来更改[英语语言环境](https://github.com/go-gitea/gitea/blob/main/options/locale/locale_en-US.ini)中合适的关键字。
|
||||
|
||||
有关对**非英语**翻译的更改,请参阅上面的 Crowdin 项目。
|
||||
|
||||
## 支持的语言
|
||||
|
||||
上述 Crowdin 项目中列出的任何语言一旦翻译了 25% 或更多都将得到支持。
|
||||
|
||||
翻译被接受后,它将在下一次 Crowdin 同步后反映在主存储库中,这通常是在任何 PR 合并之后。
|
||||
|
||||
在撰写本文时,这意味着更改后的翻译可能要到 Gitea 的下一个版本才会出现。
|
||||
|
||||
如果使用开发版本,则在同步更改内容后,它应该会在更新后立即显示。
|
|
@ -2,14 +2,14 @@
|
|||
date: "2016-12-01T16:00:00+02:00"
|
||||
title: "在地化"
|
||||
slug: "localization"
|
||||
weight: 10
|
||||
sidebar_position: 70
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "features"
|
||||
parent: "contributing"
|
||||
name: "在地化"
|
||||
weight: 20
|
||||
sidebar_position: 70
|
||||
identifier: "localization"
|
||||
---
|
||||
|
||||
|
@ -17,7 +17,7 @@ menu:
|
|||
|
||||
我們在 [Crowdin 專案](https://crowdin.com/project/gitea)上進行在地化工作。
|
||||
|
||||
**英語系**的翻譯,可在修改[英文語言檔](https://github.com/go-gitea/gitea/blob/master/options/locale/locale_en-US.ini)後提出合併請求。
|
||||
**英語系**的翻譯,可在修改[英文語言檔](https://github.com/go-gitea/gitea/blob/main/options/locale/locale_en-US.ini)後提出合併請求。
|
||||
|
||||
**非英語系**的翻譯,請前往上述的 Crowdin 專案。
|
||||
|
17
docs/content/contributing/translation.zh-cn.md
Normal file
17
docs/content/contributing/translation.zh-cn.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
date: "2023-05-25T00:00:00+02:00"
|
||||
title: "翻译指南"
|
||||
sidebar_position: 70
|
||||
toc: true
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "contributing"
|
||||
name: "翻译指南"
|
||||
sidebar_position: 70
|
||||
identifier: "translation-guidelines"
|
||||
---
|
||||
|
||||
本页面用于提供一套通用规则,以确保翻译的一致性。
|
||||
|
||||
* [German](/de-de/übersetzungs-richtlinien/)
|
13
docs/content/development.en-us.md
Normal file
13
docs/content/development.en-us.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
date: "2016-12-01T16:00:00+02:00"
|
||||
title: "Development"
|
||||
slug: "development"
|
||||
sidebar_position: 40
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
name: "Development"
|
||||
sidebar_position: 40
|
||||
identifier: "development"
|
||||
---
|
13
docs/content/development.zh-cn.md
Normal file
13
docs/content/development.zh-cn.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
date: "2016-12-01T16:00:00+02:00"
|
||||
title: "开发"
|
||||
slug: "development"
|
||||
sidebar_position: 40
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
name: "开发"
|
||||
sidebar_position: 40
|
||||
identifier: "development"
|
||||
---
|
13
docs/content/development.zh-tw.md
Normal file
13
docs/content/development.zh-tw.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
date: "2016-12-01T16:00:00+02:00"
|
||||
title: "開發"
|
||||
slug: "development"
|
||||
sidebar_position: 40
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
name: "開發"
|
||||
sidebar_position: 40
|
||||
identifier: "development"
|
||||
---
|
|
@ -2,23 +2,19 @@
|
|||
date: "2018-06-24:00:00+02:00"
|
||||
title: "API Usage"
|
||||
slug: "api-usage"
|
||||
weight: 40
|
||||
sidebar_position: 40
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "developers"
|
||||
parent: "development"
|
||||
name: "API Usage"
|
||||
weight: 40
|
||||
sidebar_position: 40
|
||||
identifier: "api-usage"
|
||||
---
|
||||
|
||||
# API Usage
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
## Enabling/configuring API access
|
||||
|
||||
By default, `ENABLE_SWAGGER` is true, and
|
|
@ -2,14 +2,14 @@
|
|||
date: "2018-06-24:00:00+02:00"
|
||||
title: "API 使用指南"
|
||||
slug: "api-usage"
|
||||
weight: 40
|
||||
sidebar_position: 40
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "developers"
|
||||
parent: "development"
|
||||
name: "API 使用指南"
|
||||
weight: 40
|
||||
sidebar_position: 40
|
||||
identifier: "api-usage"
|
||||
---
|
||||
|
|
@ -2,23 +2,19 @@
|
|||
date: "2016-12-01T16:00:00+02:00"
|
||||
title: "Hacking on Gitea"
|
||||
slug: "hacking-on-gitea"
|
||||
weight: 10
|
||||
sidebar_position: 10
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "developers"
|
||||
parent: "development"
|
||||
name: "Hacking on Gitea"
|
||||
weight: 10
|
||||
sidebar_position: 10
|
||||
identifier: "hacking-on-gitea"
|
||||
---
|
||||
|
||||
# Hacking on Gitea
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
## Quickstart
|
||||
|
||||
To get a quick working development environment you could use Gitpod.
|
||||
|
@ -32,7 +28,7 @@ environment correctly.
|
|||
|
||||
Next, [install Node.js with npm](https://nodejs.org/en/download/) which is
|
||||
required to build the JavaScript and CSS files. The minimum supported Node.js
|
||||
version is {{< min-node-version >}} and the latest LTS version is recommended.
|
||||
version is @minNodeVersion@ and the latest LTS version is recommended.
|
||||
|
||||
**Note**: When executing make tasks that require external tools, like
|
||||
`make watch-backend`, Gitea will automatically download and build these as
|
||||
|
@ -40,11 +36,11 @@ necessary. To be able to use these you must have the `"$GOPATH"/bin` directory
|
|||
on the executable path. If you don't add the go bin directory to the
|
||||
executable path you will have to manage this yourself.
|
||||
|
||||
**Note 2**: Go version {{< min-go-version >}} or higher is required.
|
||||
**Note 2**: Go version @minGoVersion@ or higher is required.
|
||||
Gitea uses `gofmt` to format source code. However, the results of
|
||||
`gofmt` can differ by the version of `go`. Therefore it is
|
||||
recommended to install the version of Go that our continuous integration is
|
||||
running. As of last update, the Go version should be {{< go-version >}}.
|
||||
running. As of last update, the Go version should be @goVersion@.
|
||||
|
||||
## Installing Make
|
||||
|
||||
|
@ -121,9 +117,8 @@ to the Gitea sources. Otherwise, changes can't be pushed.
|
|||
## Building Gitea (Basic)
|
||||
|
||||
Take a look at our
|
||||
<a href='{{< relref "doc/installation/from-source.en-us.md" >}}'>instructions</a>
|
||||
for <a href='{{< relref "doc/installation/from-source.en-us.md" >}}'>building
|
||||
from source</a>.
|
||||
[instructions](installation/from-source.md)
|
||||
for [building from source](installation/from-source.md).
|
||||
|
||||
The simplest recommended way to build from source is:
|
||||
|
||||
|
@ -177,7 +172,7 @@ server as mentioned above.
|
|||
|
||||
### Working on JS and CSS
|
||||
|
||||
Frontend development should follow [Guidelines for Frontend Development]({{< relref "doc/developers/guidelines-frontend.en-us.md" >}})
|
||||
Frontend development should follow [Guidelines for Frontend Development](contributing/guidelines-frontend.md)
|
||||
|
||||
To build with frontend resources, either use the `watch-frontend` target mentioned above or just build once:
|
||||
|
||||
|
@ -264,8 +259,8 @@ OpenAPI 3 documentation.
|
|||
When creating new configuration options, it is not enough to add them to the
|
||||
`modules/setting` files. You should add information to `custom/conf/app.ini`
|
||||
and to the
|
||||
<a href='{{< relref "doc/advanced/config-cheat-sheet.en-us.md" >}}'>configuration cheat sheet</a>
|
||||
found in `docs/content/doc/advanced/config-cheat-sheet.en-us.md`
|
||||
[configuration cheat sheet](administration/config-cheat-sheet.md)
|
||||
found in `docs/content/doc/administer/config-cheat-sheet.en-us.md`
|
||||
|
||||
### Changing the logo
|
||||
|
345
docs/content/development/hacking-on-gitea.zh-cn.md
Normal file
345
docs/content/development/hacking-on-gitea.zh-cn.md
Normal file
|
@ -0,0 +1,345 @@
|
|||
---
|
||||
date: "2016-12-01T16:00:00+02:00"
|
||||
title: "玩转 Gitea"
|
||||
slug: "hacking-on-gitea"
|
||||
sidebar_position: 10
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "development"
|
||||
name: "玩转 Gitea"
|
||||
sidebar_position: 10
|
||||
identifier: "hacking-on-gitea"
|
||||
---
|
||||
|
||||
# Hacking on Gitea
|
||||
|
||||
## 快速入门
|
||||
|
||||
要获得快速工作的开发环境,您可以使用 Gitpod。
|
||||
|
||||
[![在 Gitpod 中打开](/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/go-gitea/gitea)
|
||||
|
||||
## 安装 Golang
|
||||
|
||||
您需要 [安装 go]( https://golang.org/doc/install ) 并设置您的 go 环境。
|
||||
|
||||
接下来,[使用 npm 安装 Node.js](https://nodejs.org/en/download/) ,这是构建
|
||||
JavaScript 和 CSS 文件的必要工具。最低支持的 Node.js 版本是 @minNodeVersion@
|
||||
并且推荐使用最新的 LTS 版本。
|
||||
|
||||
**注意** :当执行需要外部工具的 make 任务时,比如
|
||||
`make watch-backend`,Gitea 会自动下载并构建这些必要的组件。为了能够使用这些,你必须
|
||||
将 `"$GOPATH"/bin` 目录加入到可执行路径上。如果你不把go bin目录添加到可执行路径你必须手动
|
||||
指定可执行程序路径。
|
||||
|
||||
**注意2** :Go版本 @minGoVersion@ 或更高版本是必须的。Gitea 使用 `gofmt` 来
|
||||
格式化源代码。然而,`gofmt` 的结果可能因 `go` 的版本而有差异。因此推荐安装我们持续集成使用
|
||||
的 Go版本。截至上次更新,Go 版本应该是 @goVersion@。
|
||||
|
||||
## 安装 Make
|
||||
|
||||
Gitea 大量使用 `Make` 来自动化任务和改进开发。本指南涵盖了如何安装 Make。
|
||||
|
||||
### 在 Linux 上
|
||||
|
||||
使用包管理器安装。
|
||||
|
||||
在 Ubuntu/Debian 上:
|
||||
|
||||
```bash
|
||||
sudo apt-get install make
|
||||
```
|
||||
|
||||
在 Fedora/RHEL/CentOS 上:
|
||||
|
||||
```bash
|
||||
sudo yum install make
|
||||
```
|
||||
|
||||
### 在 Windows 上
|
||||
|
||||
Make 的这三个发行版都可以在 Windows 上运行:
|
||||
|
||||
- [单个二进制构建]( http://www.equation.com/servlet/equation.cmd?fa=make )。复制到某处并添加到 `PATH`。
|
||||
- [32 位版本](http://www.equation.com/ftpdir/make/32/make.exe)
|
||||
- [64 位版本](http://www.equation.com/ftpdir/make/64/make.exe)
|
||||
- [MinGW-w64](https://www.mingw-w64.org) / [MSYS2](https://www.msys2.org/)。
|
||||
- MSYS2 是一个工具和库的集合,为您提供一个易于使用的环境来构建、安装和运行本机 Windows 软件,它包括 MinGW-w64。
|
||||
- 在 MingGW-w64 中,二进制文件称为 `mingw32-make.exe` 而不是 `make.exe`。将 `bin` 文件夹添加到 `PATH`。
|
||||
- 在 MSYS2 中,您可以直接使用 `make`。请参阅 [MSYS2 移植](https://www.msys2.org/wiki/Porting/)。
|
||||
- 要使用 CGO_ENABLED(例如:SQLite3)编译 Gitea,您可能需要使用 [tdm-gcc](https://jmeubank.github.io/tdm-gcc/) 而不是 MSYS2 gcc,因为 MSYS2 gcc 标头缺少一些 Windows -只有 CRT 函数像 _beginthread 一样。
|
||||
- [Chocolatey包管理器]( https://chocolatey.org/packages/make )。运行`choco install make`
|
||||
|
||||
**注意** :如果您尝试在 Windows 命令提示符下使用 make 进行构建,您可能会遇到问题。建议使用上述提示(Git bash 或 MinGW),但是如果您只有命令提示符(或可能是 PowerShell),则可以使用 [set](https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/set_1) 命令,例如 `set TAGS=bindata`。
|
||||
|
||||
## 下载并克隆 Gitea 源代码
|
||||
|
||||
获取源代码的推荐方法是使用 `git clone`。
|
||||
|
||||
```bash
|
||||
git clone https://github.com/go-gitea/gitea
|
||||
```
|
||||
|
||||
(自从go modules出现后,不再需要构建 go 项目从 `$GOPATH` 中获取,因此不再推荐使用 `go get` 方法。)
|
||||
|
||||
## 派生 Gitea
|
||||
|
||||
如上所述下载主要的 Gitea 源代码。然后,派生 [Gitea 仓库](https://github.com/go-gitea/gitea),
|
||||
并为您的本地仓库切换 git 远程源,或添加另一个远程源:
|
||||
|
||||
```bash
|
||||
# 将原来的 Gitea origin 重命名为 upstream
|
||||
git remote rename origin upstream
|
||||
git remote add origin "git@github.com:$GITHUB_USERNAME/gitea.git"
|
||||
git fetch --all --prune
|
||||
```
|
||||
|
||||
或者:
|
||||
|
||||
```bash
|
||||
# 为我们的 fork 添加新的远程
|
||||
git remote add "$FORK_NAME" "git@github.com:$GITHUB_USERNAME/gitea.git"
|
||||
git fetch --all --prune
|
||||
```
|
||||
|
||||
为了能够创建合并请求,应将分叉存储库添加为 Gitea 本地仓库的远程,否则无法推送更改。
|
||||
|
||||
## 构建 Gitea(基本)
|
||||
|
||||
看看我们的
|
||||
[说明](installation/from-source.md)
|
||||
关于如何[从源代码构建](installation/from-source.md) 。
|
||||
|
||||
从源代码构建的最简单推荐方法是:
|
||||
|
||||
```bash
|
||||
TAGS="bindata sqlite sqlite_unlock_notify" make build
|
||||
```
|
||||
|
||||
`build` 目标将同时执行 `frontend` 和 `backend` 子目标。如果存在 `bindata` 标签,资源文件将被编译成二进制文件。建议在进行前端开发时省略 `bindata` 标签,以便实时反映更改。
|
||||
|
||||
有关所有可用的 `make` 目标,请参阅 `make help`。另请参阅 [`.drone.yml`](https://github.com/go-gitea/gitea/blob/main/.drone.yml) 以了解我们的持续集成是如何工作的。
|
||||
|
||||
## 持续构建
|
||||
|
||||
要在源文件更改时运行并持续构建:
|
||||
|
||||
```bash
|
||||
# 对于前端和后端
|
||||
make watch
|
||||
|
||||
# 或者:只看前端文件(html/js/css)
|
||||
make watch-frontend
|
||||
|
||||
# 或者:只看后端文件 (go)
|
||||
make watch-backend
|
||||
```
|
||||
|
||||
在 macOS 上,监视所有后端源文件可能会达到默认的打开文件限制,这可以通过当前 shell 的 `ulimit -n 12288` 或所有未来 shell 的 shell 启动文件来增加。
|
||||
|
||||
### 格式化、代码分析和拼写检查
|
||||
|
||||
我们的持续集成将拒绝未通过代码检查(包括格式检查、代码分析和拼写检查)的 PR。
|
||||
|
||||
你应该格式化你的代码:
|
||||
|
||||
```bash
|
||||
make fmt
|
||||
```
|
||||
|
||||
并检查源代码:
|
||||
|
||||
```bash
|
||||
# lint 前端和后端代码
|
||||
make lint
|
||||
# 仅 lint 后端代码
|
||||
make lint-backend
|
||||
```
|
||||
|
||||
**注意** :`gofmt` 的结果取决于 `go` 的版本。您应该运行与持续集成相同的 go 版本。
|
||||
|
||||
### 处理 JS 和 CSS
|
||||
|
||||
前端开发应遵循 [Guidelines for Frontend Development](contributing/guidelines-frontend.md)。
|
||||
|
||||
要使用前端资源构建,请使用上面提到的“watch-frontend”目标或只构建一次:
|
||||
|
||||
```bash
|
||||
make build && ./gitea
|
||||
```
|
||||
|
||||
在提交之前,确保 linters 通过:
|
||||
|
||||
```bash
|
||||
make lint-frontend
|
||||
```
|
||||
|
||||
### 配置本地 ElasticSearch 实例
|
||||
|
||||
使用 docker 启动本地 ElasticSearch 实例:
|
||||
|
||||
```sh
|
||||
mkdir -p $(pwd) /data/elasticsearch
|
||||
sudo chown -R 1000:1000 $(pwd) /data/elasticsearch
|
||||
docker run --rm --memory= "4g" -p 127.0.0.1:9200:9200 -p 127.0.0.1:9300:9300 -e "discovery.type=single-node" -v "$(pwd)/data /elasticsearch:/usr/share/elasticsearch/data" docker.elastic.co/elasticsearch/elasticsearch:7.16.3
|
||||
```
|
||||
|
||||
配置`app.ini`:
|
||||
|
||||
```ini
|
||||
[indexer]
|
||||
ISSUE_INDEXER_TYPE = elasticsearch
|
||||
ISSUE_INDEXER_CONN_STR = http://elastic:changeme@localhost:9200
|
||||
REPO_INDEXER_ENABLED = true
|
||||
REPO_INDEXER_TYPE = elasticsearch
|
||||
REPO_INDEXER_CONN_STR = http://elastic:changeme@localhost:9200
|
||||
```
|
||||
|
||||
### 构建和添加 SVGs
|
||||
|
||||
SVG 图标是使用 `make svg` 目标构建的,该目标将 `build/generate-svg.js` 中定义的图标源编译到输出目录 `public/img/svg` 中。可以在 `web_src/svg` 目录中添加自定义图标。
|
||||
|
||||
### 构建 Logo
|
||||
|
||||
Gitea Logo的 PNG 和 SVG 版本是使用 `TAGS="gitea" make generate-images` 目标从单个 SVG 源文件 assets/logo.svg 构建的。要运行它,Node.js 和 npm 必须可用。
|
||||
|
||||
通过更新 `assets/logo.svg` 并运行 `make generate-images`,同样的过程也可用于从 SVG 源文件生成自定义 Logo PNG。忽略 gitea 编译选项将仅更新用户指定的 LOGO 文件。
|
||||
|
||||
### 更新 API
|
||||
|
||||
创建新的 API 路由或修改现有的 API 路由时,您**必须**
|
||||
更新和/或创建 [Swagger](https://swagger.io/docs/specification/2-0/what-is-swagger/)
|
||||
这些使用 [go-swagger](https://goswagger.io/) 评论的文档。
|
||||
[规范]( https://goswagger.io/use/spec.html#annotation-syntax )中描述了这些注释的结构。
|
||||
如果您想了解更多有关 Swagger 结构的信息,可以查看
|
||||
[Swagger 2.0 文档](https://swagger.io/docs/specification/2-0/basic-structure/)
|
||||
或与添加新 API 端点的先前 PR 进行比较,例如 [PR #5483](https://github.com/go-gitea/gitea/pull/5843/files#diff-2e0a7b644cf31e1c8ef7d76b444fe3aaR20)
|
||||
|
||||
您应该注意不要破坏下游用户依赖的 API。在稳定的 API 上,一般来说添加是可以接受的,但删除
|
||||
或对 API 进行根本性更改将会被拒绝。
|
||||
|
||||
创建或更改 API 端点后,请用以下命令重新生成 Swagger 文档:
|
||||
|
||||
```bash
|
||||
make generate-swagger
|
||||
```
|
||||
|
||||
您应该验证生成的 Swagger 文件并使用以下命令对其进行拼写检查:
|
||||
|
||||
```bash
|
||||
make swagger-validate misspell-check
|
||||
```
|
||||
|
||||
您应该提交更改后的 swagger JSON 文件。持续集成服务器将使用以下方法检查是否已完成:
|
||||
|
||||
```bash
|
||||
make swagger-check
|
||||
```
|
||||
|
||||
**注意** :请注意,您应该使用 Swagger 2.0 文档,而不是 OpenAPI 3 文档。
|
||||
|
||||
### 创建新的配置选项
|
||||
|
||||
创建新的配置选项时,将它们添加到 `modules/setting` 的对应文件。您应该将信息添加到 `custom/conf/app.ini`
|
||||
并到[配置备忘单](administration/config-cheat-sheet.md)
|
||||
在 `docs/content/doc/advanced/config-cheat-sheet.en-us.md` 中找到
|
||||
|
||||
### 更改Logo
|
||||
|
||||
更改 Gitea Logo SVG 时,您将需要运行并提交结果的:
|
||||
|
||||
```bash
|
||||
make generate-images
|
||||
```
|
||||
|
||||
这将创建必要的 Gitea 图标和其他图标。
|
||||
|
||||
### 数据库迁移
|
||||
|
||||
如果您对数据库中的任何数据库持久结构进行重大更改
|
||||
`models/` 目录,您将需要进行新的迁移。可以找到这些
|
||||
在 `models/migrations/` 中。您可以确保您的迁移适用于主要
|
||||
数据库类型使用:
|
||||
|
||||
```bash
|
||||
make test-sqlite-migration # 将 SQLite 切换为适当的数据库
|
||||
```
|
||||
|
||||
## 测试
|
||||
|
||||
Gitea 运行两种类型的测试:单元测试和集成测试。
|
||||
|
||||
### 单元测试
|
||||
|
||||
`go test` 系统中的`*_test.go` 涵盖了单元测试。
|
||||
您可以设置环境变量 `GITEA_UNIT_TESTS_LOG_SQL=1` 以在详细模式下运行测试时显示所有 SQL 语句(即设置`GOTESTFLAGS=-v` 时)。
|
||||
|
||||
```bash
|
||||
TAGS="bindata sqlite sqlite_unlock_notify" make test # Runs the unit tests
|
||||
```
|
||||
|
||||
### 集成测试
|
||||
|
||||
单元测试不会也不能完全单独测试 Gitea。因此,我们编写了集成测试;但是,这些依赖于数据库。
|
||||
|
||||
```bash
|
||||
TAGS="bindata sqlite sqlite_unlock_notify" make build test-sqlite
|
||||
```
|
||||
|
||||
将在 SQLite 环境中运行集成测试。集成测试需要安装 `git lfs`。其他数据库测试可用,但
|
||||
可能需要适应当地环境。
|
||||
|
||||
看看 [`tests/integration/README.md`](https://github.com/go-gitea/gitea/blob/main/tests/integration/README.md) 有关更多信息以及如何运行单个测试。
|
||||
|
||||
### 测试 PR
|
||||
|
||||
我们的持续集成将测试代码是否通过了单元测试,并且所有支持的数据库都将在 Docker 环境中通过集成测试。
|
||||
还将测试从几个最新版本的 Gitea 迁移。
|
||||
|
||||
请在PR中附带提交适当的单元测试和集成测试。
|
||||
|
||||
## 网站文档
|
||||
|
||||
该网站的文档位于 `docs/` 中。如果你改变了文档内容,你可以使用以下测试方法进行持续集成:
|
||||
|
||||
```bash
|
||||
# 来自 Gitea 中的 docs 目录
|
||||
make trans-copy clean build
|
||||
```
|
||||
|
||||
运行此任务依赖于 [Hugo](https://gohugo.io/)。请注意:这可能会生成一些未跟踪的 Git 对象,
|
||||
需要被清理干净。
|
||||
|
||||
## Visual Studio Code
|
||||
|
||||
`contrib/ide/vscode` 中为 Visual Studio Code 提供了 `launch.json` 和 `tasks.json`。查看
|
||||
[`contrib/ide/README.md`](https://github.com/go-gitea/gitea/blob/main/contrib/ide/README.md) 了解更多信息。
|
||||
|
||||
## Goland
|
||||
|
||||
单击 `/main.go` 中函数 `func main()` 上的 `Run Application` 箭头
|
||||
可以快速启动一个可调试的 Gitea 实例。
|
||||
|
||||
`Run/Debug Configuration` 中的 `Output Directory` 必须设置为
|
||||
gitea 项目目录(包含 `main.go` 和 `go.mod`),
|
||||
否则,启动实例的工作目录是 GoLand 的临时目录
|
||||
并防止 Gitea 在开发环境中加载动态资源(例如:模板)。
|
||||
|
||||
要在 GoLand 中使用 SQLite 运行单元测试,请设置 `-tags sqlite,sqlite_unlock_notify`
|
||||
在 `运行/调试配置` 的 `Go 工具参数` 中。
|
||||
|
||||
## 提交 PR
|
||||
|
||||
对更改感到满意后,将它们推送并打开拉取请求。它建议您允许 Gitea Managers 和 Owners 修改您的 PR
|
||||
分支,因为我们需要在合并之前将其更新为 main 和/或可能是能够直接帮助解决问题。
|
||||
|
||||
任何 PR 都需要 Gitea 维护者的两次批准,并且需要通过持续集成。看看我们的
|
||||
[CONTRIBUTING.md](https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md)
|
||||
文档。
|
||||
|
||||
如果您需要更多帮助,请访问 [Discord](https://discord.gg/gitea) #Develop 频道
|
||||
并在那里聊天。
|
||||
|
||||
现在,您已准备好 Hacking Gitea。
|
|
@ -2,14 +2,14 @@
|
|||
date: "2019-04-15T17:29:00+08:00"
|
||||
title: "Integrations"
|
||||
slug: "integrations"
|
||||
weight: 40
|
||||
sidebar_position: 65
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "developers"
|
||||
parent: "development"
|
||||
name: "Integrations"
|
||||
weight: 65
|
||||
sidebar_position: 65
|
||||
identifier: "integrations"
|
||||
---
|
||||
|
46
docs/content/development/integrations.zh-cn.md
Normal file
46
docs/content/development/integrations.zh-cn.md
Normal file
|
@ -0,0 +1,46 @@
|
|||
---
|
||||
date: "2023-05-25T17:29:00+08:00"
|
||||
title: "集成"
|
||||
slug: "integrations"
|
||||
sidebar_position: 65
|
||||
toc: false
|
||||
draft: false
|
||||
aliases:
|
||||
- /zh-cn/integrations
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "development"
|
||||
name: "集成"
|
||||
sidebar_position: 65
|
||||
identifier: "integrations"
|
||||
---
|
||||
|
||||
# 集成
|
||||
|
||||
Gitea拥有一个出色的第三方集成社区,以及在其他各种项目中的一流支持。
|
||||
|
||||
我们正在[awesome-gitea](https://gitea.com/gitea/awesome-gitea)上整理一个列表来跟踪这些集成!
|
||||
|
||||
如果你正在寻找[CI/CD](https://gitea.com/gitea/awesome-gitea#user-content-devops),
|
||||
一个[SDK](https://gitea.com/gitea/awesome-gitea#user-content-sdk),
|
||||
甚至一些额外的[主题](https://gitea.com/gitea/awesome-gitea#user-content-themes),
|
||||
你可以在[awesome-gitea](https://gitea.com/gitea/awesome-gitea)中找到它们的列表!
|
||||
|
||||
## 预填新文件名和内容
|
||||
|
||||
如果你想打开一个具有给定名称和内容的新文件,
|
||||
你可以使用查询参数来实现:
|
||||
|
||||
```txt
|
||||
GET /{{org}}/{{repo}}/_new/{{filepath}}
|
||||
?filename={{filename}}
|
||||
&value={{content}}
|
||||
```
|
||||
|
||||
例如:
|
||||
|
||||
```txt
|
||||
GET https://git.example.com/johndoe/bliss/_new/articles/
|
||||
?filename=hello-world.md
|
||||
&value=Hello%2C%20World!
|
||||
```
|
|
@ -2,14 +2,14 @@
|
|||
date: "2019-04-15T17:29:00+08:00"
|
||||
title: "整合"
|
||||
slug: "integrations"
|
||||
weight: 40
|
||||
sidebar_position: 65
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "developers"
|
||||
parent: "development"
|
||||
name: "整合"
|
||||
weight: 65
|
||||
sidebar_position: 65
|
||||
identifier: "integrations"
|
||||
---
|
||||
|
|
@ -2,14 +2,14 @@
|
|||
date: "2019-04-15T17:29:00+08:00"
|
||||
title: "Migrations Interfaces"
|
||||
slug: "migrations-interfaces"
|
||||
weight: 30
|
||||
sidebar_position: 55
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "developers"
|
||||
parent: "development"
|
||||
name: "Migrations Interfaces"
|
||||
weight: 55
|
||||
sidebar_position: 55
|
||||
identifier: "migrations-interfaces"
|
||||
---
|
||||
|
40
docs/content/development/migrations.zh-cn.md
Normal file
40
docs/content/development/migrations.zh-cn.md
Normal file
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
date: "2023-05-25T17:29:00+08:00"
|
||||
title: "迁移界面"
|
||||
slug: "migrations-interfaces"
|
||||
sidebar_position: 55
|
||||
toc: false
|
||||
draft: false
|
||||
aliases:
|
||||
- /zh-cn/migrations-interfaces
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "development"
|
||||
name: "迁移界面"
|
||||
sidebar_position: 55
|
||||
identifier: "migrations-interfaces"
|
||||
---
|
||||
|
||||
# 迁移功能
|
||||
|
||||
完整迁移功能在Gitea 1.9.0版本中引入。它定义了两个接口,用于支持从其他Git托管平台迁移存储库数据到Gitea,或者在将来将Gitea数据迁移到其他Git托管平台。
|
||||
|
||||
目前已实现了从GitHub、GitLab和其他Gitea实例的迁移。
|
||||
|
||||
首先,Gitea在包[modules/migration](https://github.com/go-gitea/gitea/tree/main/modules/migration)中定义了一些标准对象。它们是`Repository`、`Milestone`、`Release`、`ReleaseAsset`、`Label`、`Issue`、`Comment`、`PullRequest`、`Reaction`、`Review`、`ReviewComment`。
|
||||
|
||||
## 下载器接口
|
||||
|
||||
要从新的Git托管平台迁移,需要进行两个步骤的更新。
|
||||
|
||||
- 您应该实现一个`Downloader`,用于获取存储库信息。
|
||||
- 您应该实现一个`DownloaderFactory`,用于检测URL是否匹配,并创建上述的`Downloader`。
|
||||
- 您需要在`init()`中通过`RegisterDownloaderFactory`注册`DownloaderFactory`。
|
||||
|
||||
您可以在[downloader.go](https://github.com/go-gitea/gitea/blob/main/modules/migration/downloader.go)中找到这些接口。
|
||||
|
||||
## 上传器接口
|
||||
|
||||
目前,只实现了`GiteaLocalUploader`,因此我们只能通过此Uploader将下载的数据保存到本地的Gitea实例。目前不支持其他上传器。
|
||||
|
||||
您可以在[uploader.go](https://github.com/go-gitea/gitea/blob/main/modules/migration/uploader.go)中找到这些接口。
|
|
@ -2,14 +2,14 @@
|
|||
date: "2019-04-15T17:29:00+08:00"
|
||||
title: "遷移介面"
|
||||
slug: "migrations-interfaces"
|
||||
weight: 30
|
||||
sidebar_position: 55
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "developers"
|
||||
parent: "development"
|
||||
name: "遷移介面"
|
||||
weight: 55
|
||||
sidebar_position: 55
|
||||
identifier: "migrations-interfaces"
|
||||
---
|
||||
|
||||
|
@ -29,11 +29,11 @@ Gitea 定義了一些基本物件於套件 [modules/migration](https://github.co
|
|||
- 您必須實作一個 `DownloaderFactory`,它用來偵測 URL 是否符合並建立上述的 `Downloader`。
|
||||
- 您需要在 `init()` 透過 `RegisterDownloaderFactory` 來註冊 `DownloaderFactory`。
|
||||
|
||||
您可以在 [downloader.go](https://github.com/go-gitea/gitea/blob/master/modules/migration/downloader.go) 中找到這些介面。
|
||||
您可以在 [downloader.go](https://github.com/go-gitea/gitea/blob/main/modules/migration/downloader.go) 中找到這些介面。
|
||||
|
||||
## Uploader 介面
|
||||
|
||||
目前只有 `GiteaLocalUploader` 被實作出來,所以我們只能通過 `Uploader` 儲存已下載的資料到本地的 Gitea 實例。
|
||||
目前尚未支援其它 Uploader。
|
||||
|
||||
您可以在 [uploader.go](https://github.com/go-gitea/gitea/blob/master/modules/migration/uploader.go) 中找到這些介面。
|
||||
您可以在 [uploader.go](https://github.com/go-gitea/gitea/blob/main/modules/migration/uploader.go) 中找到這些介面。
|
|
@ -2,23 +2,19 @@
|
|||
date: "2019-04-19:44:00+01:00"
|
||||
title: "OAuth2 provider"
|
||||
slug: "oauth2-provider"
|
||||
weight: 41
|
||||
sidebar_position: 41
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "developers"
|
||||
parent: "development"
|
||||
name: "OAuth2 Provider"
|
||||
weight: 41
|
||||
sidebar_position: 41
|
||||
identifier: "oauth2-provider"
|
||||
---
|
||||
|
||||
# OAuth2 provider
|
||||
|
||||
**Table of Contents**
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
Gitea supports acting as an OAuth2 provider to allow third party applications to access its resources with the user's consent. This feature is available since release 1.8.0.
|
||||
|
||||
## Endpoints
|
137
docs/content/development/oauth2-provider.zh-cn.md
Normal file
137
docs/content/development/oauth2-provider.zh-cn.md
Normal file
|
@ -0,0 +1,137 @@
|
|||
---
|
||||
date: "2019-04-19:44:00+01:00"
|
||||
title: "OAuth2 提供者"
|
||||
slug: "oauth2-provider"
|
||||
sidebar_position: 41
|
||||
toc: false
|
||||
draft: false
|
||||
aliases:
|
||||
- /zh-cn/oauth2-provider
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "development"
|
||||
name: "OAuth2 提供者"
|
||||
sidebar_position: 41
|
||||
identifier: "oauth2-provider"
|
||||
---
|
||||
|
||||
# OAuth2 提供者
|
||||
|
||||
Gitea 支持作为 OAuth2 提供者,允许第三方应用程序在用户同意的情况下访问其资源。此功能自 1.8.0 版起可用。
|
||||
|
||||
## 端点
|
||||
|
||||
| 端点 | URL |
|
||||
| ------------------------ | ----------------------------------- |
|
||||
| OpenID Connect Discovery | `/.well-known/openid-configuration` |
|
||||
| Authorization Endpoint | `/login/oauth/authorize` |
|
||||
| Access Token Endpoint | `/login/oauth/access_token` |
|
||||
| OpenID Connect UserInfo | `/login/oauth/userinfo` |
|
||||
| JSON Web Key Set | `/login/oauth/keys` |
|
||||
|
||||
## 支持的 OAuth2 授权
|
||||
|
||||
目前 Gitea 仅支持 [**Authorization Code Grant**](https://tools.ietf.org/html/rfc6749#section-1.3.1) 标准,并额外支持以下扩展:
|
||||
|
||||
- [Proof Key for Code Exchange (PKCE)](https://tools.ietf.org/html/rfc7636)
|
||||
- [OpenID Connect (OIDC)](https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth)
|
||||
|
||||
要将 Authorization Code Grant 作为第三方应用程序,您需要通过在设置中添加一个新的 "应用程序" (`/user/settings/applications`)。
|
||||
|
||||
## 范围
|
||||
|
||||
Gitea 支持以下令牌范围:
|
||||
|
||||
| 名称 | 介绍 |
|
||||
| ---- | ----------- |
|
||||
| **(no scope)** | 授予对公共用户配置文件和公共存储库的只读访问权限 |
|
||||
| **repo** | 完全控制所有存储库 |
|
||||
| **repo:status** | 授予对所有存储库中提交状态的读/写访问权限 |
|
||||
| **public_repo** | 仅授予对公共存储库的读/写访问权限 |
|
||||
| **admin:repo_hook** | 授予对所有存储库的 Hooks 访问权限,该权限已包含在 `repo` 范围中 |
|
||||
| **write:repo_hook** | 授予对存储库 Hooks 的读/写访问权限 |
|
||||
| **read:repo_hook** | 授予对存储库 Hooks 的只读访问权限 |
|
||||
| **admin:org** | 授予对组织设置的完全访问权限 |
|
||||
| **write:org** | 授予对组织设置的读/写访问权限 |
|
||||
| **read:org** | 授予对组织设置的只读访问权限 |
|
||||
| **admin:public_key** | 授予公钥管理的完全访问权限 |
|
||||
| **write:public_key** | 授予对公钥的读/写访问权限 |
|
||||
| **read:public_key** | 授予对公钥的只读访问权限 |
|
||||
| **admin:org_hook** | 授予对组织级别 Hooks 的完全访问权限 |
|
||||
| **admin:user_hook** | 授予对用户级别 Hooks 的完全访问权限 |
|
||||
| **notification** | 授予对通知的完全访问权限 |
|
||||
| **user** | 授予对用户个人资料信息的完全访问权限 |
|
||||
| **read:user** | 授予对用户个人资料的读取权限 |
|
||||
| **user:email** | 授予对用户电子邮件地址的读取权限 |
|
||||
| **user:follow** | 授予访问权限以关注/取消关注用户 |
|
||||
| **delete_repo** | 授予删除存储库的权限 |
|
||||
| **package** | 授予对托管包的完全访问权限 |
|
||||
| **write:package** | 授予对包的读/写访问权限 |
|
||||
| **read:package** | 授予对包的读取权限 |
|
||||
| **delete:package** | 授予对包的删除权限 |
|
||||
| **admin:gpg_key** | 授予 GPG 密钥管理的完全访问权限 |
|
||||
| **write:gpg_key** | 授予对 GPG 密钥的读/写访问权限 |
|
||||
| **read:gpg_key** | 授予对 GPG 密钥的只读访问权限 |
|
||||
| **admin:application** | 授予应用程序管理的完全访问权限 |
|
||||
| **write:application** | 授予应用程序管理的读/写访问权限 |
|
||||
| **read:application** | 授予应用程序管理的读取权限 |
|
||||
| **sudo** | 允许以站点管理员身份执行操作 |
|
||||
|
||||
## 客户端类型
|
||||
|
||||
Gitea 支持私密和公共客户端类型,[参见 RFC 6749](https://datatracker.ietf.org/doc/html/rfc6749#section-2.1).
|
||||
|
||||
对于公共客户端, 允许在本地回环地址的重定向 URI 中使用任意端口,例如 `http://127.0.0.1/`。根据 [RFC 8252 的建议](https://datatracker.ietf.org/doc/html/rfc8252#section-8.3),请避免使用 `localhost`。
|
||||
|
||||
## 示例
|
||||
|
||||
**注意:** 该示例中尚未使用 PKCE。
|
||||
|
||||
1. 将用户重定向到授权端点,以获得他们的访问资源授权:
|
||||
|
||||
```curl
|
||||
https://[YOUR-GITEA-URL]/login/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI& response_type=code&state=STATE
|
||||
```
|
||||
|
||||
在设置中注册应用程序以获得 `CLIENT_ID`。`STATE` 是一个随机字符串,它将在获得用户授权后发送回您的应用程序。`state` 参数是可选的,但您应该使用它来防止 CSRF 攻击。
|
||||
|
||||
![Authorization Page](/authorize.png)
|
||||
|
||||
用户将会被询问是否授权给您的应用程序。如果他们同意了授权,用户将会被重定向到 `REDIRECT_URL`,例如:
|
||||
|
||||
```curl
|
||||
https://[REDIRECT_URI]?code=RETURNED_CODE&state=STATE
|
||||
```
|
||||
|
||||
2. 使用重定向提供的 `code`,您可以请求一个新的应用程序和 Refresh Token。Access Token Endpoint 接受 `application/json` 或 `application/x-www-form-urlencoded` 类型的 POST 请求,例如:
|
||||
|
||||
```curl
|
||||
POST https://[YOUR-GITEA-URL]/login/oauth/access_token
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"client_id": "YOUR_CLIENT_ID",
|
||||
"client_secret": "YOUR_CLIENT_SECRET",
|
||||
"code": "RETURNED_CODE",
|
||||
"grant_type": "authorization_code",
|
||||
"redirect_uri": "REDIRECT_URI"
|
||||
}
|
||||
```
|
||||
|
||||
返回:
|
||||
|
||||
```json
|
||||
{
|
||||
"access_token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJnbnQiOjIsInR0IjowLCJleHAiOjE1NTUxNzk5MTIsImlhdCI6MTU1NTE3NjMxMn0.0-iFsAwBtxuckA0sNZ6QpBQmywVPz129u75vOM7wPJecw5wqGyBkmstfJHAjEOqrAf_V5Z-1QYeCh_Cz4RiKug",
|
||||
"token_type": "bearer",
|
||||
"expires_in": 3600,
|
||||
"refresh_token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJnbnQiOjIsInR0IjoxLCJjbnQiOjEsImV4cCI6MTU1NzgwNDMxMiwiaWF0IjoxNTU1MTc2MzEyfQ.S_HZQBy4q9r5SEzNGNIoFClT43HPNDbUdHH-GYNYYdkRfft6XptJBkUQscZsGxOW975Yk6RbgtGvq1nkEcklOw"
|
||||
}
|
||||
```
|
||||
|
||||
`CLIENT_SECRET` 是生成给应用程序的唯一密钥。请注意,该密钥只会在您使用 Gitea 创建/注册应用程序后出现一次。如果您丢失了密钥,您必须在应用程序设置中重新生成密钥。
|
||||
|
||||
`access_token` 请求中的 `REDIRECT_URI` 必须与 `authorize` 请求中的 `REDIRECT_URI` 相符。
|
||||
|
||||
3. 使用 `access_token` 来构造 [API 请求](https://docs.gitea.io/en-us/api-usage#oauth2) 以读写用户的资源。
|
|
@ -2,14 +2,14 @@
|
|||
date: "2019-04-19:44:00+01:00"
|
||||
title: "OAuth2 提供者"
|
||||
slug: "oauth2-provider"
|
||||
weight: 41
|
||||
sidebar_position: 41
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "developers"
|
||||
parent: "development"
|
||||
name: "OAuth2 提供者"
|
||||
weight: 41
|
||||
sidebar_position: 41
|
||||
identifier: "oauth2-provider"
|
||||
---
|
||||
|
||||
|
@ -17,8 +17,6 @@ menu:
|
|||
|
||||
**目錄**
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
Gitea 支援作為 OAuth2 提供者,能讓第三方程式能在使用者同意下存取 Gitea 的資源。此功能自 1.8.0 版開始提供。
|
||||
|
||||
## Endpoint
|
|
@ -1,13 +0,0 @@
|
|||
---
|
||||
date: "2016-12-01T16:00:00+02:00"
|
||||
title: "Advanced"
|
||||
slug: "advanced"
|
||||
weight: 30
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
name: "Advanced"
|
||||
weight: 40
|
||||
identifier: "advanced"
|
||||
---
|
|
@ -1,13 +0,0 @@
|
|||
---
|
||||
date: "2016-12-01T16:00:00+02:00"
|
||||
title: "进阶"
|
||||
slug: "advanced"
|
||||
weight: 30
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
name: "进阶"
|
||||
weight: 40
|
||||
identifier: "advanced"
|
||||
---
|
|
@ -1,13 +0,0 @@
|
|||
---
|
||||
date: "2016-12-01T16:00:00+02:00"
|
||||
title: "進階"
|
||||
slug: "advanced"
|
||||
weight: 30
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
name: "進階"
|
||||
weight: 40
|
||||
identifier: "advanced"
|
||||
---
|
|
@ -1,13 +0,0 @@
|
|||
---
|
||||
date: "2016-12-01T16:00:00+02:00"
|
||||
title: "Developers"
|
||||
slug: "developers"
|
||||
weight: 40
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
name: "Developers"
|
||||
weight: 55
|
||||
identifier: "developers"
|
||||
---
|
|
@ -1,13 +0,0 @@
|
|||
---
|
||||
date: "2016-12-01T16:00:00+02:00"
|
||||
title: "开发者"
|
||||
slug: "developers"
|
||||
weight: 40
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
name: "开发者"
|
||||
weight: 55
|
||||
identifier: "developers"
|
||||
---
|
|
@ -1,13 +0,0 @@
|
|||
---
|
||||
date: "2016-12-01T16:00:00+02:00"
|
||||
title: "開發人員"
|
||||
slug: "developers"
|
||||
weight: 40
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
name: "開發人員"
|
||||
weight: 55
|
||||
identifier: "developers"
|
||||
---
|
|
@ -1,13 +0,0 @@
|
|||
---
|
||||
date: "2016-12-01T16:00:00+02:00"
|
||||
title: "Features"
|
||||
slug: "features"
|
||||
weight: 20
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
name: "Features"
|
||||
weight: 30
|
||||
identifier: "features"
|
||||
---
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue