diff --git a/.air.toml b/.air.toml index d13f8c4f99..de97bd8b29 100644 --- a/.air.toml +++ b/.air.toml @@ -8,6 +8,15 @@ delay = 1000 include_ext = ["go", "tmpl"] include_file = ["main.go"] include_dir = ["cmd", "models", "modules", "options", "routers", "services"] -exclude_dir = ["modules/git/tests", "services/gitdiff/testdata", "modules/avatar/testdata", "models/fixtures", "models/migrations/fixtures", "modules/migration/file_format_testdata", "modules/avatar/identicon/testdata"] +exclude_dir = [ + "models/fixtures", + "models/migrations/fixtures", + "modules/avatar/identicon/testdata", + "modules/avatar/testdata", + "modules/git/tests", + "modules/migration/file_format_testdata", + "routers/private/tests", + "services/gitdiff/testdata", +] exclude_regex = ["_test.go$", "_gen.go$"] stop_on_error = true diff --git a/.deadcode-out b/.deadcode-out index dc4aa0e498..c63fd9e0af 100644 --- a/.deadcode-out +++ b/.deadcode-out @@ -271,13 +271,19 @@ package "code.gitea.io/gitea/modules/sync" package "code.gitea.io/gitea/modules/testlogger" func (*testLoggerWriterCloser).pushT - func (*testLoggerWriterCloser).Write + func (*testLoggerWriterCloser).Log + func (*testLoggerWriterCloser).recordError + func (*testLoggerWriterCloser).printMsg func (*testLoggerWriterCloser).popT - func (*testLoggerWriterCloser).Close func (*testLoggerWriterCloser).Reset func PrintCurrentTest func Printf func NewTestLoggerWriter + func (*TestLogEventWriter).Base + func (*TestLogEventWriter).GetLevel + func (*TestLogEventWriter).GetWriterName + func (*TestLogEventWriter).GetWriterType + func (*TestLogEventWriter).Run package "code.gitea.io/gitea/modules/timeutil" func GetExecutableModTime @@ -323,7 +329,6 @@ package "code.gitea.io/gitea/services/pull" package "code.gitea.io/gitea/services/repository" func IsErrForkAlreadyExist - func UpdateRepositoryUnits package "code.gitea.io/gitea/services/repository/archiver" func ArchiveRepository @@ -336,4 +341,5 @@ package "code.gitea.io/gitea/services/repository/files" package "code.gitea.io/gitea/services/webhook" func NewNotifier + func List diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8563aafd04..1b1b66c7dd 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,7 +4,7 @@ "features": { // installs nodejs into container "ghcr.io/devcontainers/features/node:1": { - "version":"20" + "version": "20" }, "ghcr.io/devcontainers/features/git-lfs:1.1.0": {}, "ghcr.io/devcontainers-contrib/features/poetry:2": {}, @@ -24,7 +24,7 @@ "DavidAnson.vscode-markdownlint", "Vue.volar", "ms-azuretools.vscode-docker", - "zixuanchen.vitest-explorer", + "vitest.explorer", "qwtel.sqlite-viewer", "GitHub.vscode-pull-request-github" ] diff --git a/.dockerignore b/.dockerignore index d1a08977a5..98ef522331 100644 --- a/.dockerignore +++ b/.dockerignore @@ -62,7 +62,6 @@ cpu.out /data /indexers /log -/public/img/avatar /tests/integration/gitea-integration-* /tests/integration/indexers-* /tests/e2e/gitea-e2e-* @@ -77,6 +76,7 @@ cpu.out /public/assets/js /public/assets/css /public/assets/fonts +/public/assets/img/avatar /public/assets/img/webpack /vendor /web_src/fomantic/node_modules diff --git a/.eslintrc.yaml b/.eslintrc.yaml index b62b13cefe..eeb3e20cb8 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -42,10 +42,6 @@ overrides: worker: true rules: no-restricted-globals: [2, addEventListener, blur, close, closed, confirm, defaultStatus, defaultstatus, error, event, external, find, focus, frameElement, frames, history, innerHeight, innerWidth, isFinite, isNaN, length, locationbar, menubar, moveBy, moveTo, name, onblur, onerror, onfocus, onload, onresize, onunload, open, opener, opera, outerHeight, outerWidth, pageXOffset, pageYOffset, parent, print, removeEventListener, resizeBy, resizeTo, screen, screenLeft, screenTop, screenX, screenY, scroll, scrollbars, scrollBy, scrollTo, scrollX, scrollY, status, statusbar, stop, toolbar, top] - - files: ["build/generate-images.js"] - rules: - i/no-unresolved: [0] - i/no-extraneous-dependencies: [0] - files: ["*.config.*"] rules: i/no-unused-modules: [0] @@ -123,7 +119,7 @@ rules: "@stylistic/js/arrow-spacing": [2, {before: true, after: true}] "@stylistic/js/block-spacing": [0] "@stylistic/js/brace-style": [2, 1tbs, {allowSingleLine: true}] - "@stylistic/js/comma-dangle": [2, only-multiline] + "@stylistic/js/comma-dangle": [2, always-multiline] "@stylistic/js/comma-spacing": [2, {before: false, after: true}] "@stylistic/js/comma-style": [2, last] "@stylistic/js/computed-property-spacing": [2, never] @@ -290,7 +286,7 @@ rules: jquery/no-class: [0] jquery/no-clone: [2] jquery/no-closest: [0] - jquery/no-css: [0] + jquery/no-css: [2] jquery/no-data: [0] jquery/no-deferred: [2] jquery/no-delegate: [2] @@ -413,7 +409,7 @@ rules: no-jquery/no-constructor-attributes: [2] no-jquery/no-contains: [2] no-jquery/no-context-prop: [2] - no-jquery/no-css: [0] + no-jquery/no-css: [2] no-jquery/no-data: [0] no-jquery/no-deferred: [2] no-jquery/no-delegate: [2] diff --git a/.forgejo/workflows/backport.yml b/.forgejo/workflows/backport.yml index 59d953ebeb..de6e987ab2 100644 --- a/.forgejo/workflows/backport.yml +++ b/.forgejo/workflows/backport.yml @@ -34,10 +34,14 @@ jobs: !startsWith(vars.ROLE, 'forgejo-') && ( github.event.pull_request.merged && ( - github.event.action == 'closed' - || ( - github.event.action == 'labeled' - && contains(github.event.label.name, 'backport/') + ( + github.event.action == 'closed' && + contains(toJSON(github.event.pull_request.labels), 'backport/v') + ) + || + ( + github.event.action == 'labeled' && + contains(github.event.label.name, 'backport/v') ) ) ) @@ -54,7 +58,7 @@ jobs: export DEBIAN_FRONTEND=noninteractive apt-get update -qq apt-get -q install -qq -y jq - filtered_labels=$(echo "$LABELS" | jq -c 'map(select(.name | startswith("backport/")))') + filtered_labels=$(echo "$LABELS" | jq -c 'map(select(.name | startswith("backport/v")))') echo "FILTERED_LABELS=${filtered_labels}" >> $GITHUB_ENV env: LABELS: ${{ toJSON(github.event.pull_request.labels) }} diff --git a/.forgejo/workflows/build-release-integration.yml b/.forgejo/workflows/build-release-integration.yml index e066f0af5e..610b8f0520 100644 --- a/.forgejo/workflows/build-release-integration.yml +++ b/.forgejo/workflows/build-release-integration.yml @@ -9,6 +9,8 @@ on: - docker/** - .forgejo/workflows/build-release.yml - .forgejo/workflows/build-release-integration.yml + branches-ignore: + - renovate/** pull_request: paths: - Makefile diff --git a/.forgejo/workflows/build-release.yml b/.forgejo/workflows/build-release.yml index 19423205af..f8cd69850c 100644 --- a/.forgejo/workflows/build-release.yml +++ b/.forgejo/workflows/build-release.yml @@ -43,7 +43,7 @@ jobs: - uses: https://code.forgejo.org/actions/setup-go@v4 with: - go-version: "1.21" + go-version: "1.22" check-latest: true - name: version from ref diff --git a/.forgejo/workflows/e2e.yml b/.forgejo/workflows/e2e.yml index 2104f6a067..c1321b0a8e 100644 --- a/.forgejo/workflows/e2e.yml +++ b/.forgejo/workflows/e2e.yml @@ -17,7 +17,7 @@ jobs: - uses: https://code.forgejo.org/actions/checkout@v4 - uses: https://code.forgejo.org/actions/setup-go@v4 with: - go-version: "~1.21" + go-version: "1.22" check-latest: true - run: | apt-get -qq update diff --git a/.forgejo/workflows/publish-release.yml b/.forgejo/workflows/publish-release.yml index eaa14c3693..674c1c2704 100644 --- a/.forgejo/workflows/publish-release.yml +++ b/.forgejo/workflows/publish-release.yml @@ -64,7 +64,7 @@ jobs: if: vars.ROLE == 'forgejo-experimental' && secrets.OVH_APP_KEY != '' uses: https://code.forgejo.org/actions/setup-go@v4 with: - go-version: "1.21" + go-version: "1.22" check-latest: true - name: update the _release.experimental DNS record if: vars.ROLE == 'forgejo-experimental' && secrets.OVH_APP_KEY != '' diff --git a/.forgejo/workflows/renovate.yml b/.forgejo/workflows/renovate.yml new file mode 100644 index 0000000000..1a5cc15188 --- /dev/null +++ b/.forgejo/workflows/renovate.yml @@ -0,0 +1,53 @@ +name: renovate + +on: + push: + branches: + - 'renovate/**' # self-test updates + schedule: + - cron: '*/30 * * * *' + +env: + RENOVATE_DRY_RUN: ${{ (github.event_name != 'schedule' && github.ref_name != github.event.repository.default_branch) && 'full' || '' }} + RENOVATE_REPOSITORIES: ${{ github.repository }} + +jobs: + renovate: + if: ${{ secrets.RENOVATE_TOKEN != '' }} + + runs-on: docker + container: + image: ghcr.io/visualon/renovate:37.272.0 + + steps: + - uses: https://code.forgejo.org/actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + with: + path: | + .tmp/cache/renovate/repository + key: repo-cache-${{ github.run_id }} + restore-keys: | + repo-cache- + + - run: renovate + env: + GITHUB_COM_TOKEN: ${{ secrets.RENOVATE_GITHUB_COM_TOKEN }} + LOG_LEVEL: debug + RENOVATE_BASE_DIR: ${{ github.workspace }}/.tmp + RENOVATE_ENDPOINT: ${{ github.server_url }} + RENOVATE_PLATFORM: gitea + RENOVATE_REPOSITORY_CACHE: 'enabled' + RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }} + RENOVATE_GIT_AUTHOR: 'Renovate Bot ' + + GIT_AUTHOR_NAME: 'Renovate Bot' + GIT_AUTHOR_EMAIL: 'forgejo-renovate-action@forgejo.org' + GIT_COMMITTER_NAME: 'Renovate Bot' + GIT_COMMITTER_EMAIL: 'forgejo-renovate-action@forgejo.org' + + - name: Save renovate repo cache + if: always() && env.RENOVATE_DRY_RUN == 'true' + uses: https://code.forgejo.org/actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + with: + path: | + .tmp/cache/renovate/repository + key: repo-cache-${{ github.run_id }} diff --git a/.forgejo/workflows/testing.yml b/.forgejo/workflows/testing.yml index 85d7691cd1..f40cf1ed83 100644 --- a/.forgejo/workflows/testing.yml +++ b/.forgejo/workflows/testing.yml @@ -17,7 +17,7 @@ jobs: - uses: https://code.forgejo.org/actions/checkout@v3 - uses: https://code.forgejo.org/actions/setup-go@v4 with: - go-version: "1.21" + go-version: "1.22" check-latest: true - run: make deps-backend deps-tools - run: make --always-make -j$(nproc) lint-backend checks-backend # ensure the "go-licenses" make target runs @@ -52,7 +52,7 @@ jobs: - uses: https://code.forgejo.org/actions/checkout@v3 - uses: https://code.forgejo.org/actions/setup-go@v4 with: - go-version: "1.21" + go-version: "1.22" - run: | git config --add safe.directory '*' adduser --quiet --comment forgejo --disabled-password forgejo @@ -97,7 +97,7 @@ jobs: - uses: https://code.forgejo.org/actions/checkout@v3 - uses: https://code.forgejo.org/actions/setup-go@v4 with: - go-version: "1.21" + go-version: "1.22" - name: install dependencies & git >= 2.42 run: | export DEBIAN_FRONTEND=noninteractive @@ -144,7 +144,7 @@ jobs: - uses: https://code.forgejo.org/actions/checkout@v3 - uses: https://code.forgejo.org/actions/setup-go@v4 with: - go-version: "1.21" + go-version: "1.22" - name: install dependencies & git >= 2.42 run: | export DEBIAN_FRONTEND=noninteractive @@ -181,7 +181,7 @@ jobs: - uses: https://code.forgejo.org/actions/checkout@v3 - uses: https://code.forgejo.org/actions/setup-go@v4 with: - go-version: "1.21" + go-version: "1.22" - name: install dependencies & git >= 2.42 run: | export DEBIAN_FRONTEND=noninteractive diff --git a/.gitea/issue_template/bug-report-ui.yaml b/.gitea/issue_template/bug-report-ui.yaml index 4d80198399..09513d08e7 100644 --- a/.gitea/issue_template/bug-report-ui.yaml +++ b/.gitea/issue_template/bug-report-ui.yaml @@ -1,7 +1,7 @@ name: 🦋 Bug Report (web interface / frontend) description: Something doesn't look quite as it should? Report it here! title: "[BUG] " -labels: ["bug", "forgejo/ui"] +labels: ["bug/new-report", "forgejo/ui"] body: - type: markdown attributes: diff --git a/.gitea/issue_template/bug-report.yaml b/.gitea/issue_template/bug-report.yaml index ce67378175..6edbca886f 100644 --- a/.gitea/issue_template/bug-report.yaml +++ b/.gitea/issue_template/bug-report.yaml @@ -1,7 +1,7 @@ name: 🐛 Bug Report (server / backend) description: Found something you weren't expecting? Report it here! title: "[BUG] " -labels: bug +labels: bug/new-report body: - type: markdown attributes: diff --git a/.gitea/pull_request_template.md b/.gitea/pull_request_template.md index 385300ddf8..00b874fd5b 100644 --- a/.gitea/pull_request_template.md +++ b/.gitea/pull_request_template.md @@ -1,3 +1,12 @@ +--- + +name: "Pull Request Template" +about: "Template for all Pull Requests" +labels: + +- test/needed + +--- - - diff --git a/templates/admin/emails/list.tmpl b/templates/admin/emails/list.tmpl index 29fbb5f039..b72aef8f35 100644 --- a/templates/admin/emails/list.tmpl +++ b/templates/admin/emails/list.tmpl @@ -4,12 +4,9 @@ {{ctx.Locale.Tr "admin.emails.email_manage_panel"}} ({{ctx.Locale.Tr "admin.total" .Total}})
-
- {{template "admin/base/search" .}} +
diff --git a/templates/admin/packages/list.tmpl b/templates/admin/packages/list.tmpl index aef4815424..863f11da25 100644 --- a/templates/admin/packages/list.tmpl +++ b/templates/admin/packages/list.tmpl @@ -13,16 +13,16 @@
-
- {{template "shared/searchinput" dict "Value" .Query}} - {{range $type := .AvailableTypes}} {{$type.Name}} {{end}} - + {{template "shared/search/button"}}
diff --git a/templates/admin/queue_manage.tmpl b/templates/admin/queue_manage.tmpl index 80214d1021..dd1682a000 100644 --- a/templates/admin/queue_manage.tmpl +++ b/templates/admin/queue_manage.tmpl @@ -30,7 +30,7 @@ - {{else}} {{$sum}} - + {{$.CsrfTokenHtml}} diff --git a/templates/admin/repo/list.tmpl b/templates/admin/repo/list.tmpl index e977c8307c..4b27d87a45 100644 --- a/templates/admin/repo/list.tmpl +++ b/templates/admin/repo/list.tmpl @@ -19,13 +19,13 @@ {{ctx.Locale.Tr "admin.repos.name"}} {{SortArrow "alphabetically" "reversealphabetically" $.SortType false}} - + diff --git a/templates/admin/repo/unadopted.tmpl b/templates/admin/repo/unadopted.tmpl index fb4f16791d..9166a844a7 100644 --- a/templates/admin/repo/unadopted.tmpl +++ b/templates/admin/repo/unadopted.tmpl @@ -8,10 +8,10 @@
-
- - - +
+ + + {{template "shared/search/button"}}
@@ -20,8 +20,8 @@ {{if .Dirs}}
{{range $dirI, $dir := .Dirs}} -
- {{svg "octicon-file-directory-fill"}} {{$dir}} +
+ {{svg "octicon-file-directory-fill"}} {{$dir}}
{{end}} {{if eq .GetType 4}}
{{ctx.Locale.Tr "admin.repos.watches"}}{{ctx.Locale.Tr "repo.watchers"}} - {{ctx.Locale.Tr "admin.repos.stars"}} + {{ctx.Locale.Tr "repo.stars"}} {{SortArrow "moststars" "feweststars" $.SortType false}} - {{ctx.Locale.Tr "admin.repos.forks"}} + {{ctx.Locale.Tr "repo.forks"}} {{SortArrow "mostforks" "fewestforks" $.SortType false}} {{ctx.Locale.Tr "admin.repos.issues"}} {{ctx.Locale.Tr "admin.users.never_login"}} -
+ diff --git a/templates/admin/user/view.tmpl b/templates/admin/user/view.tmpl index fd3017607c..21943a8382 100644 --- a/templates/admin/user/view.tmpl +++ b/templates/admin/user/view.tmpl @@ -2,7 +2,7 @@
-
+

{{.Title}}
@@ -13,7 +13,7 @@ {{template "admin/user/view_details" .}}

-
+

{{ctx.Locale.Tr "admin.emails"}}
diff --git a/templates/base/head_navbar.tmpl b/templates/base/head_navbar.tmpl index e755775985..fac2809d17 100644 --- a/templates/base/head_navbar.tmpl +++ b/templates/base/head_navbar.tmpl @@ -11,7 +11,7 @@ -

-
+
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}}
-
+
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}} -
-
- - +
+
+ + {{template "shared/search/button"}} +
+
-
+
{{range .Topics}}{{.Name}}{{end}} - {{if and .Permission.IsAdmin (not .Repository.IsArchived)}}{{end}} + {{if and .Permission.IsAdmin (not .Repository.IsArchived)}}{{end}}
{{end}} {{if and .Permission.IsAdmin (not .Repository.IsArchived)}} -
-
-