mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-04-23 03:21:35 +02:00
Merge branch 'forgejo' into report_abuse
This commit is contained in:
commit
d40a6fc666
42 changed files with 183 additions and 64 deletions
|
@ -24,7 +24,7 @@ jobs:
|
|||
- uses: https://data.forgejo.org/actions/checkout@v4
|
||||
- uses: ./.forgejo/workflows-composite/setup-env
|
||||
- run: su forgejo -c 'make deps-backend deps-tools'
|
||||
- run: su forgejo -c 'make --always-make -j$(nproc) lint-backend tidy-check swagger-check fmt-check swagger-validate' # ensure the "go-licenses" make target runs
|
||||
- run: su forgejo -c 'make --always-make -j$(nproc) lint-backend tidy-check swagger-check lint-swagger fmt-check swagger-validate' # ensure the "go-licenses" make target runs
|
||||
- uses: ./.forgejo/workflows-composite/build-backend
|
||||
frontend-checks:
|
||||
if: vars.ROLE == 'forgejo-coding' || vars.ROLE == 'forgejo-testing'
|
||||
|
|
18
Makefile
18
Makefile
|
@ -46,9 +46,9 @@ SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.31.0 # renova
|
|||
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
|
||||
GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1.6.0 # renovate: datasource=go
|
||||
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1 # renovate: datasource=go
|
||||
DEADCODE_PACKAGE ?= golang.org/x/tools/cmd/deadcode@v0.29.0 # renovate: datasource=go
|
||||
DEADCODE_PACKAGE ?= golang.org/x/tools/cmd/deadcode@v0.30.0 # renovate: datasource=go
|
||||
GOMOCK_PACKAGE ?= go.uber.org/mock/mockgen@v0.4.0 # renovate: datasource=go
|
||||
GOPLS_PACKAGE ?= golang.org/x/tools/gopls@v0.17.1 # renovate: datasource=go
|
||||
GOPLS_PACKAGE ?= golang.org/x/tools/gopls@v0.18.0 # renovate: datasource=go
|
||||
RENOVATE_NPM_PACKAGE ?= renovate@39.171.2 # renovate: datasource=docker packageName=data.forgejo.org/renovate/renovate
|
||||
|
||||
# https://github.com/disposable-email-domains/disposable-email-domains/commits/main/
|
||||
|
@ -173,7 +173,7 @@ GO_DIRS := build cmd models modules routers services tests
|
|||
WEB_DIRS := web_src/js web_src/css
|
||||
|
||||
STYLELINT_FILES := web_src/css web_src/js/components/*.vue
|
||||
SPELLCHECK_FILES := $(GO_DIRS) $(WEB_DIRS) docs/content templates options/locale/locale_en-US.ini .github $(wildcard *.go *.js *.ts *.vue *.md *.yml *.yaml *.toml)
|
||||
SPELLCHECK_FILES := $(GO_DIRS) $(WEB_DIRS) docs/content templates options/locale/locale_en-US.ini .github $(wildcard *.go *.js *.ts *.vue *.md *.yml *.yaml)
|
||||
|
||||
GO_SOURCES := $(wildcard *.go)
|
||||
GO_SOURCES += $(shell find $(GO_DIRS) -type f -name "*.go" ! -path modules/options/bindata.go ! -path modules/public/bindata.go ! -path modules/templates/bindata.go)
|
||||
|
@ -431,16 +431,16 @@ lint-backend: lint-go lint-go-vet lint-editorconfig lint-renovate lint-locale li
|
|||
lint-backend-fix: lint-go-fix lint-go-vet lint-editorconfig lint-disposable-emails-fix
|
||||
|
||||
.PHONY: lint-codespell
|
||||
lint-codespell:
|
||||
codespell
|
||||
lint-codespell: deps-py
|
||||
@poetry run codespell
|
||||
|
||||
.PHONY: lint-codespell-fix
|
||||
lint-codespell-fix:
|
||||
codespell -w
|
||||
lint-codespell-fix: deps-py
|
||||
@poetry run codespell -w
|
||||
|
||||
.PHONY: lint-codespell-fix-i
|
||||
lint-codespell-fix-i:
|
||||
codespell -w -i 3 -C 2
|
||||
lint-codespell-fix-i: deps-py
|
||||
@poetry run codespell -w -i 3 -C 2
|
||||
|
||||
.PHONY: lint-js
|
||||
lint-js: node_modules
|
||||
|
|
2
assets/go-licenses.json
generated
2
assets/go-licenses.json
generated
|
@ -717,7 +717,7 @@
|
|||
{
|
||||
"name": "github.com/meilisearch/meilisearch-go",
|
||||
"path": "github.com/meilisearch/meilisearch-go/LICENSE",
|
||||
"licenseText": "MIT License\n\nCopyright (c) 2020-2024 Meili SAS\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
|
||||
"licenseText": "MIT License\n\nCopyright (c) 2020-2025 Meili SAS\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
|
||||
},
|
||||
{
|
||||
"name": "github.com/mholt/acmez/v3",
|
||||
|
|
|
@ -1941,7 +1941,7 @@ LEVEL = Info
|
|||
;ENABLED = true
|
||||
;;
|
||||
;; Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
|
||||
;ALLOWED_TYPES = .avif,.cpuprofile,.csv,.dmp,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.json,.jsonc,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.patch,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip
|
||||
;ALLOWED_TYPES = .avif,.cpuprofile,.csv,.dmp,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.json,.jsonc,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.patch,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.webp,.xls,.xlsx,.zip
|
||||
;;
|
||||
;; Max size of each file. Defaults to 2048MB
|
||||
;MAX_SIZE = 2048
|
||||
|
|
|
@ -14,6 +14,7 @@ import wc from 'eslint-plugin-wc';
|
|||
import globals from 'globals';
|
||||
import vue from 'eslint-plugin-vue';
|
||||
import vueScopedCss from 'eslint-plugin-vue-scoped-css';
|
||||
import toml from 'eslint-plugin-toml';
|
||||
import tseslint from 'typescript-eslint';
|
||||
|
||||
export default tseslint.config(
|
||||
|
@ -35,6 +36,7 @@ export default tseslint.config(
|
|||
sonarjs,
|
||||
unicorn,
|
||||
playwright,
|
||||
toml,
|
||||
'vitest-globals': vitestGlobals,
|
||||
vue,
|
||||
'vue-scoped-css': vueScopedCss,
|
||||
|
@ -1166,5 +1168,5 @@ export default tseslint.config(
|
|||
'vue-scoped-css/enforce-style-type': [0],
|
||||
},
|
||||
},
|
||||
|
||||
...toml.configs['flat/recommended'],
|
||||
);
|
||||
|
|
8
go.mod
8
go.mod
|
@ -26,7 +26,7 @@ require (
|
|||
github.com/alecthomas/chroma/v2 v2.15.0
|
||||
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb
|
||||
github.com/blevesearch/bleve/v2 v2.4.4
|
||||
github.com/buildkite/terminal-to-html/v3 v3.16.5
|
||||
github.com/buildkite/terminal-to-html/v3 v3.16.6
|
||||
github.com/caddyserver/certmagic v0.21.7
|
||||
github.com/chi-middleware/proxy v1.1.1
|
||||
github.com/djherbis/buffer v1.2.0
|
||||
|
@ -73,7 +73,7 @@ require (
|
|||
github.com/markbates/goth v1.80.0
|
||||
github.com/mattn/go-isatty v0.0.20
|
||||
github.com/mattn/go-sqlite3 v1.14.24
|
||||
github.com/meilisearch/meilisearch-go v0.29.0
|
||||
github.com/meilisearch/meilisearch-go v0.31.0
|
||||
github.com/mholt/archiver/v3 v3.5.1
|
||||
github.com/microcosm-cc/bluemonday v1.0.27
|
||||
github.com/minio/minio-go/v7 v7.0.85
|
||||
|
@ -194,7 +194,7 @@ require (
|
|||
github.com/go-openapi/swag v0.22.7 // indirect
|
||||
github.com/go-webauthn/x v0.1.14 // indirect
|
||||
github.com/goccy/go-json v0.10.4 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
|
||||
github.com/golang/geo v0.0.0-20230421003525-6adc56603217 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
|
@ -217,7 +217,7 @@ require (
|
|||
github.com/kevinburke/ssh_config v1.2.0 // indirect
|
||||
github.com/klauspost/pgzip v1.2.6 // indirect
|
||||
github.com/libdns/libdns v0.2.2 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mailru/easyjson v0.9.0 // indirect
|
||||
github.com/markbates/going v1.0.3 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||
|
|
16
go.sum
16
go.sum
|
@ -700,7 +700,6 @@ github.com/alexbrainman/sspi v0.0.0-20210105120005-909beea2cc74 h1:Kk6a4nehpJ3Uu
|
|||
github.com/alexbrainman/sspi v0.0.0-20210105120005-909beea2cc74/go.mod h1:cEWa1LVoE5KvSD9ONXsZrj0z6KqySlCCNKHlLzbqAt4=
|
||||
github.com/andybalholm/brotli v1.0.1/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=
|
||||
github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
|
||||
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
|
||||
github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA=
|
||||
github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA=
|
||||
github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kktS1LM=
|
||||
|
@ -768,8 +767,8 @@ github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
|
|||
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
|
||||
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
|
||||
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
|
||||
github.com/buildkite/terminal-to-html/v3 v3.16.5 h1:s/8NElw/Yhm09jKdMq4nY31tjcFMgHukjLfPrqxApcQ=
|
||||
github.com/buildkite/terminal-to-html/v3 v3.16.5/go.mod h1:PgzeBymbRFC8I2m46Sci3S18AbwonEgpaz3TGhD7EPs=
|
||||
github.com/buildkite/terminal-to-html/v3 v3.16.6 h1:QKHWPjAnKQnV1hVG/Nb2TwYDr4pliSbvCQDENk8EaJo=
|
||||
github.com/buildkite/terminal-to-html/v3 v3.16.6/go.mod h1:PgzeBymbRFC8I2m46Sci3S18AbwonEgpaz3TGhD7EPs=
|
||||
github.com/caddyserver/certmagic v0.21.7 h1:66KJioPFJwttL43KYSWk7ErSmE6LfaJgCQuhm8Sg6fg=
|
||||
github.com/caddyserver/certmagic v0.21.7/go.mod h1:LCPG3WLxcnjVKl/xpjzM0gqh0knrKKKiO5WVttX2eEI=
|
||||
github.com/caddyserver/zerossl v0.1.3 h1:onS+pxp3M8HnHpN5MMbOMyNjmTheJyWRaZYwn+YTAyA=
|
||||
|
@ -981,8 +980,8 @@ github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f h1:3BSP1Tbs2djlpprl7w
|
|||
github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f/go.mod h1:Pcatq5tYkCW2Q6yrR2VRHlbHpZ/R4/7qyL1TCF7vl14=
|
||||
github.com/gogs/go-gogs-client v0.0.0-20210131175652-1d7215cd8d85 h1:UjoPNDAQ5JPCjlxoJd6K8ALZqSDDhk2ymieAZOVaDg0=
|
||||
github.com/gogs/go-gogs-client v0.0.0-20210131175652-1d7215cd8d85/go.mod h1:fR6z1Ie6rtF7kl/vBYMfgD5/G5B1blui7z426/sj2DU=
|
||||
github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
|
||||
github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
||||
github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo=
|
||||
github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
||||
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA=
|
||||
|
@ -1233,8 +1232,9 @@ github.com/lunny/vfsgen v0.0.0-20220105142115-2c99e1ffdfa0/go.mod h1:JEfTc3+2DF9
|
|||
github.com/lyft/protoc-gen-star v0.6.0/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA=
|
||||
github.com/lyft/protoc-gen-star v0.6.1/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA=
|
||||
github.com/lyft/protoc-gen-star/v2 v2.0.1/go.mod h1:RcCdONR2ScXaYnQC5tUzxzlpA3WVYF7/opLeUgcQs/o=
|
||||
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
|
||||
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
|
||||
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
|
||||
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
|
||||
github.com/markbates/going v1.0.3 h1:mY45T5TvW+Xz5A6jY7lf4+NLg9D8+iuStIHyR7M8qsE=
|
||||
github.com/markbates/going v1.0.3/go.mod h1:fQiT6v6yQar9UD6bd/D4Z5Afbk9J6BBVBtLiyY4gp2o=
|
||||
github.com/markbates/goth v1.80.0 h1:NnvatczZDzOs1hn9Ug+dVYf2Viwwkp/ZDX5K+GLjan8=
|
||||
|
@ -1251,8 +1251,8 @@ github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh
|
|||
github.com/mattn/go-sqlite3 v1.14.14/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||
github.com/mattn/go-sqlite3 v1.14.24 h1:tpSp2G2KyMnnQu99ngJ47EIkWVmliIizyZBfPrBWDRM=
|
||||
github.com/mattn/go-sqlite3 v1.14.24/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||
github.com/meilisearch/meilisearch-go v0.29.0 h1:HZ9NEKN59USINQ/DXJge/aaXq8IrsKbXGTdAoBaaDz4=
|
||||
github.com/meilisearch/meilisearch-go v0.29.0/go.mod h1:2cRCAn4ddySUsFfNDLVPod/plRibQsJkXF/4gLhxbOk=
|
||||
github.com/meilisearch/meilisearch-go v0.31.0 h1:yZRhY1qJqdH8h6GFZALGtkDLyj8f9v5aJpsNMyrUmnY=
|
||||
github.com/meilisearch/meilisearch-go v0.31.0/go.mod h1:aNtyuwurDg/ggxQIcKqWH6G9g2ptc8GyY7PLY4zMn/g=
|
||||
github.com/mholt/acmez/v3 v3.0.1 h1:4PcjKjaySlgXK857aTfDuRbmnM5gb3Ruz3tvoSJAUp8=
|
||||
github.com/mholt/acmez/v3 v3.0.1/go.mod h1:L1wOU06KKvq7tswuMDwKdcHeKpFFgkppZy/y0DFxagQ=
|
||||
github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk=
|
||||
|
|
|
@ -99,6 +99,7 @@ func GetUserOrgsList(ctx context.Context, user *user_model.User) ([]*MinimalOrg,
|
|||
if err := db.GetEngine(ctx).Select(columnsStr).
|
||||
Table("user").
|
||||
Where(builder.In("`user`.`id`", queryUserOrgIDs(user.ID, true))).
|
||||
OrderBy("`user`.lower_name ASC").
|
||||
Find(&orgs); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
package organization_test
|
||||
|
||||
import (
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models/db"
|
||||
|
@ -74,3 +76,15 @@ func TestGetUserOrgsList(t *testing.T) {
|
|||
assert.EqualValues(t, 2, orgs[0].NumRepos)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetUserOrgsListSorting(t *testing.T) {
|
||||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
orgs, err := organization.GetUserOrgsList(db.DefaultContext, &user_model.User{ID: 1})
|
||||
require.NoError(t, err)
|
||||
|
||||
isSorted := slices.IsSortedFunc(orgs, func(a, b *organization.MinimalOrg) int {
|
||||
return strings.Compare(strings.ToLower(a.Name), strings.ToLower(b.Name))
|
||||
})
|
||||
|
||||
assert.True(t, isSorted)
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ func (r *Release) LoadArchiveDownloadCount(ctx context.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// GetTotalDownloadCount returns the summary of all dowload count of files attached to the release
|
||||
// GetTotalDownloadCount returns the summary of all download count of files attached to the release
|
||||
func (r *Release) GetTotalDownloadCount(ctx context.Context) (int64, error) {
|
||||
var archiveCount int64
|
||||
if !r.HideArchiveLinks {
|
||||
|
@ -194,7 +194,7 @@ func (r *Release) SummaryCardURL() string {
|
|||
return fmt.Sprintf("%s/releases/summary-card/%s", r.Repo.HTMLURL(), util.PathEscapeSegments(r.TagName))
|
||||
}
|
||||
|
||||
// DisplayName retruns the name of the release
|
||||
// DisplayName returns the name of the release
|
||||
func (r *Release) DisplayName() string {
|
||||
if r.IsTag && r.Title == "" {
|
||||
return r.TagName
|
||||
|
|
|
@ -69,7 +69,7 @@ func init() {
|
|||
}
|
||||
|
||||
// GetUserRedirect returns the redirect for a given username, this is a
|
||||
// case-insenstive operation.
|
||||
// case-insensitive operation.
|
||||
func GetUserRedirect(ctx context.Context, userName string) (*Redirect, error) {
|
||||
userName = strings.ToLower(userName)
|
||||
redirect := &Redirect{LowerName: userName}
|
||||
|
|
|
@ -665,7 +665,7 @@ func TestEmailTo(t *testing.T) {
|
|||
{"Hi Its <Mee>", "ee@mail.box", `"Hi Its Mee" <ee@mail.box>`},
|
||||
{"Sinéad.O'Connor", "sinead.oconnor@gmail.com", "=?utf-8?b?U2luw6lhZC5PJ0Nvbm5vcg==?= <sinead.oconnor@gmail.com>"},
|
||||
{"Æsir", "aesir@gmx.de", "=?utf-8?q?=C3=86sir?= <aesir@gmx.de>"},
|
||||
{"new😀user", "new.user@alo.com", "=?utf-8?q?new=F0=9F=98=80user?= <new.user@alo.com>"}, // codespell-ignore
|
||||
{"new😀user", "new.user@alo.com", "=?utf-8?q?new=F0=9F=98=80user?= <new.user@alo.com>"}, // codespell:ignore
|
||||
{`"quoted"`, "quoted@test.com", `"quoted" <quoted@test.com>`},
|
||||
{`gusted`, "gusted@test.com", `"gusted" <gusted@test.com>`},
|
||||
{`Joe Q. Public`, "john.q.public@example.com", `"Joe Q. Public" <john.q.public@example.com>`},
|
||||
|
|
|
@ -125,7 +125,7 @@ func GrepSearch(ctx context.Context, repo *Repository, search string, opts GrepO
|
|||
// (eg, global pattern = "src/**" and path = "node_modules/")
|
||||
|
||||
// FIXME: this is a bit too restrictive, and fails to consider cases where the
|
||||
// gloabally set include pattern refers to a file than a directory
|
||||
// globally set include pattern refers to a file than a directory
|
||||
// (eg, global pattern = "**.go" and path = "modules/git")
|
||||
exprMatched := false
|
||||
for _, expr := range setting.Indexer.IncludePatterns {
|
||||
|
|
|
@ -124,7 +124,7 @@ c=2
|
|||
{
|
||||
name: "test.gradle.kts",
|
||||
code: "@file:Suppress(\"UnstableApiUsage\")",
|
||||
want: lines("<span class=\"nd\">@file</span><span class=\"p\">:</span><span class=\"n\">Suppress</span><span class=\"p\">(</span><span class=\"s2\">"</span><span class=\"s2\">UnstableApiUsage</span><span class=\"s2\">"</span><span class=\"p\">)</span>"),
|
||||
want: lines("<span class=\"nd\">@file</span><span class=\"p\">:</span><span class=\"n\">Suppress</span><span class=\"p\">(</span><span class=\"s2\">"</span><span class=\"s2\">UnstableApiUsage</span><span class=\"s2\">"</span><span class=\"p\">)</span>"), // codespell:ignore
|
||||
lexerName: "Kotlin",
|
||||
},
|
||||
}
|
||||
|
|
|
@ -31,19 +31,19 @@ func (t *PathHierarchyTokenizer) Tokenize(input []byte) analysis.TokenStream {
|
|||
rv := make(analysis.TokenStream, 0, 8)
|
||||
count, off := 1, 0
|
||||
|
||||
// iterate till all directory seperators
|
||||
// iterate till all directory separators
|
||||
for i := bytes.IndexRune(input[off:], '/'); i != -1; i = bytes.IndexRune(input[off:], '/') {
|
||||
// the index is relative to input[offest...]
|
||||
// add this index to the accumlated offset to get the index of the current seperator in input[0...]
|
||||
// the index is relative to input[offset...]
|
||||
// add this index to the accumulated offset to get the index of the current separator in input[0...]
|
||||
off += i
|
||||
rv = append(rv, &analysis.Token{
|
||||
Term: input[:off], // take the slice, input[0...index of seperator]
|
||||
Term: input[:off], // take the slice, input[0...index of separator]
|
||||
Start: 0,
|
||||
End: off,
|
||||
Position: count,
|
||||
Type: analysis.AlphaNumeric,
|
||||
})
|
||||
// increment the offset after considering the seperator
|
||||
// increment the offset after considering the separator
|
||||
off++
|
||||
count++
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ import (
|
|||
// NumericEqualityQuery generates a numeric equality query for the given value and field
|
||||
func NumericEqualityQuery(value int64, field string) *query.NumericRangeQuery {
|
||||
f := float64(value)
|
||||
tru := true // codespell-ignore
|
||||
q := bleve.NewNumericRangeInclusiveQuery(&f, &f, &tru, &tru) // codespell-ignore
|
||||
tru := true // codespell:ignore
|
||||
q := bleve.NewNumericRangeInclusiveQuery(&f, &f, &tru, &tru) // codespell:ignore
|
||||
q.SetField(field)
|
||||
return q
|
||||
}
|
||||
|
|
|
@ -471,7 +471,7 @@ func TestColorPreview(t *testing.T) {
|
|||
// no backticks
|
||||
"rgb(166, 32, 64)",
|
||||
// typo
|
||||
"`hsI(0, 100%, 50%)`", // codespell-ignore
|
||||
"`hsI(0, 100%, 50%)`", // codespell:ignore
|
||||
// looks like a color but not really
|
||||
"`hsl(40, 60, 80)`",
|
||||
}
|
||||
|
|
|
@ -89,7 +89,6 @@ type CreatePullReviewComment struct {
|
|||
NewLineNum int64 `json:"new_position"`
|
||||
}
|
||||
|
||||
// CreatePullReviewCommentOptions are options to create a pull review comment
|
||||
type CreatePullReviewCommentOptions CreatePullReviewComment
|
||||
|
||||
// SubmitPullReviewOptions are options to submit a pending pull review
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
zig-cache/
|
||||
.zig-cache/
|
||||
zig-out/
|
||||
build/
|
||||
build-*/
|
||||
|
|
|
@ -171,7 +171,7 @@ type_tooltip = Search type
|
|||
fuzzy = Fuzzy
|
||||
fuzzy_tooltip = Include results that also match the search term closely
|
||||
union = Union
|
||||
union_tooltip = Include results that match any of the whitespace seperated keywords
|
||||
union_tooltip = Include results that match any of the whitespace separated keywords
|
||||
exact = Exact
|
||||
exact_tooltip = Include only results that match the exact search term
|
||||
regexp = RegExp
|
||||
|
@ -1190,8 +1190,8 @@ template.issue_labels = Issue labels
|
|||
template.one_item = Must select at least one template item
|
||||
template.invalid = Must select a template repository
|
||||
|
||||
archive.title = This repository is archived. You can view files and clone it, but cannot push or open issues or pull requests.
|
||||
archive.title_date = This repository has been archived on %s. You can view files and clone it, but cannot push or open issues or pull requests.
|
||||
archive.title = This repository is archived. You can view files and clone it, but you cannot make any changes to the state of this repository, such as pushing and creating new issues, pull requests or comments.
|
||||
archive.title_date = This repository has been archived on %s. You can view files and clone it, but you cannot make any changes to the state of this repository, such as pushing and creating new issues, pull requests or comments.
|
||||
archive.issue.nocomment = This repository is archived. You cannot comment on issues.
|
||||
archive.pull.nocomment = This repository is archived. You cannot comment on pull requests.
|
||||
archive.pull.noreview = This repository is archived. You cannot review pull requests.
|
||||
|
|
53
package-lock.json
generated
53
package-lock.json
generated
|
@ -4,6 +4,7 @@
|
|||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "forgejo",
|
||||
"dependencies": {
|
||||
"@citation-js/core": "0.7.14",
|
||||
"@citation-js/plugin-bibtex": "0.7.16",
|
||||
|
@ -80,6 +81,7 @@
|
|||
"eslint-plugin-playwright": "2.1.0",
|
||||
"eslint-plugin-regexp": "2.7.0",
|
||||
"eslint-plugin-sonarjs": "3.0.1",
|
||||
"eslint-plugin-toml": "0.12.0",
|
||||
"eslint-plugin-unicorn": "56.0.1",
|
||||
"eslint-plugin-vitest-globals": "1.5.0",
|
||||
"eslint-plugin-vue": "9.32.0",
|
||||
|
@ -8379,6 +8381,28 @@
|
|||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-toml": {
|
||||
"version": "0.12.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-toml/-/eslint-plugin-toml-0.12.0.tgz",
|
||||
"integrity": "sha512-+/wVObA9DVhwZB1nG83D2OAQRrcQZXy+drqUnFJKymqnmbnbfg/UPmEMCKrJNcEboUGxUjYrJlgy+/Y930mURQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"debug": "^4.1.1",
|
||||
"eslint-compat-utils": "^0.6.0",
|
||||
"lodash": "^4.17.19",
|
||||
"toml-eslint-parser": "^0.10.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ota-meshi"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-unicorn": {
|
||||
"version": "56.0.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-56.0.1.tgz",
|
||||
|
@ -15283,6 +15307,35 @@
|
|||
"integrity": "sha512-HeMHCO9yLPvP9k0apGSdPUWrUbLnxUKNFzgUoZp1PHCLploIX/4DSQ7V8H25ef+h4iO9n0he7ImfcndnN6nDrQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/toml-eslint-parser": {
|
||||
"version": "0.10.0",
|
||||
"resolved": "https://registry.npmjs.org/toml-eslint-parser/-/toml-eslint-parser-0.10.0.tgz",
|
||||
"integrity": "sha512-khrZo4buq4qVmsGzS5yQjKe/WsFvV8fGfOjDQN0q4iy9FjRfPWRgTFrU8u1R2iu/SfWLhY9WnCi4Jhdrcbtg+g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"eslint-visitor-keys": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ota-meshi"
|
||||
}
|
||||
},
|
||||
"node_modules/toml-eslint-parser/node_modules/eslint-visitor-keys": {
|
||||
"version": "3.4.3",
|
||||
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz",
|
||||
"integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/tr46": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"name": "forgejo",
|
||||
"type": "module",
|
||||
"engines": {
|
||||
"node": ">= 18.0.0"
|
||||
|
@ -80,6 +81,7 @@
|
|||
"eslint-plugin-regexp": "2.7.0",
|
||||
"eslint-plugin-sonarjs": "3.0.1",
|
||||
"eslint-plugin-unicorn": "56.0.1",
|
||||
"eslint-plugin-toml": "0.12.0",
|
||||
"eslint-plugin-vitest-globals": "1.5.0",
|
||||
"eslint-plugin-vue": "9.32.0",
|
||||
"eslint-plugin-vue-scoped-css": "2.9.0",
|
||||
|
|
|
@ -14,12 +14,11 @@ profile="golang"
|
|||
ignore="H005,H006,H013,H016,H020,H021,H030,H031"
|
||||
|
||||
[tool.codespell]
|
||||
skip = '.git,*.pdf,*.svg,package-lock.json,go.mod,locale,license,*.git,objects,*.fr-fr.*,*.de-de.*,*.css,go.sum,*.key,gitignore,pyproject.toml,diff_test.go,go-licenses.json,pyproject.toml,*.lock,venvs'
|
||||
skip = '.git,*.pdf,*.svg,package-lock.json,go.mod,locale,locale_next,license,*.git,objects,*.fr-fr.*,*.de-de.*,*.css,go.sum,*.key,gitignore,pyproject.toml,diff_test.go,go-licenses.json,pyproject.toml,*.lock,venvs,node_modules,plural_rules.go,testdata,disposable_email_domain_data.go'
|
||||
# precise hits for CamelCased words,various other curious cases which require regex to ignore
|
||||
# entire line or some portion of it
|
||||
# TODO: Resolve Treshold typo in API and remove from here
|
||||
ignore-regex = '(\b(Treshold|mx claus|commitT|ReadBy|#afile|respOne|commitI|[cC]rossReference|SMove|reVer|CheckIn|NotIn)\b|shouldbe\.|women’s.*womens|"emoji":.*|,bu,|assert\.Equal.*"fo\b|github\.com/unknwon|Copyright 2014 Unknwon|allowed\.noone|[hH]eadErr|atLeast|{"\\U.*)|Iif|FilterIn|.*codespell-ignore.*'
|
||||
#|.*(Maskenpflicht|Geimpft),.*)'
|
||||
ignore-regex = '(\b(Treshold|mx claus|commitT|ReadBy|#afile|respOne|commitI|[cC]rossReference|SMove|reVer|CheckIn|NotIn)\b|shouldbe\.|women’s.*womens|"emoji":.*|,bu,|assert\.Equal.*"fo\b|github\.com/unknwon|Copyright 2014 Unknwon|allowed\.noone|[hH]eadErr|atLeast|{"\\U.*)|Iif|FilterIn|ZiSe'
|
||||
# te - TreeEntry variable
|
||||
# commiter - wrong spelling but seems used in API
|
||||
# ALLWAYS - is a config var
|
||||
|
|
|
@ -430,7 +430,7 @@
|
|||
- [PR](https://codeberg.org/forgejo/forgejo/pulls/5651): <!--number 5651 --><!--line 0 --><!--description bGluayB0byBzZWN1cml0eSBwb2xpY3kgaW4gc2VjdXJpdHkudHh0-->link to security policy in security.txt<!--description-->
|
||||
- [PR](https://codeberg.org/forgejo/forgejo/pulls/5646): <!--number 5646 --><!--line 0 --><!--description Y2hvcmUocmVsZWFzZS1ub3Rlcyk6IG5vIG5lZWQgdG8gc3BlY2lmeSB0aGV5IGFyZSBkcmFmdA==-->chore(release-notes): no need to specify they are draft<!--description-->
|
||||
- [PR](https://codeberg.org/forgejo/forgejo/pulls/5644): <!--number 5644 --><!--line 0 --><!--description Y29uZjogSW1wcm92ZSBkZWxldGVfb2xkX2FjdGlvbnMgZGVzY3JpcHRpb24=-->conf: Improve delete_old_actions description<!--description-->
|
||||
- [PR](https://codeberg.org/forgejo/forgejo/pulls/5641): <!--number 5641 --><!--line 0 --><!--description bWFrZSBzeW5jcm9uaXplIHRhZ3MgdG8gZGF0YWJhc2UgaGFuZGxlIGFubm90ZWQgdGFncw==-->make synchronize tags to database handle annoted tags<!--description-->
|
||||
- [PR](https://codeberg.org/forgejo/forgejo/pulls/5641): <!--number 5641 --><!--line 0 --><!--description bWFrZSBzeW5jcm9uaXplIHRhZ3MgdG8gZGF0YWJhc2UgaGFuZGxlIGFubm90ZWQgdGFncw==-->make synchronize tags to database handle annotated tags<!--description-->
|
||||
- [PR](https://codeberg.org/forgejo/forgejo/pulls/5640): <!--number 5640 --><!--line 0 --><!--description UmV2ZXJ0ICJhZGQgZ2FwIGJldHdlZW4gYnJhbmNoIGRyb3Bkb3duIGFuZCBQUiBidXR0b24i-->Revert "add gap between branch dropdown and PR button"<!--description-->
|
||||
- [PR](https://codeberg.org/forgejo/forgejo/pulls/5638): <!--number 5638 --><!--line 0 --><!--description QmV0dGVyIG1lc3NhZ2VzIGZvciBjYXNlcyBvZiBwcml2YXRlIHByb2ZpbGVz-->Better messages for cases of private profiles<!--description-->
|
||||
- [PR](https://codeberg.org/forgejo/forgejo/pulls/5637): <!--number 5637 --><!--line 0 --><!--description ZmVhdChjaSk6IGFsbG93IG1hbnVhbCB0cmlnZ2VyaW5nIG9mIHRoZSB0ZXN0IHN1aXRl-->feat(ci): allow manual triggering of the test suite<!--description-->
|
||||
|
|
|
@ -19,7 +19,7 @@ See also the [dedicated blog post](https://forgejo.org/2025-02-release-v10-0-1/)
|
|||
- [PR](https://codeberg.org/forgejo/forgejo/pulls/6817) ([backported](https://codeberg.org/forgejo/forgejo/pulls/6832)): <!--number 6832 --><!--line 0 --><!--description Zml4OiBhdm9pZCB5LWF4aXMgY2xpcHBpbmcgZm9yIGJyYW5jaCBuYW1l-->fix: avoid y-axis clipping for branch name<!--description-->
|
||||
- [PR](https://codeberg.org/forgejo/forgejo/pulls/6646) ([backported](https://codeberg.org/forgejo/forgejo/pulls/6810)): <!--number 6810 --><!--line 0 --><!--description Y2k6IGZpeCBnbyB2ZXJzaW9uIGNoZWNr-->ci: fix go version check<!--description-->
|
||||
- [PR](https://codeberg.org/forgejo/forgejo/pulls/6808) ([backported](https://codeberg.org/forgejo/forgejo/pulls/6809)): <!--number 6809 --><!--line 0 --><!--description Y2hvcmUoaTE4bik6IGxpbnQgZXJyb3Jz-->chore(i18n): lint errors<!--description-->
|
||||
- [PR](https://codeberg.org/forgejo/forgejo/pulls/6782) ([backported](https://codeberg.org/forgejo/forgejo/pulls/6783)): <!--number 6783 --><!--line 0 --><!--description Zml4OiBtYWtlIGF1dGhvciBzZWFyY2ggY2FzZSBpbnNlbnN0aXZl-->fix: make author search case insenstive<!--description-->
|
||||
- [PR](https://codeberg.org/forgejo/forgejo/pulls/6782) ([backported](https://codeberg.org/forgejo/forgejo/pulls/6783)): <!--number 6783 --><!--line 0 --><!--description Zml4OiBtYWtlIGF1dGhvciBzZWFyY2ggY2FzZSBpbnNlbnN0aXZl-->fix: make author search case insensitive<!--description-->
|
||||
- [PR](https://codeberg.org/forgejo/forgejo/pulls/6620) ([backported](https://codeberg.org/forgejo/forgejo/pulls/6770)): <!--number 6770 --><!--line 0 --><!--description Zml4KHVpKTogYWRkIHRyaWFuZ2xlIGRvd24gb2N0aWNvbiB0byBjb2RlIHNlYXJjaCBvcHRpb25zIGRyb3Bkb3du-->fix(ui): add triangle down octicon to code search options dropdown<!--description-->
|
||||
- [PR](https://codeberg.org/forgejo/forgejo/pulls/6708) ([backported](https://codeberg.org/forgejo/forgejo/pulls/6749)): <!--number 6749 --><!--line 0 --><!--description U2V0IGV4cGxvcmUgcGFnZXMgdG8gY29uZmlndXJhYmxlIGRlZmF1bHQgc29ydA==-->Set explore pages to configurable default sort<!--description-->
|
||||
- [PR](https://codeberg.org/forgejo/forgejo/pulls/6734) ([backported](https://codeberg.org/forgejo/forgejo/pulls/6748)): <!--number 6748 --><!--line 0 --><!--description RGlzYWJsZSBhdXRvZm9jdXMgb24gdGhlIGRhc2hib2FyZCByZXBvc2l0b3J5IHNlYXJjaCBib3g=-->Disable autofocus on the dashboard repository search box<!--description-->
|
||||
|
|
|
@ -14,7 +14,7 @@ This is a security release. See the documentation for more information on the [u
|
|||
- Bug fixes
|
||||
- [PR](https://codeberg.org/forgejo/forgejo/pulls/4896) ([backported](https://codeberg.org/forgejo/forgejo/pulls/4901)): <!--number 4901 --><!--line 0 --><!--description ZGlzYWxsb3cgamF2YXNjcmlwdDogVVJJIGluIHRoZSByZXBvc2l0b3J5IGRlc2NyaXB0aW9u-->disallow javascript: URI in the repository description<!--description-->
|
||||
- [PR](https://codeberg.org/forgejo/forgejo/pulls/4852) ([backported](https://codeberg.org/forgejo/forgejo/pulls/4865)): <!--number 4865 --><!--line 0 --><!--description RW5zdXJlIGFsbCBmaWx0ZXJzIGFyZSBwZXJzaXN0ZW50IGluIGlzc3VlIGZpbHRlcnM=-->Ensure all filters are persistent in issue filters<!--description-->
|
||||
- [PR](https://codeberg.org/forgejo/forgejo/pulls/4828) ([backported](https://codeberg.org/forgejo/forgejo/pulls/4840)): <!--number 4840 --><!--line 0 --><!--description QWxsb3cgNCBjaGFyYWNodGVyIFNIQSBpbiBgL3NyYy9jb21taXRg-->Allow 4 charachter SHA in `/src/commit`<!--description-->
|
||||
- [PR](https://codeberg.org/forgejo/forgejo/pulls/4828) ([backported](https://codeberg.org/forgejo/forgejo/pulls/4840)): <!--number 4840 --><!--line 0 --><!--description QWxsb3cgNCBjaGFyYWNodGVyIFNIQSBpbiBgL3NyYy9jb21taXRg-->Allow 4 character SHA in `/src/commit`<!--description-->
|
||||
- Localization
|
||||
- [PR](https://codeberg.org/forgejo/forgejo/pulls/4668) ([backported](https://codeberg.org/forgejo/forgejo/pulls/4881)): <!--number 4881 --><!--line 0 --><!--description aTE4bjogYmFja3BvcnQgb2YgIzQ2NjggYW5kICM0NzgzIHRvIHY4-->i18n: backport of #4668 and #4783 to v8<!--description-->
|
||||
<!--end release-notes-assistant-->
|
||||
|
|
|
@ -295,7 +295,7 @@ func GetRepoPermissions(ctx *context.APIContext) {
|
|||
// Only allow the request in any of the following situations:
|
||||
// - The user is the instance admin.
|
||||
// - The user is the repository admin.
|
||||
// - The user is querying the permissiosn of themselves.
|
||||
// - The user is querying the permissions of themselves.
|
||||
if !ctx.IsUserSiteAdmin() && ctx.Doer.ID != collaborator.ID && !ctx.IsUserRepoAdmin() {
|
||||
ctx.Error(http.StatusForbidden, "User", "Only admins can query all permissions, repo admins can query all repo permissions, collaborators can query only their own")
|
||||
return
|
||||
|
|
|
@ -363,7 +363,7 @@ func CreatePushMirror(ctx *context.APIContext, mirrorOption *api.CreatePushMirro
|
|||
|
||||
address, err := forms.ParseRemoteAddr(mirrorOption.RemoteAddress, mirrorOption.RemoteUsername, mirrorOption.RemotePassword)
|
||||
if err == nil {
|
||||
err = migrations.IsMigrateURLAllowed(address, ctx.ContextUser)
|
||||
err = migrations.IsPushMirrorURLAllowed(address, ctx.ContextUser)
|
||||
}
|
||||
if err != nil {
|
||||
HandleRemoteAddressError(ctx, err)
|
||||
|
|
|
@ -651,7 +651,7 @@ func SettingsPost(ctx *context.Context) {
|
|||
|
||||
address, err := forms.ParseRemoteAddr(form.PushMirrorAddress, form.PushMirrorUsername, form.PushMirrorPassword)
|
||||
if err == nil {
|
||||
err = migrations.IsMigrateURLAllowed(address, ctx.Doer)
|
||||
err = migrations.IsPushMirrorURLAllowed(address, ctx.Doer)
|
||||
}
|
||||
if err != nil {
|
||||
ctx.Data["Err_PushMirrorAddress"] = true
|
||||
|
|
|
@ -364,6 +364,11 @@ func RepoRefForAPI(next http.Handler) http.Handler {
|
|||
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||
ctx := GetAPIContext(req)
|
||||
|
||||
if ctx.Repo.Repository.IsEmpty {
|
||||
ctx.NotFound(fmt.Errorf("repository is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
if ctx.Repo.GitRepo == nil {
|
||||
ctx.InternalServerError(fmt.Errorf("no open git repo"))
|
||||
return
|
||||
|
|
|
@ -39,8 +39,17 @@ func RegisterDownloaderFactory(factory base.DownloaderFactory) {
|
|||
factories = append(factories, factory)
|
||||
}
|
||||
|
||||
// IsMigrateURLAllowed checks if an URL is allowed to be migrated from
|
||||
// IsPushMirrorURLAllowed checks if an URL is allowed to be pushed to.
|
||||
func IsPushMirrorURLAllowed(remoteURL string, doer *user_model.User) error {
|
||||
return isURLAllowed(remoteURL, doer, true)
|
||||
}
|
||||
|
||||
// IsMigrateURLAllowed checks if an URL is allowed to be migrated from.
|
||||
func IsMigrateURLAllowed(remoteURL string, doer *user_model.User) error {
|
||||
return isURLAllowed(remoteURL, doer, false)
|
||||
}
|
||||
|
||||
func isURLAllowed(remoteURL string, doer *user_model.User, isPushMirror bool) error {
|
||||
// Remote address can be HTTP/HTTPS/Git URL or local path.
|
||||
u, err := url.Parse(remoteURL)
|
||||
if err != nil {
|
||||
|
@ -71,7 +80,7 @@ func IsMigrateURLAllowed(remoteURL string, doer *user_model.User) error {
|
|||
return &models.ErrInvalidCloneAddr{Host: u.Host, IsURLError: true}
|
||||
}
|
||||
|
||||
if u.Opaque != "" || u.Scheme != "" && u.Scheme != "http" && u.Scheme != "https" && u.Scheme != "git" && u.Scheme != "ssh" {
|
||||
if u.Opaque != "" || u.Scheme != "" && u.Scheme != "http" && u.Scheme != "https" && u.Scheme != "git" && u.Scheme != "ssh" || (!isPushMirror && u.Scheme == "ssh") {
|
||||
return &models.ErrInvalidCloneAddr{Host: u.Host, IsProtocolInvalid: true, IsPermissionDenied: true, IsURLError: true}
|
||||
}
|
||||
|
||||
|
|
|
@ -113,3 +113,18 @@ func TestAllowBlockList(t *testing.T) {
|
|||
// reset
|
||||
init("", "", false)
|
||||
}
|
||||
|
||||
func TestURLAllowedSSH(t *testing.T) {
|
||||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: "user2"})
|
||||
sshURL := "ssh://git@git.gay/gitgay/forgejo"
|
||||
|
||||
t.Run("Migrate URL", func(t *testing.T) {
|
||||
require.Error(t, IsMigrateURLAllowed(sshURL, user))
|
||||
})
|
||||
|
||||
t.Run("Pushmirror URL", func(t *testing.T) {
|
||||
require.NoError(t, IsPushMirrorURLAllowed(sshURL, user))
|
||||
})
|
||||
}
|
||||
|
|
|
@ -199,7 +199,7 @@ func NewCommit(row, column int, line []byte) (*Commit, error) {
|
|||
if len(data) < 5 {
|
||||
return nil, fmt.Errorf("malformed data section on line %d with commit: %s", row, string(line))
|
||||
}
|
||||
// Format is a slight modifcation from RFC1123Z
|
||||
// Format is a slight modification from RFC1123Z
|
||||
t, err := time.Parse("Mon, _2 Jan 2006 15:04:05 -0700", string(data[2]))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not parse date of commit: %w", err)
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
{{if eq $val.Type "boolean"}}
|
||||
<div class="ui checkbox">
|
||||
<label><strong>{{if $val.Description}}{{$val.Description}}{{else}}{{$key}}{{end}}</strong></label>
|
||||
{{/* These two inputs need to stay in exactly this order (checkbox first, hidden second) or boolean fields wont work correctly! */}}
|
||||
{{/* These two inputs need to stay in exactly this order (checkbox first, hidden second) or boolean fields won't work correctly! */}}
|
||||
<input type="checkbox" name="inputs[{{$key}}]" value="on" {{if eq $val.Default "true"}}checked{{end}}>
|
||||
<input type="hidden" name="inputs[{{$key}}]" value="off" autocomplete="off">
|
||||
</div>
|
||||
|
|
1
templates/swagger/v1_json.tmpl
generated
1
templates/swagger/v1_json.tmpl
generated
|
@ -22411,7 +22411,6 @@
|
|||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"CreatePullReviewCommentOptions": {
|
||||
"description": "CreatePullReviewCommentOptions are options to create a pull review comment",
|
||||
"$ref": "#/definitions/CreatePullReviewComment"
|
||||
},
|
||||
"CreatePullReviewOptions": {
|
||||
|
|
|
@ -123,7 +123,7 @@ func TestAPIForkListPrivateRepo(t *testing.T) {
|
|||
}).AddTokenAuth(token)
|
||||
MakeRequest(t, req, http.StatusAccepted)
|
||||
|
||||
t.Run("Anomynous", func(t *testing.T) {
|
||||
t.Run("Anonymous", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
||||
req := NewRequest(t, "GET", "/api/v1/repos/user2/repo1/forks")
|
||||
|
|
|
@ -136,3 +136,24 @@ func TestEmptyRepoAddFileByAPI(t *testing.T) {
|
|||
DecodeJSON(t, resp, &apiRepo)
|
||||
assert.Equal(t, "new_branch", apiRepo.DefaultBranch)
|
||||
}
|
||||
|
||||
func TestEmptyRepoAPIRequestsReturn404(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
session := loginUser(t, "user30")
|
||||
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeReadRepository)
|
||||
|
||||
t.Run("Raw", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
||||
req := NewRequest(t, "GET", "/api/v1/repos/user30/empty/raw/main/something").AddTokenAuth(token)
|
||||
_ = session.MakeRequest(t, req, http.StatusNotFound)
|
||||
})
|
||||
|
||||
t.Run("Media", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
||||
req := NewRequest(t, "GET", "/api/v1/repos/user30/empty/media/main/something").AddTokenAuth(token)
|
||||
_ = session.MakeRequest(t, req, http.StatusNotFound)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ func TestFeed(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("View permission", func(t *testing.T) {
|
||||
t.Run("Anomynous", func(t *testing.T) {
|
||||
t.Run("Anonymous", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
req := NewRequest(t, "GET", "/org3/repo3/rss/branch/master")
|
||||
MakeRequest(t, req, http.StatusNotFound)
|
||||
|
|
|
@ -249,7 +249,7 @@ func TestForkListPrivateRepo(t *testing.T) {
|
|||
|
||||
testRepoFork(t, session, "user2", "repo1", org23.Name, "repo1")
|
||||
|
||||
t.Run("Anomynous", func(t *testing.T) {
|
||||
t.Run("Anonymous", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
||||
req := NewRequest(t, "GET", "/user2/repo1/forks")
|
||||
|
|
|
@ -194,7 +194,7 @@ func TestRepoGenerateTemplating(t *testing.T) {
|
|||
})
|
||||
defer f()
|
||||
|
||||
// The repo.TemplateID field is not initalized. Luckly the ID field holds the expected value
|
||||
// The repo.TemplateID field is not initialized. Luckily, the ID field holds the expected value
|
||||
templateID := strconv.FormatInt(template.ID, 10)
|
||||
|
||||
testRepoGenerate(
|
||||
|
|
2
web_src/fomantic/build/semantic.js
generated
2
web_src/fomantic/build/semantic.js
generated
|
@ -344,7 +344,7 @@ $.api = $.fn.api = function(parameters) {
|
|||
cancelled: function() {
|
||||
return (module.cancelled || false);
|
||||
},
|
||||
succesful: function() { // codespell-ignore
|
||||
succesful: function() { // codespell:ignore
|
||||
module.verbose('This behavior will be deleted due to typo. Use "was successful" instead.');
|
||||
return module.was.successful();
|
||||
},
|
||||
|
|
|
@ -262,7 +262,7 @@ const sfc = {
|
|||
|
||||
try {
|
||||
this.loading = true;
|
||||
// Since no async operations occured since fetching myLoadingLogCursors, we can be sure that we have the most
|
||||
// Since no async operations occurred since fetching myLoadingLogCursors, we can be sure that we have the most
|
||||
// recent needed log cursors, so we can reset needLoadingWithLogCursors -- it could be stale if exceptions
|
||||
// occurred in previous load attempts.
|
||||
this.needLoadingWithLogCursors = null;
|
||||
|
|
Loading…
Add table
Reference in a new issue