Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsek committed Jun 2, 2022
2 parents 015a57a + 6171ea7 commit fb9ea68
Show file tree
Hide file tree
Showing 18 changed files with 100 additions and 105 deletions.
1 change: 1 addition & 0 deletions docker/root/etc/s6/openssh/setup
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ if [ -d /etc/ssh ]; then
SSH_DSA_CERT="${SSH_DSA_CERT:+"HostCertificate "}${SSH_DSA_CERT}" \
SSH_MAX_STARTUPS="${SSH_MAX_STARTUPS:+"MaxStartups "}${SSH_MAX_STARTUPS}" \
SSH_MAX_SESSIONS="${SSH_MAX_SESSIONS:+"MaxSessions "}${SSH_MAX_SESSIONS}" \
SSH_INCLUDE_FILE="${SSH_INCLUDE_FILE:+"Include "}${SSH_INCLUDE_FILE}" \
SSH_LOG_LEVEL=${SSH_LOG_LEVEL:-"INFO"} \
envsubst < /etc/templates/sshd_config > /etc/ssh/sshd_config

Expand Down
2 changes: 2 additions & 0 deletions docker/root/etc/templates/sshd_config
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ Banner none
Subsystem sftp /usr/lib/ssh/sftp-server

AcceptEnv GIT_PROTOCOL

${SSH_INCLUDE_FILE}
46 changes: 1 addition & 45 deletions docs/content/doc/developers/guidelines-frontend.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Discouraged implementations:
Only mark a function as `async` if and only if there are `await` calls
or `Promise` returns inside the function.

It's not recommended to use `async` event listeners, which may lead to problems.
It's not recommended to use `async` event listeners, which may lead to problems.
The reason is that the code after await is executed outside the event dispatch.
Reference: https://github.com/github/eslint-plugin-github/blob/main/docs/rules/async-preventdefault.md

Expand All @@ -73,50 +73,6 @@ it's recommended to use `const _promise = asyncFoo()` to tell readers
that this is done by purpose, we want to call the async function and ignore the Promise.
Some lint rules and IDEs also have warnings if the returned Promise is not handled.

#### DOM Event Listener

```js
el.addEventListener('click', (e) => {
(async () => {
await asyncFoo(); // recommended
// then we shound't do e.preventDefault() after await, no effect
})();

const _promise = asyncFoo(); // recommended

e.preventDefault(); // correct
});

el.addEventListener('async', async (e) => { // not recommended but acceptable
e.preventDefault(); // acceptable
await asyncFoo(); // skip out event dispatch
e.preventDefault(); // WRONG
});
```

#### jQuery Event Listener

```js
$('#el').on('click', (e) => {
(async () => {
await asyncFoo(); // recommended
// then we shound't do e.preventDefault() after await, no effect
})();

const _promise = asyncFoo(); // recommended

e.preventDefault(); // correct
return false; // correct
});

$('#el').on('click', async (e) => { // not recommended but acceptable
e.preventDefault(); // acceptable
return false; // WRONG, jQuery expects the returned value is a boolean, not a Promise
await asyncFoo(); // skip out event dispatch
return false; // WRONG
});
```

### HTML Attributes and `dataset`

We forbid `dataset` usage, its camel-casing behaviour makes it hard to grep for attributes. However there are still some special cases, so the current guideline is:
Expand Down
17 changes: 17 additions & 0 deletions docs/content/doc/usage/backup-and-restore.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ file can be unpacked and used to restore an instance.

{{< toc >}}

## Backup Consistency

To ensure the consistency of the Gitea instance, it must be shutdown during backup.

Gitea consists of a database, files and git repositories, all of which change when it is used. For instance, when a migration is in progress, a transaction is created in the database while the git repository is being copied over. If the backup happens in the middle of the migration, the git repository may be incomplete although the database claims otherwise because it was dumped afterwards. The only way to avoid such race conditions is by stopping the Gitea instance during the backups.

## Backup Command (`dump`)

Switch to the user running Gitea: `su git`. Run `./gitea dump -c /path/to/app.ini` in the Gitea installation
Expand All @@ -48,6 +54,17 @@ Inside the `gitea-dump-1482906742.zip` file, will be the following:
Intermediate backup files are created in a temporary directory specified either with the
`--tempdir` command-line parameter or the `TMPDIR` environment variable.

