Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
* upstream/main:
  Fix incorrect `HookEventType` of pull request review comments (go-gitea#23650)
  [skip ci] Updated translations via Crowdin
  Fix codeblocks in the cheat sheet (go-gitea#23664)
  Drop migration for ForeignReference (go-gitea#23605)
  Fix new issue/pull request btn margin when it is next to sort (go-gitea#23647)
  A tool to help to backport locales, changes source strings to fix other broken translations (go-gitea#23633)
  Fix incorrect `show-modal` and `show-panel` class (go-gitea#23660)
  Restructure documentation. Now the documentation has installation, administration, usage, development, contributing the 5 main parts (go-gitea#23629)
  Check LFS/Packages settings in dump and doctor command (go-gitea#23631)
  Use a general approach to show tooltip, fix temporary tooltip bug (go-gitea#23574)
  Improve workflow event triggers (go-gitea#23613)
  Improve `<SvgIcon>` to make it output `svg` node and optimize performance (go-gitea#23570)
  • Loading branch information
zjjhot committed Mar 24, 2023
2 parents 795e9d1 + 9e04627 commit 6312f0d
Show file tree
Hide file tree
Showing 165 changed files with 758 additions and 507 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ ifeq ($(RACE_ENABLED),true)
endif

STORED_VERSION_FILE := VERSION
HUGO_VERSION ?= 0.111.3

ifneq ($(DRONE_TAG),)
VERSION ?= $(subst v,,$(DRONE_TAG))
Expand Down Expand Up @@ -817,7 +818,7 @@ release-docs: | $(DIST_DIRS) docs
.PHONY: docs
docs:
@hash hugo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
curl -sL https://github.com/gohugoio/hugo/releases/download/v0.74.3/hugo_0.74.3_Linux-64bit.tar.gz | tar zxf - -C /tmp && mv /tmp/hugo /usr/bin/hugo && chmod +x /usr/bin/hugo; \
curl -sL https://github.com/gohugoio/hugo/releases/download/v$(HUGO_VERSION)/hugo_$(HUGO_VERSION)_Linux-64bit.tar.gz | tar zxf - -C /tmp && mv /tmp/hugo /usr/bin/hugo && chmod +x /usr/bin/hugo; \
fi
cd docs; make trans-copy clean build-offline;

Expand Down
89 changes: 89 additions & 0 deletions build/backport-locales.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
//go:build ignore

package main

import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"

"gopkg.in/ini.v1"
)

func main() {
if len(os.Args) != 2 {
println("usage: backport-locales <to-ref>")
println("eg: backport-locales release/v1.19")
os.Exit(1)
}

ini.PrettyFormat = false
mustNoErr := func(err error) {
if err != nil {
panic(err)
}
}
collectInis := func(ref string) map[string]*ini.File {
inis := map[string]*ini.File{}
err := filepath.WalkDir("options/locale", func(path string, d os.DirEntry, err error) error {
if err != nil {
return err
}
if d.IsDir() || !strings.HasSuffix(d.Name(), ".ini") {
return nil
}
cfg, err := ini.LoadSources(ini.LoadOptions{
IgnoreInlineComment: true,
UnescapeValueCommentSymbols: true,
}, path)
mustNoErr(err)
inis[path] = cfg
fmt.Printf("collecting: %s @ %s\n", path, ref)
return nil
})
mustNoErr(err)
return inis
}

// collect new locales from current working directory
inisNew := collectInis("HEAD")

// switch to the target ref, and collect the old locales
cmd := exec.Command("git", "checkout", os.Args[1])
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
mustNoErr(cmd.Run())
inisOld := collectInis(os.Args[1])

// use old en-US as the base, and copy the new translations to the old locales
enUsOld := inisOld["options/locale/locale_en-US.ini"]
for path, iniOld := range inisOld {
if iniOld == enUsOld {
continue
}
iniNew := inisNew[path]
if iniNew == nil {
continue
}
for _, secEnUS := range enUsOld.Sections() {
secOld := iniOld.Section(secEnUS.Name())
secNew := iniNew.Section(secEnUS.Name())
for _, keyEnUs := range secEnUS.Keys() {
if secNew.HasKey(keyEnUs.Name()) {
oldStr := secOld.Key(keyEnUs.Name()).String()
newStr := secNew.Key(keyEnUs.Name()).String()
// A bug: many of new translations with ";" are broken in Crowdin (due to last messy restoring)
// As the broken strings are gradually fixed, this workaround check could be removed (in a few months?)
if strings.Contains(oldStr, ";") && !strings.Contains(newStr, ";") {
println("skip potential broken string", path, secEnUS.Name(), keyEnUs.Name())
continue
}
secOld.Key(keyEnUs.Name()).SetValue(newStr)
}
}
}
mustNoErr(iniOld.SaveTo(path))
}
}
4 changes: 4 additions & 0 deletions cmd/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ func runDump(ctx *cli.Context) error {

if ctx.IsSet("skip-lfs-data") && ctx.Bool("skip-lfs-data") {
log.Info("Skip dumping LFS data")
} else if !setting.LFS.StartServer {
log.Info("LFS isn't enabled. Skip dumping LFS data")
} else if err := storage.LFS.IterateObjects("", func(objPath string, object storage.Object) error {
info, err := object.Stat()
if err != nil {
Expand Down Expand Up @@ -364,6 +366,8 @@ func runDump(ctx *cli.Context) error {

if ctx.IsSet("skip-package-data") && ctx.Bool("skip-package-data") {
log.Info("Skip dumping package data")
} else if !setting.Packages.Enabled {
log.Info("Packages isn't enabled. Skip dumping package data")
} else if err := storage.Packages.IterateObjects("", func(objPath string, object storage.Object) error {
info, err := object.Stat()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ THEME := themes/gitea
PUBLIC := public
ARCHIVE := https://dl.gitea.com/theme/main.tar.gz

HUGO_PACKAGE := github.com/gohugoio/hugo@v0.82.0
HUGO_PACKAGE := github.com/gohugoio/hugo@v0.111.3

.PHONY: all
all: build
Expand Down
5 changes: 5 additions & 0 deletions docs/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ params:
repo: "https://github.com/go-gitea/gitea"
docContentPath: "docs/content"

markup:
tableOfContents:
startLevel: 1
endLevel: 9

outputs:
home:
- HTML
Expand Down
14 changes: 14 additions & 0 deletions docs/content/doc/administration.en-us.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
date: "2016-12-01T16:00:00+02:00"
title: "Administration"
slug: "administration"
weight: 30
toc: false
draft: false
menu:
sidebar:
name: "Administration"
weight: 20
collapse: true
identifier: "administration"
---
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
date: "2017-08-23T09:00:00+02:00"
title: "Avancé"
slug: "advanced"
slug: "administration"
weight: 30
toc: false
draft: false
menu:
sidebar:
name: "Avancé"
weight: 40
identifier: "advanced"
weight: 20
identifier: "administration"
---
13 changes: 13 additions & 0 deletions docs/content/doc/administration.zh-cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
date: "2016-12-01T16:00:00+02:00"
title: "运维"
slug: "administration"
weight: 30
toc: false
draft: false
menu:
sidebar:
name: "运维"
weight: 20
identifier: "administration"
---
13 changes: 13 additions & 0 deletions docs/content/doc/administration.zh-tw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
date: "2016-12-01T16:00:00+02:00"
title: "運維"
slug: "administration"
weight: 30
toc: false
draft: false
menu:
sidebar:
name: "運維"
weight: 20
identifier: "administration"
---
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ toc: false
draft: false
menu:
sidebar:
parent: "advanced"
parent: "administration"
name: "Adding Legal Pages"
identifier: "adding-legal-pages"
weight: 9
weight: 110
---

Some jurisdictions (such as EU), requires certain legal pages (e.g. Privacy Policy) to be added to website. Follow these steps to add them to your Gitea instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ toc: false
draft: false
menu:
sidebar:
parent: "usage"
parent: "administration"
name: "Backup and Restore"
weight: 11
identifier: "backup-and-restore"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ toc: false
draft: false
menu:
sidebar:
parent: "usage"
parent: "administration"
name: "备份与恢复"
weight: 11
identifier: "backup-and-restore"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ toc: false
draft: false
menu:
sidebar:
parent: "usage"
parent: "administration"
name: "備份與還原"
weight: 11
identifier: "backup-and-restore"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ toc: false
draft: false
menu:
sidebar:
parent: "advanced"
parent: "administration"
name: "Embedded data extraction tool"
weight: 40
weight: 20
identifier: "cmd-embedded"
---

Expand All @@ -21,7 +21,7 @@ menu:

Gitea's executable contains all the resources required to run: templates, images, style-sheets
and translations. Any of them can be overridden by placing a replacement in a matching path
inside the `custom` directory (see [Customizing Gitea]({{< relref "doc/advanced/customizing-gitea.en-us.md" >}})).
inside the `custom` directory (see [Customizing Gitea]({{< relref "doc/administration/customizing-gitea.en-us.md" >}})).

To obtain a copy of the embedded resources ready for editing, the `embedded` command from the CLI
can be used from the OS shell interface.
Expand Down Expand Up @@ -85,7 +85,7 @@ The default is the current directory.
The `--custom` flag tells Gitea to extract the files directly into the `custom` directory.
For this to work, the command needs to know the location of the `app.ini` configuration
file (`--config`) and, depending of the configuration, be ran from the directory where
Gitea normally starts. See [Customizing Gitea]({{< relref "doc/advanced/customizing-gitea.en-us.md" >}}) for details.
Gitea normally starts. See [Customizing Gitea]({{< relref "doc/administration/customizing-gitea.en-us.md" >}}) for details.

The `--overwrite` flag allows any existing files in the destination directory to be overwritten.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ toc: false
draft: false
menu:
sidebar:
parent: "usage"
parent: "administration"
name: "Command Line"
weight: 10
weight: 1
identifier: "command-line"
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ toc: false
draft: false
menu:
sidebar:
parent: "advanced"
parent: "administration"
name: "Config Cheat Sheet"
weight: 20
weight: 30
identifier: "config-cheat-sheet"
---

Expand Down Expand Up @@ -753,7 +753,7 @@ and
- `FORCE_TRUST_SERVER_CERT`: **false**: If set to `true`, completely ignores server certificate validation errors. This option is unsafe. Consider adding the certificate to the system trust store instead.
- `USER`: **\<empty\>**: Username of mailing user (usually the sender's e-mail address).
- `PASSWD`: **\<empty\>**: Password of mailing user. Use \`your password\` for quoting if you use special characters in the password.
- Please note: authentication is only supported when the SMTP server communication is encrypted with TLS (this can be via `STARTTLS`) or SMTP host is localhost. See [Email Setup]({{< relref "doc/usage/email-setup.en-us.md" >}}) for more information.
- Please note: authentication is only supported when the SMTP server communication is encrypted with TLS (this can be via `STARTTLS`) or SMTP host is localhost. See [Email Setup]({{< relref "doc/administration/email-setup.en-us.md" >}}) for more information.
- `ENABLE_HELO`: **true**: Enable HELO operation.
- `HELO_HOSTNAME`: **(retrieved from system)**: HELO hostname.
- `FROM`: **\<empty\>**: Mail from address, RFC 5322. This can be just an email address, or the "Name" \<email@example.com\> format.
Expand Down Expand Up @@ -994,7 +994,7 @@ Default templates for project boards:

### Extended cron tasks (not enabled by default)

#### Cron - Garbage collect all repositories ('cron.git_gc_repos')
#### Cron - Garbage collect all repositories (`cron.git_gc_repos`)

- `ENABLED`: **false**: Enable service.
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
Expand All @@ -1003,66 +1003,66 @@ Default templates for project boards:
- `NOTICE_ON_SUCCESS`: **false**: Set to true to switch on success notices.
- `ARGS`: **\<empty\>**: Arguments for command `git gc`, e.g. `--aggressive --auto`. The default value is same with [git] -> GC_ARGS

#### Cron - Update the '.ssh/authorized_keys' file with Gitea SSH keys ('cron.resync_all_sshkeys')
#### Cron - Update the '.ssh/authorized_keys' file with Gitea SSH keys (`cron.resync_all_sshkeys`)

- `ENABLED`: **false**: Enable service.
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
- `NOTICE_ON_SUCCESS`: **false**: Set to true to switch on success notices.
- `SCHEDULE`: **@every 72h**: Cron syntax for scheduling repository archive cleanup, e.g. `@every 1h`.

#### Cron - Resynchronize pre-receive, update and post-receive hooks of all repositories ('cron.resync_all_hooks')
#### Cron - Resynchronize pre-receive, update and post-receive hooks of all repositories (`cron.resync_all_hooks`)

- `ENABLED`: **false**: Enable service.
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
- `NOTICE_ON_SUCCESS`: **false**: Set to true to switch on success notices.
- `SCHEDULE`: **@every 72h**: Cron syntax for scheduling repository archive cleanup, e.g. `@every 1h`.

#### Cron - Reinitialize all missing Git repositories for which records exist ('cron.reinit_missing_repos')
#### Cron - Reinitialize all missing Git repositories for which records exist (`cron.reinit_missing_repos`)

- `ENABLED`: **false**: Enable service.
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
- `NOTICE_ON_SUCCESS`: **false**: Set to true to switch on success notices.
- `SCHEDULE`: **@every 72h**: Cron syntax for scheduling repository archive cleanup, e.g. `@every 1h`.

#### Cron - Delete all repositories missing their Git files ('cron.delete_missing_repos')
#### Cron - Delete all repositories missing their Git files (`cron.delete_missing_repos`)

- `ENABLED`: **false**: Enable service.
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
- `NOTICE_ON_SUCCESS`: **false**: Set to true to switch on success notices.
- `SCHEDULE`: **@every 72h**: Cron syntax for scheduling repository archive cleanup, e.g. `@every 1h`.

#### Cron - Delete generated repository avatars ('cron.delete_generated_repository_avatars')
#### Cron - Delete generated repository avatars (`cron.delete_generated_repository_avatars`)

- `ENABLED`: **false**: Enable service.
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
- `NOTICE_ON_SUCCESS`: **false**: Set to true to switch on success notices.
- `SCHEDULE`: **@every 72h**: Cron syntax for scheduling repository archive cleanup, e.g. `@every 1h`.

#### Cron - Delete all old actions from database ('cron.delete_old_actions')
#### Cron - Delete all old actions from database (`cron.delete_old_actions`)

- `ENABLED`: **false**: Enable service.
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
- `NOTICE_ON_SUCCESS`: **false**: Set to true to switch on success notices.
- `SCHEDULE`: **@every 168h**: Cron syntax to set how often to check.
- `OLDER_THAN`: **@every 8760h**: any action older than this expression will be deleted from database, suggest using `8760h` (1 year) because that's the max length of heatmap.

#### Cron - Check for new Gitea versions ('cron.update_checker')
#### Cron - Check for new Gitea versions (`cron.update_checker`)

- `ENABLED`: **true**: Enable service.
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
- `ENABLE_SUCCESS_NOTICE`: **true**: Set to false to switch off success notices.
- `SCHEDULE`: **@every 168h**: Cron syntax for scheduling a work, e.g. `@every 168h`.
- `HTTP_ENDPOINT`: **https://dl.gitea.io/gitea/version.json**: the endpoint that Gitea will check for newer versions

#### Cron - Delete all old system notices from database ('cron.delete_old_system_notices')
#### Cron - Delete all old system notices from database (`cron.delete_old_system_notices`)

- `ENABLED`: **false**: Enable service.
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
- `NO_SUCCESS_NOTICE`: **false**: Set to true to switch off success notices.
- `SCHEDULE`: **@every 168h**: Cron syntax to set how often to check.
- `OLDER_THAN`: **@every 8760h**: any system notice older than this expression will be deleted from database.

#### Cron - Garbage collect LFS pointers in repositories ('cron.gc_lfs')
#### Cron - Garbage collect LFS pointers in repositories (`cron.gc_lfs`)

- `ENABLED`: **false**: Enable service.
- `RUN_AT_START`: **false**: Run tasks at start up time (if ENABLED).
Expand Down
Loading

0 comments on commit 6312f0d

Please sign in to comment.