mirror of
https://github.com/go-gitea/gitea.git
synced 2025-11-05 18:32:41 +09:00
Compare commits
148 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f831540ebd | ||
|
|
1e9a7656e0 | ||
|
|
088d746636 | ||
|
|
c208b1180e | ||
|
|
dfd511faf3 | ||
|
|
41b2d0be93 | ||
|
|
4d5854b216 | ||
|
|
439e071acf | ||
|
|
69ea554e23 | ||
|
|
c077a084d7 | ||
|
|
dfd960f22a | ||
|
|
2978b435bb | ||
|
|
00705da102 | ||
|
|
4a48370d91 | ||
|
|
1dedf9bba0 | ||
|
|
2147bfde05 | ||
|
|
a1c232cae3 | ||
|
|
63512cd15d | ||
|
|
71803d33e3 | ||
|
|
a954cc3fb9 | ||
|
|
ca4418eff1 | ||
|
|
80c0c88152 | ||
|
|
171950a0d4 | ||
|
|
7b96f71bc7 | ||
|
|
e6d1afaee3 | ||
|
|
1d4c193df5 | ||
|
|
4ffa683820 | ||
|
|
973b7f6298 | ||
|
|
4126aad4aa | ||
|
|
5c96a2be87 | ||
|
|
acedf0f702 | ||
|
|
23139aa27b | ||
|
|
b6b71c78c4 | ||
|
|
2138661dae | ||
|
|
4b37eb2c23 | ||
|
|
dd2f007501 | ||
|
|
dd44c2164e | ||
|
|
2604571993 | ||
|
|
eae6985b63 | ||
|
|
d8583edfe7 | ||
|
|
d99479c810 | ||
|
|
fbe1f35112 | ||
|
|
25233a9bdc | ||
|
|
7a99c7b83c | ||
|
|
1d6e5c8e58 | ||
|
|
882e465c3a | ||
|
|
b139234fa8 | ||
|
|
d8b39324d7 | ||
|
|
9df573bddc | ||
|
|
b0a405c5fa | ||
|
|
3c53740244 | ||
|
|
da7d7e60d8 | ||
|
|
e502be46f3 | ||
|
|
4a886de71e | ||
|
|
b6fd1e48c0 | ||
|
|
69c4e2954c | ||
|
|
9f14b2173a | ||
|
|
e15794f62f | ||
|
|
2a184796b5 | ||
|
|
2cfabb68ff | ||
|
|
e8da63c24e | ||
|
|
93c36f395c | ||
|
|
302c03c4a9 | ||
|
|
41bae29f84 | ||
|
|
c72f6067b3 | ||
|
|
54cc459ea8 | ||
|
|
c3d323fd85 | ||
|
|
4013f3f600 | ||
|
|
3bab20491e | ||
|
|
087df926cc | ||
|
|
b159ebbab7 | ||
|
|
c8b189eb01 | ||
|
|
a1cec4141e | ||
|
|
307ee2c044 | ||
|
|
2f6c0e6596 | ||
|
|
e6173acac9 | ||
|
|
4af872178e | ||
|
|
508c624e99 | ||
|
|
ecfed9e298 | ||
|
|
2f4de240c1 | ||
|
|
e1fa3d1d69 | ||
|
|
352a495c02 | ||
|
|
a4b14638b5 | ||
|
|
f43df2f820 | ||
|
|
fe78aabc67 | ||
|
|
4aed0e6b07 | ||
|
|
11711c51cb | ||
|
|
bcb0f3a90f | ||
|
|
c99374b151 | ||
|
|
b643b2ca9c | ||
|
|
94f86964b4 | ||
|
|
1f29cfa683 | ||
|
|
1cedf36d30 | ||
|
|
7da85fa0c3 | ||
|
|
0ac8b774e9 | ||
|
|
762d4245fb | ||
|
|
3571cbba34 | ||
|
|
6d60d4e554 | ||
|
|
31208fe9a1 | ||
|
|
4bdb8dd9cc | ||
|
|
24d6aacc7e | ||
|
|
d1a55aabc9 | ||
|
|
f1c5d33d3e | ||
|
|
acc0fd22d8 | ||
|
|
fe1b11b639 | ||
|
|
80d7288ea4 | ||
|
|
2d1202b32c | ||
|
|
9112ce22a4 | ||
|
|
2bdc38e592 | ||
|
|
f155cf60d3 | ||
|
|
0f5e07f538 | ||
|
|
368e9e0f1b | ||
|
|
d6cf261be8 | ||
|
|
7c555b2231 | ||
|
|
981ab48503 | ||
|
|
ec37ea5945 | ||
|
|
8ad331c9d2 | ||
|
|
dbabdf6d71 | ||
|
|
2d1a7e1cd4 | ||
|
|
df5558135b | ||
|
|
f329982b6e | ||
|
|
cb1a4da5c2 | ||
|
|
39cbca0f95 | ||
|
|
9aadc25bc1 | ||
|
|
b94370504f | ||
|
|
4fd8ac0653 | ||
|
|
59354d7135 | ||
|
|
0b97463cef | ||
|
|
fa431b377d | ||
|
|
8a97cdd91b | ||
|
|
3e9475b3b2 | ||
|
|
9be9042479 | ||
|
|
9451781ebe | ||
|
|
88f6f7579c | ||
|
|
fcd055c34a | ||
|
|
a57568bad7 | ||
|
|
8e07d53fe4 | ||
|
|
a758337046 | ||
|
|
2cf1515f5c | ||
|
|
a075285f24 | ||
|
|
2517da90aa | ||
|
|
060026995a | ||
|
|
0f265a2489 | ||
|
|
0d04f70d6a | ||
|
|
2122743093 | ||
|
|
3a29712e0a | ||
|
|
81d3dc1da5 | ||
|
|
c5fe09db72 |
@@ -13,46 +13,42 @@ groups:
|
||||
-
|
||||
name: BREAKING
|
||||
labels:
|
||||
- kind/breaking
|
||||
- pr/breaking
|
||||
-
|
||||
name: SECURITY
|
||||
labels:
|
||||
- kind/security
|
||||
- topic/security
|
||||
-
|
||||
name: FEATURES
|
||||
labels:
|
||||
- kind/feature
|
||||
- type/feature
|
||||
-
|
||||
name: API
|
||||
labels:
|
||||
- kind/api
|
||||
- modifies/api
|
||||
-
|
||||
name: ENHANCEMENTS
|
||||
labels:
|
||||
- kind/enhancement
|
||||
- kind/refactor
|
||||
- kind/ui
|
||||
- type/enhancement
|
||||
- type/refactoring
|
||||
- topic/ui
|
||||
-
|
||||
name: BUGFIXES
|
||||
labels:
|
||||
- kind/bug
|
||||
- type/bug
|
||||
-
|
||||
name: TESTING
|
||||
labels:
|
||||
- kind/testing
|
||||
-
|
||||
name: TRANSLATION
|
||||
labels:
|
||||
- kind/translation
|
||||
- type/testing
|
||||
-
|
||||
name: BUILD
|
||||
labels:
|
||||
- kind/build
|
||||
- kind/lint
|
||||
- topic/build
|
||||
- topic/code-linting
|
||||
-
|
||||
name: DOCS
|
||||
labels:
|
||||
- kind/docs
|
||||
- type/docs
|
||||
-
|
||||
name: MISC
|
||||
default: true
|
||||
|
||||
426
.drone.yml
426
.drone.yml
@@ -1,426 +0,0 @@
|
||||
---
|
||||
kind: pipeline
|
||||
name: release-version
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
workspace:
|
||||
base: /source
|
||||
path: /
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- tag
|
||||
|
||||
volumes:
|
||||
- name: deps
|
||||
temp: {}
|
||||
|
||||
steps:
|
||||
- name: fetch-tags
|
||||
image: docker:git
|
||||
pull: always
|
||||
commands:
|
||||
- git fetch --tags --force
|
||||
|
||||
- name: deps-frontend
|
||||
image: node:20
|
||||
pull: always
|
||||
commands:
|
||||
- make deps-frontend
|
||||
|
||||
- name: deps-backend
|
||||
image: gitea/test_env:linux-1.20-amd64
|
||||
pull: always
|
||||
commands:
|
||||
- make deps-backend
|
||||
volumes:
|
||||
- name: deps
|
||||
path: /go
|
||||
|
||||
- name: static
|
||||
image: techknowlogick/xgo:go-1.20.x
|
||||
pull: always
|
||||
commands:
|
||||
# Upgrade to node 20 once https://github.com/techknowlogick/xgo/issues/163 is resolved
|
||||
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get -qqy install nodejs
|
||||
- export PATH=$PATH:$GOPATH/bin
|
||||
- make release
|
||||
environment:
|
||||
GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not
|
||||
TAGS: bindata sqlite sqlite_unlock_notify
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
depends_on: [fetch-tags]
|
||||
volumes:
|
||||
- name: deps
|
||||
path: /go
|
||||
|
||||
- name: gpg-sign
|
||||
image: plugins/gpgsign:1
|
||||
pull: always
|
||||
settings:
|
||||
detach_sign: true
|
||||
excludes:
|
||||
- "dist/release/*.sha256"
|
||||
files:
|
||||
- "dist/release/*"
|
||||
environment:
|
||||
GPGSIGN_KEY:
|
||||
from_secret: gpgsign_key
|
||||
GPGSIGN_PASSPHRASE:
|
||||
from_secret: gpgsign_passphrase
|
||||
depends_on: [static]
|
||||
|
||||
- name: release-tag
|
||||
image: woodpeckerci/plugin-s3:latest
|
||||
pull: always
|
||||
settings:
|
||||
acl:
|
||||
from_secret: aws_s3_acl
|
||||
region:
|
||||
from_secret: aws_s3_region
|
||||
bucket:
|
||||
from_secret: aws_s3_bucket
|
||||
endpoint:
|
||||
from_secret: aws_s3_endpoint
|
||||
path_style:
|
||||
from_secret: aws_s3_path_style
|
||||
source: "dist/release/*"
|
||||
strip_prefix: dist/release/
|
||||
target: "/gitea/${DRONE_TAG##v}"
|
||||
environment:
|
||||
AWS_ACCESS_KEY_ID:
|
||||
from_secret: aws_access_key_id
|
||||
AWS_SECRET_ACCESS_KEY:
|
||||
from_secret: aws_secret_access_key
|
||||
depends_on: [gpg-sign]
|
||||
|
||||
- name: github
|
||||
image: plugins/github-release:latest
|
||||
pull: always
|
||||
settings:
|
||||
files:
|
||||
- "dist/release/*"
|
||||
file_exists: overwrite
|
||||
environment:
|
||||
GITHUB_TOKEN:
|
||||
from_secret: github_token
|
||||
depends_on: [gpg-sign]
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: docker-linux-amd64-release-version
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
trigger:
|
||||
ref:
|
||||
include:
|
||||
- "refs/tags/**"
|
||||
exclude:
|
||||
- "refs/tags/**-rc*"
|
||||
paths:
|
||||
exclude:
|
||||
- "docs/**"
|
||||
|
||||
steps:
|
||||
- name: fetch-tags
|
||||
image: docker:git
|
||||
pull: always
|
||||
commands:
|
||||
- git fetch --tags --force
|
||||
|
||||
- name: publish
|
||||
image: plugins/docker:latest
|
||||
pull: always
|
||||
settings:
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-amd64
|
||||
repo: gitea/gitea
|
||||
build_args:
|
||||
- GOPROXY=https://goproxy.io
|
||||
password:
|
||||
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: plugins/docker:latest
|
||||
settings:
|
||||
dockerfile: Dockerfile.rootless
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-amd64-rootless
|
||||
repo: gitea/gitea
|
||||
build_args:
|
||||
- GOPROXY=https://goproxy.io
|
||||
password:
|
||||
from_secret: docker_password
|
||||
username:
|
||||
from_secret: docker_username
|
||||
environment:
|
||||
PLUGIN_MIRROR:
|
||||
from_secret: plugin_mirror
|
||||
DOCKER_BUILDKIT: 1
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
---
|
||||
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: docker-linux-amd64-release-candidate-version
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
trigger:
|
||||
ref:
|
||||
- "refs/tags/**-rc*"
|
||||
paths:
|
||||
exclude:
|
||||
- "docs/**"
|
||||
|
||||
steps:
|
||||
- name: fetch-tags
|
||||
image: docker:git
|
||||
pull: always
|
||||
commands:
|
||||
- git fetch --tags --force
|
||||
|
||||
- name: publish
|
||||
image: plugins/docker:latest
|
||||
pull: always
|
||||
settings:
|
||||
tags: ${DRONE_TAG##v}-linux-amd64
|
||||
repo: gitea/gitea
|
||||
build_args:
|
||||
- GOPROXY=https://goproxy.io
|
||||
password:
|
||||
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: plugins/docker:latest
|
||||
settings:
|
||||
dockerfile: Dockerfile.rootless
|
||||
tags: ${DRONE_TAG##v}-linux-amd64-rootless
|
||||
repo: gitea/gitea
|
||||
build_args:
|
||||
- GOPROXY=https://goproxy.io
|
||||
password:
|
||||
from_secret: docker_password
|
||||
username:
|
||||
from_secret: docker_username
|
||||
environment:
|
||||
PLUGIN_MIRROR:
|
||||
from_secret: plugin_mirror
|
||||
DOCKER_BUILDKIT: 1
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: docker-linux-arm64-release-version
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: arm64
|
||||
|
||||
trigger:
|
||||
ref:
|
||||
include:
|
||||
- "refs/tags/**"
|
||||
exclude:
|
||||
- "refs/tags/**-rc*"
|
||||
paths:
|
||||
exclude:
|
||||
- "docs/**"
|
||||
|
||||
steps:
|
||||
- name: fetch-tags
|
||||
image: docker:git
|
||||
pull: always
|
||||
commands:
|
||||
- git fetch --tags --force
|
||||
|
||||
- name: publish
|
||||
image: plugins/docker:latest
|
||||
pull: always
|
||||
settings:
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-arm64
|
||||
repo: gitea/gitea
|
||||
build_args:
|
||||
- GOPROXY=https://goproxy.io
|
||||
password:
|
||||
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: plugins/docker:latest
|
||||
settings:
|
||||
dockerfile: Dockerfile.rootless
|
||||
auto_tag: true
|
||||
auto_tag_suffix: linux-arm64-rootless
|
||||
repo: gitea/gitea
|
||||
build_args:
|
||||
- GOPROXY=https://goproxy.io
|
||||
password:
|
||||
from_secret: docker_password
|
||||
username:
|
||||
from_secret: docker_username
|
||||
environment:
|
||||
PLUGIN_MIRROR:
|
||||
from_secret: plugin_mirror
|
||||
DOCKER_BUILDKIT: 1
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: docker-linux-arm64-release-candidate-version
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: arm64
|
||||
|
||||
trigger:
|
||||
ref:
|
||||
- "refs/tags/**-rc*"
|
||||
paths:
|
||||
exclude:
|
||||
- "docs/**"
|
||||
|
||||
steps:
|
||||
- name: fetch-tags
|
||||
image: docker:git
|
||||
pull: always
|
||||
commands:
|
||||
- git fetch --tags --force
|
||||
|
||||
- name: publish
|
||||
image: plugins/docker:latest
|
||||
pull: always
|
||||
settings:
|
||||
tags: ${DRONE_TAG##v}-linux-arm64
|
||||
repo: gitea/gitea
|
||||
build_args:
|
||||
- GOPROXY=https://goproxy.io
|
||||
password:
|
||||
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: plugins/docker:latest
|
||||
settings:
|
||||
dockerfile: Dockerfile.rootless
|
||||
tags: ${DRONE_TAG##v}-linux-arm64-rootless
|
||||
repo: gitea/gitea
|
||||
build_args:
|
||||
- GOPROXY=https://goproxy.io
|
||||
password:
|
||||
from_secret: docker_password
|
||||
username:
|
||||
from_secret: docker_username
|
||||
environment:
|
||||
PLUGIN_MIRROR:
|
||||
from_secret: plugin_mirror
|
||||
DOCKER_BUILDKIT: 1
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- pull_request
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: docker-manifest-version
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: manifest-rootless
|
||||
image: plugins/manifest
|
||||
pull: always
|
||||
settings:
|
||||
auto_tag: true
|
||||
ignore_missing: true
|
||||
spec: docker/manifest.rootless.tmpl
|
||||
password:
|
||||
from_secret: docker_password
|
||||
username:
|
||||
from_secret: docker_username
|
||||
|
||||
- name: manifest
|
||||
image: plugins/manifest
|
||||
settings:
|
||||
auto_tag: true
|
||||
ignore_missing: true
|
||||
spec: docker/manifest.tmpl
|
||||
password:
|
||||
from_secret: docker_password
|
||||
username:
|
||||
from_secret: docker_username
|
||||
|
||||
trigger:
|
||||
ref:
|
||||
- "refs/tags/**"
|
||||
paths:
|
||||
exclude:
|
||||
- "docs/**"
|
||||
|
||||
depends_on:
|
||||
- docker-linux-amd64-release-version
|
||||
- docker-linux-amd64-release-candidate-version
|
||||
- docker-linux-arm64-release-version
|
||||
- docker-linux-arm64-release-candidate-version
|
||||
@@ -5,7 +5,7 @@
|
||||
2. Please ask questions or configuration/deploy problems on our Discord
|
||||
server (https://discord.gg/gitea) or forum (https://discourse.gitea.io).
|
||||
3. Please take a moment to check that your issue doesn't already exist.
|
||||
4. Make sure it's not mentioned in the FAQ (https://docs.gitea.io/en-us/faq)
|
||||
4. Make sure it's not mentioned in the FAQ (https://docs.gitea.com/help/faq)
|
||||
5. Please give all relevant information below for bug reports, because
|
||||
incomplete details will be handled as an invalid report.
|
||||
-->
|
||||
@@ -26,7 +26,7 @@
|
||||
- [ ] No
|
||||
- Log gist:
|
||||
<!-- It really is important to provide pertinent logs -->
|
||||
<!-- Please read https://docs.gitea.io/en-us/logging-configuration/#debugging-problems -->
|
||||
<!-- Please read https://docs.gitea.com/administration/logging-config#collecting-logs-for-help -->
|
||||
<!-- In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini -->
|
||||
|
||||
## Description
|
||||
|
||||
13
.github/ISSUE_TEMPLATE/bug-report.yaml
vendored
13
.github/ISSUE_TEMPLATE/bug-report.yaml
vendored
@@ -1,6 +1,6 @@
|
||||
name: Bug Report
|
||||
description: Found something you weren't expecting? Report it here!
|
||||
labels: kind/bug
|
||||
labels: ["kind/bug"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
@@ -14,12 +14,9 @@ body:
|
||||
server (https://discord.gg/gitea) or forum (https://discourse.gitea.io).
|
||||
3. Make sure you are using the latest release and
|
||||
take a moment to check that your issue hasn't been reported before.
|
||||
4. Make sure it's not mentioned in the FAQ (https://docs.gitea.io/en-us/faq)
|
||||
5. Please give all relevant information below for bug reports, because
|
||||
4. Make sure it's not mentioned in the FAQ (https://docs.gitea.com/help/faq)
|
||||
5. It's really important to provide pertinent details and logs (https://docs.gitea.com/help/support),
|
||||
incomplete details will be handled as an invalid report.
|
||||
6. In particular it's really important to provide pertinent logs. You must give us DEBUG level logs.
|
||||
Please read https://docs.gitea.io/en-us/logging-configuration/#debugging-problems
|
||||
In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
@@ -50,7 +47,7 @@ body:
|
||||
attributes:
|
||||
value: |
|
||||
It's really important to provide pertinent logs
|
||||
Please read https://docs.gitea.io/en-us/logging-configuration/#debugging-problems
|
||||
Please read https://docs.gitea.com/administration/logging-config#collecting-logs-for-help
|
||||
In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini
|
||||
- type: input
|
||||
id: logs
|
||||
@@ -89,6 +86,6 @@ body:
|
||||
description: What database system are you running?
|
||||
options:
|
||||
- PostgreSQL
|
||||
- MySQL
|
||||
- MySQL/MariaDB
|
||||
- MSSQL
|
||||
- SQLite
|
||||
|
||||
4
.github/ISSUE_TEMPLATE/config.yml
vendored
4
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -8,9 +8,9 @@ contact_links:
|
||||
about: Please ask questions and discuss configuration or deployment problems here.
|
||||
- name: Discourse Forum
|
||||
url: https://discourse.gitea.io
|
||||
about: Questions and configuration or deployment problems can also be discussed on our forum.
|
||||
about: Questions and configuration or deployment problems can also be discussed on our forum.
|
||||
- name: Frequently Asked Questions
|
||||
url: https://docs.gitea.io/en-us/faq
|
||||
url: https://docs.gitea.com/help/faq
|
||||
about: Please check if your question isn't mentioned here.
|
||||
- name: Crowdin Translations
|
||||
url: https://crowdin.com/project/gitea
|
||||
|
||||
4
.github/ISSUE_TEMPLATE/ui.bug-report.yaml
vendored
4
.github/ISSUE_TEMPLATE/ui.bug-report.yaml
vendored
@@ -13,12 +13,12 @@ body:
|
||||
2. Please ask questions or configuration/deploy problems on our Discord
|
||||
server (https://discord.gg/gitea) or forum (https://discourse.gitea.io).
|
||||
3. Please take a moment to check that your issue doesn't already exist.
|
||||
4. Make sure it's not mentioned in the FAQ (https://docs.gitea.io/en-us/faq)
|
||||
4. Make sure it's not mentioned in the FAQ (https://docs.gitea.com/help/faq)
|
||||
5. Please give all relevant information below for bug reports, because
|
||||
incomplete details will be handled as an invalid report.
|
||||
6. In particular it's really important to provide pertinent logs. If you are certain that this is a javascript
|
||||
error, show us the javascript console. If the error appears to relate to Gitea the server you must also give us
|
||||
DEBUG level logs. (See https://docs.gitea.io/en-us/logging-configuration/#debugging-problems)
|
||||
DEBUG level logs. (See https://docs.gitea.com/administration/logging-config#collecting-logs-for-help)
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
|
||||
5
.github/actionlint.yaml
vendored
Normal file
5
.github/actionlint.yaml
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
self-hosted-runner:
|
||||
labels:
|
||||
- actuated-4cpu-8gb
|
||||
- actuated-4cpu-16gb
|
||||
- nscloud
|
||||
146
.github/workflows/release-tag-version.yml
vendored
Normal file
146
.github/workflows/release-tag-version.yml
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
name: release-tag-version
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v1.*"
|
||||
- "!v1*-rc*"
|
||||
- "!v1*-dev"
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
binary:
|
||||
runs-on: nscloud
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
|
||||
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
|
||||
- run: git fetch --unshallow --quiet --tags --force
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
check-latest: true
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- run: make deps-frontend deps-backend
|
||||
# xgo build
|
||||
- run: make release
|
||||
env:
|
||||
TAGS: bindata sqlite sqlite_unlock_notify
|
||||
- name: import gpg key
|
||||
id: import_gpg
|
||||
uses: crazy-max/ghaction-import-gpg@v6
|
||||
with:
|
||||
gpg_private_key: ${{ secrets.GPGSIGN_KEY }}
|
||||
passphrase: ${{ secrets.GPGSIGN_PASSPHRASE }}
|
||||
- name: sign binaries
|
||||
run: |
|
||||
for f in dist/release/*; do
|
||||
echo '${{ secrets.GPGSIGN_PASSPHRASE }}' | gpg --pinentry-mode loopback --passphrase-fd 0 --batch --yes --detach-sign -u ${{ steps.import_gpg.outputs.fingerprint }} --output "$f.asc" "$f"
|
||||
done
|
||||
# clean branch name to get the folder name in S3
|
||||
- name: Get cleaned branch name
|
||||
id: clean_name
|
||||
run: |
|
||||
REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//')
|
||||
echo "Cleaned name is ${REF_NAME}"
|
||||
echo "branch=${REF_NAME}" >> "$GITHUB_OUTPUT"
|
||||
- name: configure aws
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
with:
|
||||
aws-region: ${{ secrets.AWS_REGION }}
|
||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
- name: upload binaries to s3
|
||||
run: |
|
||||
aws s3 sync dist/release s3://${{ secrets.AWS_S3_BUCKET }}/gitea/${{ steps.clean_name.outputs.branch }} --no-progress
|
||||
- name: Install GH CLI
|
||||
uses: dev-hanz-ops/install-gh-cli-action@v0.1.0
|
||||
with:
|
||||
gh-cli-version: 2.39.1
|
||||
- name: create github release
|
||||
run: |
|
||||
gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --notes-from-tag dist/release/*
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
docker-rootful:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
|
||||
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
|
||||
- run: git fetch --unshallow --quiet --tags --force
|
||||
- uses: docker/setup-qemu-action@v3
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
- uses: docker/metadata-action@v5
|
||||
id: meta
|
||||
with:
|
||||
images: gitea/gitea
|
||||
flavor: |
|
||||
latest=false
|
||||
# this will generate tags in the following format:
|
||||
# since it's not a main stable version, just generation 1.x and 1.x.x
|
||||
# latest
|
||||
# 1
|
||||
# 1.2
|
||||
# 1.2.3
|
||||
tags: |
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{version}}
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: build rootful docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
docker-rootless:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
|
||||
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
|
||||
- run: git fetch --unshallow --quiet --tags --force
|
||||
- uses: docker/setup-qemu-action@v3
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
- uses: docker/metadata-action@v5
|
||||
id: meta
|
||||
with:
|
||||
images: gitea/gitea
|
||||
# each tag below will have the suffix of -rootless
|
||||
flavor: |
|
||||
latest=false
|
||||
suffix=-rootless
|
||||
# this will generate tags in the following format (with -rootless suffix added):
|
||||
# since it's not a main stable version, just generation 1.x and 1.x.x
|
||||
# latest
|
||||
# 1
|
||||
# 1.2
|
||||
# 1.2.3
|
||||
tags: |
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{version}}
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: build rootless docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
file: Dockerfile.rootless
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
153
CHANGELOG.md
153
CHANGELOG.md
@@ -2,9 +2,156 @@
|
||||
|
||||
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).
|
||||
been added to each release, please refer to the [blog](https://blog.gitea.com).
|
||||
|
||||
## [1.20.2](https://github.com/go-gitea/gitea/releases/tag/1.20.2) - 2023-07-29
|
||||
## [1.20.6](https://github.com/go-gitea/gitea/releases/tag/1.20.6) - 2023-11-26
|
||||
|
||||
* SECURITY
|
||||
* Fix comment permissions (#28213) (#28217)
|
||||
* Dont leak private users via extensions (#28023) (#28028)
|
||||
* Unify two factor check (#27915) (#27939)
|
||||
* Support allowed hosts for webhook to work with proxy (#27655) (#27674)
|
||||
* BUGFIXES
|
||||
* Fix no ActionTaskOutput table waring (#28149) (#28151)
|
||||
* Restricted users only see repos in orgs which their team was assigned to (#28025) (#28050)
|
||||
* Fix DownloadFunc when migrating releases (#27887) (#27889)
|
||||
* Fix http protocol auth (#27875) (#27878)
|
||||
* Revert "fix orphan check for deleted branch (#27310) (#27320)" (#27763)
|
||||
* Fix label render containing invalid HTML (#27752) (#27761)
|
||||
* Fix poster is not loaded in get default merge message (#27657) (#27665)
|
||||
* Fix 404 when deleting Docker package with an internal version (#27615) (#27629)
|
||||
* Fix attachment download bug (#27486) (#27570)
|
||||
* When comparing with an non-exist repository, return 404 but 500 (#27437) (#27441)
|
||||
* API
|
||||
* Fix package webhook (#27839) (#27854)
|
||||
* Fix org team endpoint (#27721) (#27729)
|
||||
* ENHANCEMENTS
|
||||
* Render email addresses as such if followed by punctuation (#27987) (#27991)
|
||||
* Fix mermaid flowchart margin issue (#27503) (#27517)
|
||||
* Fix panic in storageHandler (#27446) (#27478)
|
||||
* DOCS
|
||||
* Update agit-support.en-us.md (#27652)
|
||||
* MISC
|
||||
* Fix wrong xorm Delete usage(backport for 1.20) (#28003)
|
||||
* Remove duplicated button in Install web page (#27941)
|
||||
* Avoid run change title process when the title is same (#27467) (#27557)
|
||||
|
||||
## [1.20.5](https://github.com/go-gitea/gitea/releases/tag/1.20.5) - 2023-10-03
|
||||
|
||||
* ENHANCEMENTS
|
||||
* Fix z-index on markdown completion (#27237) (#27242 & #27238)
|
||||
* Use secure cookie for HTTPS sites (#26999) (#27013)
|
||||
* BUGFIXES
|
||||
* Fix git 2.11 error when checking IsEmpty (#27393) (#27396)
|
||||
* Allow get release download files and lfs files with oauth2 token format (#26430) (#27378)
|
||||
* Fix orphan check for deleted branch (#27310) (#27320)
|
||||
* Quote table `release` in sql queries (#27205) (#27219)
|
||||
* Fix release URL in webhooks (#27182) (#27184)
|
||||
* Fix successful return value for `SyncAndGetUserSpecificDiff` (#27152) (#27156)
|
||||
* fix pagination for followers and following (#27127) (#27138)
|
||||
* Fix issue templates when blank isses are disabled (#27061) (#27082)
|
||||
* Fix context cache bug & enable context cache for dashabord commits' authors(#26991) (#27017)
|
||||
* Fix INI parsing for value with trailing slash (#26995) (#27001)
|
||||
* Fix PushEvent NullPointerException jenkinsci/github-plugin (#27203) (#27249)
|
||||
* Fix organization field being null in POST /orgs/{orgid}/teams (#27150) (#27167 & #27162)
|
||||
* Fix bug of review request number (#27406) (#27104)
|
||||
* TESTING
|
||||
* services/wiki: Close() after error handling (#27129) (#27137)
|
||||
* DOCS
|
||||
* Improve actions docs related to `pull_request` event (#27126) (#27145)
|
||||
* MISC
|
||||
* Add logs for data broken of comment review (#27326) (#27344)
|
||||
* Load reviewer before sending notification (#27063) (#27064)
|
||||
|
||||
## [1.20.4](https://github.com/go-gitea/gitea/releases/tag/v1.20.4) - 2023-09-08
|
||||
|
||||
* SECURITY
|
||||
* Check blocklist for emails when adding them to account (#26812) (#26831)
|
||||
* ENHANCEMENTS
|
||||
* Add `branch_filter` to hooks API endpoints (#26599) (#26632)
|
||||
* Fix incorrect "tabindex" attributes (#26733) (#26734)
|
||||
* Use line-height: normal by default (#26635) (#26708)
|
||||
* Fix unable to display individual-level project (#26198) (#26636)
|
||||
* BUGFIXES
|
||||
* Fix wrong review requested number (#26784) (#26880)
|
||||
* Avoid double-unescaping of form value (#26853) (#26863)
|
||||
* Redirect from `{repo}/issues/new` to `{repo}/issues/new/choose` when blank issues are disabled (#26813) (#26847)
|
||||
* Sync tags when adopting repos (#26816) (#26834)
|
||||
* Fix verifyCommits error when push a new branch (#26664) (#26810)
|
||||
* Include the GITHUB_TOKEN/GITEA_TOKEN secret for fork pull requests (#26759) (#26806)
|
||||
* Fix some slice append usages (#26778) (#26798)
|
||||
* Add fix incorrect can_create_org_repo for org owner team (#26683) (#26791)
|
||||
* Fix bug for ctx usage (#26763)
|
||||
* Make issue template field template access correct template data (#26698) (#26709)
|
||||
* Use correct minio error (#26634) (#26639)
|
||||
* Ignore the trailing slashes when comparing oauth2 redirect_uri (#26597) (#26618)
|
||||
* Set errwriter for urfave/cli v1 (#26616)
|
||||
* Fix reopen logic for agit flow pull request (#26399) (#26613)
|
||||
* Fix context filter has no effect in dashboard (#26695) (#26811)
|
||||
* Fix being unable to use a repo that prohibits accepting PRs as a PR source. (#26785) (#26790)
|
||||
* Fix Page Not Found error (#26768)
|
||||
|
||||
## [1.20.3](https://github.com/go-gitea/gitea/releases/tag/v1.20.3) - 2023-08-20
|
||||
|
||||
* BREAKING
|
||||
* Fix the wrong derive path (#26271) (#26318)
|
||||
* SECURITY
|
||||
* Fix API leaking Usermail if not logged in (#25097) (#26350)
|
||||
* FEATURES
|
||||
* Add ThreadID parameter for Telegram webhooks (#25996) (#26480)
|
||||
* ENHANCEMENTS
|
||||
* Add minimum polyfill to support "relative-time-element" in PaleMoon (#26575) (#26578)
|
||||
* Fix dark theme highlight for "NameNamespace" (#26519) (#26527)
|
||||
* Detect ogg mime-type as audio or video (#26494) (#26505)
|
||||
* Use `object-fit: contain` for oauth2 custom icons (#26493) (#26498)
|
||||
* Move dropzone progress bar to bottom to show filename when uploading (#26492) (#26497)
|
||||
* Remove last newline from config file (#26468) (#26471)
|
||||
* Minio: add missing region on client initialization (#26412) (#26438)
|
||||
* Add pull request review request webhook event (#26401) (#26407)
|
||||
* Fix text truncate (#26354) (#26384)
|
||||
* Fix incorrect color of selected assignees when create issue (#26324) (#26372)
|
||||
* Display human-readable text instead of cryptic filemodes (#26352) (#26358)
|
||||
* Hide `last indexed SHA` when a repo could not be indexed yet (#26340) (#26345)
|
||||
* Fix the topic validation rule and suport dots (#26286) (#26303)
|
||||
* Fix due date rendering the wrong date in issue (#26268) (#26274)
|
||||
* Don't autosize textarea in diff view (#26233) (#26244)
|
||||
* Fix commit compare style (#26209) (#26226)
|
||||
* Warn instead of reporting an error when a webhook cannot be found (#26039) (#26211)
|
||||
* BUGFIXES
|
||||
* Use "input" event instead of "keyup" event for migration form (#26602) (#26605)
|
||||
* Do not use deprecated log config options by default (#26592) (#26600)
|
||||
* Fix "issueReposQueryPattern does not match query" (#26556) (#26564)
|
||||
* Sync repo's IsEmpty status correctly (#26517) (#26560)
|
||||
* Fix project filter bugs (#26490) (#26558)
|
||||
* Use `hidden` over `clip` for text truncation (#26520) (#26522)
|
||||
* Set "type=button" for editor's toolbar buttons (#26510) (#26518)
|
||||
* Fix NuGet search endpoints (#25613) (#26499)
|
||||
* Fix storage path logic especially for relative paths (#26441) (#26481)
|
||||
* Close stdout correctly for "git blame" (#26470) (#26473)
|
||||
* Check first if minio bucket exists before trying to create it (#26420) (#26465)
|
||||
* Avoiding accessing undefined tributeValues #26461 (#26462)
|
||||
* Call git.InitSimple for runRepoSyncReleases (#26396) (#26450)
|
||||
* Add transaction when creating pull request created dirty data (#26259) (#26437)
|
||||
* Fix wrong middleware sequence (#26428) (#26436)
|
||||
* Fix admin queue page title and fix CI failures (#26409) (#26421)
|
||||
* Introduce ctx.PathParamRaw to avoid incorrect unescaping (#26392) (#26405)
|
||||
* Bypass MariaDB performance bug of the "IN" sub-query, fix incorrect IssueIndex (#26279) (#26368)
|
||||
* Fix incorrect CLI exit code and duplicate error message (#26346) (#26347)
|
||||
* Prevent newline errors with Debian packages (#26332) (#26342)
|
||||
* Fix bug with sqlite load read (#26305) (#26339)
|
||||
* Make git batch operations use parent context timeout instead of default timeout (#26325) (#26330)
|
||||
* Support getting changed files when commit ID is `EmptySHA` (#26290) (#26316)
|
||||
* Clarify the logger's MODE config option (#26267) (#26281)
|
||||
* Use shared template for webhook icons (#26242) (#26246)
|
||||
* Fix pull request check list is limited (#26179) (#26245)
|
||||
* Fix attachment clipboard copy on insecure origin (#26224) (#26231)
|
||||
* Fix access check for org-level project (#26182) (#26223)
|
||||
* MISC
|
||||
* Improve profile readme rendering (#25988) (#26453)
|
||||
* [docs] Add missing backtick in quickstart.zh-cn.md (#26349) (#26357)
|
||||
* Upgrade x/net to 0.13.0 (#26301)
|
||||
|
||||
## [1.20.2](https://github.com/go-gitea/gitea/releases/tag/v1.20.2) - 2023-07-29
|
||||
|
||||
* ENHANCEMENTS
|
||||
* Calculate MAX_WORKERS default value by CPU number (#26177) (#26183)
|
||||
@@ -32,7 +179,7 @@ been added to each release, please refer to the [blog](https://blog.gitea.io).
|
||||
* Fix wrong workflow status when rerun a job in an already finished workflow (#26119) (#26124)
|
||||
* Fix duplicated url prefix on issue context menu (#26066) (#26067)
|
||||
|
||||
## [1.20.1](https://github.com/go-gitea/gitea/releases/tag/1.20.1) - 2023-07-22
|
||||
## [1.20.1](https://github.com/go-gitea/gitea/releases/tag/v1.20.1) - 2023-07-22
|
||||
|
||||
* SECURITY
|
||||
* Disallow dangerous URL schemes (#25960) (#25964)
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
## Introduction
|
||||
|
||||
This document explains how to contribute changes to the Gitea project. \
|
||||
It assumes you have followed the [installation instructions](https://docs.gitea.io/en-us/). \
|
||||
It assumes you have followed the [installation instructions](https://docs.gitea.com/category/installation). \
|
||||
Sensitive security-related issues should be reported to [security@gitea.io](mailto:security@gitea.io).
|
||||
|
||||
For configuring IDEs for Gitea development, see the [contributed IDE configurations](contrib/ide/).
|
||||
|
||||
@@ -86,7 +86,7 @@ When building from the official source tarballs which include pre-built frontend
|
||||
|
||||
Parallelism (`make -j <num>`) is not supported.
|
||||
|
||||
More info: https://docs.gitea.io/en-us/install-from-source/
|
||||
More info: https://docs.gitea.com/installation/install-from-source
|
||||
|
||||
## Using
|
||||
|
||||
@@ -110,13 +110,13 @@ Translations are done through Crowdin. If you want to translate to a new languag
|
||||
|
||||
You can also just create an issue for adding a language or ask on discord on the #translation channel. If you need context or find some translation issues, you can leave a comment on the string or ask on Discord. For general translation questions there is a section in the docs. Currently a bit empty but we hope to fill it as questions pop up.
|
||||
|
||||
https://docs.gitea.io/en-us/contributing/translation-guidelines/
|
||||
https://docs.gitea.com/contributing/localization
|
||||
|
||||
[](https://crowdin.com/project/gitea)
|
||||
|
||||
## Further information
|
||||
|
||||
For more information and instructions about how to install Gitea, please look at our [documentation](https://docs.gitea.io/en-us/).
|
||||
For more information and instructions about how to install Gitea, please look at our [documentation](https://docs.gitea.com).
|
||||
If you have questions that are not covered by the documentation, you can get in contact with us on our [Discord server](https://discord.gg/Gitea) or create a post in the [discourse forum](https://discourse.gitea.io/).
|
||||
|
||||
We maintain a list of Gitea-related projects at [gitea/awesome-gitea](https://gitea.com/gitea/awesome-gitea).
|
||||
|
||||
@@ -68,7 +68,7 @@ Gitea 的首要目标是创建一个极易安装,运行非常快速,安装
|
||||
|
||||
## 文档
|
||||
|
||||
关于如何安装请访问我们的 [文档站](https://docs.gitea.io/zh-cn/),如果没有找到对应的文档,你也可以通过 [Discord - 英文](https://discord.gg/gitea) 和 QQ群 328432459 来和我们交流。
|
||||
关于如何安装请访问我们的 [文档站](https://docs.gitea.com/zh-cn/category/installation),如果没有找到对应的文档,你也可以通过 [Discord - 英文](https://discord.gg/gitea) 和 QQ群 328432459 来和我们交流。
|
||||
|
||||
## 贡献流程
|
||||
|
||||
|
||||
@@ -348,6 +348,10 @@ func runRepoSyncReleases(_ *cli.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := git.InitSimple(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Trace("Synchronizing repository releases (this may take a while)")
|
||||
for page := 1; ; page++ {
|
||||
repos, count, err := repo_model.SearchRepositoryByName(ctx, &repo_model.SearchRepoOptions{
|
||||
|
||||
26
cmd/main.go
Normal file
26
cmd/main.go
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright 2023 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
func RunMainApp(app *cli.App, args ...string) error {
|
||||
err := app.Run(args)
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
if strings.HasPrefix(err.Error(), "flag provided but not defined:") {
|
||||
// the cli package should already have output the error message, so just exit
|
||||
cli.OsExiter(1)
|
||||
return err
|
||||
}
|
||||
_, _ = fmt.Fprintf(app.ErrWriter, "Command error: %v\n", err)
|
||||
cli.OsExiter(1)
|
||||
return err
|
||||
}
|
||||
@@ -4,9 +4,16 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
"code.gitea.io/gitea/modules/test"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@@ -14,3 +21,64 @@ func TestMain(m *testing.M) {
|
||||
GiteaRootPath: "..",
|
||||
})
|
||||
}
|
||||
|
||||
func newTestApp(testCmdAction func(ctx *cli.Context) error) *cli.App {
|
||||
app := cli.NewApp()
|
||||
app.HelpName = "gitea"
|
||||
testCmd := cli.Command{Name: "test-cmd", Action: testCmdAction}
|
||||
app.Commands = append(app.Commands, testCmd)
|
||||
return app
|
||||
}
|
||||
|
||||
type runResult struct {
|
||||
Stdout string
|
||||
Stderr string
|
||||
ExitCode int
|
||||
}
|
||||
|
||||
func runTestApp(app *cli.App, args ...string) (runResult, error) {
|
||||
outBuf := new(strings.Builder)
|
||||
errBuf := new(strings.Builder)
|
||||
app.Writer = outBuf
|
||||
app.ErrWriter = errBuf
|
||||
exitCode := -1
|
||||
defer test.MockVariableValue(&cli.ErrWriter, app.ErrWriter)()
|
||||
defer test.MockVariableValue(&cli.OsExiter, func(code int) {
|
||||
if exitCode == -1 {
|
||||
exitCode = code // save the exit code once and then reset the writer (to simulate the exit)
|
||||
app.Writer, app.ErrWriter, cli.ErrWriter = io.Discard, io.Discard, io.Discard
|
||||
}
|
||||
})()
|
||||
err := RunMainApp(app, args...)
|
||||
return runResult{outBuf.String(), errBuf.String(), exitCode}, err
|
||||
}
|
||||
|
||||
func TestCliCmdError(t *testing.T) {
|
||||
app := newTestApp(func(ctx *cli.Context) error { return fmt.Errorf("normal error") })
|
||||
r, err := runTestApp(app, "./gitea", "test-cmd")
|
||||
assert.Error(t, err)
|
||||
assert.Equal(t, 1, r.ExitCode)
|
||||
assert.Equal(t, "", r.Stdout)
|
||||
assert.Equal(t, "Command error: normal error\n", r.Stderr)
|
||||
|
||||
app = newTestApp(func(ctx *cli.Context) error { return cli.NewExitError("exit error", 2) })
|
||||
r, err = runTestApp(app, "./gitea", "test-cmd")
|
||||
assert.Error(t, err)
|
||||
assert.Equal(t, 2, r.ExitCode)
|
||||
assert.Equal(t, "", r.Stdout)
|
||||
assert.Equal(t, "exit error\n", r.Stderr)
|
||||
|
||||
app = newTestApp(func(ctx *cli.Context) error { return nil })
|
||||
r, err = runTestApp(app, "./gitea", "test-cmd", "--no-such")
|
||||
assert.Error(t, err)
|
||||
assert.Equal(t, 1, r.ExitCode)
|
||||
assert.EqualValues(t, "Incorrect Usage: flag provided but not defined: -no-such\n\nNAME:\n gitea test-cmd - \n\nUSAGE:\n gitea test-cmd [arguments...]\n", r.Stdout)
|
||||
assert.Equal(t, "", r.Stderr) // the cli package's strange behavior, the error message is not in stderr ....
|
||||
|
||||
app = newTestApp(func(ctx *cli.Context) error { return nil })
|
||||
r, err = runTestApp(app, "./gitea", "test-cmd")
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, -1, r.ExitCode) // the cli.OsExiter is not called
|
||||
assert.Equal(t, "", r.Stdout)
|
||||
assert.Equal(t, "", r.Stderr)
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
dashboardTimezone: 'default',
|
||||
dashboardRefresh: '1m',
|
||||
|
||||
// please see https://docs.gitea.io/en-us/config-cheat-sheet/#metrics-metrics
|
||||
// please see https://docs.gitea.com/administration/config-cheat-sheet#metrics-metrics
|
||||
// Show issue by repository metrics with format gitea_issues_by_repository{repository="org/repo"} 5.
|
||||
// Requires Gitea 1.16.0 with ENABLED_ISSUE_BY_REPOSITORY set to true.
|
||||
showIssuesByRepository: true,
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
<h3>With your Consent</h3>
|
||||
|
||||
<p>We share your User Personal Information, if you consent, after letting you know what information will be shared, with whom, and why. For example, if you allow third party applications to access your Account using <a href="https://docs.gitea.io/en-us/oauth2-provider/">OAuth2 providers</a>, we share all information associated with your Account, including private repos and organizations. You may also direct us through your action on Your Gitea Instance to share your User Personal Information, such as when joining an Organization.</p>
|
||||
<p>We share your User Personal Information, if you consent, after letting you know what information will be shared, with whom, and why. For example, if you allow third party applications to access your Account using <a href="https://docs.gitea.com/development/oauth2-provider">OAuth2 providers</a>, we share all information associated with your Account, including private repos and organizations. You may also direct us through your action on Your Gitea Instance to share your User Personal Information, such as when joining an Organization.</p>
|
||||
|
||||
<h3>With Service Providers</h3>
|
||||
|
||||
@@ -144,7 +144,7 @@
|
||||
|
||||
<h3>Data Portability</h3>
|
||||
|
||||
<p>As a Your Gitea Instance User, you can always take your data with you. You can clone your repositories to your computer, or you can <a href="https://docs.gitea.io/en-us/migrations-interfaces/">perform migrations using the provided interfaces</a>, for example.</p>
|
||||
<p>As a Your Gitea Instance User, you can always take your data with you. You can clone your repositories to your computer, or you can <a href="https://docs.gitea.com/development/migrations-interfaces">perform migrations using the provided interfaces</a>, for example.</p>
|
||||
|
||||
<h3>Data Retention and Deletion of Data</h3>
|
||||
|
||||
@@ -183,7 +183,7 @@
|
||||
|
||||
<h2>Changes to this Privacy Policy</h2>
|
||||
|
||||
<p>Although most changes are likely to be minor, Your Gitea Instance may change our Privacy Statement from time to time. We will provide notification to Users of material changes to this Privacy Statement through our Website at least 30 days prior to the change taking effect by posting a notice on our home page or sending email to the primary email address specified in your account.</p>
|
||||
<p>Although most changes are likely to be minor, Your Gitea Instance may change our Privacy Statement from time to time. We will provide notification to Users of material changes to this Privacy Statement through our Website at least 30 days prior to the change taking effect by posting a notice on our home page or sending email to the primary email address specified in your account.</p>
|
||||
|
||||
<h2>Contact</h2>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
;; Do not copy the whole file as-is, as it contains some invalid sections for illustrative purposes.
|
||||
;; If you don't know what a setting is you should not set it.
|
||||
;;
|
||||
;; see https://docs.gitea.io/en-us/config-cheat-sheet/ for additional documentation.
|
||||
;; see https://docs.gitea.com/administration/config-cheat-sheet for additional documentation.
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@@ -1724,8 +1724,8 @@ LEVEL = Info
|
||||
;; Session cookie name
|
||||
;COOKIE_NAME = i_like_gitea
|
||||
;;
|
||||
;; If you use session in https only, default is false
|
||||
;COOKIE_SECURE = false
|
||||
;; If you use session in https only: true or false. If not set, it defaults to `true` if the ROOT_URL is an HTTPS URL.
|
||||
;COOKIE_SECURE =
|
||||
;;
|
||||
;; Session GC time interval in seconds, default is 86400 (1 day)
|
||||
;GC_INTERVAL_TIME = 86400
|
||||
@@ -1804,8 +1804,9 @@ LEVEL = Info
|
||||
;; Currently, only `minio` is supported.
|
||||
;SERVE_DIRECT = false
|
||||
;;
|
||||
;; Path for attachments. Defaults to `data/attachments` only available when STORAGE_TYPE is `local`
|
||||
;PATH = data/attachments
|
||||
;; Path for attachments. Defaults to `attachments`. Only available when STORAGE_TYPE is `local`
|
||||
;; Relative paths will be resolved to `${AppDataPath}/${attachment.PATH}`
|
||||
;PATH = attachments
|
||||
;;
|
||||
;; Minio endpoint to connect only available when STORAGE_TYPE is `minio`
|
||||
;MINIO_ENDPOINT = localhost:9000
|
||||
|
||||
@@ -4,4 +4,4 @@ Dockerfile is found in root of repository.
|
||||
|
||||
Docker image can be found on [docker hub](https://hub.docker.com/r/gitea/gitea)
|
||||
|
||||
Documentation on using docker image can be found on [Gitea Docs site](https://docs.gitea.io/en-us/install-with-docker/)
|
||||
Documentation on using docker image can be found on [Gitea Docs site](https://docs.gitea.com/installation/install-with-docker-rootless)
|
||||
|
||||
@@ -46,7 +46,6 @@ PATH = /data/gitea/attachments
|
||||
[log]
|
||||
MODE = console
|
||||
LEVEL = info
|
||||
ROUTER = console
|
||||
ROOT_PATH = /data/gitea/log
|
||||
|
||||
[security]
|
||||
|
||||
@@ -337,7 +337,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
|
||||
- `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`.
|
||||
- `SSH_AUTHORIZED_PRINCIPALS_BACKUP`: **false/true**: Enable SSH Authorized Principals Backup when rewriting all keys, default is true if `SSH_AUTHORIZED_PRINCIPALS_ALLOW` is not `off`.
|
||||
- `SSH_AUTHORIZED_KEYS_COMMAND_TEMPLATE`: **{{.AppPath}} --config={{.CustomConf}} serv key-{{.Key.ID}}**: Set the template for the command to passed on authorized keys. Possible keys are: AppPath, AppWorkPath, CustomConf, CustomPath, Key - where Key is a `models/asymkey.PublicKey` and the others are strings which are shellquoted.
|
||||
- `SSH_AUTHORIZED_KEYS_COMMAND_TEMPLATE`: **`{{.AppPath}} --config={{.CustomConf}} serv key-{{.Key.ID}}`**: Set the template for the command to passed on authorized keys. Possible keys are: AppPath, AppWorkPath, CustomConf, CustomPath, Key - where Key is a `models/asymkey.PublicKey` and the others are strings which are shellquoted.
|
||||
- `SSH_SERVER_CIPHERS`: **chacha20-poly1305@openssh.com, aes128-ctr, aes192-ctr, aes256-ctr, aes128-gcm@openssh.com, aes256-gcm@openssh.com**: For the built-in SSH server, choose the ciphers to support for SSH connections, for system SSH this setting has no effect.
|
||||
- `SSH_SERVER_KEY_EXCHANGES`: **curve25519-sha256, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, diffie-hellman-group14-sha256, diffie-hellman-group14-sha1**: For the built-in SSH server, choose the key exchange algorithms to support for SSH connections, for system SSH this setting has no effect.
|
||||
- `SSH_SERVER_MACS`: **hmac-sha2-256-etm@openssh.com, hmac-sha2-256, hmac-sha1**: For the built-in SSH server, choose the MACs to support for SSH connections, for system SSH this setting has no effect
|
||||
@@ -443,7 +443,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
|
||||
- `ITERATE_BUFFER_SIZE`: **50**: Internal buffer size for iterating.
|
||||
- `CHARSET`: **utf8mb4**: For MySQL only, either "utf8" or "utf8mb4". NOTICE: for "utf8mb4" you must use MySQL InnoDB > 5.6. Gitea is unable to check this.
|
||||
- `PATH`: **data/gitea.db**: For SQLite3 only, the database file path.
|
||||
- `LOG_SQL`: **true**: Log the executed SQL.
|
||||
- `LOG_SQL`: **false**: Log the executed SQL.
|
||||
- `DB_RETRIES`: **10**: How many ORM init / DB connect attempts allowed.
|
||||
- `DB_RETRY_BACKOFF`: **3s**: time.Duration to wait before trying another ORM init / DB connect attempt, if failure occurred.
|
||||
- `MAX_OPEN_CONNS` **0**: Database maximum open connections - default is 0, meaning there is no limit.
|
||||
@@ -772,7 +772,7 @@ and
|
||||
|
||||
- `PROVIDER`: **memory**: Session engine provider \[memory, file, redis, redis-cluster, db, mysql, couchbase, memcache, postgres\]. Setting `db` will reuse the configuration in `[database]`
|
||||
- `PROVIDER_CONFIG`: **data/sessions**: For file, the root path; for db, empty (database config will be used); for others, the connection string. Relative paths will be made absolute against _`AppWorkPath`_.
|
||||
- `COOKIE_SECURE`: **false**: Enable this to force using HTTPS for all session access.
|
||||
- `COOKIE_SECURE`:**_empty_**: `true` or `false`. Enable this to force using HTTPS for all session access. If not set, it defaults to `true` if the ROOT_URL is an HTTPS URL.
|
||||
- `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)
|
||||
@@ -818,7 +818,7 @@ Default templates for project boards:
|
||||
- `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]`
|
||||
- `SERVE_DIRECT`: **false**: Allows the storage driver to redirect to authenticated URLs to serve files directly. Currently, only Minio/S3 is supported via signed URLs, local does nothing.
|
||||
- `PATH`: **data/attachments**: Path to store attachments only available when STORAGE_TYPE is `local`
|
||||
- `PATH`: **attachments**: Path to store attachments only available when STORAGE_TYPE is `local`, relative paths will be resolved to `${AppDataPath}/${attachment.PATH}`.
|
||||
- `MINIO_ENDPOINT`: **localhost:9000**: Minio endpoint to connect only available when STORAGE_TYPE is `minio`
|
||||
- `MINIO_ACCESS_KEY_ID`: Minio accessKeyID to connect only available when STORAGE_TYPE is `minio`
|
||||
- `MINIO_SECRET_ACCESS_KEY`: Minio secretAccessKey to connect only available when STORAGE_TYPE is `minio`
|
||||
@@ -1384,7 +1384,7 @@ Please note that using `self` is not recommended for most cases, as it could mak
|
||||
Additionally, it requires you to mirror all the actions you need to your Gitea instance, which may not be worth it.
|
||||
Therefore, please use `self` only if you understand what you are doing.
|
||||
|
||||
In earlier versions (<= 1.19), `DEFAULT_ACTIONS_URL` cound be set to any custom URLs like `https://gitea.com` or `http://your-git-server,https://gitea.com`, and the default value was `https://gitea.com`.
|
||||
In earlier versions (`<= 1.19`), `DEFAULT_ACTIONS_URL` cound be set to any custom URLs like `https://gitea.com` or `http://your-git-server,https://gitea.com`, and the default value was `https://gitea.com`.
|
||||
However, later updates removed those options, and now the only options are `github` and `self`, with the default value being `github`.
|
||||
However, if you want to use actions from other git server, you can use a complete URL in `uses` field, it's supported by Gitea (but not GitHub).
|
||||
Like `uses: https://gitea.com/actions/checkout@v3` or `uses: http://your-git-server/actions/checkout@v3`.
|
||||
|
||||
@@ -98,7 +98,7 @@ menu:
|
||||
- `SSL_MODE`: MySQL 或 PostgreSQL数据库是否启用SSL模式。
|
||||
- `CHARSET`: **utf8mb4**: 仅当数据库为 MySQL 时有效, 可以为 "utf8" 或 "utf8mb4"。注意:如果使用 "utf8mb4",你的 MySQL InnoDB 版本必须在 5.6 以上。
|
||||
- `PATH`: SQLite3 数据文件存放路径。
|
||||
- `LOG_SQL`: **true**: 显示生成的SQL,默认为真。
|
||||
- `LOG_SQL`: **false**: 显示生成的SQL,默认为真。
|
||||
- `MAX_IDLE_CONNS` **0**: 最大空闲数据库连接
|
||||
- `CONN_MAX_LIFETIME` **3s**: 数据库连接最大存活时间
|
||||
|
||||
@@ -200,7 +200,7 @@ menu:
|
||||
|
||||
- `PROVIDER`: Session 内容存储方式,可选 `memory`, `file`, `redis` 或 `mysql`。
|
||||
- `PROVIDER_CONFIG`: 如果是文件,那么这里填根目录;其他的要填主机地址和端口。
|
||||
- `COOKIE_SECURE`: 强制使用 HTTPS 作为session访问。
|
||||
- `COOKIE_SECURE`: **_empty_**:`true` 或 `false`。启用此选项以强制在所有会话访问中使用 HTTPS。如果没有设置,当 ROOT_URL 是 https 链接的时候默认设置为 true。
|
||||
- `GC_INTERVAL_TIME`: Session失效时间。
|
||||
|
||||
## Picture (`picture`)
|
||||
@@ -230,7 +230,7 @@ menu:
|
||||
- `MAX_SIZE`: 附件最大限制,单位 MB,比如: `4`。
|
||||
- `MAX_FILES`: 一次最多上传的附件数量,比如: `5`。
|
||||
- `STORAGE_TYPE`: **local**: 附件存储类型,`local` 将存储到本地文件夹, `minio` 将存储到 s3 兼容的对象存储服务中。
|
||||
- `PATH`: **data/attachments**: 附件存储路径,仅当 `STORAGE_TYPE` 为 `local` 时有效。
|
||||
- `PATH`: **attachments**: 存储附件的路径,仅当 STORAGE_TYPE 为 `local` 时可用。如果是相对路径,将会被解析为 `${AppDataPath}/${attachment.PATH}`.
|
||||
- `MINIO_ENDPOINT`: **localhost:9000**: Minio 终端,仅当 `STORAGE_TYPE` 是 `minio` 时有效。
|
||||
- `MINIO_ACCESS_KEY_ID`: Minio accessKeyID ,仅当 `STORAGE_TYPE` 是 `minio` 时有效。
|
||||
- `MINIO_SECRET_ACCESS_KEY`: Minio secretAccessKey,仅当 `STORAGE_TYPE` 是 `minio` 时有效。
|
||||
|
||||
@@ -36,7 +36,7 @@ Application settings can be found in file `CustomConf` which is by default,
|
||||
Again `gitea help` will allow you review this variable and you can override it using the
|
||||
`--config` option on the `gitea` binary.
|
||||
|
||||
- [Quick Cheat Sheet](https://docs.gitea.io/en-us/config-cheat-sheet/)
|
||||
- [Quick Cheat Sheet](administration/config-cheat-sheet.md)
|
||||
- [Complete List](https://github.com/go-gitea/gitea/blob/main/custom/conf/app.example.ini)
|
||||
|
||||
If the `CustomPath` folder can't be found despite checking `gitea help`, check the `GITEA_CUSTOM`
|
||||
@@ -44,7 +44,7 @@ environment variable; this can be used to override the default path to something
|
||||
`GITEA_CUSTOM` might, for example, be set by an init script. You can check whether the value
|
||||
is set under the "Configuration" tab on the site administration page.
|
||||
|
||||
- [List of Environment Variables](https://docs.gitea.io/en-us/environment-variables/)
|
||||
- [List of Environment Variables](administration/environment-variables.md)
|
||||
|
||||
**Note:** Gitea must perform a full restart to see configuration changes.
|
||||
|
||||
@@ -79,7 +79,7 @@ for C++ repositories, we want to replace `options/gitignore/C++`. To do this, a
|
||||
must be placed in `$GITEA_CUSTOM/options/gitignore/C++` (see about the location of the `CustomPath`
|
||||
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/),
|
||||
Every single page of Gitea can be changed. Dynamic content is generated using [go templates](https://pkg.go.dev/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](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).
|
||||
@@ -103,7 +103,7 @@ just place it under your "$GITEA_CUSTOM/public/" directory (for instance `$GITEA
|
||||
To match the current style, the link should have the class name "item", and you can use `{{AppSubUrl}}` to get the base URL:
|
||||
`<a class="item" href="{{AppSubUrl}}/assets/impressum.html">Impressum</a>`
|
||||
|
||||
For more information, see [Adding Legal Pages](https://docs.gitea.io/en-us/adding-legal-pages).
|
||||
For more information, see [Adding Legal Pages](administration/adding-legal-pages.md).
|
||||
|
||||
You can add new tabs in the same way, putting them in `extra_tabs.tmpl`.
|
||||
The exact HTML needed to match the style of other tabs is in the file
|
||||
@@ -355,10 +355,10 @@ A full list of supported emoji's is at [emoji list](https://gitea.com/gitea/gite
|
||||
## Customizing the look of Gitea
|
||||
|
||||
The default built-in themes are `gitea` (light), `arc-green` (dark), and `auto` (chooses light or dark depending on operating system settings).
|
||||
The default theme can be changed via `DEFAULT_THEME` in the [ui](https://docs.gitea.io/en-us/config-cheat-sheet/#ui-ui) section of `app.ini`.
|
||||
The default theme can be changed via `DEFAULT_THEME` in the [ui](administration/config-cheat-sheet.md#ui-ui) section of `app.ini`.
|
||||
|
||||
Gitea also has support for user themes, which means every user can select which theme should be used.
|
||||
The list of themes a user can choose from can be configured with the `THEMES` value in the [ui](https://docs.gitea.io/en-us/config-cheat-sheet/#ui-ui) section of `app.ini`.
|
||||
The list of themes a user can choose from can be configured with the `THEMES` value in the [ui](administration/config-cheat-sheet.md#ui-ui) section of `app.ini`.
|
||||
|
||||
To make a custom theme available to all users:
|
||||
|
||||
|
||||
@@ -23,13 +23,13 @@ Gitea 引用 `custom` 目录中的自定义配置文件来覆盖配置、模板
|
||||
将会自动创建包括 `custom/` 在内的必要应用目录,应用本身的配置存放在
|
||||
`custom/conf/app.ini` 当中。在发行版中可能会以 `/etc/gitea/` 的形式为 `custom` 设置一个符号链接,查看配置详情请移步:
|
||||
|
||||
- [快速备忘单](https://docs.gitea.io/en-us/config-cheat-sheet/)
|
||||
- [快速备忘单](administration/config-cheat-sheet.md)
|
||||
- [完整配置清单](https://github.com/go-gitea/gitea/blob/main/custom/conf/app.example.ini)
|
||||
|
||||
如果您在 binary 同目录下无法找到 `custom` 文件夹,请检查您的 `GITEA_CUSTOM`
|
||||
环境变量配置, 因为它可能被配置到了其他地方(可能被一些启动脚本设置指定了目录)。
|
||||
|
||||
- [环境变量清单](https://docs.gitea.io/en-us/specific-variables/)
|
||||
- [环境变量清单](administration/environment-variables.md)
|
||||
|
||||
**注:** 必须完全重启 Gitea 以使配置生效。
|
||||
|
||||
@@ -87,4 +87,4 @@ Gitea 引用 `custom` 目录中的自定义配置文件来覆盖配置、模板
|
||||
## 更改 Gitea 外观
|
||||
|
||||
Gitea 目前由两种内置主题,分别为默认 `gitea` 主题和深色主题 `arc-green`,您可以通过修改
|
||||
`app.ini` [ui](https://docs.gitea.io/en-us/config-cheat-sheet/#ui-ui) 部分的 `DEFAULT_THEME` 的值来变更至一个可用的 Gitea 外观。
|
||||
`app.ini` [ui](administration/config-cheat-sheet.md#ui-ui) 部分的 `DEFAULT_THEME` 的值来变更至一个可用的 Gitea 外观。
|
||||
|
||||
@@ -79,8 +79,9 @@ SMTP_PORT = 465
|
||||
FROM = example.user@gmail.com
|
||||
USER = example.user
|
||||
PASSWD = `***`
|
||||
PROTOCOL = smtp
|
||||
IS_TLS_ENABLED = true
|
||||
PROTOCOL = smtps ; Gitea >= 1.19.0
|
||||
; PROTOCOL = smtp ; Gitea < 1.19.0
|
||||
; IS_TLS_ENABLED = true ; Gitea < 1.19.0
|
||||
```
|
||||
|
||||
Note that you'll need to create and use an [App password](https://support.google.com/accounts/answer/185833?hl=en) by enabling 2FA on your Google
|
||||
|
||||
@@ -55,7 +55,7 @@ PASSWD = `password`
|
||||
|
||||
要发送测试邮件以验证设置,请转到 Gitea > 站点管理 > 配置 > SMTP 邮件配置。
|
||||
|
||||
有关所有选项的完整列表,请查看[配置速查表](doc/administration/config-cheat-sheet.zh-cn.md)。
|
||||
有关所有选项的完整列表,请查看[配置速查表](administration/config-cheat-sheet.md)。
|
||||
|
||||
请注意:只有在使用 TLS 或 `HOST=localhost` 加密 SMTP 服务器通信时才支持身份验证。TLS 加密可以通过以下方式进行:
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ it is just a matter of:
|
||||
- add some configuration to your `app.ini` file
|
||||
- restart your Gitea instance
|
||||
|
||||
This supports rendering of whole files. If you want to render code blocks in markdown you would need to do something with javascript. See some examples on the [Customizing Gitea](../customizing-gitea) page.
|
||||
This supports rendering of whole files. If you want to render code blocks in markdown you would need to do something with javascript. See some examples on the [Customizing Gitea](administration/customizing-gitea.md) page.
|
||||
|
||||
## Installing external binaries
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ proxy_set_header X-Real-IP $remote_addr;
|
||||
|
||||
The security options in `app.ini` need to be adjusted to allow the interpretation of the headers
|
||||
as well as the list of IP addresses and networks that describe trusted proxy servers
|
||||
(See the [configuration cheat sheet](https://docs.gitea.io/en-us/config-cheat-sheet/#security-security) for more information).
|
||||
(See the [configuration cheat sheet](administration/config-cheat-sheet.md#security-security) for more information).
|
||||
|
||||
```
|
||||
REVERSE_PROXY_LIMIT = 1
|
||||
|
||||
@@ -91,4 +91,4 @@ REVERSE_PROXY_TRUSTED_PROXIES = 127.0.0.0/8,::1/128
|
||||
`REVERSE_PROXY_LIMIT` 限制反向代理服务器的层数,设置为 `0` 表示不使用这些标头。
|
||||
`REVERSE_PROXY_TRUSTED_PROXIES` 表示受信任的反向代理服务器网络地址,
|
||||
经过该网络地址转发来的流量会经过解析 `X-Real-IP` 头部得到真实客户端地址。
|
||||
(参考 [configuration cheat sheet](https://docs.gitea.io/en-us/config-cheat-sheet/#security-security))
|
||||
(参考 [configuration cheat sheet](administration/config-cheat-sheet.md#security-security))
|
||||
|
||||
@@ -36,7 +36,7 @@ KEY_FILE = key.pem
|
||||
```
|
||||
|
||||
Note that if your certificate is signed by a third party certificate authority (i.e. not self-signed), then cert.pem should contain the certificate chain. The server certificate must be the first entry in cert.pem, followed by the intermediaries in order (if any). The root certificate does not have to be included because the connecting client must already have it in order to estalbish the trust relationship.
|
||||
To learn more about the config values, please checkout the [Config Cheat Sheet](../config-cheat-sheet#server-server).
|
||||
To learn more about the config values, please checkout the [Config Cheat Sheet](administration/config-cheat-sheet.md#server-server).
|
||||
|
||||
For the `CERT_FILE` or `KEY_FILE` field, the file path is relative to the `GITEA_CUSTOM` environment variable when it is a relative path. It can be an absolute path as well.
|
||||
|
||||
@@ -85,11 +85,11 @@ ACME_DIRECTORY=https
|
||||
ACME_EMAIL=email@example.com
|
||||
```
|
||||
|
||||
To learn more about the config values, please checkout the [Config Cheat Sheet](../config-cheat-sheet#server-server).
|
||||
To learn more about the config values, please checkout the [Config Cheat Sheet](administration/config-cheat-sheet.md#server-server).
|
||||
|
||||
## Using a reverse proxy
|
||||
|
||||
Setup up your reverse proxy as shown in the [reverse proxy guide](../reverse-proxies).
|
||||
Setup up your reverse proxy as shown in the [reverse proxy guide](administration/reverse-proxies.md).
|
||||
|
||||
After that, enable HTTPS by following one of these guides:
|
||||
|
||||
|
||||
@@ -82,11 +82,11 @@ ACME_DIRECTORY=https
|
||||
ACME_EMAIL=email@example.com
|
||||
```
|
||||
|
||||
要了解关于配置, 请访问 [配置备忘单](../config-cheat-sheet#server-server)获取更多信息
|
||||
要了解关于配置, 请访问 [配置备忘单](administration/config-cheat-sheet.md#server-server)获取更多信息
|
||||
|
||||
## 使用反向代理服务器
|
||||
|
||||
按照 [reverse proxy guide](../reverse-proxies) 的规则设置你的反向代理服务器
|
||||
按照 [reverse proxy guide](administration/reverse-proxies.md) 的规则设置你的反向代理服务器
|
||||
|
||||
然后,按照下面的向导启用 HTTPS:
|
||||
|
||||
|
||||
@@ -102,8 +102,11 @@ MODE = file, file-error
|
||||
|
||||
; by default, the "file" mode will record logs to %(log.ROOT_PATH)/gitea.log, so we don't need to set it
|
||||
; [log.file]
|
||||
; by default, the MODE (actually it's the output writer of this logger) is taken from the section name, so we don't need to set it either
|
||||
; MODE = file
|
||||
|
||||
[log.file-error]
|
||||
MODE = file
|
||||
LEVEL = Error
|
||||
FILE_NAME = file-error.log
|
||||
```
|
||||
|
||||
@@ -18,7 +18,7 @@ menu:
|
||||
# Mail templates
|
||||
|
||||
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/).
|
||||
for these functions are located under the [`custom` directory](administration/customizing-gitea.md).
|
||||
Gitea has an internal template that serves as default in case there's no custom alternative.
|
||||
|
||||
Custom templates are loaded when Gitea starts. Changes made to them are not recognized until Gitea is restarted again.
|
||||
@@ -165,7 +165,7 @@ If the template fails to render, it will be noticed only at the moment the mail
|
||||
A default subject is used if the subject template fails, and whatever was rendered successfully
|
||||
from the the _mail body_ is used, disregarding the rest.
|
||||
|
||||
Please check [Gitea's logs](https://docs.gitea.io/en-us/logging-configuration/) for error messages in case of trouble.
|
||||
Please check [Gitea's logs](administration/logging-config.md) for error messages in case of trouble.
|
||||
|
||||
## Example
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ menu:
|
||||
|
||||
# 邮件模板
|
||||
|
||||
为了定制特定操作的电子邮件主题和内容,可以使用模板来自定义 Gitea。这些功能的模板位于 [`custom` 目录](https://docs.gitea.io/en-us/customizing-gitea/) 下。
|
||||
为了定制特定操作的电子邮件主题和内容,可以使用模板来自定义 Gitea。这些功能的模板位于 [`custom` 目录](administration/customizing-gitea.md) 下。
|
||||
如果没有自定义的替代方案,Gitea 将使用内部模板作为默认模板。
|
||||
|
||||
自定义模板在 Gitea 启动时加载。对它们的更改在 Gitea 重新启动之前不会被识别。
|
||||
@@ -148,7 +148,7 @@ _主题_ 和 _邮件正文_ 由 [Golang的模板引擎](https://golang.org/pkg/t
|
||||
如果模板无法呈现,则只有在发送邮件时才会注意到。
|
||||
如果主题模板失败,将使用默认主题,如果从 _邮件正文_ 中成功呈现了任何内容,则将使用该内容,忽略其他内容。
|
||||
|
||||
如果遇到问题,请检查 [Gitea的日志](https://docs.gitea.io/en-us/logging-configuration/) 以获取错误消息。
|
||||
如果遇到问题,请检查 [Gitea的日志](administration/logging-config.md) 以获取错误消息。
|
||||
|
||||
## 示例
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ menu:
|
||||
|
||||
## 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/):
|
||||
Gitea can search through the files of the repositories by enabling this function in your [`app.ini`](administration/config-cheat-sheet.md):
|
||||
|
||||
```ini
|
||||
[indexer]
|
||||
|
||||
@@ -19,7 +19,7 @@ menu:
|
||||
|
||||
## 设置仓库索引器
|
||||
|
||||
通过在您的 [`app.ini`](https://docs.gitea.io/en-us/config-cheat-sheet/) 中启用此功能,Gitea 可以通过仓库的文件进行搜索:
|
||||
通过在您的 [`app.ini`](administration/config-cheat-sheet.md) 中启用此功能,Gitea 可以通过仓库的文件进行搜索:
|
||||
|
||||
```ini
|
||||
[indexer]
|
||||
|
||||
@@ -21,7 +21,7 @@ menu:
|
||||
|
||||
By default, `ENABLE_SWAGGER` is true, and
|
||||
`MAX_RESPONSE_ITEMS` is set to 50. See [Config Cheat
|
||||
Sheet](https://docs.gitea.io/en-us/config-cheat-sheet/) for more
|
||||
Sheet](administration/config-cheat-sheet.md) for more
|
||||
information.
|
||||
|
||||
## Authentication
|
||||
@@ -76,7 +76,7 @@ interface: `Settings | Applications | Generate New Token`.
|
||||
|
||||
## OAuth2 Provider
|
||||
|
||||
Access tokens obtained from Gitea's [OAuth2 provider](https://docs.gitea.io/en-us/oauth2-provider) are accepted by these methods:
|
||||
Access tokens obtained from Gitea's [OAuth2 provider](development/oauth2-provider.md) are accepted by these methods:
|
||||
|
||||
- `Authorization bearer ...` header in HTTP headers
|
||||
- `token=...` parameter in URL query string
|
||||
|
||||
@@ -20,7 +20,7 @@ menu:
|
||||
## 开启/配置 API 访问
|
||||
|
||||
通常情况下, `ENABLE_SWAGGER` 默认开启并且参数 `MAX_RESPONSE_ITEMS` 默认为 50。您可以从 [Config Cheat
|
||||
Sheet](https://docs.gitea.io/en-us/config-cheat-sheet/) 中获取更多配置相关信息。
|
||||
Sheet](administration/config-cheat-sheet.md) 中获取更多配置相关信息。
|
||||
|
||||
## 通过 API 认证
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ For public clients, a redirect URI of a loopback IP address such as `http://127.
|
||||
|
||||
The `REDIRECT_URI` in the `access_token` request must match the `REDIRECT_URI` in the `authorize` request.
|
||||
|
||||
3. Use the `access_token` to make [API requests](https://docs.gitea.io/en-us/api-usage#oauth2) to access the user's resources.
|
||||
3. Use the `access_token` to make [API requests](development/api-usage.md#oauth2-provider) to access the user's resources.
|
||||
|
||||
### Public client (PKCE)
|
||||
|
||||
@@ -199,4 +199,4 @@ After you have generated this values, you can continue with your request.
|
||||
|
||||
The `REDIRECT_URI` in the `access_token` request must match the `REDIRECT_URI` in the `authorize` request.
|
||||
|
||||
3. Use the `access_token` to make [API requests](https://docs.gitea.io/en-us/api-usage#oauth2) to access the user's resources.
|
||||
3. Use the `access_token` to make [API requests](development/api-usage.md#oauth2-provider) to access the user's resources.
|
||||
|
||||
@@ -134,4 +134,4 @@ Gitea 支持私密和公共客户端类型,[参见 RFC 6749](https://datatrack
|
||||
|
||||
`access_token` 请求中的 `REDIRECT_URI` 必须与 `authorize` 请求中的 `REDIRECT_URI` 相符。
|
||||
|
||||
3. 使用 `access_token` 来构造 [API 请求](https://docs.gitea.io/en-us/api-usage#oauth2) 以读写用户的资源。
|
||||
3. 使用 `access_token` 来构造 [API 请求](development/api-usage.md#oauth2-provider) 以读写用户的资源。
|
||||
|
||||
@@ -93,4 +93,4 @@ Gitea 支援作為 OAuth2 提供者,能讓第三方程式能在使用者同意
|
||||
|
||||
`access_token` 請求中的 `REDIRECT_URI` 必須符合 `authorize` 請求中的 `REDIRECT_URI`。
|
||||
|
||||
1. 發送 [API requests](https://docs.gitea.io/en-us/api-usage#oauth2) 時使用 `access_token` 以存取使用者的資源。
|
||||
1. 發送 [API requests](development/api-usage.md#oauth2-provider) 時使用 `access_token` 以存取使用者的資源。
|
||||
|
||||
@@ -138,9 +138,9 @@ All Gitea instances have the built-in API and there is no way to disable it comp
|
||||
You can, however, disable showing its documentation by setting `ENABLE_SWAGGER` to `false` in the `api` section of your `app.ini`.
|
||||
For more information, refer to Gitea's [API docs](development/api-usage.md).
|
||||
|
||||
You can see the latest API (for example) on <https://try.gitea.io/api/swagger>.
|
||||
You can see the latest API (for example) on https://try.gitea.io/api/swagger
|
||||
|
||||
You can also see an example of the `swagger.json` file at <https://try.gitea.io/swagger.v1.json>.
|
||||
You can also see an example of the `swagger.json` file at https://try.gitea.io/swagger.v1.json
|
||||
|
||||
## Adjusting your server for public/private use
|
||||
|
||||
|
||||
@@ -142,9 +142,9 @@ Gitea不提供内置的Pages服务器。您需要一个专用的域名来提供
|
||||
但是,您可以在app.ini的api部分将ENABLE_SWAGGER设置为false,以禁用其文档显示。
|
||||
有关更多信息,请参阅Gitea的[API文档](development/api-usage.md)。
|
||||
|
||||
您可以在上查看最新的API(例如)<https://try.gitea.io/api/swagger>。
|
||||
您可以在上查看最新的API(例如)https://try.gitea.io/api/swagger
|
||||
|
||||
您还可以在上查看`swagger.json`文件的示例 <https://try.gitea.io/swagger.v1.json>。
|
||||
您还可以在上查看`swagger.json`文件的示例 https://try.gitea.io/swagger.v1.json
|
||||
|
||||
## 调整服务器用于公共/私有使用
|
||||
|
||||
|
||||
@@ -20,34 +20,59 @@ menu:
|
||||
- [Paid Commercial Support](https://about.gitea.com/)
|
||||
- [Discord](https://discord.gg/Gitea)
|
||||
- [Discourse Forum](https://discourse.gitea.io/)
|
||||
- [Matrix](https://matrix.to/#/#gitea-space:matrix.org)
|
||||
- NOTE: Most of the Matrix channels are bridged with their counterpart in Discord and may experience some degree of flakiness with the bridge process.
|
||||
- Chinese Support
|
||||
- [Discourse Chinese Category](https://discourse.gitea.io/c/5-category/5)
|
||||
- QQ Group 328432459
|
||||
|
||||
# Bug Report
|
||||
|
||||
If you found a bug, please [create an issue on GitHub](https://github.com/go-gitea/gitea/issues).
|
||||
|
||||
**NOTE:** When asking for support, it may be a good idea to have the following available so that the person helping has all the info they need:
|
||||
|
||||
1. Your `app.ini` (with any sensitive data scrubbed as necessary).
|
||||
2. The Gitea logs, and any other appropriate log files for the situation.
|
||||
- When using systemd, use `journalctl --lines 1000 --unit gitea` to collect logs.
|
||||
- When using docker, use `docker logs --tail 1000 <gitea-container>` to collect logs.
|
||||
- By default, the logs are outputted to console. If you need to collect logs from files,
|
||||
you could copy the following config into your `app.ini` (remove all other `[log]` sections),
|
||||
then you can find the `*.log` files in Gitea's log directory (default: `%(GITEA_WORK_DIR)/log`).
|
||||
|
||||
```ini
|
||||
; To show all SQL logs, you can also set LOG_SQL=true in the [database] section
|
||||
[log]
|
||||
LEVEL=debug
|
||||
MODE=console,file
|
||||
```
|
||||
|
||||
3. Any error messages you are seeing.
|
||||
4. When possible, try to replicate the issue on [try.gitea.io](https://try.gitea.io) and include steps so that others can reproduce the issue.
|
||||
- This will greatly improve the chance that the root of the issue can be quickly discovered and resolved.
|
||||
5. If you encounter slow/hanging/deadlock problems, please report the stack trace when the problem occurs.
|
||||
2. Any error messages you are seeing.
|
||||
3. The Gitea logs, and all other related logs for the situation.
|
||||
- It's more useful to collect `trace` / `debug` level logs (see the next section).
|
||||
- When using systemd, use `journalctl --lines 1000 --unit gitea` to collect logs.
|
||||
- When using docker, use `docker logs --tail 1000 <gitea-container>` to collect logs.
|
||||
4. Reproducible steps so that others could reproduce and understand the problem more quickly and easily.
|
||||
- [try.gitea.io](https://try.gitea.io) could be used to reproduce the problem.
|
||||
5. If you encounter slow/hanging/deadlock problems, please report the stacktrace when the problem occurs.
|
||||
Go to the "Site Admin" -> "Monitoring" -> "Stacktrace" -> "Download diagnosis report".
|
||||
|
||||
## Bugs
|
||||
# Advanced Bug Report Tips
|
||||
|
||||
If you found a bug, please create an [issue on GitHub](https://github.com/go-gitea/gitea/issues).
|
||||
## More Config Options for Logs
|
||||
|
||||
## Chinese Support
|
||||
By default, the logs are outputted to console with `info` level.
|
||||
If you need to set log level and/or collect logs from files,
|
||||
you could just copy the following config into your `app.ini` (remove all other `[log]` sections),
|
||||
then you will find the `*.log` files in Gitea's log directory (default: `%(GITEA_WORK_DIR)/log`).
|
||||
|
||||
Support for the Chinese language is provided at [Our discourse](https://discourse.gitea.io/c/5-category/5) or QQ Group 328432459.
|
||||
```ini
|
||||
; To show all SQL logs, you can also set LOG_SQL=true in the [database] section
|
||||
[log]
|
||||
LEVEL=debug
|
||||
MODE=console,file
|
||||
```
|
||||
|
||||
## Collecting Stacktrace by Command Line
|
||||
|
||||
Gitea could use Golang's pprof handler and toolchain to collect stacktrace and other runtime information.
|
||||
|
||||
If the web UI stops working, you could try to collect the stacktrace by command line:
|
||||
|
||||
1. Set `app.ini`:
|
||||
|
||||
```
|
||||
[server]
|
||||
ENABLE_PPROF = true
|
||||
```
|
||||
|
||||
2. Restart Gitea
|
||||
|
||||
3. Try to trigger the bug, when the requests get stuck for a while,
|
||||
use `curl` or browser to visit: `http://127.0.0.1:6060/debug/pprof/goroutine?debug=1` to get the stacktrace.
|
||||
|
||||
@@ -28,7 +28,7 @@ menu:
|
||||
3. 您看到的任何錯誤訊息
|
||||
4. 儘可能地在 [try.gitea.io](https://try.gitea.io) 觸發您的問題並記下步驟,以便其他人能重現那個問題。
|
||||
- 這將讓我們更有機會快速地找出問題的根源並解決它。
|
||||
5. 堆棧跟踪,[請參考英文文檔](https://docs.gitea.io/en-us/seek-help/)
|
||||
5. 堆棧跟踪,[請參考英文文檔](https://docs.gitea.com/help/support)
|
||||
|
||||
## 錯誤回報
|
||||
|
||||
|
||||
@@ -17,13 +17,13 @@ menu:
|
||||
|
||||
# Database Preparation
|
||||
|
||||
You need a database to use Gitea. Gitea supports PostgreSQL (>=10), MySQL (>=5.7), SQLite, and MSSQL (>=2008R2 SP3). This page will guide into preparing database. Only PostgreSQL and MySQL will be covered here since those database engines are widely-used in production. If you plan to use SQLite, you can ignore this chapter.
|
||||
You need a database to use Gitea. Gitea supports PostgreSQL (>=10), MySQL (>=5.7), MariaDB, SQLite, and MSSQL (>=2008R2 SP3). This page will guide into preparing database. Only PostgreSQL and MySQL will be covered here since those database engines are widely-used in production. If you plan to use SQLite, you can ignore this chapter.
|
||||
|
||||
Database instance can be on same machine as Gitea (local database setup), or on different machine (remote database).
|
||||
|
||||
Note: All steps below requires that the database engine of your choice is installed on your system. For remote database setup, install the server application on database instance and client program on your Gitea server. The client program is used to test connection to the database from Gitea server, while Gitea itself use database driver provided by Go to accomplish the same thing. In addition, make sure you use same engine version for both server and client for some engine features to work. For security reason, protect `root` (MySQL) or `postgres` (PostgreSQL) database superuser with secure password. The steps assumes that you run Linux for both database and Gitea servers.
|
||||
|
||||
## MySQL
|
||||
## MySQL/MariaDB
|
||||
|
||||
1. For remote database setup, you will need to make MySQL listen to your IP address. Edit `bind-address` option on `/etc/mysql/my.cnf` on database instance to:
|
||||
|
||||
@@ -45,7 +45,7 @@ Note: All steps below requires that the database engine of your choice is instal
|
||||
|
||||
```sql
|
||||
SET old_passwords=0;
|
||||
CREATE USER 'gitea' IDENTIFIED BY 'gitea';
|
||||
CREATE USER 'gitea'@'%' IDENTIFIED BY 'gitea';
|
||||
```
|
||||
|
||||
For remote database:
|
||||
|
||||
@@ -117,7 +117,7 @@ chmod 770 /etc/gitea
|
||||
- 使用 `gitea generate secret` 创建 `SECRET_KEY` 和 `INTERNAL_TOKEN`
|
||||
- 提供所有必要的密钥
|
||||
|
||||
详情参考 [命令行文档](/zh-cn/command-line/) 中有关 `gitea generate secret` 的内容。
|
||||
详情参考 [命令行文档](administration/command-line.md) 中有关 `gitea generate secret` 的内容。
|
||||
|
||||
### 配置 Gitea 工作路径
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ apk add gitea
|
||||
|
||||
## Arch Linux
|
||||
|
||||
The rolling release distribution has [Gitea](https://www.archlinux.org/packages/community/x86_64/gitea/) in their official community repository and package updates are provided with new Gitea releases.
|
||||
The rolling release distribution has [Gitea](https://www.archlinux.org/packages/extra/x86_64/gitea/) in their official extra repository and package updates are provided with new Gitea releases.
|
||||
|
||||
```sh
|
||||
pacman -S gitea
|
||||
|
||||
@@ -52,7 +52,7 @@ git checkout v@version@
|
||||
|
||||
- `go` @minGoVersion@ 或以上版本, 详见[这里](https://golang.google.cn/doc/install)
|
||||
- `node` @minNodeVersion@ 或以上版本,并且安装 `npm`, 详见[这里](https://nodejs.org/zh-cn/download/)
|
||||
- `make`, 详见[这里](/zh-cn/hacking-on-gitea/)
|
||||
- `make`, 详见[这里](development/hacking-on-gitea.md)
|
||||
|
||||
各种可用的 [make 任务](https://github.com/go-gitea/gitea/blob/main/Makefile)
|
||||
可以用来使编译过程更方便。
|
||||
|
||||
@@ -17,16 +17,20 @@ menu:
|
||||
|
||||
# Upgrade from an old Gitea
|
||||
|
||||
To update Gitea, download a newer version, stop the old one, perform a backup, and run the new one.
|
||||
Every time a Gitea instance starts up, it checks whether a database migration should be run.
|
||||
If a database migration is required, Gitea will take some time to complete the upgrade and then serve.
|
||||
Follow below steps to ensure a smooth upgrade to a new Gitea version.
|
||||
|
||||
## Check the Changelog for breaking changes
|
||||
|
||||
To make Gitea better, some breaking changes are unavoidable, especially for big milestone releases.
|
||||
Before upgrade, please read the [Changelog on Gitea blog](https://blog.gitea.io/)
|
||||
Before upgrading, please read the [Changelog on Gitea blog](https://blog.gitea.com/)
|
||||
and check whether the breaking changes affect your Gitea instance.
|
||||
|
||||
## Verify there are no deprecated configuration options
|
||||
|
||||
New versions of Gitea often come with changed configuration syntax or options which are usually displayed for
|
||||
at least one release cycle inside at the top of the Site Administration panel. If these warnings are not
|
||||
resolved, Gitea may refuse to start in the following version.
|
||||
|
||||
## Backup for downgrade
|
||||
|
||||
Gitea keeps compatibility for patch versions whose first two fields are the same (`a.b.x` -> `a.b.y`),
|
||||
@@ -60,6 +64,11 @@ Backup steps:
|
||||
If you are using cloud services or filesystems with snapshot feature,
|
||||
a snapshot for the Gitea data volume and related object storage is more convenient.
|
||||
|
||||
After all of steps have been prepared, download the new version, stop the application, perform a backup and
|
||||
then start the new application. On each startup, Gitea verifies that the database is up to date and will automtically
|
||||
perform any necessary migrations. Depending on the size of the database, this can take some additional time on the
|
||||
first launch during which the application will be unavailable.
|
||||
|
||||
## Upgrade with Docker
|
||||
|
||||
* `docker pull` the latest Gitea release.
|
||||
|
||||
@@ -15,16 +15,20 @@ menu:
|
||||
|
||||
# 从旧版 Gitea 升级
|
||||
|
||||
想要升级 Gitea,只需要下载新版,停止运行旧版,进行数据备份,然后运行新版就好。
|
||||
每次 Gitea 实例启动时,它都会检查是否要进行数据库迁移。
|
||||
如果需要进行数据库迁移,Gitea 会花一些时间完成升级然后继续服务。
|
||||
在升级之前,您需要做如下的准备工作。
|
||||
|
||||
## 为重大变更检查更新日志
|
||||
|
||||
为了让 Gitea 变得更好,进行重大变更是不可避免的,尤其是一些里程碑更新的发布。
|
||||
在更新前,请 [在 Gitea 博客上阅读更新日志](https://blog.gitea.io/)
|
||||
在更新前,请 [在 Gitea 博客上阅读更新日志](https://blog.gitea.com/)
|
||||
并检查重大变更是否会影响你的 Gitea 实例。
|
||||
|
||||
## 在控制面板中检查过期的配置项
|
||||
|
||||
一些配置项可能会在后续版本中过期,你需要在控制面板中检查他们。如果不解决过期的配置项,
|
||||
Gitea也许会在升级后无法重启。你可以访问 https://docs.gitea.com 获得要升级的版本
|
||||
对应的文档来修改你的配置文件。
|
||||
|
||||
## 降级前的备份
|
||||
|
||||
Gitea 会保留首二位版本号相同的版本的兼容性 (`a.b.x` -> `a.b.y`),
|
||||
@@ -56,6 +60,10 @@ Gitea 会保留首二位版本号相同的版本的兼容性 (`a.b.x` -> `a.b.y`
|
||||
如果你在使用云服务或拥有快照功能的文件系统,
|
||||
最好对 Gitea 的数据盘及相关资料存储进行一次快照。
|
||||
|
||||
在所有上述步骤准备妥当之后,要升级 Gitea,只需要下载新版,停止运行旧版,进行数据备份,然后运行新版就好。
|
||||
每次 Gitea 实例启动时,它都会检查是否要进行数据库迁移。
|
||||
如果需要进行数据库迁移,Gitea 会花一些时间完成升级然后继续服务。
|
||||
|
||||
## 从 Docker 升级
|
||||
|
||||
* `docker pull` 拉取 Gitea 的最新发布版。
|
||||
|
||||
@@ -254,7 +254,7 @@ documented above, please note that `db` must be used as the database hostname.
|
||||
|
||||
# Customization
|
||||
|
||||
Customization files described [here](https://docs.gitea.io/en-us/customizing-gitea/) should
|
||||
Customization files described [here](administration/customizing-gitea.md) should
|
||||
be placed in `/var/lib/gitea/custom` directory. If using host volumes, it's quite easy to access these
|
||||
files; for named volumes, this is done through another container or by direct access at
|
||||
`/var/lib/docker/volumes/gitea_gitea/_/var_lib_gitea`. The configuration file will be saved at
|
||||
@@ -313,7 +313,7 @@ services:
|
||||
- GITEA__mailer__PASSWD="""${GITEA__mailer__PASSWD:?GITEA__mailer__PASSWD not set}"""
|
||||
```
|
||||
|
||||
To set required TOKEN and SECRET values, consider using Gitea's built-in [generate utility functions](https://docs.gitea.io/en-us/command-line/#generate).
|
||||
To set required TOKEN and SECRET values, consider using Gitea's built-in [generate utility functions](administration/command-line.md#generate).
|
||||
|
||||
# SSH Container Passthrough
|
||||
|
||||
@@ -342,7 +342,7 @@ Once the wrapper is in place, you can make it the shell for the `git` user:
|
||||
sudo usermod -s /usr/local/bin/gitea-shell git
|
||||
```
|
||||
|
||||
Now that all the SSH commands are forwarded to the container, you need to set up the SSH authentication on the host. This is done by leveraging the [SSH AuthorizedKeysCommand](https://docs.gitea.io/en-us/command-line/#keys) to match the keys against those accepted by Gitea. Add the following block to `/etc/ssh/sshd_config`, on the host:
|
||||
Now that all the SSH commands are forwarded to the container, you need to set up the SSH authentication on the host. This is done by leveraging the [SSH AuthorizedKeysCommand](administration/command-line.md#keys) to match the keys against those accepted by Gitea. Add the following block to `/etc/ssh/sshd_config`, on the host:
|
||||
|
||||
```bash
|
||||
Match User git
|
||||
|
||||
@@ -281,7 +281,7 @@ services:
|
||||
- GITEA__mailer__PASSWD="""${GITEA__mailer__PASSWD:?GITEA__mailer__PASSWD not set}"""
|
||||
```
|
||||
|
||||
要设置所需的 TOKEN 和 SECRET 值,可以使用 Gitea 的内置[生成使用函数](https://docs.gitea.io/en-us/command-line/#generate).
|
||||
要设置所需的 TOKEN 和 SECRET 值,可以使用 Gitea 的内置[生成使用函数](administration/command-line.md#generate).
|
||||
|
||||
# SSH 容器透传
|
||||
|
||||
@@ -310,7 +310,7 @@ sudo chmod +x /usr/local/bin/gitea-shell
|
||||
sudo usermod -s /usr/local/bin/gitea-shell git
|
||||
```
|
||||
|
||||
现在,所有的 SSH 命令都会被转发到容器,您需要在主机上设置 SSH 认证。这可以通过利用 [SSH AuthorizedKeysCommand](https://docs.gitea.io/en-us/command-line/#keys) 来匹配 Gitea 接受的密钥。在主机的 `/etc/ssh/sshd_config` 文件中添加以下代码块:
|
||||
现在,所有的 SSH 命令都会被转发到容器,您需要在主机上设置 SSH 认证。这可以通过利用 [SSH AuthorizedKeysCommand](administration/command-line.md#keys) 来匹配 Gitea 接受的密钥。在主机的 `/etc/ssh/sshd_config` 文件中添加以下代码块:
|
||||
|
||||
```bash
|
||||
Match User git
|
||||
|
||||
@@ -261,7 +261,7 @@ documented above, please note that `db` must be used as the database hostname.
|
||||
|
||||
## Customization
|
||||
|
||||
Customization files described [here](https://docs.gitea.io/en-us/customizing-gitea/) should
|
||||
Customization files described [here](administration/customizing-gitea.md) should
|
||||
be placed in `/data/gitea` directory. If using host volumes, it's quite easy to access these
|
||||
files; for named volumes, this is done through another container or by direct access at
|
||||
`/var/lib/docker/volumes/gitea_gitea/_data`. The configuration file will be saved at
|
||||
@@ -309,7 +309,7 @@ services:
|
||||
- GITEA__mailer__PASSWD="""${GITEA__mailer__PASSWD:?GITEA__mailer__PASSWD not set}"""
|
||||
```
|
||||
|
||||
Gitea will generate new secrets/tokens for every new installation automatically and write them into the app.ini. If you want to set the secrets/tokens manually, you can use the following docker commands to use of Gitea's built-in [generate utility functions](https://docs.gitea.io/en-us/command-line/#generate). Do not lose/change your SECRET_KEY after the installation, otherwise the encrypted data can not be decrypted anymore.
|
||||
Gitea will generate new secrets/tokens for every new installation automatically and write them into the app.ini. If you want to set the secrets/tokens manually, you can use the following docker commands to use of Gitea's built-in [generate utility functions](administration/command-line.md#generate). Do not lose/change your SECRET_KEY after the installation, otherwise the encrypted data can not be decrypted anymore.
|
||||
|
||||
The following commands will output a new `SECRET_KEY` and `INTERNAL_TOKEN` to `stdout`, which you can then place in your environment variables.
|
||||
|
||||
@@ -553,7 +553,7 @@ In this option, the idea is that the host SSH uses an `AuthorizedKeysCommand` in
|
||||
|
||||
Now all attempts to login as the `git` user on the host will be forwarded to the docker - including the `SSH_ORIGINAL_COMMAND`. We now need to set-up SSH authentication on the host.
|
||||
|
||||
We will do this by leveraging the [SSH AuthorizedKeysCommand](https://docs.gitea.io/en-us/command-line/#keys) to match the keys against those accepted by Gitea.
|
||||
We will do this by leveraging the [SSH AuthorizedKeysCommand](administration/command-line.md#keys) to match the keys against those accepted by Gitea.
|
||||
|
||||
Add the following block to `/etc/ssh/sshd_config`, on the host:
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ Vous devriez maintenant avoir deux conteneurs Docker pour Gitea et PostgreSQL pl
|
||||
|
||||
# Personnalisation
|
||||
|
||||
Les fichier personnalisés ([voir les instructions](https://docs.gitea.io/en-us/customizing-gitea/)) peuvent être placés dans le répertoire `/data/gitea`.
|
||||
Les fichier personnalisés ([voir les instructions](administration/customizing-gitea.md)) peuvent être placés dans le répertoire `/data/gitea`.
|
||||
|
||||
Le fichier de configuration sera sauvegardé à l'emplacement suivant : `/data/gitea/conf/app.ini`
|
||||
|
||||
|
||||
@@ -260,7 +260,7 @@ MySQL 或 PostgreSQL 容器将需要分别创建。
|
||||
|
||||
## 自定义
|
||||
|
||||
[此处](https://docs.gitea.io/zh-cn/customizing-gitea/)描述的定制文件应放在 `/data/gitea` 目录中。如果使用主机卷,则访问这些文件非常容易;对于命名卷,可以通过另一个容器或通过直接访问 `/var/lib/docker/volumes/gitea_gitea/_data` 来完成。安装后,配置文件将保存在 `/data/gitea/conf/app.ini` 中。
|
||||
[此处](administration/customizing-gitea.md)描述的定制文件应放在 `/data/gitea` 目录中。如果使用主机卷,则访问这些文件非常容易;对于命名卷,可以通过另一个容器或通过直接访问 `/var/lib/docker/volumes/gitea_gitea/_data` 来完成。安装后,配置文件将保存在 `/data/gitea/conf/app.ini` 中。
|
||||
|
||||
## 升级
|
||||
|
||||
@@ -293,7 +293,7 @@ services:
|
||||
- GITEA__mailer__PASSWD="""${GITEA__mailer__PASSWD:?GITEA__mailer__PASSWD not set}"""
|
||||
```
|
||||
|
||||
Gitea 将为每次新安装自动生成新的 `SECRET_KEY` 并将它们写入 `app.ini`。 如果您想手动设置 `SECRET_KEY`,您可以使用以下 docker 命令来使用 Gitea 内置的[方法](https://docs.gitea.io/en-us/command-line/#generate)生成 `SECRET_KEY`。 安装后请妥善保管您的 `SECRET_KEY`,如若丢失则无法解密已加密的数据。
|
||||
Gitea 将为每次新安装自动生成新的 `SECRET_KEY` 并将它们写入 `app.ini`。 如果您想手动设置 `SECRET_KEY`,您可以使用以下 docker 命令来使用 Gitea 内置的[方法](administration/command-line.md#generate)生成 `SECRET_KEY`。 安装后请妥善保管您的 `SECRET_KEY`,如若丢失则无法解密已加密的数据。
|
||||
|
||||
以下命令将向 `stdout` 输出一个新的 `SECRET_KEY` 和 `INTERNAL_TOKEN`,然后您可以将其放入环境变量中。
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ docker run --entrypoint="" --rm -it gitea/act_runner:latest act_runner generate-
|
||||
When you are using the docker image, you can specify the configuration file by using the `CONFIG_FILE` environment variable. Make sure that the file is mounted into the container as a volume:
|
||||
|
||||
```bash
|
||||
docker run -v $(pwd)/config.yaml:/config.yaml -e CONFIG_FILE=/config.yaml ...
|
||||
docker run -v $PWD/config.yaml:/config.yaml -e CONFIG_FILE=/config.yaml ...
|
||||
```
|
||||
|
||||
You may notice the commands above are both incomplete, because it is not the time to run the act runner yet.
|
||||
@@ -157,8 +157,8 @@ If you are using the docker image, behaviour will be slightly different. Registr
|
||||
|
||||
```bash
|
||||
docker run \
|
||||
-v $(pwd)/config.yaml:/config.yaml \
|
||||
-v $(pwd)/data:/data \
|
||||
-v $PWD/config.yaml:/config.yaml \
|
||||
-v $PWD/data:/data \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-e CONFIG_FILE=/config.yaml \
|
||||
-e GITEA_INSTANCE_URL=<instance_url> \
|
||||
|
||||
@@ -112,7 +112,7 @@ You can configure your Gitea instance to fetch actions or images from your intra
|
||||
|
||||
In fact, your Gitea instance can serve as both the actions marketplace and the image registry.
|
||||
You can mirror actions repositories from GitHub to your Gitea instance, and use them as normal.
|
||||
And [Gitea Container Registry](https://docs.gitea.io/en-us/usage/packages/container/) can be used as a Docker image registry.
|
||||
And [Gitea Container Registry](usage/packages/container.md) can be used as a Docker image registry.
|
||||
|
||||
### Connection 4, job containers to internet
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ act runner 必须能够连接到Gitea以接收任务并发送执行结果回来
|
||||
|
||||
实际上,您的Gitea实例可以同时充当 Actions 市场和镜像注册表。
|
||||
您可以将GitHub上的Actions仓库镜像到您的Gitea实例,并将其用作普通Actions。
|
||||
而 [Gitea 容器注册表](https://docs.gitea.io/en-us/usage/packages/container/) 可用作Docker镜像注册表。
|
||||
而 [Gitea 容器注册表](usage/packages/container.md) 可用作Docker镜像注册表。
|
||||
|
||||
### 连接 4,Job容器到互联网
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ For example:
|
||||
Be careful, the `https://` or `http://` prefix is necessary!
|
||||
|
||||
Alternatively, if you want your runners to download actions from GitHub or your own Gitea instance by default, you can configure it by setting `[actions].DEFAULT_ACTIONS_URL`.
|
||||
See [Configuration Cheat Sheet](https://docs.gitea.io/en-us/config-cheat-sheet/#actions-actions).
|
||||
See [Configuration Cheat Sheet](administration/config-cheat-sheet.md#actions-actions).
|
||||
|
||||
This is one of the differences from GitHub Actions, but it should allow users much more flexibility in how they run Actions.
|
||||
|
||||
@@ -69,7 +69,7 @@ This is one of the differences from GitHub Actions, but it should allow users mu
|
||||
|
||||
Runners have no more permissions than simply connecting to your Gitea instance.
|
||||
When any runner receives a job to run, it will temporarily gain limited permission to the repository associated with the job.
|
||||
If you want to give more permissions to the runner, allowing it to access more private repositories or external systems, you can pass [secrets](https://docs.gitea.io/en-us/usage/secrets/) to it.
|
||||
If you want to give more permissions to the runner, allowing it to access more private repositories or external systems, you can pass [secrets](usage/secrets.md) to it.
|
||||
|
||||
Refined permission control to Actions is a complicated job.
|
||||
In the future, we will add more options to Gitea to make it more configurable, such as allowing more write access to repositories or read access to all repositories in the same organization.
|
||||
@@ -180,3 +180,6 @@ For events supported only by GitHub, see GitHub's [documentation](https://docs.g
|
||||
| pull_request_review_comment | `created`, `edited` |
|
||||
| release | `published`, `edited` |
|
||||
| registry_package | `published` |
|
||||
|
||||
> For `pull_request` events, in [GitHub Actions](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request), the `ref` is `refs/pull/:prNumber/merge`, which is a reference to the merge commit preview. However, Gitea has no such reference.
|
||||
> Therefore, the `ref` in Gitea Actions is `refs/pull/:prNumber/head`, which points to the head of pull request rather than the preview of the merge commit.
|
||||
|
||||
@@ -61,7 +61,7 @@ DEFAULT_REPO_UNITS = ...,repo.actions
|
||||
注意,`https://`或`http://`前缀是必需的!
|
||||
|
||||
另外,如果您希望您的Runner默认从GitHub或您自己的Gitea实例下载Actions,可以通过设置 `[actions].DEFAULT_ACTIONS_URL`进行配置。
|
||||
参见[配置速查表](https://docs.gitea.io/en-us/config-cheat-sheet/#actions-actions)。
|
||||
参见[配置速查表](administration/config-cheat-sheet.md#actions-actions)。
|
||||
|
||||
这是与GitHub Actions的一个区别,但它应该允许用户以更灵活的方式运行Actions。
|
||||
|
||||
@@ -69,7 +69,7 @@ DEFAULT_REPO_UNITS = ...,repo.actions
|
||||
|
||||
Runner仅具有连接到您的Gitea实例的权限。
|
||||
当任何Runner接收到要运行的Job时,它将临时获得与Job关联的仓库的有限权限。
|
||||
如果您想为Runner提供更多权限,允许它访问更多私有仓库或外部系统,您可以向其传递[密钥](https://docs.gitea.io/en-us/usage/secrets/)。
|
||||
如果您想为Runner提供更多权限,允许它访问更多私有仓库或外部系统,您可以向其传递[密钥](usage/secrets.md)。
|
||||
|
||||
对于 Actions 的细粒度权限控制是一项复杂的工作。
|
||||
在未来,我们将添加更多选项以使Gitea更可配置,例如允许对仓库进行更多写访问或对同一组织中的所有仓库进行读访问。
|
||||
@@ -180,3 +180,6 @@ defaults:
|
||||
| pull_request_review_comment | `created`, `edited` |
|
||||
| release | `published`, `edited` |
|
||||
| registry_package | `published` |
|
||||
|
||||
> 对于 `pull_request` 事件,在 [GitHub Actions](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request) 中 `ref` 是 `refs/pull/:prNumber/merge`,它指向这个拉取请求合并提交的一个预览。但是 Gitea 没有这种 reference。
|
||||
> 因此,Gitea Actions 中 `ref` 是 `refs/pull/:prNumber/head`,它指向这个拉取请求的头分支而不是合并提交的预览。
|
||||
|
||||
@@ -123,7 +123,7 @@ jobs:
|
||||
|
||||
请注意,演示文件中包含一些表情符号。
|
||||
请确保您的数据库支持它们,特别是在使用MySQL时。
|
||||
如果字符集不是`utf8mb4,将出现错误,例如`Error 1366 (HY000): Incorrect string value: '\\xF0\\x9F\\x8E\\x89 T...' for column 'name' at row 1`。
|
||||
如果字符集不是`utf8mb4`,将出现错误,例如`Error 1366 (HY000): Incorrect string value: '\\xF0\\x9F\\x8E\\x89 T...' for column 'name' at row 1`。
|
||||
有关更多信息,请参阅[数据库准备工作](installation/database-preparation.md#mysql)。
|
||||
|
||||
或者,您可以从演示文件中删除所有表情符号,然后再尝试一次。
|
||||
|
||||
@@ -21,8 +21,8 @@ In Gitea `1.13`, support for [agit](https://git-repo.info/en/2020/03/agit-flow-a
|
||||
|
||||
## Creating PRs with Agit
|
||||
|
||||
Agit allows to create PRs while pushing code to the remote repo. \
|
||||
This can be done by pushing to the branch followed by a specific refspec (a location identifier known to git). \
|
||||
Agit allows to create PRs while pushing code to the remote repo.
|
||||
This can be done by pushing to the branch followed by a specific refspec (a location identifier known to git).
|
||||
The following example illustrates this:
|
||||
|
||||
```shell
|
||||
|
||||
@@ -157,12 +157,13 @@ Uses the following fields:
|
||||
|
||||
- User Attribute in Group (optional)
|
||||
|
||||
- Which user LDAP attribute is listed in the group.
|
||||
- Example: `uid`
|
||||
- The user attribute that is used to reference a user in the group object.
|
||||
- Example: `uid` if the group objects contains a `member: bender` and the user object contains a `uid: bender`.
|
||||
- Example: `dn` if the group object contains a `member: uid=bender,ou=users,dc=planetexpress,dc=com`.
|
||||
|
||||
- Group Attribute for User (optional)
|
||||
- Which group LDAP attribute contains an array above user attribute names.
|
||||
- Example: `memberUid`
|
||||
- The attribute of the group object that lists/contains the group members.
|
||||
- Example: `memberUid` or `member`
|
||||
|
||||
## PAM (Pluggable Authentication Module)
|
||||
|
||||
@@ -197,7 +198,7 @@ administrative user.
|
||||
field is set to `mail.com`, then Gitea will expect the `user email` field
|
||||
for an authenticated GIT instance to be `gituser@mail.com`.[^2]
|
||||
|
||||
**Note**: PAM support is added via [build-time flags](https://docs.gitea.io/en-us/install-from-source/#build),
|
||||
**Note**: PAM support is added via [build-time flags](installation/from-source.md#build),
|
||||
and the official binaries provided do not have this enabled. PAM requires that
|
||||
the necessary libpam dynamic library be available and the necessary PAM
|
||||
development headers be accessible to the compiler.
|
||||
|
||||
@@ -27,7 +27,7 @@ menu:
|
||||
|
||||
标签具有必填的名称和颜色,可选的描述,以及必须是独占的或非独占的(见下面的“作用域标签”)。
|
||||
|
||||
当您创建一个仓库时,可以通过使用 `工单标签(Issue Labels)` 选项来选择标签集。该选项列出了一些在您的实例上 [全局配置的可用标签集](../administration/customizing-gitea/#labels)。在创建仓库时,这些标签也将被创建。
|
||||
当您创建一个仓库时,可以通过使用 `工单标签(Issue Labels)` 选项来选择标签集。该选项列出了一些在您的实例上 [全局配置的可用标签集](administration/customizing-gitea.md#labels)。在创建仓库时,这些标签也将被创建。
|
||||
|
||||
## 作用域标签
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ Sometimes a commit or pull request may fix or bring back a problem documented
|
||||
in a particular issue. Gitea supports closing and reopening the referenced
|
||||
issues by preceding the reference with a particular _keyword_. Common keywords
|
||||
include "closes", "fixes", "reopens", etc. This list can be
|
||||
[customized]({{< ref "doc/administration/config-cheat-sheet.en-us.md" >}}) by the
|
||||
[customized](administration/config-cheat-sheet.md) by the
|
||||
site administrator.
|
||||
|
||||
Example:
|
||||
|
||||
@@ -66,7 +66,7 @@ menu:
|
||||
|
||||
## 可操作的引用在合并请求和提交消息中
|
||||
|
||||
有时,一个提交或合并请求可能会修复或重新出现在某个特定工单中。Gitea 支持在引用之前加上特定的“关键字”来关闭和重新打开被引用的工单。常见的关键字包括“closes”、“fixes”、“reopens”等。这个列表可以由站点管理员进行 [自定义]({{< ref "doc/administration/config-cheat-sheet.zh-cn.md" >}})。
|
||||
有时,一个提交或合并请求可能会修复或重新出现在某个特定工单中。Gitea 支持在引用之前加上特定的“关键字”来关闭和重新打开被引用的工单。常见的关键字包括“closes”、“fixes”、“reopens”等。这个列表可以由站点管理员进行 [自定义](administration/config-cheat-sheet.md)。
|
||||
|
||||
示例:
|
||||
|
||||
|
||||
35
docs/content/usage/multi-factor-authentication.en-us.md
Normal file
35
docs/content/usage/multi-factor-authentication.en-us.md
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
date: "2023-08-22T14:21:00+08:00"
|
||||
title: "Multi-factor Authentication (MFA)"
|
||||
slug: "multi-factor-authentication"
|
||||
weight: 15
|
||||
toc: false
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "usage"
|
||||
name: "Multi-factor Authentication (MFA)"
|
||||
weight: 15
|
||||
identifier: "multi-factor-authentication"
|
||||
---
|
||||
|
||||
# Multi-factor Authentication (MFA)
|
||||
|
||||
Multi-factor Authentication (also referred to as MFA or 2FA) enhances security by requiring a time-sensitive set of credentials in addition to a password.
|
||||
If a password were later to be compromised, logging into Gitea will not be possible without the additional credentials and the account would remain secure.
|
||||
Gitea supports both TOTP (Time-based One-Time Password) tokens and FIDO-based hardware keys using the Webauthn API.
|
||||
|
||||
MFA can be configured within the "Security" tab of the user settings page.
|
||||
|
||||
## MFA Considerations
|
||||
|
||||
Enabling MFA on a user does affect how the Git HTTP protocol can be used with the Git CLI.
|
||||
This interface does not support MFA, and trying to use a password normally will no longer be possible whilst MFA is enabled.
|
||||
If SSH is not an option for Git operations, an access token can be generated within the "Applications" tab of the user settings page.
|
||||
This access token can be used as if it were a password in order to allow the Git CLI to function over HTTP.
|
||||
|
||||
> **Warning** - By its very nature, an access token sidesteps the security benefits of MFA.
|
||||
> It must be kept secure and should only be used as a last resort.
|
||||
|
||||
The Gitea API supports providing the relevant TOTP password in the `X-Gitea-OTP` header, as described in [API Usage](development/api-usage.md).
|
||||
This should be used instead of an access token where possible.
|
||||
@@ -66,4 +66,4 @@ The first value of the list will be used in helpers.
|
||||
|
||||
## Pull Request Templates
|
||||
|
||||
You can find more information about pull request templates at the page [Issue and Pull Request templates](issue-pull-request-templates).
|
||||
You can find more information about pull request templates at the page [Issue and Pull Request templates](usage/issue-pull-request-templates.md).
|
||||
|
||||
@@ -30,4 +30,4 @@ WORK_IN_PROGRESS_PREFIXES=WIP:,[WIP]
|
||||
|
||||
## 合并请求模板
|
||||
|
||||
有关合并请求模板的更多信息请您移步 : [工单与合并请求模板](issue-pull-request-templates)
|
||||
有关合并请求模板的更多信息请您移步 : [工单与合并请求模板](usage/issue-pull-request-templates.md)
|
||||
|
||||
@@ -31,4 +31,4 @@ WORK_IN_PROGRESS_PREFIXES=WIP:,[WIP]
|
||||
|
||||
## 合併請求範本
|
||||
|
||||
您可以在[問題與合併請求範本](issue-pull-request-templates)找到更多關於合併請求範本的資訊。
|
||||
您可以在[問題與合併請求範本](usage/issue-pull-request-templates.md)找到更多關於合併請求範本的資訊。
|
||||
|
||||
2
go.mod
2
go.mod
@@ -109,7 +109,7 @@ require (
|
||||
github.com/yuin/goldmark-meta v1.1.0
|
||||
golang.org/x/crypto v0.11.0
|
||||
golang.org/x/image v0.7.0
|
||||
golang.org/x/net v0.12.0
|
||||
golang.org/x/net v0.13.0
|
||||
golang.org/x/oauth2 v0.8.0
|
||||
golang.org/x/sys v0.10.0
|
||||
golang.org/x/text v0.11.0
|
||||
|
||||
4
go.sum
4
go.sum
@@ -1269,8 +1269,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
||||
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
|
||||
golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50=
|
||||
golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
|
||||
golang.org/x/net v0.13.0 h1:Nvo8UFsZ8X3BhAC9699Z1j7XQ3rsZnUUm7jfBEk1ueY=
|
||||
golang.org/x/net v0.13.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
|
||||
8
main.go
8
main.go
@@ -146,11 +146,13 @@ func main() {
|
||||
app.Commands = append(app.Commands, subCmdWithIni...)
|
||||
app.Commands = append(app.Commands, subCmdStandalone...)
|
||||
|
||||
err := app.Run(os.Args)
|
||||
if err != nil {
|
||||
_, _ = fmt.Fprintf(app.Writer, "\nFailed to run with %s: %v\n", os.Args, err)
|
||||
cli.OsExiter = func(code int) {
|
||||
log.GetManager().Close()
|
||||
os.Exit(code)
|
||||
}
|
||||
app.ErrWriter = os.Stderr
|
||||
|
||||
_ = cmd.RunMainApp(app, os.Args...) // all errors should have been handled by the RunMainApp
|
||||
log.GetManager().Close()
|
||||
}
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@ func CreateTaskForRunner(ctx context.Context, runner *ActionRunner) (*ActionTask
|
||||
if gots, err := jobparser.Parse(job.WorkflowPayload); err != nil {
|
||||
return nil, false, fmt.Errorf("parse workflow of job %d: %w", job.ID, err)
|
||||
} else if len(gots) != 1 {
|
||||
return nil, false, fmt.Errorf("workflow of job %d: not signle workflow", job.ID)
|
||||
return nil, false, fmt.Errorf("workflow of job %d: not single workflow", job.ID)
|
||||
} else {
|
||||
_, workflowJob = gots[0].Job()
|
||||
}
|
||||
|
||||
@@ -20,6 +20,10 @@ type ActionTaskOutput struct {
|
||||
OutputValue string `xorm:"MEDIUMTEXT"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
db.RegisterModel(new(ActionTaskOutput))
|
||||
}
|
||||
|
||||
// FindTaskOutputByTaskID returns the outputs of the task.
|
||||
func FindTaskOutputByTaskID(ctx context.Context, taskID int64) ([]*ActionTaskOutput, error) {
|
||||
var outputs []*ActionTaskOutput
|
||||
|
||||
@@ -685,18 +685,34 @@ func NotifyWatchersActions(acts []*Action) error {
|
||||
}
|
||||
|
||||
// DeleteIssueActions delete all actions related with issueID
|
||||
func DeleteIssueActions(ctx context.Context, repoID, issueID int64) error {
|
||||
func DeleteIssueActions(ctx context.Context, repoID, issueID, issueIndex int64) error {
|
||||
// delete actions assigned to this issue
|
||||
subQuery := builder.Select("`id`").
|
||||
From("`comment`").
|
||||
Where(builder.Eq{"`issue_id`": issueID})
|
||||
if _, err := db.GetEngine(ctx).In("comment_id", subQuery).Delete(&Action{}); err != nil {
|
||||
return err
|
||||
e := db.GetEngine(ctx)
|
||||
|
||||
// MariaDB has a performance bug: https://jira.mariadb.org/browse/MDEV-16289
|
||||
// so here it uses "DELETE ... WHERE IN" with pre-queried IDs.
|
||||
var lastCommentID int64
|
||||
commentIDs := make([]int64, 0, db.DefaultMaxInSize)
|
||||
for {
|
||||
commentIDs = commentIDs[:0]
|
||||
err := e.Select("`id`").Table(&issues_model.Comment{}).
|
||||
Where(builder.Eq{"issue_id": issueID}).And("`id` > ?", lastCommentID).
|
||||
OrderBy("`id`").Limit(db.DefaultMaxInSize).
|
||||
Find(&commentIDs)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if len(commentIDs) == 0 {
|
||||
break
|
||||
} else if _, err = db.GetEngine(ctx).In("comment_id", commentIDs).Delete(&Action{}); err != nil {
|
||||
return err
|
||||
} else {
|
||||
lastCommentID = commentIDs[len(commentIDs)-1]
|
||||
}
|
||||
}
|
||||
|
||||
_, err := db.GetEngine(ctx).Table("action").Where("repo_id = ?", repoID).
|
||||
_, err := e.Where("repo_id = ?", repoID).
|
||||
In("op_type", ActionCreateIssue, ActionCreatePullRequest).
|
||||
Where("content LIKE ?", strconv.FormatInt(issueID, 10)+"|%").
|
||||
Where("content LIKE ?", strconv.FormatInt(issueIndex, 10)+"|%"). // "IssueIndex|content..."
|
||||
Delete(&Action{})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package activities_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
@@ -284,3 +285,36 @@ func TestConsistencyUpdateAction(t *testing.T) {
|
||||
assert.NoError(t, db.GetEngine(db.DefaultContext).Where("id = ?", id).Find(&actions))
|
||||
unittest.CheckConsistencyFor(t, &activities_model.Action{})
|
||||
}
|
||||
|
||||
func TestDeleteIssueActions(t *testing.T) {
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
// load an issue
|
||||
issue := unittest.AssertExistsAndLoadBean(t, &issue_model.Issue{ID: 4})
|
||||
assert.NotEqualValues(t, issue.ID, issue.Index) // it needs to use different ID/Index to test the DeleteIssueActions to delete some actions by IssueIndex
|
||||
|
||||
// insert a comment
|
||||
err := db.Insert(db.DefaultContext, &issue_model.Comment{Type: issue_model.CommentTypeComment, IssueID: issue.ID})
|
||||
assert.NoError(t, err)
|
||||
comment := unittest.AssertExistsAndLoadBean(t, &issue_model.Comment{Type: issue_model.CommentTypeComment, IssueID: issue.ID})
|
||||
|
||||
// truncate action table and insert some actions
|
||||
err = db.TruncateBeans(db.DefaultContext, &activities_model.Action{})
|
||||
assert.NoError(t, err)
|
||||
err = db.Insert(db.DefaultContext, &activities_model.Action{
|
||||
OpType: activities_model.ActionCommentIssue,
|
||||
CommentID: comment.ID,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
err = db.Insert(db.DefaultContext, &activities_model.Action{
|
||||
OpType: activities_model.ActionCreateIssue,
|
||||
RepoID: issue.RepoID,
|
||||
Content: fmt.Sprintf("%d|content...", issue.Index),
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
|
||||
// assert that the actions exist, then delete them
|
||||
unittest.AssertCount(t, &activities_model.Action{}, 2)
|
||||
assert.NoError(t, activities_model.DeleteIssueActions(db.DefaultContext, issue.RepoID, issue.ID, issue.Index))
|
||||
unittest.AssertCount(t, &activities_model.Action{}, 0)
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ func createIssueNotification(ctx context.Context, userID int64, issue *issues_mo
|
||||
}
|
||||
|
||||
func updateIssueNotification(ctx context.Context, userID, issueID, commentID, updatedByID int64) error {
|
||||
notification, err := getIssueNotification(ctx, userID, issueID)
|
||||
notification, err := GetIssueNotification(ctx, userID, issueID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -331,7 +331,8 @@ func updateIssueNotification(ctx context.Context, userID, issueID, commentID, up
|
||||
return err
|
||||
}
|
||||
|
||||
func getIssueNotification(ctx context.Context, userID, issueID int64) (*Notification, error) {
|
||||
// GetIssueNotification return the notification about an issue
|
||||
func GetIssueNotification(ctx context.Context, userID, issueID int64) (*Notification, error) {
|
||||
notification := new(Notification)
|
||||
_, err := db.GetEngine(ctx).
|
||||
Where("user_id = ?", userID).
|
||||
@@ -742,7 +743,7 @@ func GetUIDsAndNotificationCounts(since, until timeutil.TimeStamp) ([]UserIDCoun
|
||||
|
||||
// SetIssueReadBy sets issue to be read by given user.
|
||||
func SetIssueReadBy(ctx context.Context, issueID, userID int64) error {
|
||||
if err := issues_model.UpdateIssueUserByRead(userID, issueID); err != nil {
|
||||
if err := issues_model.UpdateIssueUserByRead(ctx, userID, issueID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -750,7 +751,7 @@ func SetIssueReadBy(ctx context.Context, issueID, userID int64) error {
|
||||
}
|
||||
|
||||
func setIssueNotificationStatusReadIfUnread(ctx context.Context, userID, issueID int64) error {
|
||||
notification, err := getIssueNotification(ctx, userID, issueID)
|
||||
notification, err := GetIssueNotification(ctx, userID, issueID)
|
||||
// ignore if not exists
|
||||
if err != nil {
|
||||
return nil
|
||||
@@ -762,7 +763,7 @@ func setIssueNotificationStatusReadIfUnread(ctx context.Context, userID, issueID
|
||||
|
||||
notification.Status = NotificationStatusRead
|
||||
|
||||
_, err = db.GetEngine(ctx).ID(notification.ID).Update(notification)
|
||||
_, err = db.GetEngine(ctx).ID(notification.ID).Cols("status").Update(notification)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package activities_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
activities_model "code.gitea.io/gitea/models/activities"
|
||||
@@ -109,3 +110,16 @@ func TestUpdateNotificationStatuses(t *testing.T) {
|
||||
unittest.AssertExistsAndLoadBean(t,
|
||||
&activities_model.Notification{ID: notfPinned.ID, Status: activities_model.NotificationStatusPinned})
|
||||
}
|
||||
|
||||
func TestSetIssueReadBy(t *testing.T) {
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1})
|
||||
issue := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{ID: 1})
|
||||
assert.NoError(t, db.WithTx(db.DefaultContext, func(ctx context.Context) error {
|
||||
return activities_model.SetIssueReadBy(ctx, issue.ID, user.ID)
|
||||
}))
|
||||
|
||||
nt, err := activities_model.GetIssueNotification(db.DefaultContext, user.ID, issue.ID)
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, activities_model.NotificationStatusRead, nt.Status)
|
||||
}
|
||||
|
||||
@@ -342,7 +342,7 @@ func (stats *ActivityStats) FillReleases(repoID int64, fromTime time.Time) error
|
||||
|
||||
// Published releases list
|
||||
sess := releasesForActivityStatement(repoID, fromTime)
|
||||
sess.OrderBy("release.created_unix DESC")
|
||||
sess.OrderBy("`release`.created_unix DESC")
|
||||
stats.PublishedReleases = make([]*repo_model.Release, 0)
|
||||
if err = sess.Find(&stats.PublishedReleases); err != nil {
|
||||
return err
|
||||
@@ -350,7 +350,7 @@ func (stats *ActivityStats) FillReleases(repoID int64, fromTime time.Time) error
|
||||
|
||||
// Published releases authors
|
||||
sess = releasesForActivityStatement(repoID, fromTime)
|
||||
if _, err = sess.Select("count(distinct release.publisher_id) as `count`").Table("release").Get(&count); err != nil {
|
||||
if _, err = sess.Select("count(distinct `release`.publisher_id) as `count`").Table("release").Get(&count); err != nil {
|
||||
return err
|
||||
}
|
||||
stats.PublishedReleaseAuthorCount = count
|
||||
@@ -359,7 +359,7 @@ func (stats *ActivityStats) FillReleases(repoID int64, fromTime time.Time) error
|
||||
}
|
||||
|
||||
func releasesForActivityStatement(repoID int64, fromTime time.Time) *xorm.Session {
|
||||
return db.GetEngine(db.DefaultContext).Where("release.repo_id = ?", repoID).
|
||||
And("release.is_draft = ?", false).
|
||||
And("release.created_unix >= ?", fromTime.Unix())
|
||||
return db.GetEngine(db.DefaultContext).Where("`release`.repo_id = ?", repoID).
|
||||
And("`release`.is_draft = ?", false).
|
||||
And("`release`.created_unix >= ?", fromTime.Unix())
|
||||
}
|
||||
|
||||
@@ -93,9 +93,9 @@ func CountUserGPGKeys(userID int64) (int64, error) {
|
||||
}
|
||||
|
||||
// GetGPGKeyByID returns public key by given ID.
|
||||
func GetGPGKeyByID(keyID int64) (*GPGKey, error) {
|
||||
func GetGPGKeyForUserByID(ownerID, keyID int64) (*GPGKey, error) {
|
||||
key := new(GPGKey)
|
||||
has, err := db.GetEngine(db.DefaultContext).ID(keyID).Get(key)
|
||||
has, err := db.GetEngine(db.DefaultContext).Where("id=? AND owner_id=?", keyID, ownerID).Get(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !has {
|
||||
@@ -225,7 +225,7 @@ func deleteGPGKey(ctx context.Context, keyID string) (int64, error) {
|
||||
|
||||
// DeleteGPGKey deletes GPG key information in database.
|
||||
func DeleteGPGKey(doer *user_model.User, id int64) (err error) {
|
||||
key, err := GetGPGKeyByID(id)
|
||||
key, err := GetGPGKeyForUserByID(doer.ID, id)
|
||||
if err != nil {
|
||||
if IsErrGPGKeyNotExist(err) {
|
||||
return nil
|
||||
@@ -233,11 +233,6 @@ func DeleteGPGKey(doer *user_model.User, id int64) (err error) {
|
||||
return fmt.Errorf("GetPublicKeyByID: %w", err)
|
||||
}
|
||||
|
||||
// Check if user has access to delete this key.
|
||||
if !doer.IsAdmin && doer.ID != key.OwnerID {
|
||||
return ErrGPGKeyAccessDenied{doer.ID, key.ID}
|
||||
}
|
||||
|
||||
ctx, committer, err := db.TxContext(db.DefaultContext)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -53,6 +53,15 @@ func (app *OAuth2Application) TableName() string {
|
||||
|
||||
// ContainsRedirectURI checks if redirectURI is allowed for app
|
||||
func (app *OAuth2Application) ContainsRedirectURI(redirectURI string) bool {
|
||||
contains := func(s string) bool {
|
||||
s = strings.TrimSuffix(strings.ToLower(s), "/")
|
||||
for _, u := range app.RedirectURIs {
|
||||
if strings.TrimSuffix(strings.ToLower(u), "/") == s {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
if !app.ConfidentialClient {
|
||||
uri, err := url.Parse(redirectURI)
|
||||
// ignore port for http loopback uris following https://datatracker.ietf.org/doc/html/rfc8252#section-7.3
|
||||
@@ -61,13 +70,13 @@ func (app *OAuth2Application) ContainsRedirectURI(redirectURI string) bool {
|
||||
if ip != nil && ip.IsLoopback() {
|
||||
// strip port
|
||||
uri.Host = uri.Hostname()
|
||||
if util.SliceContainsString(app.RedirectURIs, uri.String(), true) {
|
||||
if contains(uri.String()) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return util.SliceContainsString(app.RedirectURIs, redirectURI, true)
|
||||
return contains(redirectURI)
|
||||
}
|
||||
|
||||
// Base32 characters, but lowercased.
|
||||
|
||||
@@ -63,6 +63,18 @@ func TestOAuth2Application_ContainsRedirectURI_WithPort(t *testing.T) {
|
||||
assert.False(t, app.ContainsRedirectURI(":"))
|
||||
}
|
||||
|
||||
func TestOAuth2Application_ContainsRedirect_Slash(t *testing.T) {
|
||||
app := &auth_model.OAuth2Application{RedirectURIs: []string{"http://127.0.0.1"}}
|
||||
assert.True(t, app.ContainsRedirectURI("http://127.0.0.1"))
|
||||
assert.True(t, app.ContainsRedirectURI("http://127.0.0.1/"))
|
||||
assert.False(t, app.ContainsRedirectURI("http://127.0.0.1/other"))
|
||||
|
||||
app = &auth_model.OAuth2Application{RedirectURIs: []string{"http://127.0.0.1/"}}
|
||||
assert.True(t, app.ContainsRedirectURI("http://127.0.0.1"))
|
||||
assert.True(t, app.ContainsRedirectURI("http://127.0.0.1/"))
|
||||
assert.False(t, app.ContainsRedirectURI("http://127.0.0.1/other"))
|
||||
}
|
||||
|
||||
func TestOAuth2Application_ValidateClientSecret(t *testing.T) {
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
app := unittest.AssertExistsAndLoadBean(t, &auth_model.OAuth2Application{ID: 1})
|
||||
|
||||
@@ -232,7 +232,7 @@ func CreateSource(source *Source) error {
|
||||
err = registerableSource.RegisterSource()
|
||||
if err != nil {
|
||||
// remove the AuthSource in case of errors while registering configuration
|
||||
if _, err := db.GetEngine(db.DefaultContext).Delete(source); err != nil {
|
||||
if _, err := db.GetEngine(db.DefaultContext).ID(source.ID).Delete(new(Source)); err != nil {
|
||||
log.Error("CreateSource: Error while wrapOpenIDConnectInitializeError: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,12 @@ func generateEmailAvatarLink(ctx context.Context, email string, size int, final
|
||||
return DefaultAvatarLink()
|
||||
}
|
||||
|
||||
enableFederatedAvatar := system_model.GetSettingWithCacheBool(ctx, system_model.KeyPictureEnableFederatedAvatar)
|
||||
disableGravatar := system_model.GetSettingWithCacheBool(ctx, system_model.KeyPictureDisableGravatar,
|
||||
setting.GetDefaultDisableGravatar(),
|
||||
)
|
||||
|
||||
enableFederatedAvatar := system_model.GetSettingWithCacheBool(ctx, system_model.KeyPictureEnableFederatedAvatar,
|
||||
setting.GetDefaultEnableFederatedAvatar(disableGravatar))
|
||||
|
||||
var err error
|
||||
if enableFederatedAvatar && system_model.LibravatarService != nil {
|
||||
@@ -174,7 +179,6 @@ func generateEmailAvatarLink(ctx context.Context, email string, size int, final
|
||||
return urlStr
|
||||
}
|
||||
|
||||
disableGravatar := system_model.GetSettingWithCacheBool(ctx, system_model.KeyPictureDisableGravatar)
|
||||
if !disableGravatar {
|
||||
// copy GravatarSourceURL, because we will modify its Path.
|
||||
avatarURLCopy := *system_model.GravatarSourceURL
|
||||
|
||||
@@ -20,3 +20,19 @@ func BuildCaseInsensitiveLike(key, value string) builder.Cond {
|
||||
}
|
||||
return builder.Like{"UPPER(" + key + ")", strings.ToUpper(value)}
|
||||
}
|
||||
|
||||
// BuilderDialect returns the xorm.Builder dialect of the engine
|
||||
func BuilderDialect() string {
|
||||
switch {
|
||||
case setting.Database.Type.IsMySQL():
|
||||
return builder.MYSQL
|
||||
case setting.Database.Type.IsSQLite3():
|
||||
return builder.SQLITE
|
||||
case setting.Database.Type.IsPostgreSQL():
|
||||
return builder.POSTGRES
|
||||
case setting.Database.Type.IsMSSQL():
|
||||
return builder.MSSQL
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,3 +140,16 @@
|
||||
download_count: 0
|
||||
size: 0
|
||||
created_unix: 946684800
|
||||
|
||||
-
|
||||
id: 12
|
||||
uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a22
|
||||
repo_id: 2
|
||||
issue_id: 0
|
||||
release_id: 11
|
||||
uploader_id: 2
|
||||
comment_id: 0
|
||||
name: README.md
|
||||
download_count: 0
|
||||
size: 0
|
||||
created_unix: 946684800
|
||||
|
||||
@@ -66,3 +66,12 @@
|
||||
tree_path: "README.md"
|
||||
created_unix: 946684812
|
||||
invalidated: true
|
||||
|
||||
-
|
||||
id: 8
|
||||
type: 0 # comment
|
||||
poster_id: 2
|
||||
issue_id: 4 # in repo_id 2
|
||||
content: "comment in private pository"
|
||||
created_unix: 946684811
|
||||
updated_unix: 946684811
|
||||
|
||||
@@ -276,4 +276,12 @@
|
||||
email: user2-2@example.com
|
||||
lower_email: user2-2@example.com
|
||||
is_activated: false
|
||||
is_primary: false
|
||||
is_primary: false
|
||||
|
||||
-
|
||||
id: 36
|
||||
uid: 36
|
||||
email: abcde@gitea.com
|
||||
lower_email: abcde@gitea.com
|
||||
is_activated: true
|
||||
is_primary: false
|
||||
|
||||
@@ -1 +1,23 @@
|
||||
[] # empty
|
||||
-
|
||||
id: 5
|
||||
owner_id: 36
|
||||
key_id: B15431642629B826
|
||||
primary_key_id:
|
||||
content: xsDNBGTrY3UBDAC2HLBqmMplAV15qSnC7g1c4dV406f5EHNhFr95Nup2My6b2eafTlvedv77s8PT/I7F3fy4apOZs5A7w2SsPlLMcQ3ev4uGOsxRtkq5RLy1Yb6SNueX0Da2UVKR5KTC5Q6BWaqxwS0IjKOLZ/xz0Pbe/ClV3bZSKBEY2omkVo3Z0HZ771vB2clPRvGJ/IdeKOsZ3ZytSFXfyiJBdARmeSPmydXLil8+Ibq5iLAeow5PK8hK1TCOnKHzLWNqcNq70tyjoHvcGi70iGjoVEEUgPCLLuU8WmzTJwlvA3BuDzjtaO7TLo/jdE6iqkHtMSS8x+43sAH6hcFRCWAVh/0Uq7n36uGDfNxGnX3YrmX3LR9x5IsBES1rGGWbpxio4o5GIf/Xd+JgDd9rzJCqRuZ3/sW/TxK38htWaVNZV0kMkHUCTc1ctzWpCm635hbFCHBhPYIp+/z206khkAKDbz/CNuU91Wazsh7KO07wrwDtxfDDbInJ8TfHE2TGjzjQzgChfmcAEQEAAQ==
|
||||
verified: true
|
||||
can_sign: true
|
||||
can_encrypt_comms: true
|
||||
can_encrypt_storage: true
|
||||
can_certify: true
|
||||
|
||||
-
|
||||
id: 6
|
||||
owner_id: 36
|
||||
key_id: EE3AF48454AFD619
|
||||
primary_key_id: B15431642629B826
|
||||
content: zsDNBGTrY3UBDADsHrzuOicQaPdUQm0+0UNrs92cESm/j/4yBBUk+sfLZAo6J99c4eh4nAQzzZ7al080rYKB0G+7xoRz1eHcQH6zrVcqB8KYtf/sdY47WaMiMyxM+kTSvzp7tsv7QuSQZ0neUEXRyYMz5ttBfIjWUd+3NDItuHyB+MtNWlS3zXgaUbe5VifqKaNmzN0Ye4yXTKcpypE3AOqPVz+iIFv3c6TmsqLHJaR4VoicCleAqLyF/28WsJO7M9dDW+EM3MZVnsVpycTURyHAJGfSk10waQZAaRwmarCN/q0KEJ+aEAK/SRliUneBZoMO5hY5iBeG432tofwaQqAahPv9uXIb1n2JEMKwnMlMA9UGD1AcDbywfj1m/ZGBBw95i4Ekkfn43RvV3THr7uJU/dRqqP+iic4MwpUrOxqELW/kmeHXlBcNbZZhEEvwRoW7U2/9eeuog4nRleRJ0pi/xOP9wmxkKjaIPIK3phdBtEpVk4w/UTAWNdyIIrFggukeAnZFyGJwlm8AEQEAAQ==
|
||||
verified: true
|
||||
can_sign: true
|
||||
can_encrypt_comms: true
|
||||
can_encrypt_storage: true
|
||||
can_certify: true
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
priority: 0
|
||||
is_closed: true
|
||||
is_pull: false
|
||||
num_comments: 0
|
||||
num_comments: 1
|
||||
created_unix: 946684830
|
||||
updated_unix: 978307200
|
||||
is_locked: false
|
||||
|
||||
@@ -136,3 +136,17 @@
|
||||
is_prerelease: false
|
||||
is_tag: false
|
||||
created_unix: 946684803
|
||||
|
||||
- id: 11
|
||||
repo_id: 2
|
||||
publisher_id: 2
|
||||
tag_name: "v1.1"
|
||||
lower_tag_name: "v1.1"
|
||||
target: ""
|
||||
title: "v1.1"
|
||||
sha1: "205ac761f3326a7ebe416e8673760016450b5cec"
|
||||
num_commits: 2
|
||||
is_draft: false
|
||||
is_prerelease: false
|
||||
is_tag: false
|
||||
created_unix: 946684803
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
-
|
||||
id: 1
|
||||
setting_key: 'disable_gravatar'
|
||||
setting_key: 'picture.disable_gravatar'
|
||||
setting_value: 'false'
|
||||
version: 1
|
||||
created: 1653533198
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
-
|
||||
id: 2
|
||||
setting_key: 'enable_federated_avatar'
|
||||
setting_key: 'picture.enable_federated_avatar'
|
||||
setting_value: 'false'
|
||||
version: 1
|
||||
created: 1653533198
|
||||
|
||||
@@ -280,3 +280,9 @@
|
||||
team_id: 20
|
||||
type: 9 # package
|
||||
access_mode: 2
|
||||
|
||||
-
|
||||
id: 48
|
||||
team_id: 2
|
||||
type: 8
|
||||
access_mode: 2
|
||||
|
||||
@@ -1301,7 +1301,7 @@
|
||||
lower_name: limited_org36
|
||||
name: limited_org36
|
||||
full_name: Limited Org 36
|
||||
email: limited_org36@example.com
|
||||
email: abcde@gitea.com
|
||||
keep_email_private: false
|
||||
email_notifications_preference: enabled
|
||||
passwd: ZogKvWdyEx:password
|
||||
@@ -1320,7 +1320,7 @@
|
||||
allow_create_organization: true
|
||||
prohibit_login: false
|
||||
avatar: avatar22
|
||||
avatar_email: limited_org36@example.com
|
||||
avatar_email: abcde@gitea.com
|
||||
use_custom_avatar: false
|
||||
num_followers: 0
|
||||
num_following: 0
|
||||
|
||||
@@ -283,9 +283,9 @@ func GetLatestCommitStatus(ctx context.Context, repoID int64, sha string, listOp
|
||||
Where("repo_id = ?", repoID).And("sha = ?", sha).
|
||||
Select("max( id ) as id").
|
||||
GroupBy("context_hash").OrderBy("max( id ) desc")
|
||||
|
||||
sess = db.SetSessionPagination(sess, &listOptions)
|
||||
|
||||
if !listOptions.IsListAll() {
|
||||
sess = db.SetSessionPagination(sess, &listOptions)
|
||||
}
|
||||
count, err := sess.FindAndCount(&ids)
|
||||
if err != nil {
|
||||
return nil, count, err
|
||||
|
||||
@@ -1014,6 +1014,7 @@ type FindCommentsOptions struct {
|
||||
Type CommentType
|
||||
IssueIDs []int64
|
||||
Invalidated util.OptionalBool
|
||||
IsPull util.OptionalBool
|
||||
}
|
||||
|
||||
// ToConds implements FindOptions interface
|
||||
@@ -1048,6 +1049,9 @@ func (opts *FindCommentsOptions) ToConds() builder.Cond {
|
||||
if !opts.Invalidated.IsNone() {
|
||||
cond = cond.And(builder.Eq{"comment.invalidated": opts.Invalidated.IsTrue()})
|
||||
}
|
||||
if opts.IsPull != util.OptionalBoolNone {
|
||||
cond = cond.And(builder.Eq{"issue.is_pull": opts.IsPull.IsTrue()})
|
||||
}
|
||||
return cond
|
||||
}
|
||||
|
||||
@@ -1055,7 +1059,7 @@ func (opts *FindCommentsOptions) ToConds() builder.Cond {
|
||||
func FindComments(ctx context.Context, opts *FindCommentsOptions) (CommentList, error) {
|
||||
comments := make([]*Comment, 0, 10)
|
||||
sess := db.GetEngine(ctx).Where(opts.ToConds())
|
||||
if opts.RepoID > 0 {
|
||||
if opts.RepoID > 0 || opts.IsPull != util.OptionalBoolNone {
|
||||
sess.Join("INNER", "issue", "issue.id = comment.issue_id")
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/modules/container"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
)
|
||||
|
||||
// CommentList defines a list of comments
|
||||
@@ -422,37 +423,18 @@ func (comments CommentList) loadReviews(ctx context.Context) error {
|
||||
|
||||
reviewIDs := comments.getReviewIDs()
|
||||
reviews := make(map[int64]*Review, len(reviewIDs))
|
||||
left := len(reviewIDs)
|
||||
for left > 0 {
|
||||
limit := db.DefaultMaxInSize
|
||||
if left < limit {
|
||||
limit = left
|
||||
}
|
||||
rows, err := db.GetEngine(ctx).
|
||||
In("id", reviewIDs[:limit]).
|
||||
Rows(new(Review))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for rows.Next() {
|
||||
var review Review
|
||||
err = rows.Scan(&review)
|
||||
if err != nil {
|
||||
_ = rows.Close()
|
||||
return err
|
||||
}
|
||||
|
||||
reviews[review.ID] = &review
|
||||
}
|
||||
_ = rows.Close()
|
||||
|
||||
left -= limit
|
||||
reviewIDs = reviewIDs[limit:]
|
||||
if err := db.GetEngine(ctx).In("id", reviewIDs).Find(&reviews); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, comment := range comments {
|
||||
comment.Review = reviews[comment.ReviewID]
|
||||
if comment.Review == nil {
|
||||
if comment.ReviewID > 0 {
|
||||
log.Error("comment with review id [%d] but has no review record", comment.ReviewID)
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
// If the comment dismisses a review, we need to load the reviewer to show whose review has been dismissed.
|
||||
// Otherwise, the reviewer is the poster of the comment, so we don't need to load it.
|
||||
|
||||
@@ -218,9 +218,9 @@ func GetIssueContentHistoryByID(dbCtx context.Context, id int64) (*ContentHistor
|
||||
}
|
||||
|
||||
// GetIssueContentHistoryAndPrev get a history and the previous non-deleted history (to compare)
|
||||
func GetIssueContentHistoryAndPrev(dbCtx context.Context, id int64) (history, prevHistory *ContentHistory, err error) {
|
||||
func GetIssueContentHistoryAndPrev(dbCtx context.Context, issueID, id int64) (history, prevHistory *ContentHistory, err error) {
|
||||
history = &ContentHistory{}
|
||||
has, err := db.GetEngine(dbCtx).ID(id).Get(history)
|
||||
has, err := db.GetEngine(dbCtx).Where("id=? AND issue_id=?", id, issueID).Get(history)
|
||||
if err != nil {
|
||||
log.Error("failed to get issue content history %v. err=%v", id, err)
|
||||
return nil, nil, err
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user