## Backup the database

The SQL dump created by `gitea dump` uses XORM and Gitea admins may prefer to use the native the MySQL and PostgreSQL dump tools instead. There are still open issues when using XORM for dumping the database that may cause problems when attempting to restore it.

```sh
# mysql
mysqldump -u$USER -p$PASS --database $DATABASE > gitea-db.sql
# postgres
pgdump -U $USER $DATABASE > gitea-db.sql
```

### Using Docker (`dump`)

There are a few caveats for using the `dump` command with Docker.
Expand Down
2 changes: 1 addition & 1 deletion docs/content/page/index.de-de.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Gitea ist ein [Gogs](http://gogs.io)-Fork.
- 2 CPU Kerne und 1GB RAM sind für kleine Teams/Projekte ausreichend.
- Gitea sollte unter einem seperaten nicht-root Account auf UNIX-Systemen ausgeführt werden.
- Achtung: Gitea verwaltet die `~/.ssh/authorized_keys` Datei. Gitea unter einem normalen Benutzer auszuführen könnte dazu führen, dass dieser sich nicht mehr anmelden kann.
- [Git](https://git-scm.com/) Version 1.7.2 oder später wird benötigt. Version 1.9.0 oder später wird empfohlen. Außerdem zu beachten:
- [Git](https://git-scm.com/) Version 2.0 oder später wird benötigt.
- Wenn git >= 2.1.2. und [Git large file storage](https://git-lfs.github.com/) aktiviert ist, dann wird es auch in Gitea verwendbar sein.
- Wenn git >= 2.18, dann wird das Rendern von Commit-Graphen automatisch aktiviert.

Expand Down
34 changes: 22 additions & 12 deletions docs/content/page/index.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,25 @@ Windows, on architectures like amd64, i386, ARM, PowerPC, and others.
- Webhooks
- Git Hooks
- Deploy keys
- Package Registries
- Composer
- Conan
- Container
- Generic
- Helm
- Maven
- NPM
- Nuget
- PyPI
- RubyGems

## System Requirements

- A Raspberry Pi 3 is powerful enough to run Gitea for small workloads.
- 2 CPU cores and 1GB RAM is typically sufficient for small teams/projects.
- Gitea should be run with a dedicated non-root system account on UNIX-type systems.
- Note: Gitea manages the `~/.ssh/authorized_keys` file. Running Gitea as a regular user could break that user's ability to log in.
- [Git](https://git-scm.com/) version 1.7.2 or later is required. Version 1.9.0 or later is recommended. Also please note:
- [Git](https://git-scm.com/) version 2.0.0 or later is required.
- [Git Large File Storage](https://git-lfs.github.com/) will be available if enabled when Git >= 2.1.2.
- Git commit-graph rendering will be enabled automatically when Git >= 2.18.

Expand All @@ -267,22 +278,21 @@ Windows, on architectures like amd64, i386, ARM, PowerPC, and others.

## Components

* Web framework: [Chi](http://github.com/go-chi/chi)
* Web server framework: [Chi](http://github.com/go-chi/chi)
* ORM: [XORM](https://xorm.io)
* UI components:
* [Semantic UI](http://semantic-ui.com/)
* [GitHub Octicons](https://octicons.github.com/)
* [Font Awesome](http://fontawesome.io/)
* [DropzoneJS](http://www.dropzonejs.com/)
* [Highlight](https://highlightjs.org/)
* [Clipboard](https://zenorocha.github.io/clipboard.js/)
* [CodeMirror](https://codemirror.net/)
* [jQuery MiniColors](https://github.com/claviska/jquery-minicolors)
* UI frameworks:
* [jQuery](https://jquery.com)
* [Fomantic UI](https://fomantic-ui.com)
* [Vue2](https://vuejs.org)
* and various components (see package.json)
* Editors:
* [CodeMirror](https://codemirror.net)
* [EasyMDE](https://github.com/Ionaru/easy-markdown-editor)
* [Monaco Editor](https://microsoft.github.io/monaco-editor)
* Database drivers:
* [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)
* [github.com/lib/pq](https://github.com/lib/pq)
* [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3)
* [github.com/pingcap/tidb](https://github.com/pingcap/tidb)
* [github.com/denisenkom/go-mssqldb](https://github.com/denisenkom/go-mssqldb)

## Software and Service Support
Expand Down
19 changes: 8 additions & 11 deletions docs/content/page/index.fr-fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,27 +249,24 @@ Le but de ce projet est de fournir de la manière la plus simple, la plus rapide

## Navigateurs supportés

- Consultez [Semantic UI](https://github.com/Semantic-Org/Semantic-UI#browser-support) pour la liste des navigateurs supportés.
- La taille minimale supportée officielement est de **1024*768**, l'interface utilisateur peut toujours fonctionner à une taille plus petite, mais ce n'est pas garanti et les problèmes remontés ne seront pas corrigés.
- Chrome, Firefox, Safari, Edge

## Composants

* Framework web : [Chi](http://github.com/go-chi/chi)
* ORM: [XORM](https://xorm.io)
* Interface graphique :
* [Semantic UI](http://semantic-ui.com/)
* [GitHub Octicons](https://octicons.github.com/)
* [Font Awesome](http://fontawesome.io/)
* [DropzoneJS](http://www.dropzonejs.com/)
* [Highlight](https://highlightjs.org/)
* [Clipboard](https://zenorocha.github.io/clipboard.js/)
* [CodeMirror](https://codemirror.net/)
* [jQuery MiniColors](https://github.com/claviska/jquery-minicolors)
* [jQuery](https://jquery.com)
* [Fomantic UI](https://fomantic-ui.com)
* [Vue2](https://vuejs.org)
* [CodeMirror](https://codemirror.net)
* [EasyMDE](https://github.com/Ionaru/easy-markdown-editor)
* [Monaco Editor](https://microsoft.github.io/monaco-editor)
* ... (package.json)
* Connecteurs de base de données :
* [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)
* [github.com/lib/pq](https://github.com/lib/pq)
* [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3)
* [github.com/pingcap/tidb](https://github.com/pingcap/tidb)
* [github.com/denisenkom/go-mssqldb](https://github.com/denisenkom/go-mssqldb)

## Logiciels et services
Expand Down
23 changes: 11 additions & 12 deletions docs/content/page/index.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Gitea的首要目标是创建一个极易安装,运行非常快速,安装和
- 支持后台管理面板
- 支持 MySQL、PostgreSQL、SQLite3、MSSQL 和 TiDB(MySQL) 数据库
- 支持多语言本地化(21 种语言)
- 支持软件包注册中心(Composer/Conan/Container/Generic/Helm/Maven/NPM/Nuget/PyPI/RubyGems)

## 系统要求

Expand All @@ -42,27 +43,25 @@ Gitea的首要目标是创建一个极易安装,运行非常快速,安装和

## 浏览器支持

- 请根据 [Semantic UI](https://github.com/Semantic-Org/Semantic-UI#browser-support) 查看具体支持的浏览器版本。
- 官方支持的最小 UI 尺寸为 **1024*768**,UI 不一定会在更小尺寸的设备上被破坏,但我们无法保证且不会修复。
- Chrome, Firefox, Safari, Edge

## 组件

* Web框架: [Chi](http://github.com/go-chi/chi)
* ORM: [XORM](https://xorm.io)
* UI组件
* [Semantic UI](http://semantic-ui.com/)
* [GitHub Octicons](https://octicons.github.com/)
* [Font Awesome](http://fontawesome.io/)
* [DropzoneJS](http://www.dropzonejs.com/)
* [Highlight](https://highlightjs.org/)
* [Clipboard](https://zenorocha.github.io/clipboard.js/)
* [CodeMirror](https://codemirror.net/)
* [jQuery MiniColors](https://github.com/claviska/jquery-minicolors)
* UI 框架
* [jQuery](https://jquery.com)
* [Fomantic UI](https://fomantic-ui.com)
* [Vue2](https://vuejs.org)
* 更多组件参见 package.json
* 编辑器:
* [CodeMirror](https://codemirror.net)
* [EasyMDE](https://github.com/Ionaru/easy-markdown-editor)
* [Monaco Editor](https://microsoft.github.io/monaco-editor)
* 数据库驱动:
* [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)
* [github.com/lib/pq](https://github.com/lib/pq)
* [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3)
* [github.com/pingcap/tidb](https://github.com/pingcap/tidb)
* [github.com/denisenkom/go-mssqldb](https://github.com/denisenkom/go-mssqldb)

## 软件及服务支持
Expand Down
27 changes: 13 additions & 14 deletions docs/content/page/index.zh-tw.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ Gitea 是從 [Gogs](http://gogs.io) Fork 出來的,請閱讀部落格文章 [G
- 在類 UNIX 系統上, 應該以專用的非 root 系統帳號來執行 Gitea。
- 備註:Gitea 管理著 `~/.ssh/authorized_keys` 檔案。以一般身份使用者執行 Gitea 可能會破壞該使用者的登入能力。

- [Git](https://git-scm.com/) 的最低需求為 1.7.2 或更新版本。建議使用 1.9.0 或更新版本。並請留意:
- [Git](https://git-scm.com/) 的最低需求為 2.0 或更新版本。
- 當 git 版本 >= 2.1.2 時,可啟用 Git [large file storage](https://git-lfs.github.com/)
- 當 git 版本 >= 2.18 時,將自動啟用 Git 提交線圖渲染。

Expand All @@ -269,20 +269,19 @@ Gitea 是從 [Gogs](http://gogs.io) Fork 出來的,請閱讀部落格文章 [G
- Web 框架: [Chi](http://github.com/go-chi/chi)
- ORM: [XORM](https://xorm.io)
- UI 元件:
- [Semantic UI](http://semantic-ui.com/)
- [GitHub Octicons](https://octicons.github.com/)
- [Font Awesome](http://fontawesome.io/)
- [DropzoneJS](http://www.dropzonejs.com/)
- [Highlight](https://highlightjs.org/)
- [Clipboard](https://zenorocha.github.io/clipboard.js/)
- [CodeMirror](https://codemirror.net/)
- [jQuery MiniColors](https://github.com/claviska/jquery-minicolors)
* [jQuery](https://jquery.com)
* [Fomantic UI](https://fomantic-ui.com)
* [Vue2](https://vuejs.org)
* [CodeMirror](https://codemirror.net)
* [EasyMDE](https://github.com/Ionaru/easy-markdown-editor)
* [Monaco Editor](https://microsoft.github.io/monaco-editor)
* ... (package.json)
- 資料庫驅動程式:
- [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)
- [github.com/lib/pq](https://github.com/lib/pq)
- [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3)
- [github.com/pingcap/tidb](https://github.com/pingcap/tidb)
- [github.com/denisenkom/go-mssqldb](https://github.com/denisenkom/go-mssqldb)
* [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)
* [github.com/lib/pq](https://github.com/lib/pq)
* [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3)
* [github.com/denisenkom/go-mssqldb](https://github.com/denisenkom/go-mssqldb)


## 軟體和服務支援

Expand Down
2 changes: 1 addition & 1 deletion models/issue_stopwatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ type UserStopwatch struct {
// GetUIDsAndNotificationCounts between the two provided times
func GetUIDsAndStopwatch() ([]*UserStopwatch, error) {
sws := []*Stopwatch{}
if err := db.GetEngine(db.DefaultContext).Find(&sws); err != nil {
if err := db.GetEngine(db.DefaultContext).Where("issue_id != 0").Find(&sws); err != nil {
return nil, err
}
if len(sws) == 0 {
Expand Down
6 changes: 5 additions & 1 deletion modules/doctor/fix16961.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,11 @@ func fixBrokenRepoUnits16961(ctx context.Context, logger log.Logger, autofix boo
}

if !autofix {
logger.Warn("Found %d broken repo_units", count)
if count == 0 {
logger.Info("Found no broken repo_units")
} else {
logger.Warn("Found %d broken repo_units", count)
}
return nil
}
logger.Info("Fixed %d broken repo_units", count)
Expand Down
8 changes: 5 additions & 3 deletions modules/doctor/mergebase.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,14 @@ func checkPRMergeBase(ctx context.Context, logger log.Logger, autofix bool) erro
if autofix {
logger.Info("%d PR mergebases updated of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos)
} else {
if numPRsUpdated > 0 && err == nil {
if numPRsUpdated == 0 {
logger.Info("All %d PRs in %d repos have a correct mergebase", numPRs, numRepos)
} else if err == nil {
logger.Critical("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos)
return fmt.Errorf("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos)
} else {
logger.Warn("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos)
}

logger.Warn("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos)
}

return err
Expand Down
6 changes: 6 additions & 0 deletions modules/web/wrap_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ func convertHandler(handler interface{}) wrappedHandlerFunc {
case http.HandlerFunc:
return func(resp http.ResponseWriter, req *http.Request, others ...wrappedHandlerFunc) (done bool, deferrable func()) {
routing.UpdateFuncInfo(req.Context(), funcInfo)
if _, ok := resp.(context.ResponseWriter); !ok {
resp = context.NewResponse(resp)
}
t(resp, req)
if r, ok := resp.(context.ResponseWriter); ok && r.Status() > 0 {
done = true
Expand Down Expand Up @@ -92,6 +95,9 @@ func convertHandler(handler interface{}) wrappedHandlerFunc {
next = wrapInternal(others)
}
routing.UpdateFuncInfo(req.Context(), funcInfo)
if _, ok := resp.(context.ResponseWriter); !ok {
resp = context.NewResponse(resp)
}
t(next).ServeHTTP(resp, req)
if r, ok := resp.(context.ResponseWriter); ok && r.Status() > 0 {
done = true
Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_el-GR.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3091,6 +3091,7 @@ maven.documentation=Για περισσότερες πληροφορίες σχ
nuget.registry=Ρυθμίστε αυτό το μητρώο από τη γραμμή εντολών:
nuget.install=Για να εγκαταστήσετε το πακέτο χρησιμοποιώντας το NuGet, εκτελέστε την ακόλουθη εντολή:
nuget.documentation=Για περισσότερες πληροφορίες σχετικά με το μητρώο NuGet δείτε <a target="_blank" rel="noopener noreferrer" href="https://docs.gitea.io/en-us/packages/nuget/">την τεκμηρίωση</a>.
nuget.dependency.framework=Πλαίσιο Ανάπτυξης
npm.registry=Ρυθμίστε αυτό το μητρώο στο αρχείο <code>.npmrc</code> του έργου σας:
npm.install=Για να εγκαταστήσετε το πακέτο χρησιμοποιώντας npm, εκτελέστε την ακόλουθη εντολή:
npm.install2=ή προσθέστε το στο αρχείο package.json:
Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_pt-PT.ini
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,7 @@ webauthn_delete_key_desc=Se remover uma chave de segurança, deixará de poder u
manage_account_links=Gerir contas vinculadas
manage_account_links_desc=Estas contas externas estão vinculadas à sua conta do Gitea.
account_links_not_available=Neste momento não existem contas externas vinculadas à sua conta do Gitea.
link_account=Vincular conta
remove_account_link=Remover conta vinculada
remove_account_link_desc=A remoção de uma conta vinculada revogará o acesso dessa conta à sua conta do Gitea. Quer continuar?
remove_account_link_success=A conta vinculada foi removida.
Expand Down
2 changes: 1 addition & 1 deletion routers/private/hook_proc_receive.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func HookProcReceive(ctx *gitea_context.PrivateContext) {
return
}

results := agit.ProcRecive(ctx, opts)
results := agit.ProcReceive(ctx, opts)
if ctx.Written() {
return
}
Expand Down
4 changes: 2 additions & 2 deletions services/agit/agit.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
pull_service "code.gitea.io/gitea/services/pull"
)

// ProcRecive handle proc receive work
func ProcRecive(ctx *context.PrivateContext, opts *private.HookOptions) []private.HookProcReceiveRefResult {
// ProcReceive handle proc receive work
func ProcReceive(ctx *context.PrivateContext, opts *private.HookOptions) []private.HookProcReceiveRefResult {
// TODO: Add more options?
var (
topicBranch string
Expand Down
Loading

0 comments on commit fb9ea68

Please sign in to comment.