Skip to content

Commit f5c3a69

Browse files
committed
Merge remote-tracking branch 'origin/master' into update-outdated-comments-in-pull-request-label-style
* origin/master: (27 commits) [skip ci] Updated translations via Crowdin add more clarification to the issue-template.md (go-gitea#13235) go-version constraints ignore pre-releases (go-gitea#13234) [skip ci] Updated translations via Crowdin Update some JS dependencies (go-gitea#13222) Return the full rejection message and errors in flash errors (go-gitea#13221) Update heatmap fixtures to restore tests (go-gitea#13224) [skip ci] Updated translations via Crowdin Add review request api (go-gitea#11355) [skip ci] Updated translations via Crowdin When the git ref is unable to be found return broken pr (go-gitea#13218) Various arc-green fixes (go-gitea#13214) Show stale label for stale code comment which is marked as resolved (go-gitea#13213) Move install pages out of main macaron routes (go-gitea#13195) Use CSS Variables for fonts, remove postcss-loader (go-gitea#13204) [skip ci] Updated translations via Crowdin Align `SSH_AUTHORIZED_KEYS_BACKUP` var with the value in `app.ini` (go-gitea#13212) Fix size and clickable area on file table back link (go-gitea#13205) [skip ci] Updated translations via Crowdin Fix error in diff html rendering (go-gitea#13191) ...
2 parents 486a1d3 + f0fe568 commit f5c3a69

File tree

131 files changed

+2649
-2070
lines changed

Some content is hidden

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

131 files changed

+2649
-2070
lines changed

.eslintrc

+7-3
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ rules:
9999
import/no-amd: [0]
100100
import/no-anonymous-default-export: [0]
101101
import/no-commonjs: [0]
102-
import/no-cycle: [0]
102+
import/no-cycle: [2, {ignoreExternal: true}]
103103
import/no-default-export: [0]
104104
import/no-deprecated: [0]
105105
import/no-dynamic-require: [0]
@@ -117,7 +117,7 @@ rules:
117117
import/no-self-import: [2]
118118
import/no-unassigned-import: [0]
119119
import/no-unresolved: [2, {commonjs: true}]
120-
import/no-unused-modules: [0]
120+
import/no-unused-modules: [2, {unusedExports: true}]
121121
import/no-useless-path-segments: [2, {commonjs: true}]
122122
import/no-webpack-loader-syntax: [2]
123123
import/order: [0]
@@ -211,7 +211,7 @@ rules:
211211
no-mixed-operators: [0]
212212
no-mixed-spaces-and-tabs: [2]
213213
no-multi-assign: [0]
214-
no-multi-spaces: [2, {ignoreEOLComments: true, exceptions: {Property: true, VariableDeclarator: true}}]
214+
no-multi-spaces: [2, {ignoreEOLComments: true, exceptions: {Property: true}}]
215215
no-multi-str: [2]
216216
no-negated-condition: [0]
217217
no-nested-ternary: [0]
@@ -336,6 +336,7 @@ rules:
336336
unicorn/explicit-length-check: [0]
337337
unicorn/filename-case: [0]
338338
unicorn/import-index: [0]
339+
unicorn/import-style: [0]
339340
unicorn/new-for-builtins: [2]
340341
unicorn/no-abusive-eslint-disable: [0]
341342
unicorn/no-array-instanceof: [0]
@@ -356,11 +357,13 @@ rules:
356357
unicorn/no-useless-undefined: [0]
357358
unicorn/no-zero-fractions: [2]
358359
unicorn/number-literal-case: [0]
360+
unicorn/numeric-separators-style: [0]
359361
unicorn/prefer-add-event-listener: [2]
360362
unicorn/prefer-array-find: [2]
361363
unicorn/prefer-dataset: [2]
362364
unicorn/prefer-event-key: [2]
363365
unicorn/prefer-includes: [2]
366+
unicorn/prefer-math-trunc: [2]
364367
unicorn/prefer-modern-dom-apis: [0]
365368
unicorn/prefer-negative-index: [2]
366369
unicorn/prefer-node-append: [0]
@@ -374,6 +377,7 @@ rules:
374377
unicorn/prefer-spread: [0]
375378
unicorn/prefer-starts-ends-with: [2]
376379
unicorn/prefer-string-slice: [0]
380+
unicorn/prefer-ternary: [0]
377381
unicorn/prefer-text-content: [2]
378382
unicorn/prefer-trim-start-end: [2]
379383
unicorn/prefer-type-error: [0]

.github/issue_template.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
- Gitea version (or commit ref):
1313
- Git version:
1414
- Operating system:
15+
<!-- Please include information on whether you built gitea yourself, used one of our downloads or are using some other package -->
16+
<!-- Please also tell us how you are running gitea, e.g. if it is being run from docker, a command-line, systemd etc. --->
17+
<!-- If you are using a package or systemd tell us what distribution you are using -->
1518
- Database (use `[x]`):
1619
- [ ] PostgreSQL
1720
- [ ] MySQL
@@ -20,8 +23,10 @@
2023
- Can you reproduce the bug at https://try.gitea.io:
2124
- [ ] Yes (provide example URL)
2225
- [ ] No
23-
- [ ] Not relevant
2426
- Log gist:
27+
<!-- It really is important to provide pertinent logs -->
28+
<!-- Please read https://docs.gitea.io/en-us/logging-configuration/#debugging-problems -->
29+
<!-- In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini -->
2530

2631
## Description
2732

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This changelog goes through all the changes that have been made in each release
44
without substantial changes to our git log; to see the highlights of what has
55
been added to each release, please refer to the [blog](https://blog.gitea.io).
66

7-
## [1.13.0-RC1](https://github.com/go-gitea/gitea/releases/tag/v1.13.0-RC1) - 2020-10-14
7+
## [1.13.0-RC1](https://github.com/go-gitea/gitea/releases/tag/v1.13.0-rc1) - 2020-10-14
88

99
* SECURITY
1010
* Mitigate Security vulnerability in the git hook feature (#13058)

MAINTAINERS

+1
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ Mura Li <[email protected]> (@typeless)
3737
jaqra <[email protected]> (@jaqra)
3838
David Svantesson <[email protected]> (@davidsvantesson)
3939
CirnoT <[email protected]> (@CirnoT)
40+
a1012112796 <[email protected]> (@a1012112796)

cmd/web.go

+89-46
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import (
1919
"code.gitea.io/gitea/routers"
2020
"code.gitea.io/gitea/routers/routes"
2121

22+
"gitea.com/macaron/macaron"
23+
2224
context2 "github.com/gorilla/context"
2325
"github.com/unknwon/com"
2426
"github.com/urfave/cli"
@@ -114,48 +116,89 @@ func runWeb(ctx *cli.Context) error {
114116
setting.WritePIDFile = true
115117
}
116118

119+
// Flag for port number in case first time run conflict.
120+
if ctx.IsSet("port") {
121+
if err := setPort(ctx.String("port")); err != nil {
122+
return err
123+
}
124+
}
125+
126+
// Perform pre-initialization
127+
needsInstall := routers.PreInstallInit(graceful.GetManager().HammerContext())
128+
if needsInstall {
129+
m := routes.NewMacaron()
130+
routes.RegisterInstallRoute(m)
131+
err := listen(m, false)
132+
select {
133+
case <-graceful.GetManager().IsShutdown():
134+
<-graceful.GetManager().Done()
135+
log.Info("PID: %d Gitea Web Finished", os.Getpid())
136+
log.Close()
137+
return err
138+
default:
139+
}
140+
} else {
141+
NoInstallListener()
142+
}
143+
144+
if setting.EnablePprof {
145+
go func() {
146+
log.Info("Starting pprof server on localhost:6060")
147+
log.Info("%v", http.ListenAndServe("localhost:6060", nil))
148+
}()
149+
}
150+
151+
log.Info("Global init")
117152
// Perform global initialization
118153
routers.GlobalInit(graceful.GetManager().HammerContext())
119154

120155
// Set up Macaron
121156
m := routes.NewMacaron()
122157
routes.RegisterRoutes(m)
123158

124-
// Flag for port number in case first time run conflict.
125-
if ctx.IsSet("port") {
126-
setting.AppURL = strings.Replace(setting.AppURL, setting.HTTPPort, ctx.String("port"), 1)
127-
setting.HTTPPort = ctx.String("port")
159+
err := listen(m, true)
160+
<-graceful.GetManager().Done()
161+
log.Info("PID: %d Gitea Web Finished", os.Getpid())
162+
log.Close()
163+
return err
164+
}
128165

129-
switch setting.Protocol {
130-
case setting.UnixSocket:
131-
case setting.FCGI:
132-
case setting.FCGIUnix:
133-
default:
134-
// Save LOCAL_ROOT_URL if port changed
135-
cfg := ini.Empty()
136-
if com.IsFile(setting.CustomConf) {
137-
// Keeps custom settings if there is already something.
138-
if err := cfg.Append(setting.CustomConf); err != nil {
139-
return fmt.Errorf("Failed to load custom conf '%s': %v", setting.CustomConf, err)
140-
}
141-
}
166+
func setPort(port string) error {
167+
setting.AppURL = strings.Replace(setting.AppURL, setting.HTTPPort, port, 1)
168+
setting.HTTPPort = port
142169

143-
defaultLocalURL := string(setting.Protocol) + "://"
144-
if setting.HTTPAddr == "0.0.0.0" {
145-
defaultLocalURL += "localhost"
146-
} else {
147-
defaultLocalURL += setting.HTTPAddr
170+
switch setting.Protocol {
171+
case setting.UnixSocket:
172+
case setting.FCGI:
173+
case setting.FCGIUnix:
174+
default:
175+
// Save LOCAL_ROOT_URL if port changed
176+
cfg := ini.Empty()
177+
if com.IsFile(setting.CustomConf) {
178+
// Keeps custom settings if there is already something.
179+
if err := cfg.Append(setting.CustomConf); err != nil {
180+
return fmt.Errorf("Failed to load custom conf '%s': %v", setting.CustomConf, err)
148181
}
149-
defaultLocalURL += ":" + setting.HTTPPort + "/"
182+
}
183+
184+
defaultLocalURL := string(setting.Protocol) + "://"
185+
if setting.HTTPAddr == "0.0.0.0" {
186+
defaultLocalURL += "localhost"
187+
} else {
188+
defaultLocalURL += setting.HTTPAddr
189+
}
190+
defaultLocalURL += ":" + setting.HTTPPort + "/"
150191

151-
cfg.Section("server").Key("LOCAL_ROOT_URL").SetValue(defaultLocalURL)
192+
cfg.Section("server").Key("LOCAL_ROOT_URL").SetValue(defaultLocalURL)
152193

153-
if err := cfg.SaveTo(setting.CustomConf); err != nil {
154-
return fmt.Errorf("Error saving generated JWT Secret to custom config: %v", err)
155-
}
194+
if err := cfg.SaveTo(setting.CustomConf); err != nil {
195+
return fmt.Errorf("Error saving generated JWT Secret to custom config: %v", err)
156196
}
157197
}
198+
return nil
199+
}
158200

201+
func listen(m *macaron.Macaron, handleRedirector bool) error {
159202
listenAddr := setting.HTTPAddr
160203
if setting.Protocol != setting.UnixSocket && setting.Protocol != setting.FCGIUnix {
161204
listenAddr = net.JoinHostPort(listenAddr, setting.HTTPPort)
@@ -166,37 +209,40 @@ func runWeb(ctx *cli.Context) error {
166209
log.Info("LFS server enabled")
167210
}
168211

169-
if setting.EnablePprof {
170-
go func() {
171-
log.Info("Starting pprof server on localhost:6060")
172-
log.Info("%v", http.ListenAndServe("localhost:6060", nil))
173-
}()
174-
}
175-
176212
var err error
177213
switch setting.Protocol {
178214
case setting.HTTP:
179-
NoHTTPRedirector()
215+
if handleRedirector {
216+
NoHTTPRedirector()
217+
}
180218
err = runHTTP("tcp", listenAddr, context2.ClearHandler(m))
181219
case setting.HTTPS:
182220
if setting.EnableLetsEncrypt {
183221
err = runLetsEncrypt(listenAddr, setting.Domain, setting.LetsEncryptDirectory, setting.LetsEncryptEmail, context2.ClearHandler(m))
184222
break
185223
}
186-
if setting.RedirectOtherPort {
187-
go runHTTPRedirector()
188-
} else {
189-
NoHTTPRedirector()
224+
if handleRedirector {
225+
if setting.RedirectOtherPort {
226+
go runHTTPRedirector()
227+
} else {
228+
NoHTTPRedirector()
229+
}
190230
}
191231
err = runHTTPS("tcp", listenAddr, setting.CertFile, setting.KeyFile, context2.ClearHandler(m))
192232
case setting.FCGI:
193-
NoHTTPRedirector()
233+
if handleRedirector {
234+
NoHTTPRedirector()
235+
}
194236
err = runFCGI("tcp", listenAddr, context2.ClearHandler(m))
195237
case setting.UnixSocket:
196-
NoHTTPRedirector()
238+
if handleRedirector {
239+
NoHTTPRedirector()
240+
}
197241
err = runHTTP("unix", listenAddr, context2.ClearHandler(m))
198242
case setting.FCGIUnix:
199-
NoHTTPRedirector()
243+
if handleRedirector {
244+
NoHTTPRedirector()
245+
}
200246
err = runFCGI("unix", listenAddr, context2.ClearHandler(m))
201247
default:
202248
log.Fatal("Invalid protocol: %s", setting.Protocol)
@@ -206,8 +252,5 @@ func runWeb(ctx *cli.Context) error {
206252
log.Critical("Failed to start server: %v", err)
207253
}
208254
log.Info("HTTP Listener: %s Closed", listenAddr)
209-
<-graceful.GetManager().Done()
210-
log.Info("PID: %d Gitea Web Finished", os.Getpid())
211-
log.Close()
212-
return nil
255+
return err
213256
}

cmd/web_graceful.go

+6
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ func NoMainListener() {
3737
graceful.GetManager().InformCleanup()
3838
}
3939

40+
// NoInstallListener tells our cleanup routine that we will not be using a possibly provided listener
41+
// for our install HTTP/HTTPS service
42+
func NoInstallListener() {
43+
graceful.GetManager().InformCleanup()
44+
}
45+
4046
func runFCGI(network, listenAddr string, m http.Handler) error {
4147
// This needs to handle stdin as fcgi point
4248
fcgiServer := graceful.NewServer(network, listenAddr)

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
251251
- `SSH_LISTEN_PORT`: **%(SSH\_PORT)s**: Port for the built-in SSH server.
252252
- `SSH_ROOT_PATH`: **~/.ssh**: Root path of SSH directory.
253253
- `SSH_CREATE_AUTHORIZED_KEYS_FILE`: **true**: Gitea will create a authorized_keys file by default when it is not using the internal ssh server. If you intend to use the AuthorizedKeysCommand functionality then you should turn this off.
254+
- `SSH_AUTHORIZED_KEYS_BACKUP`: **true**: Enable SSH Authorized Key Backup when rewriting all keys, default is true.
254255
- `SSH_TRUSTED_USER_CA_KEYS`: **\<empty\>**: Specifies the public keys of certificate authorities that are trusted to sign user certificates for authentication. Multiple keys should be comma separated. E.g.`ssh-<algorithm> <key>` or `ssh-<algorithm> <key1>, ssh-<algorithm> <key2>`. For more information see `TrustedUserCAKeys` in the sshd config man pages. When empty no file will be created and `SSH_AUTHORIZED_PRINCIPALS_ALLOW` will default to `off`.
255256
- `SSH_TRUSTED_USER_CA_KEYS_FILENAME`: **`RUN_USER`/.ssh/gitea-trusted-user-ca-keys.pem**: Absolute path of the `TrustedUserCaKeys` file gitea will manage. If you're running your own ssh server and you want to use the gitea managed file you'll also need to modify your sshd_config to point to this file. The official docker image will automatically work without further configuration.
256257
- `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.
@@ -261,7 +262,6 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
261262
- `SSH_SERVER_MACS`: **[email protected], hmac-sha2-256, hmac-sha1, hmac-sha1-96**: For the built-in SSH server, choose the MACs to support for SSH connections, for system SSH this setting has no effect
262263
- `SSH_KEY_TEST_PATH`: **/tmp**: Directory to create temporary files in when testing public keys using ssh-keygen, default is the system temporary directory.
263264
- `SSH_KEYGEN_PATH`: **ssh-keygen**: Path to ssh-keygen, default is 'ssh-keygen' which means the shell is responsible for finding out which one to call.
264-
- `SSH_BACKUP_AUTHORIZED_KEYS`: **true**: Enable SSH Authorized Key Backup when rewriting all keys, default is true.
265265
- `SSH_EXPOSE_ANONYMOUS`: **false**: Enable exposure of SSH clone URL to anonymous visitors, default is false.
266266
- `MINIMUM_KEY_SIZE_CHECK`: **true**: Indicate whether to check minimum key size with corresponding type.
267267

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

+12
Original file line numberDiff line numberDiff line change
@@ -295,3 +295,15 @@ A full list of supported emoji's is at [emoji list](https://gitea.com/gitea/gite
295295

296296
As of version 1.6.0 Gitea has built-in themes. The two built-in themes are, the default theme `gitea`, and a dark theme `arc-green`. To change the look of your Gitea install change the value of `DEFAULT_THEME` in the [ui](https://docs.gitea.io/en-us/config-cheat-sheet/#ui-ui) section of `app.ini` to another one of the available options.
297297
As of version 1.8.0 Gitea also has per-user themes. 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` (defaults to `gitea` and `arc-green`, light and dark respectively)
298+
299+
## Customizing fonts
300+
301+
Fonts can be customized using CSS variables:
302+
303+
```css
304+
:root {
305+
--fonts-proportional: /* custom proportional fonts */ !important;
306+
--fonts-monospace: /* custom monospace fonts */ !important;
307+
--fonts-emoji: /* custom emoji fonts */ !important;
308+
}
309+
```

docs/content/doc/installation/with-docker.en-us.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ config:
371371

372372
```
373373
[ssh]
374-
SSH_BACKUP_AUTHORIZED_KEYS=false
374+
SSH_AUTHORIZED_KEYS_BACKUP=false
375375
```
376376

377377
- mount your `.ssh` directory directly into the container i.e. add the

integrations/api_comment_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"testing"
1212

1313
"code.gitea.io/gitea/models"
14+
"code.gitea.io/gitea/modules/convert"
1415
api "code.gitea.io/gitea/modules/structs"
1516

1617
"github.com/stretchr/testify/assert"
@@ -125,7 +126,7 @@ func TestAPIGetComment(t *testing.T) {
125126
DecodeJSON(t, resp, &apiComment)
126127

127128
assert.NoError(t, comment.LoadPoster())
128-
expect := comment.APIFormat()
129+
expect := convert.ToComment(comment)
129130

130131
assert.Equal(t, expect.ID, apiComment.ID)
131132
assert.Equal(t, expect.Poster.FullName, apiComment.Poster.FullName)

integrations/api_issue_reaction_test.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"time"
1212

1313
"code.gitea.io/gitea/models"
14+
"code.gitea.io/gitea/modules/convert"
1415
api "code.gitea.io/gitea/modules/structs"
1516

1617
"github.com/stretchr/testify/assert"
@@ -60,7 +61,7 @@ func TestAPIIssuesReactions(t *testing.T) {
6061
DecodeJSON(t, resp, &apiReactions)
6162
expectResponse := make(map[int]api.Reaction)
6263
expectResponse[0] = api.Reaction{
63-
User: user2.APIFormat(),
64+
User: convert.ToUser(user2, true, true),
6465
Reaction: "eyes",
6566
Created: time.Unix(1573248003, 0),
6667
}
@@ -120,12 +121,12 @@ func TestAPICommentReactions(t *testing.T) {
120121
DecodeJSON(t, resp, &apiReactions)
121122
expectResponse := make(map[int]api.Reaction)
122123
expectResponse[0] = api.Reaction{
123-
User: user2.APIFormat(),
124+
User: convert.ToUser(user2, true, true),
124125
Reaction: "laugh",
125126
Created: time.Unix(1573248004, 0),
126127
}
127128
expectResponse[1] = api.Reaction{
128-
User: user1.APIFormat(),
129+
User: convert.ToUser(user1, true, true),
129130
Reaction: "laugh",
130131
Created: time.Unix(1573248005, 0),
131132
}

0 commit comments

Comments
 (0)