Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into update-outdated-com…
Browse files Browse the repository at this point in the history
…ments-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)
  ...
  • Loading branch information
ivanvc committed Oct 21, 2020
2 parents 486a1d3 + f0fe568 commit f5c3a69
Show file tree
Hide file tree
Showing 131 changed files with 2,649 additions and 2,070 deletions.
10 changes: 7 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ rules:
import/no-amd: [0]
import/no-anonymous-default-export: [0]
import/no-commonjs: [0]
import/no-cycle: [0]
import/no-cycle: [2, {ignoreExternal: true}]
import/no-default-export: [0]
import/no-deprecated: [0]
import/no-dynamic-require: [0]
Expand All @@ -117,7 +117,7 @@ rules:
import/no-self-import: [2]
import/no-unassigned-import: [0]
import/no-unresolved: [2, {commonjs: true}]
import/no-unused-modules: [0]
import/no-unused-modules: [2, {unusedExports: true}]
import/no-useless-path-segments: [2, {commonjs: true}]
import/no-webpack-loader-syntax: [2]
import/order: [0]
Expand Down Expand Up @@ -211,7 +211,7 @@ rules:
no-mixed-operators: [0]
no-mixed-spaces-and-tabs: [2]
no-multi-assign: [0]
no-multi-spaces: [2, {ignoreEOLComments: true, exceptions: {Property: true, VariableDeclarator: true}}]
no-multi-spaces: [2, {ignoreEOLComments: true, exceptions: {Property: true}}]
no-multi-str: [2]
no-negated-condition: [0]
no-nested-ternary: [0]
Expand Down Expand Up @@ -336,6 +336,7 @@ rules:
unicorn/explicit-length-check: [0]
unicorn/filename-case: [0]
unicorn/import-index: [0]
unicorn/import-style: [0]
unicorn/new-for-builtins: [2]
unicorn/no-abusive-eslint-disable: [0]
unicorn/no-array-instanceof: [0]
Expand All @@ -356,11 +357,13 @@ rules:
unicorn/no-useless-undefined: [0]
unicorn/no-zero-fractions: [2]
unicorn/number-literal-case: [0]
unicorn/numeric-separators-style: [0]
unicorn/prefer-add-event-listener: [2]
unicorn/prefer-array-find: [2]
unicorn/prefer-dataset: [2]
unicorn/prefer-event-key: [2]
unicorn/prefer-includes: [2]
unicorn/prefer-math-trunc: [2]
unicorn/prefer-modern-dom-apis: [0]
unicorn/prefer-negative-index: [2]
unicorn/prefer-node-append: [0]
Expand All @@ -374,6 +377,7 @@ rules:
unicorn/prefer-spread: [0]
unicorn/prefer-starts-ends-with: [2]
unicorn/prefer-string-slice: [0]
unicorn/prefer-ternary: [0]
unicorn/prefer-text-content: [2]
unicorn/prefer-trim-start-end: [2]
unicorn/prefer-type-error: [0]
Expand Down
7 changes: 6 additions & 1 deletion .github/issue_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
- Gitea version (or commit ref):
- Git version:
- Operating system:
<!-- Please include information on whether you built gitea yourself, used one of our downloads or are using some other package -->
<!-- Please also tell us how you are running gitea, e.g. if it is being run from docker, a command-line, systemd etc. --->
<!-- If you are using a package or systemd tell us what distribution you are using -->
- Database (use `[x]`):
- [ ] PostgreSQL
- [ ] MySQL
Expand All @@ -20,8 +23,10 @@
- Can you reproduce the bug at https://try.gitea.io:
- [ ] Yes (provide example URL)
- [ ] No
- [ ] Not relevant
- Log gist:
<!-- It really is important to provide pertinent 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 -->

