Skip to content

Commit 02d1e01

Browse files
committed
Merge branch 'main' into feature/issue_23628
# Conflicts: # web_src/js/features/repo-diff.js
2 parents f6c900a + cf5a281 commit 02d1e01

File tree

474 files changed

+8226
-4304
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

474 files changed

+8226
-4304
lines changed

.drone.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ steps:
726726

727727
# TODO: We should probably build all dependencies into a test image
728728
- name: test-e2e
729-
image: mcr.microsoft.com/playwright:v1.31.2-focal
729+
image: mcr.microsoft.com/playwright:v1.32.1-focal
730730
commands:
731731
- curl -sLO https://go.dev/dl/go1.20.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.20.linux-amd64.tar.gz
732732
- groupadd --gid 1001 gitea && useradd -m --gid 1001 --uid 1001 gitea

.eslintrc.yaml

+15-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ plugins:
1313
- eslint-plugin-import
1414
- eslint-plugin-jquery
1515
- eslint-plugin-sonarjs
16+
- eslint-plugin-custom-elements
1617

1718
env:
1819
es2022: true
@@ -62,6 +63,19 @@ rules:
6263
consistent-this: [0]
6364
constructor-super: [2]
6465
curly: [0]
66+
custom-elements/expose-class-on-global: [0]
67+
custom-elements/extends-correct-class: [2]
68+
custom-elements/file-name-matches-element: [0]
69+
custom-elements/no-constructor: [2]
70+
custom-elements/no-customized-built-in-elements: [2]
71+
custom-elements/no-dom-traversal-in-attributechangedcallback: [2]
72+
custom-elements/no-dom-traversal-in-connectedcallback: [2]
73+
custom-elements/no-exports-with-element: [2]
74+
custom-elements/no-method-prefixed-with-on: [2]
75+
custom-elements/no-unchecked-define: [0]
76+
custom-elements/one-element-per-file: [0]
77+
custom-elements/tag-name-matches-class: [2]
78+
custom-elements/valid-tag-name: [2]
6579
default-case-last: [2]
6680
default-case: [0]
6781
default-param-last: [0]
@@ -164,7 +178,7 @@ rules:
164178
jquery/no-parse-html: [2]
165179
jquery/no-prop: [0]
166180
jquery/no-proxy: [2]
167-
jquery/no-ready: [0]
181+
jquery/no-ready: [2]
168182
jquery/no-serialize: [2]
169183
jquery/no-show: [2]
170184
jquery/no-size: [2]

.gitpod.yml

-9
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,6 @@ tasks:
2323
gp sync-await setup
2424
make watch-frontend
2525
openMode: split-right
26-
- name: Run docs
27-
command: |
28-
gp sync-await setup
29-
cd docs
30-
make clean update
31-
hugo server -D -F --baseUrl $(gp url 1313) --liveReloadPort=443 --appendPort=false --bind=0.0.0.0
32-
openMode: split-right
3326

3427
vscode:
3528
extensions:
@@ -46,5 +39,3 @@ vscode:
4639
ports:
4740
- name: Gitea
4841
port: 3000
49-
- name: Docs
50-
port: 1313

.stylelintrc.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ rules:
8888
no-invalid-position-at-import-rule: null
8989
no-irregular-whitespace: true
9090
no-unknown-animations: null
91+
no-unknown-custom-properties: null
9192
number-max-precision: null
9293
property-allowed-list: null
9394
property-disallowed-list: null

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Build stage
2-
FROM golang:1.20-alpine3.17 AS build-env
2+
FROM docker.io/library/golang:1.20-alpine3.17 AS build-env
33

44
ARG GOPROXY
55
ENV GOPROXY ${GOPROXY:-direct}
@@ -23,7 +23,7 @@ RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
2323
# Begin env-to-ini build
2424
RUN go build contrib/environment-to-ini/environment-to-ini.go
2525

26-
FROM alpine:3.17
26+
FROM docker.io/library/alpine:3.17
2727
LABEL maintainer="maintainers@gitea.io"
2828

2929
EXPOSE 22 3000

Dockerfile.rootless

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Build stage
2-
FROM golang:1.20-alpine3.17 AS build-env
2+
FROM docker.io/library/golang:1.20-alpine3.17 AS build-env
33

