Skip to content

Commit 9519c39

Browse files
authored
Merge branch 'master' into lunny/pr_cmd_instruction2
2 parents 3ec9353 + af79677 commit 9519c39

File tree

152 files changed

+1851
-1700
lines changed

Some content is hidden

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

152 files changed

+1851
-1700
lines changed

.golangci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ issues:
101101
- path: cmd/dump.go
102102
linters:
103103
- dupl
104+
- path: services/webhook/webhook.go
105+
linters:
106+
- structcheck
104107
- text: "commentFormatting: put a space between `//` and comment text"
105108
linters:
106109
- gocritic

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,12 @@ NOTES:
6969

7070
## Further information
7171

72-
For more information and instructions about how to install Gitea, please look
73-
at our [documentation](https://docs.gitea.io/en-us/). If you have questions
74-
that are not covered by the documentation, you can get in contact with us on
75-
our [Discord server](https://discord.gg/Gitea),
76-
or [forum](https://discourse.gitea.io/)!
72+
For more information and instructions about how to install Gitea, please look at our [documentation](https://docs.gitea.io/en-us/).
73+
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/).
74+
75+
We maintain a list of Gitea-related projects at [gitea/awesome-gitea](https://gitea.com/gitea/awesome-gitea).
76+
The hugo-based documentationt theme is hosted at [gitea/theme](https://gitea.com/gitea/theme).
77+
The official Gitea CLI is developed at [gitea/tea](https://gitea.com/gitea/tea).
7778

7879
## Authors
7980

docs/content/doc/advanced/cmd-embedded.en-us.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ date: "2020-01-25T21:00:00-03:00"
33
title: "Embedded data extraction tool"
44
slug: "cmd-embedded"
55
weight: 40
6-
toc: true
6+
toc: false
77
draft: false
88
menu:
99
sidebar:
@@ -15,6 +15,10 @@ menu:
1515

1616
# Embedded data extraction tool
1717

18+
**Table of Contents**
19+
20+
{{< toc >}}
21+
1822
Gitea's executable contains all the resources required to run: templates, images, style-sheets
1923
and translations. Any of them can be overridden by placing a replacement in a matching path
2024
inside the `custom` directory (see [Customizing Gitea]({{< relref "doc/advanced/customizing-gitea.en-us.md" >}})).
@@ -28,7 +32,7 @@ can be used from the OS shell interface.
2832

2933
To list resources embedded in Gitea's executable, use the following syntax:
3034

31-
```
35+
```sh
3236
gitea embedded list [--include-vendored] [patterns...]
3337
```
3438

@@ -48,11 +52,11 @@ a special meaning for your command shell.
4852

4953
If no pattern is provided, all files are listed.
5054

51-
#### Example
55+
### Example
5256

5357
Listing all embedded files with `openid` in their path:
5458

55-
```
59+
```sh
5660
$ gitea embedded list '**openid**'
5761
public/img/auth/openid_connect.svg
5862
public/img/openid-16x16.png
@@ -68,7 +72,7 @@ templates/user/settings/security_openid.tmpl
6872

6973
To extract resources embedded in Gitea's executable, use the following syntax:
7074

71-
```
75+
```sh
7276
gitea [--config {file}] embedded extract [--destination {dir}|--custom] [--overwrite|--rename] [--include-vendored] {patterns...}
7377
```
7478

@@ -91,19 +95,19 @@ as `filename.bak`. Previous `.bak` files are overwritten.
9195
At least one file search pattern must be provided; see `list` subcomand above for pattern
9296
syntax and examples.
9397

94-
#### Important notice
98+
### Important notice
9599

96100
Make sure to **only extract those files that require customization**. Files that
97101
are present in the `custom` directory are not upgraded by Gitea's upgrade process.
98102
When Gitea is upgraded to a new version (by replacing the executable), many of the
99103
embedded files will suffer changes. Gitea will honor and use any files found
100104
in the `custom` directory, even if they are old and incompatible.
101105

102-
#### Example
106+
### Example
103107

104108
Extracting mail templates to a temporary directory:
105109

106-
```
110+
```sh
107111
$ mkdir tempdir
108112
$ gitea embedded extract --destination tempdir 'templates/mail/**.tmpl'
109113
Extracting to tempdir:

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
3131

3232
**Note:** A full restart is required for Gitea configuration changes to take effect.
3333

34+
{{< toc >}}
35+
3436
## Overall (`DEFAULT`)
3537

3638
- `APP_NAME`: **Gitea: Git with a cup of tea**: Application name, used in the page title.

docs/content/doc/advanced/config-cheat-sheet.zh-cn.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ menu:
1717

1818
这是针对Gitea配置文件的说明,你可以了解Gitea的强大配置。需要说明的是,你的所有改变请修改 `custom/conf/app.ini` 文件而不是源文件。所有默认值可以通过 [app.example.ini](https://github.com/go-gitea/gitea/blob/master/custom/conf/app.example.ini) 查看到。如果你发现 `%(X)s` 这样的内容,请查看 [ini](https://github.com/go-ini/ini/#recursive-values) 这里的说明。标注了 :exclamation: 的配置项表明除非你真的理解这个配置项的意义,否则最好使用默认值。
1919

20+
{{< toc >}}
21+
2022
## Overall (`DEFAULT`)
2123

2224
- `APP_NAME`: 应用名称,改成你希望的名字。

docs/content/doc/advanced/customizing-gitea.en-us.md

Lines changed: 43 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ environment variable; this can be used to override the default path to something
4545

4646
**Note:** Gitea must perform a full restart to see configuration changes.
4747

48+
**Table of Contents**
49+
50+
{{< toc >}}
51+
4852
## Serving custom public files
4953

5054
To make Gitea serve custom public files (like pages and images), use the folder
@@ -123,8 +127,8 @@ copy javascript files from https://gitea.com/davidsvantesson/plantuml-code-highl
123127
<script src="https://your-server.com/encode.js"></script>
124128
<script src="https://your-server.com/plantuml_codeblock_parse.js"></script>
125129
<script>
126-
<!-- Replace call with address to your plantuml server-->
127-
parsePlantumlCodeBlocks("http://www.plantuml..com/plantuml")
130+
<!-- Replace call with address to your plantuml server-->
131+
parsePlantumlCodeBlocks("http://www.plantuml..com/plantuml");
128132
</script>
129133
{{end}}
130134
```
@@ -144,38 +148,50 @@ The script will detect tags with `class="language-plantuml"`, but you can change
144148
#### Example: STL Preview
145149

146150
You can display STL file directly in Gitea by adding:
151+
147152
```html
148153
<script>
149-
function lS(src){
150-
return new Promise(function(resolve, reject) {
151-
let s = document.createElement('script')
152-
s.src = src
153-
s.addEventListener('load', () => {
154-
resolve()
155-
})
156-
document.body.appendChild(s)
157-
});
158-
}
159-
160-
if($('.view-raw>a[href$=".stl" i]').length){
161-
$('body').append('<link href="/Madeleine.js/src/css/Madeleine.css" rel="stylesheet">');
162-
Promise.all([lS("/Madeleine.js/src/lib/stats.js"),lS("/Madeleine.js/src/lib/detector.js"), lS("/Madeleine.js/src/lib/three.min.js"), lS("/Madeleine.js/src/Madeleine.js")]).then(function() {
163-
$('.view-raw').attr('id', 'view-raw').attr('style', 'padding: 0;margin-bottom: -10px;');
164-
new Madeleine({
165-
target: 'view-raw',
166-
data: $('.view-raw>a[href$=".stl" i]').attr('href'),
167-
path: '/Madeleine.js/src'
154+
function lS(src) {
155+
return new Promise(function (resolve, reject) {
156+
let s = document.createElement("script");
157+
s.src = src;
158+
s.addEventListener("load", () => {
159+
resolve();
160+
});
161+
document.body.appendChild(s);
168162
});
169-
$('.view-raw>a[href$=".stl"]').remove()
170-
});
171-
}
163+
}
164+
165+
if ($('.view-raw>a[href$=".stl" i]').length) {
166+
$("body").append(
167+
'<link href="/Madeleine.js/src/css/Madeleine.css" rel="stylesheet">'
168+
);
169+
Promise.all([
170+
lS("/Madeleine.js/src/lib/stats.js"),
171+
lS("/Madeleine.js/src/lib/detector.js"),
172+
lS("/Madeleine.js/src/lib/three.min.js"),
173+
lS("/Madeleine.js/src/Madeleine.js"),
174+
]).then(function () {
175+
$(".view-raw")
176+
.attr("id", "view-raw")
177+
.attr("style", "padding: 0;margin-bottom: -10px;");
178+
new Madeleine({
179+
target: "view-raw",
180+
data: $('.view-raw>a[href$=".stl" i]').attr("href"),
181+
path: "/Madeleine.js/src",
182+
});
183+
$('.view-raw>a[href$=".stl"]').remove();
184+
});
185+
}
172186
</script>
173187
```
188+
174189
to the file `templates/custom/footer.tmpl`
175190

176191
You also need to download the content of the library [Madeleine.js](https://jinjunho.github.io/Madeleine.js/) and place it under `custom/public/` folder.
177192

178193
You should end-up with a folder structucture similar to:
194+
179195
```
180196
custom/templates
181197
-- custom
@@ -263,7 +279,7 @@ To add a custom license, add a file with the license text to `custom/options/lic
263279

264280
Locales are managed via our [crowdin](https://crowdin.com/project/gitea).
265281
You can override a locale by placing an altered locale file in `custom/options/locale`.
266-
Gitea's default locale files can be found in the [`options/locale`](https://github.com/go-gitea/gitea/tree/master/options/locale) source folder and these should be used as examples for your changes.
282+
Gitea's default locale files can be found in the [`options/locale`](https://github.com/go-gitea/gitea/tree/master/options/locale) source folder and these should be used as examples for your changes.
267283

268284
To add a completely new locale, as well as placing the file in the above location, you will need to add the new lang and name to the `[i18n]` section in your `app.ini`. Keep in mind that Gitea will use those settings as **overrides**, so if you want to keep the other languages as well you will need to copy/paste the default values and add your own to them.
269285

@@ -285,10 +301,12 @@ currently there are `{Name}` (name of repository), `{Description}`, `{CloneURL.S
285301
### Reactions
286302

287303
To change reaction emoji's you can set allowed reactions at app.ini
304+
288305
```
289306
[ui]
290307
REACTIONS = +1, -1, laugh, confused, heart, hooray, eyes
291308
```
309+
292310
A full list of supported emoji's is at [emoji list](https://gitea.com/gitea/gitea.com/issues/8)
293311

294312
## Customizing the look of Gitea

docs/content/doc/advanced/environment-variables.en-us.md

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,54 +15,58 @@ menu:
1515

1616
# Environment variables
1717

18+
**Table of Contents**
19+
20+
{{< toc >}}
21+
1822
This is an inventory of Gitea environment variables. They change Gitea behaviour.
1923

2024
Initialize them before Gitea command to be effective, for example:
2125

22-
```
26+
```sh
2327
GITEA_CUSTOM=/home/gitea/custom ./gitea web
2428
```
2529

2630
## From Go language
2731

2832
As Gitea is written in Go, it uses some Go variables, such as:
2933

30-
* `GOOS`
31-
* `GOARCH`
32-
* [`GOPATH`](https://golang.org/cmd/go/#hdr-GOPATH_environment_variable)
34+
- `GOOS`
35+
- `GOARCH`
36+
- [`GOPATH`](https://golang.org/cmd/go/#hdr-GOPATH_environment_variable)
3337

3438
For documentation about each of the variables available, refer to the
3539
[official Go documentation](https://golang.org/cmd/go/#hdr-Environment_variables).
3640

3741
## Gitea files
3842

39-
* `GITEA_WORK_DIR`: Absolute path of working directory.
40-
* `GITEA_CUSTOM`: Gitea uses `GITEA_WORK_DIR`/custom folder by default. Use this variable
41-
to change *custom* directory.
42-
* `GOGS_WORK_DIR`: Deprecated, use `GITEA_WORK_DIR`
43-
* `GOGS_CUSTOM`: Deprecated, use `GITEA_CUSTOM`
43+
- `GITEA_WORK_DIR`: Absolute path of working directory.
44+
- `GITEA_CUSTOM`: Gitea uses `GITEA_WORK_DIR`/custom folder by default. Use this variable
45+
to change _custom_ directory.
46+
- `GOGS_WORK_DIR`: Deprecated, use `GITEA_WORK_DIR`
47+
- `GOGS_CUSTOM`: Deprecated, use `GITEA_CUSTOM`
4448

4549
## Operating system specifics
4650

47-
* `USER`: System user that Gitea will run as. Used for some repository access strings.
48-
* `USERNAME`: if no `USER` found, Gitea will use `USERNAME`
49-
* `HOME`: User home directory path. The `USERPROFILE` environment variable is used in Windows.
51+
- `USER`: System user that Gitea will run as. Used for some repository access strings.
52+
- `USERNAME`: if no `USER` found, Gitea will use `USERNAME`
53+
- `HOME`: User home directory path. The `USERPROFILE` environment variable is used in Windows.
5054

5155
### Only on Windows
5256

53-
* `USERPROFILE`: User home directory path. If empty, uses `HOMEDRIVE` + `HOMEPATH`
54-
* `HOMEDRIVE`: Main drive path used to access the home directory (C:)
55-
* `HOMEPATH`: Home relative path in the given home drive path
57+
- `USERPROFILE`: User home directory path. If empty, uses `HOMEDRIVE` + `HOMEPATH`
58+
- `HOMEDRIVE`: Main drive path used to access the home directory (C:)
59+
- `HOMEPATH`: Home relative path in the given home drive path
5660

5761
## Macaron (framework used by Gitea)
5862

59-
* `HOST`: Host Macaron will listen on
60-
* `PORT`: Port Macaron will listen on
61-
* `MACARON_ENV`: global variable to provide special functionality for development environments
62-
vs. production environments. If MACARON_ENV is set to "" or "development", then templates will
63-
be recompiled on every request. For more performance, set the MACARON_ENV environment variable
64-
to "production".
63+
- `HOST`: Host Macaron will listen on
64+
- `PORT`: Port Macaron will listen on
65+
- `MACARON_ENV`: global variable to provide special functionality for development environments
66+
vs. production environments. If MACARON_ENV is set to "" or "development", then templates will
67+
be recompiled on every request. For more performance, set the MACARON_ENV environment variable
68+
to "production".
6569

6670
## Miscellaneous
6771

68-
* `SKIP_MINWINSVC`: If set to 1, do not run as a service on Windows.
72+
- `SKIP_MINWINSVC`: If set to 1, do not run as a service on Windows.

docs/content/doc/advanced/external-renderers.en-us.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ date: "2018-11-23:00:00+02:00"
33
title: "External renderers"
44
slug: "external-renderers"
55
weight: 40
6-
toc: true
6+
toc: false
77
draft: false
88
menu:
99
sidebar:
@@ -15,12 +15,16 @@ menu:
1515

1616
# Custom files rendering configuration
1717

18+
**Table of Contents**
19+
20+
{{< toc >}}
21+
1822
Gitea supports custom file renderings (i.e., Jupyter notebooks, asciidoc, etc.) through external binaries,
1923
it is just a matter of:
2024

21-
* installing external binaries
22-
* add some configuration to your `app.ini` file
23-
* restart your Gitea instance
25+
- installing external binaries
26+
- add some configuration to your `app.ini` file
27+
- restart your Gitea instance
2428

2529
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.
2630

@@ -29,7 +33,7 @@ This supports rendering of whole files. If you want to render code blocks in mar
2933
In order to get file rendering through external binaries, their associated packages must be installed.
3034
If you're using a Docker image, your `Dockerfile` should contain something along this lines:
3135

32-
```
36+
```docker
3337
FROM gitea/gitea:{{< version >}}
3438
[...]
3539
@@ -49,7 +53,7 @@ RUN pip3 install jupyter docutils
4953

5054
add one `[markup.XXXXX]` section per external renderer on your custom `app.ini`:
5155

52-
```
56+
```ini
5357
[markup.asciidoc]
5458
ENABLED = true
5559
FILE_EXTENSIONS = .adoc,.asciidoc

0 commit comments

Comments
 (0)