## Description

Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This changelog goes through all the changes that have been made in each release
without substantial changes to our git log; to see the highlights of what has
been added to each release, please refer to the [blog](https://blog.gitea.io).

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

* SECURITY
* Mitigate Security vulnerability in the git hook feature (#13058)
Expand Down
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ Mura Li <[email protected]> (@typeless)
jaqra <[email protected]> (@jaqra)
David Svantesson <[email protected]> (@davidsvantesson)
CirnoT <[email protected]> (@CirnoT)
a1012112796 <[email protected]> (@a1012112796)
135 changes: 89 additions & 46 deletions cmd/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
"code.gitea.io/gitea/routers"
"code.gitea.io/gitea/routers/routes"

"gitea.com/macaron/macaron"

context2 "github.com/gorilla/context"
"github.com/unknwon/com"
"github.com/urfave/cli"
Expand Down Expand Up @@ -114,48 +116,89 @@ func runWeb(ctx *cli.Context) error {
setting.WritePIDFile = true
}

// Flag for port number in case first time run conflict.
if ctx.IsSet("port") {
if err := setPort(ctx.String("port")); err != nil {
return err
}
}

// Perform pre-initialization
needsInstall := routers.PreInstallInit(graceful.GetManager().HammerContext())
if needsInstall {
m := routes.NewMacaron()
routes.RegisterInstallRoute(m)
err := listen(m, false)
select {
case <-graceful.GetManager().IsShutdown():
<-graceful.GetManager().Done()
log.Info("PID: %d Gitea Web Finished", os.Getpid())
log.Close()
return err
default:
}
} else {
NoInstallListener()
}

if setting.EnablePprof {
go func() {
log.Info("Starting pprof server on localhost:6060")
log.Info("%v", http.ListenAndServe("localhost:6060", nil))
}()
}

log.Info("Global init")
// Perform global initialization
routers.GlobalInit(graceful.GetManager().HammerContext())

// Set up Macaron
m := routes.NewMacaron()
routes.RegisterRoutes(m)

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

switch setting.Protocol {
case setting.UnixSocket:
case setting.FCGI:
case setting.FCGIUnix:
default:
// Save LOCAL_ROOT_URL if port changed
cfg := ini.Empty()
if com.IsFile(setting.CustomConf) {
// Keeps custom settings if there is already something.
if err := cfg.Append(setting.CustomConf); err != nil {
return fmt.Errorf("Failed to load custom conf '%s': %v", setting.CustomConf, err)
}
}
func setPort(port string) error {
setting.AppURL = strings.Replace(setting.AppURL, setting.HTTPPort, port, 1)
setting.HTTPPort = port

defaultLocalURL := string(setting.Protocol) + "://"
if setting.HTTPAddr == "0.0.0.0" {
defaultLocalURL += "localhost"
} else {
defaultLocalURL += setting.HTTPAddr
switch setting.Protocol {
case setting.UnixSocket:
case setting.FCGI:
case setting.FCGIUnix:
default:
// Save LOCAL_ROOT_URL if port changed
cfg := ini.Empty()
if com.IsFile(setting.CustomConf) {
// Keeps custom settings if there is already something.
if err := cfg.Append(setting.CustomConf); err != nil {
return fmt.Errorf("Failed to load custom conf '%s': %v", setting.CustomConf, err)
}
defaultLocalURL += ":" + setting.HTTPPort + "/"
}

defaultLocalURL := string(setting.Protocol) + "://"
if setting.HTTPAddr == "0.0.0.0" {
defaultLocalURL += "localhost"
} else {
defaultLocalURL += setting.HTTPAddr
}
defaultLocalURL += ":" + setting.HTTPPort + "/"

cfg.Section("server").Key("LOCAL_ROOT_URL").SetValue(defaultLocalURL)
cfg.Section("server").Key("LOCAL_ROOT_URL").SetValue(defaultLocalURL)

if err := cfg.SaveTo(setting.CustomConf); err != nil {
return fmt.Errorf("Error saving generated JWT Secret to custom config: %v", err)
}
if err := cfg.SaveTo(setting.CustomConf); err != nil {
return fmt.Errorf("Error saving generated JWT Secret to custom config: %v", err)
}
}
return nil
}

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

if setting.EnablePprof {
go func() {
log.Info("Starting pprof server on localhost:6060")
log.Info("%v", http.ListenAndServe("localhost:6060", nil))
}()
}

var err error
switch setting.Protocol {
case setting.HTTP:
NoHTTPRedirector()
if handleRedirector {
NoHTTPRedirector()
}
err = runHTTP("tcp", listenAddr, context2.ClearHandler(m))
case setting.HTTPS:
if setting.EnableLetsEncrypt {
err = runLetsEncrypt(listenAddr, setting.Domain, setting.LetsEncryptDirectory, setting.LetsEncryptEmail, context2.ClearHandler(m))
break
}
if setting.RedirectOtherPort {
go runHTTPRedirector()
} else {
NoHTTPRedirector()
if handleRedirector {
if setting.RedirectOtherPort {
go runHTTPRedirector()
} else {
NoHTTPRedirector()
}
}
err = runHTTPS("tcp", listenAddr, setting.CertFile, setting.KeyFile, context2.ClearHandler(m))
case setting.FCGI:
NoHTTPRedirector()
if handleRedirector {
NoHTTPRedirector()
}
err = runFCGI("tcp", listenAddr, context2.ClearHandler(m))
case setting.UnixSocket:
NoHTTPRedirector()
if handleRedirector {
NoHTTPRedirector()
}
err = runHTTP("unix", listenAddr, context2.ClearHandler(m))
case setting.FCGIUnix:
NoHTTPRedirector()
if handleRedirector {
NoHTTPRedirector()
}
err = runFCGI("unix", listenAddr, context2.ClearHandler(m))
default:
log.Fatal("Invalid protocol: %s", setting.Protocol)
Expand All @@ -206,8 +252,5 @@ func runWeb(ctx *cli.Context) error {
log.Critical("Failed to start server: %v", err)
}
log.Info("HTTP Listener: %s Closed", listenAddr)
<-graceful.GetManager().Done()
log.Info("PID: %d Gitea Web Finished", os.Getpid())
log.Close()
return nil
return err
}
6 changes: 6 additions & 0 deletions cmd/web_graceful.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ func NoMainListener() {
graceful.GetManager().InformCleanup()
}

// NoInstallListener tells our cleanup routine that we will not be using a possibly provided listener
// for our install HTTP/HTTPS service
func NoInstallListener() {
graceful.GetManager().InformCleanup()
}

func runFCGI(network, listenAddr string, m http.Handler) error {
// This needs to handle stdin as fcgi point
fcgiServer := graceful.NewServer(network, listenAddr)
Expand Down
2 changes: 1 addition & 1 deletion docs/content/doc/advanced/config-cheat-sheet.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
- `SSH_LISTEN_PORT`: **%(SSH\_PORT)s**: Port for the built-in SSH server.
- `SSH_ROOT_PATH`: **~/.ssh**: Root path of SSH directory.
- `SSH_CREATE_AUTHORIZED_KEYS_FILE`: **true**: Gitea will create a authorized_keys file by default when it is not using the internal ssh server. If you intend to use the AuthorizedKeysCommand functionality then you should turn this off.
- `SSH_AUTHORIZED_KEYS_BACKUP`: **true**: Enable SSH Authorized Key Backup when rewriting all keys, default is true.
- `SSH_TRUSTED_USER_CA_KEYS`: **\<empty\>**: Specifies the public keys of certificate authorities that are trusted to sign user certificates for authentication. Multiple keys should be comma separated. E.g.`ssh-<algorithm> <key>` or `ssh-<algorithm> <key1>, ssh-<algorithm> <key2>`. For more information see `TrustedUserCAKeys` in the sshd config man pages. When empty no file will be created and `SSH_AUTHORIZED_PRINCIPALS_ALLOW` will default to `off`.
- `SSH_TRUSTED_USER_CA_KEYS_FILENAME`: **`RUN_USER`/.ssh/gitea-trusted-user-ca-keys.pem**: Absolute path of the `TrustedUserCaKeys` file gitea will manage. If you're running your own ssh server and you want to use the gitea managed file you'll also need to modify your sshd_config to point to this file. The official docker image will automatically work without further configuration.
- `SSH_AUTHORIZED_PRINCIPALS_ALLOW`: **off** or **username, email**: \[off, username, email, anything\]: Specify the principals values that users are allowed to use as principal. When set to `anything` no checks are done on the principal string. When set to `off` authorized principal are not allowed to be set.
Expand All @@ -261,7 +262,6 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
- `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
- `SSH_KEY_TEST_PATH`: **/tmp**: Directory to create temporary files in when testing public keys using ssh-keygen, default is the system temporary directory.
- `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.
- `SSH_BACKUP_AUTHORIZED_KEYS`: **true**: Enable SSH Authorized Key Backup when rewriting all keys, default is true.
- `SSH_EXPOSE_ANONYMOUS`: **false**: Enable exposure of SSH clone URL to anonymous visitors, default is false.
- `MINIMUM_KEY_SIZE_CHECK`: **true**: Indicate whether to check minimum key size with corresponding type.

Expand Down
12 changes: 12 additions & 0 deletions docs/content/doc/advanced/customizing-gitea.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,3 +295,15 @@ A full list of supported emoji's is at [emoji list](https://gitea.com/gitea/gite

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.
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)

## Customizing fonts

Fonts can be customized using CSS variables:

```css
:root {
--fonts-proportional: /* custom proportional fonts */ !important;
--fonts-monospace: /* custom monospace fonts */ !important;
--fonts-emoji: /* custom emoji fonts */ !important;
}
```
2 changes: 1 addition & 1 deletion docs/content/doc/installation/with-docker.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ config:

```
[ssh]
SSH_BACKUP_AUTHORIZED_KEYS=false
SSH_AUTHORIZED_KEYS_BACKUP=false
```

- mount your `.ssh` directory directly into the container i.e. add the
Expand Down
3 changes: 2 additions & 1 deletion integrations/api_comment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"testing"

"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/convert"
api "code.gitea.io/gitea/modules/structs"

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

assert.NoError(t, comment.LoadPoster())
expect := comment.APIFormat()
expect := convert.ToComment(comment)

assert.Equal(t, expect.ID, apiComment.ID)
assert.Equal(t, expect.Poster.FullName, apiComment.Poster.FullName)
Expand Down
7 changes: 4 additions & 3 deletions integrations/api_issue_reaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"time"

"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/convert"
api "code.gitea.io/gitea/modules/structs"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -60,7 +61,7 @@ func TestAPIIssuesReactions(t *testing.T) {
DecodeJSON(t, resp, &apiReactions)
expectResponse := make(map[int]api.Reaction)
expectResponse[0] = api.Reaction{
User: user2.APIFormat(),
User: convert.ToUser(user2, true, true),
Reaction: "eyes",
Created: time.Unix(1573248003, 0),
}
Expand Down Expand Up @@ -120,12 +121,12 @@ func TestAPICommentReactions(t *testing.T) {
DecodeJSON(t, resp, &apiReactions)
expectResponse := make(map[int]api.Reaction)
expectResponse[0] = api.Reaction{
User: user2.APIFormat(),
User: convert.ToUser(user2, true, true),
Reaction: "laugh",
Created: time.Unix(1573248004, 0),
}
expectResponse[1] = api.Reaction{
User: user1.APIFormat(),
User: convert.ToUser(user1, true, true),
Reaction: "laugh",
Created: time.Unix(1573248005, 0),
}
Expand Down
Loading

0 comments on commit f5c3a69

Please sign in to comment.