44
ARG GOPROXY
55
ENV GOPROXY ${GOPROXY:-direct}
@@ -23,7 +23,7 @@ RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
2323
# Begin env-to-ini build
2424
RUN go build contrib/environment-to-ini/environment-to-ini.go
2525

26-
FROM alpine:3.17
26+
FROM docker.io/library/alpine:3.17
2727
LABEL maintainer="maintainers@gitea.io"
2828

2929
EXPOSE 2222 3000

MAINTAINERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Jimmy Praet <jimmy.praet@telenet.be> (@jpraet)
4444
Leon Hofmeister <dev.lh@web.de> (@delvh)
4545
Wim <wim@42.be> (@42wim)
4646
Jason Song <i@wolfogre.com> (@wolfogre)
47-
Yarden Shoham <hrsi88@gmail.com> (@yardenshoham)
47+
Yarden Shoham <git@yardenshoham.com> (@yardenshoham)
4848
Yu Tian <zettat123@gmail.com> (@Zettat123)
4949
Eddie Yang <576951401@qq.com> (@yp05327)
5050
Dong Ge <gedong_1994@163.com> (@sillyguodong)

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ generate-go: $(TAGS_PREREQ)
747747

748748
.PHONY: security-check
749749
security-check:
750-
go run $(GOVULNCHECK_PACKAGE) -v ./...
750+
go run $(GOVULNCHECK_PACKAGE) ./...
751751

752752
$(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ)
753753
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@

assets/go-licenses.json

+17-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.go

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright 2020 The Gitea Authors. All rights reserved.
22
// SPDX-License-Identifier: MIT
33

4-
54
//go:build vendor
65

76
package main

build/backport-locales.go

