From b73e4216463632ead1b5bcf8b12ae50e0bcfe6c5 Mon Sep 17 00:00:00 2001 From: GiteaBot Date: Sun, 1 Aug 2021 00:07:51 +0000 Subject: [PATCH 1/7] [skip ci] Updated translations via Crowdin --- options/locale/locale_pt-PT.ini | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/options/locale/locale_pt-PT.ini b/options/locale/locale_pt-PT.ini index 5039f004f81e..393072566f11 100644 --- a/options/locale/locale_pt-PT.ini +++ b/options/locale/locale_pt-PT.ini @@ -1040,6 +1040,7 @@ editor.require_signed_commit=O ramo requer um cometimento assinado commits.desc=Navegar pelo histórico de modificações no código fonte. commits.commits=Cometimentos commits.no_commits=Não há cometimentos em comum. '%s' e '%s' têm históricos completamente diferentes. +commits.nothing_to_compare=Estes ramos são iguais. commits.search=Procurar cometimentos… commits.search.tooltip=Pode prefixar palavras-chave com "author:", "committer:", "after:", ou "before:". Por exemplo: "revert author:Alice before:2019-04-01". commits.find=Procurar @@ -1828,8 +1829,8 @@ settings.event_pull_request_review=Pedido de integração revisto settings.event_pull_request_review_desc=Pedido de integração aprovado, rejeitado ou comentado na revisão. settings.event_pull_request_sync=Pedido de integração sincronizado settings.event_pull_request_sync_desc=Pedido de integração sincronizado. -settings.branch_filter=Filtro por ramo -settings.branch_filter_desc=Lista de permissões do ramo para eventos de envio e de criação e eliminação de ramos, especificada como um padrão glob. Se estiver em branco ou for *, serão reportados eventos para todos os ramos. Veja a documentação github.com/gobwas/glob para ver os detalhes da sintaxe. Exemplos: trunk, {trunk,release*}. +settings.branch_filter=Filtro de ramos +settings.branch_filter_desc=Lista dos ramos a serem considerados nos eventos de envio e de criação e eliminação de ramos, especificada como um padrão glob. Se estiver em branco ou for *, serão reportados eventos para todos os ramos. Veja a documentação github.com/gobwas/glob para ver os detalhes da sintaxe. Exemplos: trunk, {trunk,release*}. settings.active=Em funcionamento settings.active_helper=Informação sobre eventos despoletados será enviada para o URL deste automatismo web. settings.add_hook_success=O automatismo web foi adicionado. From e3b6526922367db57698025f4e11066f3ecff32c Mon Sep 17 00:00:00 2001 From: zeripath Date: Sun, 1 Aug 2021 15:33:02 +0100 Subject: [PATCH 2/7] Use node:16.5 for frontend instead of node:16 (#16591) * Disable frontend testing Jest does not appear to work on the latest node 16.6.0 and fails with an inscrutable message. I have been unable to work out what the problem is. This PR simply disables the test-frontend part in the makefile. Another alternative would be to drop node to node 14 - which is the LTS for node. Signed-off-by: Andrew Thornton * actually just tell on 16.5 instead Signed-off-by: Andrew Thornton * Use node 16.5 instead of 16 Signed-off-by: Andrew Thornton --- .drone.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index c12138989bd9..65b239fb6f72 100644 --- a/.drone.yml +++ b/.drone.yml @@ -15,12 +15,12 @@ trigger: steps: - name: deps-frontend pull: always - image: node:16 + image: node:16.5 commands: - make node_modules - name: lint-frontend - image: node:16 + image: node:16.5 commands: - make lint-frontend depends_on: [deps-frontend] @@ -58,7 +58,7 @@ steps: TAGS: bindata gogit sqlite sqlite_unlock_notify - name: checks-frontend - image: node:16 + image: node:16.5 commands: - make checks-frontend depends_on: [deps-frontend] @@ -71,13 +71,13 @@ steps: depends_on: [lint-backend] - name: test-frontend - image: node:16 + image: node:16.5 commands: - make test-frontend depends_on: [lint-frontend] - name: build-frontend - image: node:16 + image: node:16.5 commands: - make frontend depends_on: [test-frontend] From d686d7b05231ee43d6901317208c1dd851dacfa9 Mon Sep 17 00:00:00 2001 From: Lars Hvam Date: Sun, 1 Aug 2021 18:28:05 +0200 Subject: [PATCH 3/7] =?UTF-8?q?Fix=20swagger=20doc=20by=20rename=20repoAdd?= =?UTF-8?q?Top=C3=ADc=20to=20repoAddTopic=20(#16580)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Swagger API: rename repoAddTopíc to repoAddTopic This changes the operationId to only contain 7 bit ascii, note "í" instead of "i" --- routers/api/v1/repo/topic.go | 2 +- templates/swagger/v1_json.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/routers/api/v1/repo/topic.go b/routers/api/v1/repo/topic.go index 14712f536f8f..7646eaf82e33 100644 --- a/routers/api/v1/repo/topic.go +++ b/routers/api/v1/repo/topic.go @@ -126,7 +126,7 @@ func UpdateTopics(ctx *context.APIContext) { // AddTopic adds a topic name to a repo func AddTopic(ctx *context.APIContext) { - // swagger:operation PUT /repos/{owner}/{repo}/topics/{topic} repository repoAddTopíc + // swagger:operation PUT /repos/{owner}/{repo}/topics/{topic} repository repoAddTopic // --- // summary: Add a topic to a repository // produces: diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 238265fd7e0d..d97ec5ff2d7b 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -9651,7 +9651,7 @@ "repository" ], "summary": "Add a topic to a repository", - "operationId": "repoAddTopíc", + "operationId": "repoAddTopic", "parameters": [ { "type": "string", From e51c73ae5c03c83256d48cdcd0ca9cbdbf7a5222 Mon Sep 17 00:00:00 2001 From: zeripath Date: Sun, 1 Aug 2021 18:04:32 +0100 Subject: [PATCH 4/7] Fix 500 on first wiki page (#16586) * Fix 500 on first wiki page There is a mistake in #16319 and #16487 which means that the first time a wiki page is created a 500 is reported because the `master` branch is not in existence in that wiki yet. This PR simply checks for this error and returns not found. Fix #16584 Signed-off-by: Andrew Thornton --- services/wiki/wiki.go | 3 +++ services/wiki/wiki_test.go | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/services/wiki/wiki.go b/services/wiki/wiki.go index f1632c6bf7aa..e1590f461ef2 100644 --- a/services/wiki/wiki.go +++ b/services/wiki/wiki.go @@ -90,6 +90,9 @@ func prepareWikiFileName(gitRepo *git.Repository, wikiName string) (bool, string // Look for both files filesInIndex, err := gitRepo.LsTree("master", unescaped, escaped) if err != nil { + if strings.Contains(err.Error(), "Not a valid object name master") { + return false, escaped, nil + } log.Error("%v", err) return false, escaped, err } diff --git a/services/wiki/wiki_test.go b/services/wiki/wiki_test.go index a1614b509c2b..6c861d556a7f 100644 --- a/services/wiki/wiki_test.go +++ b/services/wiki/wiki_test.go @@ -5,11 +5,15 @@ package wiki import ( + "io/ioutil" + "os" "path/filepath" "testing" "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/git" + "code.gitea.io/gitea/modules/util" + "github.com/stretchr/testify/assert" ) @@ -261,3 +265,28 @@ func TestPrepareWikiFileName(t *testing.T) { }) } } + +func TestPrepareWikiFileName_FirstPage(t *testing.T) { + models.PrepareTestEnv(t) + + // Now create a temporaryDirectory + tmpDir, err := ioutil.TempDir("", "empty-wiki") + assert.NoError(t, err) + defer func() { + if _, err := os.Stat(tmpDir); !os.IsNotExist(err) { + _ = util.RemoveAll(tmpDir) + } + }() + + err = git.InitRepository(tmpDir, true) + assert.NoError(t, err) + + gitRepo, err := git.OpenRepository(tmpDir) + defer gitRepo.Close() + assert.NoError(t, err) + + existence, newWikiPath, err := prepareWikiFileName(gitRepo, "Home") + assert.False(t, existence) + assert.NoError(t, err) + assert.Equal(t, "Home.md", newWikiPath) +} From 48c7c880b8fcf8e5d8495e66392e787bd7209b8c Mon Sep 17 00:00:00 2001 From: zeripath Date: Sun, 1 Aug 2021 21:44:15 +0100 Subject: [PATCH 5/7] Swagger AccessToken fixes (#16574) There is a subtle problem with the Swagger definition for AccessTokens which causes autogeneration of APIs for these endpoints to fail. This PR corrects these errors. Ref: https://github.com/zeripath/java-gitea-api/issues/4 Signed-off-by: Andrew Thornton Co-authored-by: techknowlogick --- routers/api/v1/swagger/app.go | 7 ++++++ routers/api/v1/swagger/options.go | 3 +++ routers/api/v1/user/app.go | 9 ++----- templates/swagger/v1_json.tmpl | 39 ++++++++++++------------------- 4 files changed, 27 insertions(+), 31 deletions(-) diff --git a/routers/api/v1/swagger/app.go b/routers/api/v1/swagger/app.go index 8be2c855749a..9783abe1a082 100644 --- a/routers/api/v1/swagger/app.go +++ b/routers/api/v1/swagger/app.go @@ -14,3 +14,10 @@ type swaggerResponseOAuth2Application struct { // in:body Body api.OAuth2Application `json:"body"` } + +// AccessToken represents an API access token. +// swagger:response AccessToken +type swaggerResponseAccessToken struct { + // in:body + Body api.AccessToken `json:"body"` +} diff --git a/routers/api/v1/swagger/options.go b/routers/api/v1/swagger/options.go index 0ae96a920354..3f0c6e2d524c 100644 --- a/routers/api/v1/swagger/options.go +++ b/routers/api/v1/swagger/options.go @@ -164,6 +164,9 @@ type swaggerParameterBodies struct { // in:body CreateTagOption api.CreateTagOption + // in:body + CreateAccessTokenOption api.CreateAccessTokenOption + // in:body UserSettingsOptions api.UserSettingsOptions } diff --git a/routers/api/v1/user/app.go b/routers/api/v1/user/app.go index 9f355a828950..afd209f2f079 100644 --- a/routers/api/v1/user/app.go +++ b/routers/api/v1/user/app.go @@ -76,15 +76,10 @@ func CreateAccessToken(ctx *context.APIContext) { // description: username of user // type: string // required: true - // - name: accessToken + // - name: userCreateToken // in: body // schema: - // type: object - // required: - // - name - // properties: - // name: - // type: string + // "$ref": "#/definitions/CreateAccessTokenOption" // responses: // "201": // "$ref": "#/responses/AccessToken" diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index d97ec5ff2d7b..a1d92abec7a8 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -11917,18 +11917,10 @@ "required": true }, { - "name": "accessToken", + "name": "userCreateToken", "in": "body", "schema": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - } - } + "$ref": "#/definitions/CreateAccessTokenOption" } } ], @@ -12654,6 +12646,17 @@ }, "x-go-package": "code.gitea.io/gitea/modules/structs" }, + "CreateAccessTokenOption": { + "description": "CreateAccessTokenOption options when create access token", + "type": "object", + "properties": { + "name": { + "type": "string", + "x-go-name": "Name" + } + }, + "x-go-package": "code.gitea.io/gitea/modules/structs" + }, "CreateBranchProtectionOption": { "description": "CreateBranchProtectionOption options for creating a branch protection", "type": "object", @@ -17045,20 +17048,8 @@ "responses": { "AccessToken": { "description": "AccessToken represents an API access token.", - "headers": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "sha1": { - "type": "string" - }, - "token_last_eight": { - "type": "string" - } + "schema": { + "$ref": "#/definitions/AccessToken" } }, "AccessTokenList": { From 3375e7658e00fe8764a8b7fa7016d85753686739 Mon Sep 17 00:00:00 2001 From: GiteaBot Date: Mon, 2 Aug 2021 00:07:40 +0000 Subject: [PATCH 6/7] [skip ci] Updated translations via Crowdin --- options/locale/locale_ja-JP.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/options/locale/locale_ja-JP.ini b/options/locale/locale_ja-JP.ini index 8f4bab2e677a..651093ed23ba 100644 --- a/options/locale/locale_ja-JP.ini +++ b/options/locale/locale_ja-JP.ini @@ -1040,6 +1040,7 @@ editor.require_signed_commit=ブランチでは署名されたコミットが必 commits.desc=ソースコードの変更履歴を参照します。 commits.commits=コミット commits.no_commits=共通のコミットはありません。 '%s' と '%s' の履歴はすべて異なっています。 +commits.nothing_to_compare=二つのブランチは同じ内容です。 commits.search=コミットの検索… commits.search.tooltip=キーワード "author:"、"committer:"、"after:"、"before:" を付けて指定できます。 例 "revert author:Alice before:2019-04-01" commits.find=検索 From 24366eddec0915d92165f1a45c01ed2a5bdeac8e Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 2 Aug 2021 03:47:29 +0200 Subject: [PATCH 7/7] [CI] Use node v14 instead of node v16 untill it will pass again (#16595) * for CI release: use node 14 (lts) to build until 16 do fail * all in for node v14.x --- .drone.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.drone.yml b/.drone.yml index 65b239fb6f72..f4a6d31625fa 100644 --- a/.drone.yml +++ b/.drone.yml @@ -15,12 +15,12 @@ trigger: steps: - name: deps-frontend pull: always - image: node:16.5 + image: node:14 commands: - make node_modules - name: lint-frontend - image: node:16.5 + image: node:14 commands: - make lint-frontend depends_on: [deps-frontend] @@ -58,7 +58,7 @@ steps: TAGS: bindata gogit sqlite sqlite_unlock_notify - name: checks-frontend - image: node:16.5 + image: node:14 commands: - make checks-frontend depends_on: [deps-frontend] @@ -71,13 +71,13 @@ steps: depends_on: [lint-backend] - name: test-frontend - image: node:16.5 + image: node:14 commands: - make test-frontend depends_on: [lint-frontend] - name: build-frontend - image: node:16.5 + image: node:14 commands: - make frontend depends_on: [test-frontend] @@ -514,7 +514,7 @@ steps: pull: always image: techknowlogick/xgo:go-1.16.x commands: - - curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs + - curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt-get install -y nodejs - export PATH=$PATH:$GOPATH/bin - make release environment: @@ -610,7 +610,7 @@ steps: pull: always image: techknowlogick/xgo:go-1.16.x commands: - - curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs + - curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt-get install -y nodejs - export PATH=$PATH:$GOPATH/bin - make release environment: