Skip to content

Commit f290e04

Browse files
committed
Merge branch 'master' of https://github.com/go-gitea/gitea into fuzz2
2 parents 1a95d77 + 0c5fca2 commit f290e04

File tree

311 files changed

+35500
-28800
lines changed

Some content is hidden

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

311 files changed

+35500
-28800
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

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ import (
158158
To maintain understandable code and avoid circular dependencies it is important to have a good structure of the code. The gitea code is divided into the following parts:
159159

160160
- **integration:** Integrations tests
161-
- **models:** Contains the data structures used by xorm to construct database tables. It also contains supporting functions to query and update the database. Dependecies to other code in Gitea should be avoided although some modules might be needed (for example for logging).
161+
- **models:** Contains the data structures used by xorm to construct database tables. It also contains supporting functions to query and update the database. Dependencies to other code in Gitea should be avoided although some modules might be needed (for example for logging).
162162
- **models/fixtures:** Sample model data used in integration tests.
163163
- **models/migrations:** Handling of database migrations between versions. PRs that changes a database structure shall also have a migration step.
164164
- **modules:** Different modules to handle specific functionality in Gitea.
@@ -181,16 +181,16 @@ The same applies to status responses. If you notice a problem, feel free to leav
181181
All expected results (errors, success, fail messages) should be documented
182182
([example](https://github.com/go-gitea/gitea/blob/c620eb5b2d0d874da68ebd734d3864c5224f71f7/routers/api/v1/repo/issue.go#L319-L327)).
183183

184-
All JSON input types must be defined as a struct in `models/structs/`
184+
All JSON input types must be defined as a struct in [modules/structs/](modules/structs/)
185185
([example](https://github.com/go-gitea/gitea/blob/c620eb5b2d0d874da68ebd734d3864c5224f71f7/modules/structs/issue.go#L76-L91))
186186
and referenced in
187187
[routers/api/v1/swagger/options.go](https://github.com/go-gitea/gitea/blob/c620eb5b2d0d874da68ebd734d3864c5224f71f7/routers/api/v1/swagger/options.go).
188188
They can then be used like the following:
189189
([example](https://github.com/go-gitea/gitea/blob/c620eb5b2d0d874da68ebd734d3864c5224f71f7/routers/api/v1/repo/issue.go#L318)).
190190

191-
All JSON responses must be defined as a struct in `models/structs/`
191+
All JSON responses must be defined as a struct in [modules/structs/](modules/structs/)
192192
([example](https://github.com/go-gitea/gitea/blob/c620eb5b2d0d874da68ebd734d3864c5224f71f7/modules/structs/issue.go#L36-L68))
193-
and referenced in its category in `routers/api/v1/swagger/`
193+
and referenced in its category in [routers/api/v1/swagger/](routers/api/v1/swagger/)
194194
([example](https://github.com/go-gitea/gitea/blob/c620eb5b2d0d874da68ebd734d3864c5224f71f7/routers/api/v1/swagger/issue.go#L11-L16))
195195
They can be used like the following:
196196
([example](https://github.com/go-gitea/gitea/blob/c620eb5b2d0d874da68ebd734d3864c5224f71f7/routers/api/v1/repo/issue.go#L277-L279))
@@ -199,7 +199,7 @@ In general, HTTP methods are chosen as follows:
199199
* **GET** endpoints return requested object and status **OK (200)**
200200
* **DELETE** endpoints return status **No Content (204)**
201201
* **POST** endpoints return status **Created (201)**, used to **create** new objects (e.g. a User)
202-
* **PUT** endpoints return status **No Content (204)**, used to **add/assign** existing Obejcts (e.g. User) to something (e.g. Org-Team)
202+
* **PUT** endpoints return status **No Content (204)**, used to **add/assign** existing Objects (e.g. User) to something (e.g. Org-Team)
203203
* **PATCH** endpoints return changed object and status **OK (200)**, used to **edit/change** an existing object
204204

205205

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ jaqra <[email protected]> (@jaqra)
3838
David Svantesson <[email protected]> (@davidsvantesson)
3939
CirnoT <[email protected]> (@CirnoT)
4040
a1012112796 <[email protected]> (@a1012112796)
41+
Karl Heinz Marbaise <[email protected]> (@khmarbaise)

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

build/generate-svg.js

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,16 @@ function exit(err) {
1414
process.exit(err ? 1 : 0);
1515
}
1616

17-
async function processFile(file, {prefix = ''} = {}) {
18-
let name = parse(file).name;
19-
if (prefix) name = `${prefix}-${name}`;
20-
if (prefix === 'octicon') name = name.replace(/-[0-9]+$/, ''); // chop of '-16' on octicons
17+
async function processFile(file, {prefix, fullName} = {}) {
18+
let name;
19+
20+
if (fullName) {
21+
name = fullName;
22+
} else {
23+
name = parse(file).name;
24+
if (prefix) name = `${prefix}-${name}`;
25+
if (prefix === 'octicon') name = name.replace(/-[0-9]+$/, ''); // chop of '-16' on octicons
26+
}
2127

2228
const svgo = new Svgo({
2329
plugins: [
@@ -47,18 +53,20 @@ async function processFile(file, {prefix = ''} = {}) {
4753
await writeFile(resolve(outputDir, `${name}.svg`), data);
4854
}
4955

56+
function processFiles(pattern, opts) {
57+
return glob(pattern).map((file) => processFile(file, opts));
58+
}
59+
5060
async function main() {
5161
try {
5262
await mkdir(outputDir);
5363
} catch {}
5464

55-
for (const file of glob('../node_modules/@primer/octicons/build/svg/*-16.svg')) {
56-
await processFile(file, {prefix: 'octicon'});
57-
}
58-
59-
for (const file of glob('../web_src/svg/*.svg')) {
60-
await processFile(file);
61-
}
65+
await Promise.all([
66+
...processFiles('../node_modules/@primer/octicons/build/svg/*-16.svg', {prefix: 'octicon'}),
67+
...processFiles('../web_src/svg/*.svg'),
68+
...processFiles('../assets/logo.svg', {fullName: 'gitea-gitea'}),
69+
]);
6270
}
6371

6472
main().then(exit).catch(exit);

docs/config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ menu:
4848
url: https://blog.gitea.io/
4949
weight: 30
5050
pre: rss
51-
- name: Code
52-
url: https://code.gitea.io/
51+
- name: Shop
52+
url: https://shop.gitea.io/
5353
weight: 40
5454
pre: code
5555
- name: Translation

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

0 commit comments

Comments
 (0)