+30-4
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ func main() {
6262

6363
// use old en-US as the base, and copy the new translations to the old locales
6464
enUsOld := inisOld["options/locale/locale_en-US.ini"]
65+
brokenWarned := map[string]bool{}
6566
for path, iniOld := range inisOld {
6667
if iniOld == enUsOld {
6768
continue
@@ -77,10 +78,14 @@ func main() {
7778
if secNew.HasKey(keyEnUs.Name()) {
7879
oldStr := secOld.Key(keyEnUs.Name()).String()
7980
newStr := secNew.Key(keyEnUs.Name()).String()
80-
// A bug: many of new translations with ";" are broken in Crowdin (due to last messy restoring)
81-
// As the broken strings are gradually fixed, this workaround check could be removed (in a few months?)
82-
if strings.Contains(oldStr, ";") && !strings.Contains(newStr, ";") {
83-
println("skip potential broken string", path, secEnUS.Name(), keyEnUs.Name())
81+
broken := oldStr != "" && strings.Count(oldStr, "%") != strings.Count(newStr, "%")
82+
broken = broken || strings.Contains(oldStr, "\n") || strings.Contains(oldStr, "\n")
83+
if broken {
84+
brokenWarned[secOld.Name()+"."+keyEnUs.Name()] = true
85+
fmt.Println("----")
86+
fmt.Printf("WARNING: skip broken locale: %s , [%s] %s\n", path, secEnUS.Name(), keyEnUs.Name())
87+
fmt.Printf("\told: %s\n", strings.ReplaceAll(oldStr, "\n", "\\n"))
88+
fmt.Printf("\tnew: %s\n", strings.ReplaceAll(newStr, "\n", "\\n"))
8489
continue
8590
}
8691
secOld.Key(keyEnUs.Name()).SetValue(newStr)
@@ -89,4 +94,25 @@ func main() {
8994
}
9095
mustNoErr(iniOld.SaveTo(path))
9196
}
97+
98+
fmt.Println("========")
99+
100+
for path, iniNew := range inisNew {
101+
for _, sec := range iniNew.Sections() {
102+
for _, key := range sec.Keys() {
103+
str := sec.Key(key.Name()).String()
104+
broken := strings.Contains(str, "\n")
105+
broken = broken || strings.HasPrefix(str, "`") != strings.HasSuffix(str, "`")
106+
broken = broken || strings.HasPrefix(str, "\"`")
107+
broken = broken || strings.HasPrefix(str, "`\"")
108+
broken = broken || strings.Count(str, `"`)%2 == 1
109+
broken = broken || strings.Count(str, "`")%2 == 1
110+
if broken && !brokenWarned[sec.Name()+"."+key.Name()] {
111+
fmt.Printf("WARNING: found broken locale: %s , [%s] %s\n", path, sec.Name(), key.Name())
112+
fmt.Printf("\tstr: %s\n", strings.ReplaceAll(str, "\n", "\\n"))
113+
fmt.Println("----")
114+
}
115+
}
116+
}
117+
}
92118
}

build/generate-emoji.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ func main() {
6060
// generate data
6161
buf, err := generate()
6262
if err != nil {
63-
log.Fatal(err)
63+
log.Fatalf("generate err: %v", err)
6464
}
6565

6666
// write
6767
err = os.WriteFile(*flagOut, buf, 0o644)
6868
if err != nil {
69-
log.Fatal(err)
69+
log.Fatalf("WriteFile err: %v", err)
7070
}
7171
}
7272

build/generate-go-licenses.go

+17-12
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ package main
77

88
import (
99
"encoding/json"
10+
"fmt"
1011
"io/fs"
1112
"os"
12-
goPath "path"
13+
"path"
1314
"path/filepath"
1415
"regexp"
1516
"sort"
@@ -27,9 +28,14 @@ type LicenseEntry struct {
2728
}
2829

2930
func main() {
31+
if len(os.Args) != 3 {
32+
fmt.Println("usage: go run generate-go-licenses.go <base-dir> <out-json-file>")
33+
os.Exit(1)
34+
}
35+
3036
base, out := os.Args[1], os.Args[2]
3137

32-
paths := []string{}
38+
var paths []string
3339
err := filepath.WalkDir(base, func(path string, entry fs.DirEntry, err error) error {
3440
if err != nil {
3541
return err
@@ -46,28 +52,27 @@ func main() {
4652

4753
sort.Strings(paths)
4854

49-
entries := []LicenseEntry{}
50-
for _, path := range paths {
51-
path := filepath.ToSlash(path)
52-
53-
licenseText, err := os.ReadFile(path)
55+
var entries []LicenseEntry
56+
for _, filePath := range paths {
57+
licenseText, err := os.ReadFile(filePath)
5458
if err != nil {
5559
panic(err)
5660
}
5761

58-
path = strings.Replace(path, base+"/", "", 1)
59-
name := goPath.Dir(path)
62+
pkgPath := filepath.ToSlash(filePath)
63+
pkgPath = strings.TrimPrefix(pkgPath, base+"/")
64+
pkgName := path.Dir(pkgPath)
6065

6166
// There might be a bug somewhere in go-licenses that sometimes interprets the
6267
// root package as "." and sometimes as "code.gitea.io/gitea". Workaround by
6368
// removing both of them for the sake of stable output.
64-
if name == "." || name == "code.gitea.io/gitea" {
69+
if pkgName == "." || pkgName == "code.gitea.io/gitea" {
6570
continue
6671
}
6772

6873
entries = append(entries, LicenseEntry{
69-
Name: name,
70-
Path: path,
74+
Name: pkgName,
75+
Path: pkgPath,
7176
LicenseText: string(licenseText),
7277
})
7378
}

build/update-locales.sh

+4-11
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,10 @@ fi
1717

1818
mv ./options/locale/locale_en-US.ini ./options/
1919

20-
# the "ini" library for locale has many quirks
21-
# * `a="xx"` gets `xx` (no quote)
22-
# * `a=x\"y` gets `x\"y` (no unescaping)
23-
# * `a="x\"y"` gets `"x\"y"` (no unescaping, the quotes are still there)
24-
# * `a='x\"y'` gets `x\"y` (no unescaping, no quote)
25-
# * `a="foo` gets `"foo` (although the quote is not closed)
26-
# * 'a=`foo`' works like single-quote
27-
# crowdin needs the strings to be quoted correctly and doesn't like incomplete quotes
28-
# crowdin always outputs quoted strings if there are quotes in the strings.
29-
30-
# this script helps to unquote the crowdin outputs for the quirky ini library
20+
# the "ini" library for locale has many quirks, its behavior is different from Crowdin.
21+
# see i18n_test.go for more details
22+
23+
# this script helps to unquote the Crowdin outputs for the quirky ini library
3124
# * find all `key="...\"..."` lines
3225
# * remove the leading quote
3326
# * remove the trailing quote

0 commit comments

Comments
 (0)