Skip to content

Commit d0303ff

Browse files
authored
Merge branch 'main' into notext
2 parents ff0c9a0 + 1b1b850 commit d0303ff

File tree

171 files changed

+7269
-6283
lines changed

Some content is hidden

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

171 files changed

+7269
-6283
lines changed

.github/workflows/pull-compliance.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ jobs:
3838
- uses: actions/setup-node@v4
3939
with:
4040
node-version: 20
41+
cache: npm
42+
cache-dependency-path: package-lock.json
4143
- run: pip install poetry
4244
- run: make deps-py
4345
- run: make deps-frontend
@@ -65,6 +67,8 @@ jobs:
6567
- uses: actions/setup-node@v4
6668
with:
6769
node-version: 20
70+
cache: npm
71+
cache-dependency-path: package-lock.json
6872
- run: make deps-frontend
6973
- run: make lint-swagger
7074

@@ -134,6 +138,8 @@ jobs:
134138
- uses: actions/setup-node@v4
135139
with:
136140
node-version: 20
141+
cache: npm
142+
cache-dependency-path: package-lock.json
137143
- run: make deps-frontend
138144
- run: make lint-frontend
139145
- run: make checks-frontend
@@ -181,6 +187,8 @@ jobs:
181187
- uses: actions/setup-node@v4
182188
with:
183189
node-version: 20
190+
cache: npm
191+
cache-dependency-path: package-lock.json
184192
- run: make deps-frontend
185193
- run: make lint-md
186194
- run: make docs

.github/workflows/pull-e2e-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ jobs:
2424
- uses: actions/setup-node@v4
2525
with:
2626
node-version: 20
27+
cache: npm
28+
cache-dependency-path: package-lock.json
2729
- run: make deps-frontend frontend deps-backend
2830
- run: npx playwright install --with-deps
2931
- run: make test-e2e-sqlite

.github/workflows/release-nightly.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ jobs:
2525
- uses: actions/setup-node@v4
2626
with:
2727
node-version: 20
28+
cache: npm
29+
cache-dependency-path: package-lock.json
2830
- run: make deps-frontend deps-backend
2931
# xgo build
3032
- run: make release

.github/workflows/release-tag-rc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ jobs:
2424
- uses: actions/setup-node@v4
2525
with:
2626
node-version: 20
27+
cache: npm
28+
cache-dependency-path: package-lock.json
2729
- run: make deps-frontend deps-backend
2830
# xgo build
2931
- run: make release

.github/workflows/release-tag-version.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ jobs:
2626
- uses: actions/setup-node@v4
2727
with:
2828
node-version: 20
29+
cache: npm
30+
cache-dependency-path: package-lock.json
2931
- run: make deps-frontend deps-backend
3032
# xgo build
3133
- run: make release

CHANGELOG-archived.md

Lines changed: 5223 additions & 0 deletions
Large diffs are not rendered by default.

CHANGELOG.md

Lines changed: 154 additions & 5228 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ LDFLAGS := $(LDFLAGS) -X "main.MakeVersion=$(MAKE_VERSION)" -X "main.Version=$(G
110110

111111
LINUX_ARCHS ?= linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64
112112

113-
GO_PACKAGES ?= $(filter-out code.gitea.io/gitea/tests/integration/migration-test code.gitea.io/gitea/tests code.gitea.io/gitea/tests/integration code.gitea.io/gitea/tests/e2e,$(shell $(GO) list ./... | grep -v /vendor/))
114113
GO_TEST_PACKAGES ?= $(filter-out $(shell $(GO) list code.gitea.io/gitea/models/migrations/...) code.gitea.io/gitea/tests/integration/migration-test code.gitea.io/gitea/tests code.gitea.io/gitea/tests/integration code.gitea.io/gitea/tests/e2e,$(shell $(GO) list ./... | grep -v /vendor/))
115114
MIGRATE_TEST_PACKAGES ?= $(shell $(GO) list code.gitea.io/gitea/models/migrations/...)
116115

@@ -144,9 +143,9 @@ TAR_EXCLUDES := .git data indexers queues log node_modules $(EXECUTABLE) $(FOMAN
144143
GO_DIRS := build cmd models modules routers services tests
145144
WEB_DIRS := web_src/js web_src/css
146145

147-
ESLINT_FILES := web_src/js tools *.config.js tests/e2e
146+
ESLINT_FILES := web_src/js tools *.js tests/e2e
148147
STYLELINT_FILES := web_src/css web_src/js/components/*.vue
149-
SPELLCHECK_FILES := $(GO_DIRS) $(WEB_DIRS) docs/content templates options/locale/locale_en-US.ini .github
148+
SPELLCHECK_FILES := $(GO_DIRS) $(WEB_DIRS) docs/content templates options/locale/locale_en-US.ini .github $(filter-out CHANGELOG.md, $(wildcard *.go *.js *.md *.yml *.yaml *.toml))
150149
EDITORCONFIG_FILES := templates .github/workflows options/locale/locale_en-US.ini
151150

152151
GO_SOURCES := $(wildcard *.go)
@@ -423,7 +422,7 @@ lint-go-windows:
423422
lint-go-vet:
424423
@echo "Running go vet..."
425424
@GOOS= GOARCH= $(GO) build code.gitea.io/gitea-vet
426-
@$(GO) vet -vettool=gitea-vet $(GO_PACKAGES)
425+
@$(GO) vet -vettool=gitea-vet ./...
427426

428427
.PHONY: lint-editorconfig
429428
lint-editorconfig:
@@ -779,7 +778,7 @@ generate-backend: $(TAGS_PREREQ) generate-go
779778
.PHONY: generate-go
780779
generate-go: $(TAGS_PREREQ)
781780
@echo "Running go generate..."
782-
@CC= GOOS= GOARCH= $(GO) generate -tags '$(TAGS)' $(GO_PACKAGES)
781+
@CC= GOOS= GOARCH= $(GO) generate -tags '$(TAGS)' ./...
783782

784783
.PHONY: security-check
785784
security-check:

assets/go-licenses.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/admin_auth.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package cmd
55

66
import (
7+
"errors"
78
"fmt"
89
"os"
910
"text/tabwriter"
@@ -91,7 +92,7 @@ func runListAuth(c *cli.Context) error {
9192

9293
func runDeleteAuth(c *cli.Context) error {
9394
if !c.IsSet("id") {
94-
return fmt.Errorf("--id flag is missing")
95+
return errors.New("--id flag is missing")
9596
}
9697

9798
ctx, cancel := installSignals()

cmd/admin_auth_oauth.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package cmd
55

66
import (
7+
"errors"
78
"fmt"
89
"net/url"
910

@@ -193,7 +194,7 @@ func runAddOauth(c *cli.Context) error {
193194

194195
func runUpdateOauth(c *cli.Context) error {
195196
if !c.IsSet("id") {
196-
return fmt.Errorf("--id flag is missing")
197+
return errors.New("--id flag is missing")
197198
}
198199

199200
ctx, cancel := installSignals()

cmd/admin_auth_stmp.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package cmd
55

66
import (
77
"errors"
8-
"fmt"
98
"strings"
109

1110
auth_model "code.gitea.io/gitea/models/auth"
@@ -166,7 +165,7 @@ func runAddSMTP(c *cli.Context) error {
166165

167166
func runUpdateSMTP(c *cli.Context) error {
168167
if !c.IsSet("id") {
169-
return fmt.Errorf("--id flag is missing")
168+
return errors.New("--id flag is missing")
170169
}
171170

172171
ctx, cancel := installSignals()

cmd/admin_user_delete.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package cmd
55

66
import (
7+
"errors"
78
"fmt"
89
"strings"
910

@@ -42,7 +43,7 @@ var microcmdUserDelete = &cli.Command{
4243

4344
func runDeleteUser(c *cli.Context) error {
4445
if !c.IsSet("id") && !c.IsSet("username") && !c.IsSet("email") {
45-
return fmt.Errorf("You must provide the id, username or email of a user to delete")
46+
return errors.New("You must provide the id, username or email of a user to delete")
4647
}
4748

4849
ctx, cancel := installSignals()

cmd/admin_user_generate_access_token.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package cmd
55

66
import (
7+
"errors"
78
"fmt"
89

910
auth_model "code.gitea.io/gitea/models/auth"
@@ -42,7 +43,7 @@ var microcmdUserGenerateAccessToken = &cli.Command{
4243

4344
func runGenerateAccessToken(c *cli.Context) error {
4445
if !c.IsSet("username") {
45-
return fmt.Errorf("You must provide a username to generate a token for")
46+
return errors.New("You must provide a username to generate a token for")
4647
}
4748

4849
ctx, cancel := installSignals()
@@ -68,7 +69,7 @@ func runGenerateAccessToken(c *cli.Context) error {
6869
return err
6970
}
7071
if exist {
71-
return fmt.Errorf("access token name has been used already")
72+
return errors.New("access token name has been used already")
7273
}
7374

7475
// make sure the scopes are valid

cmd/embedded.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ func runViewDo(c *cli.Context) error {
157157
}
158158

159159
if len(matchedAssetFiles) == 0 {
160-
return fmt.Errorf("no files matched the given pattern")
160+
return errors.New("no files matched the given pattern")
161161
} else if len(matchedAssetFiles) > 1 {
162-
return fmt.Errorf("too many files matched the given pattern, try to be more specific")
162+
return errors.New("too many files matched the given pattern, try to be more specific")
163163
}
164164

165165
data, err := matchedAssetFiles[0].fs.ReadFile(matchedAssetFiles[0].name)
@@ -180,7 +180,7 @@ func runExtractDo(c *cli.Context) error {
180180
}
181181

182182
if c.NArg() == 0 {
183-
return fmt.Errorf("a list of pattern of files to extract is mandatory (e.g. '**' for all)")
183+
return errors.New("a list of pattern of files to extract is mandatory (e.g. '**' for all)")
184184
}
185185

186186
destdir := "."

cmd/manager_logging.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package cmd
55

66
import (
7+
"errors"
78
"fmt"
89
"os"
910

@@ -249,7 +250,7 @@ func runAddFileLogger(c *cli.Context) error {
249250
if c.IsSet("filename") {
250251
vals["filename"] = c.String("filename")
251252
} else {
252-
return fmt.Errorf("filename must be set when creating a file logger")
253+
return errors.New("filename must be set when creating a file logger")
253254
}
254255
if c.IsSet("rotate") {
255256
vals["rotate"] = c.Bool("rotate")

custom/conf/app.example.ini

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,8 +1553,9 @@ LEVEL = Info
15531553
;; The source of the username for new oauth2 accounts:
15541554
;; userid = use the userid / sub attribute
15551555
;; nickname = use the nickname attribute
1556+
;; preferred_username = use the preferred_username attribute
15561557
;; email = use the username part of the email attribute
1557-
;; Note: `nickname` and `email` options will normalize input strings using the following criteria:
1558+
;; Note: `nickname`, `preferred_username` and `email` options will normalize input strings using the following criteria:
15581559
;; - diacritics are removed
15591560
;; - the characters in the set `['´\x60]` are removed
15601561
;; - the characters in the set `[\s~+]` are replaced with `-`
@@ -2376,22 +2377,6 @@ LEVEL = Info
23762377
;; Enable issue by repository metrics; default is false
23772378
;ENABLED_ISSUE_BY_REPOSITORY = false
23782379

2379-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2380-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2381-
;[task]
2382-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2383-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2384-
;;
2385-
;; Task queue type, could be `channel` or `redis`.
2386-
;QUEUE_TYPE = channel
2387-
;;
2388-
;; Task queue length, available only when `QUEUE_TYPE` is `channel`.
2389-
;QUEUE_LENGTH = 1000
2390-
;;
2391-
;; Task queue connection string, available only when `QUEUE_TYPE` is `redis`.
2392-
;; If there is a password of redis, use `redis://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s` or `redis+cluster://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s` for `redis-clsuter`.
2393-
;QUEUE_CONN_STR = "redis://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s"
2394-
23952380
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
23962381
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
23972382
;[migrations]

docs/content/administration/config-cheat-sheet.en-us.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -608,9 +608,10 @@ And the following unique queues:
608608
- `ENABLE_AUTO_REGISTRATION`: **false**: Automatically create user accounts for new oauth2 users.
609609
- `USERNAME`: **nickname**: The source of the username for new oauth2 accounts:
610610
- `userid` - use the userid / sub attribute
611-
- `nickname` - use the nickname attribute
611+
- `nickname` - use the nickname
612+
- `preferred_username` - use the preferred_username
612613
- `email` - use the username part of the email attribute
613-
- Note: `nickname` and `email` options will normalize input strings using the following criteria:
614+
- Note: `nickname`, `preferred_username` and `email` options will normalize input strings using the following criteria:
614615
- diacritics are removed
615616
- the characters in the set `['´\x60]` are removed
616617
- the characters in the set `[\s~+]` are replaced with `-`
@@ -1197,14 +1198,6 @@ in this mapping or the filetype using heuristics.
11971198

11981199
- `DEFAULT_UI_LOCATION`: Default location of time on the UI, so that we can display correct user's time on UI. i.e. Asia/Shanghai
11991200

1200-
## Task (`task`)
1201-
1202-
Task queue configuration has been moved to `queue.task`. However, the below configuration values are kept for backwards compatibility:
1203-
1204-
- `QUEUE_TYPE`: **channel**: Task queue type, could be `channel` or `redis`.
1205-
- `QUEUE_LENGTH`: **1000**: Task queue length, available only when `QUEUE_TYPE` is `channel`.
1206-
- `QUEUE_CONN_STR`: **redis://127.0.0.1:6379/0**: Task queue connection string, available only when `QUEUE_TYPE` is `redis`. If redis needs a password, use `redis://[email protected]:6379/0` or `redis+cluster://[email protected]:6379/0`.
1207-
12081201
## Migrations (`migrations`)
12091202

12101203
- `MAX_ATTEMPTS`: **3**: Max attempts per http/https request on migrations.

docs/content/administration/config-cheat-sheet.zh-cn.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,15 +1128,6 @@ ALLOW_DATA_URI_IMAGES = true
11281128

11291129
- `DEFAULT_UI_LOCATION`:在 UI 上的默认时间位置,以便我们可以在 UI 上显示正确的用户时间。例如:Asia/Shanghai
11301130

1131-
## 任务 (`task`)
1132-
1133-
任务队列配置已移动到 `queue.task`。然而,以下配置值仍保留以确保向后兼容:
1134-
1135-
- `QUEUE_TYPE`**channel**:任务队列类型,可以是 `channel``redis`
1136-
- `QUEUE_LENGTH`**1000**:任务队列长度,仅在 `QUEUE_TYPE``channel` 时可用。
1137-
- `QUEUE_CONN_STR`**redis://127.0.0.1:6379/0**:任务队列连接字符串,仅在 `QUEUE_TYPE``redis` 时可用。
1138-
如果 redis 需要密码,使用 `redis://[email protected]:6379/0``redis+cluster://[email protected]:6379/0`
1139-
11401131
## 迁移 (`migrations`)
11411132

11421133
- `MAX_ATTEMPTS`**3**:每次 http/https 请求的最大尝试次数(用于迁移)。

go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ require (
1616
gitea.com/lunny/levelqueue v0.4.2-0.20230414023320-3c0159fe0fe4
1717
github.com/42wim/sshsig v0.0.0-20211121163825-841cf5bbc121
1818
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358
19-
github.com/NYTimes/gziphandler v1.1.1
2019
github.com/PuerkitoBio/goquery v1.9.1
2120
github.com/alecthomas/chroma/v2 v2.13.0
2221
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb
@@ -67,7 +66,7 @@ require (
6766
github.com/json-iterator/go v1.1.12
6867
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
6968
github.com/keybase/go-crypto v0.0.0-20200123153347-de78d2cb44f4
70-
github.com/klauspost/compress v1.17.7
69+
github.com/klauspost/compress v1.17.8
7170
github.com/klauspost/cpuid/v2 v2.2.7
7271
github.com/lib/pq v1.10.9
7372
github.com/markbates/goth v1.79.0

go.sum

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBa
7070
github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY=
7171
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
7272
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
73-
github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I=
74-
github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c=
7573
github.com/ProtonMail/go-crypto v1.0.0 h1:LRuvITjQWX+WIfr930YHG2HNfjR1uOfyf5vE0kC2U78=
7674
github.com/ProtonMail/go-crypto v1.0.0/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
7775
github.com/PuerkitoBio/goquery v1.9.1 h1:mTL6XjbJTZdpfL+Gwl5U2h1l9yEkJjhmlTeV9VPW7UI=
@@ -500,8 +498,8 @@ github.com/klauspost/compress v1.11.4/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYs
500498
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
501499
github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
502500
github.com/klauspost/compress v1.15.6/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU=
503-
github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg=
504-
github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
501+
github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU=
502+
github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
505503
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
506504
github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
507505
github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c=

models/activities/action_list.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ func (actions ActionList) loadRepoOwner(ctx context.Context, userMap map[int64]*
8383
_, alreadyLoaded := userMap[action.Repo.OwnerID]
8484
return action.Repo.OwnerID, !alreadyLoaded
8585
})
86+
if len(missingUserIDs) == 0 {
87+
return nil
88+
}
8689

8790
if err := db.GetEngine(ctx).
8891
In("id", missingUserIDs).
@@ -129,6 +132,9 @@ func (actions ActionList) LoadComments(ctx context.Context) error {
129132
commentIDs = append(commentIDs, action.CommentID)
130133
}
131134
}
135+
if len(commentIDs) == 0 {
136+
return nil
137+
}
132138

133139
commentsMap := make(map[int64]*issues_model.Comment, len(commentIDs))
134140
if err := db.GetEngine(ctx).In("id", commentIDs).Find(&commentsMap); err != nil {

models/auth/oauth2.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"crypto/sha256"
99
"encoding/base32"
1010
"encoding/base64"
11+
"errors"
1112
"fmt"
1213
"net"
1314
"net/url"
@@ -294,7 +295,7 @@ func UpdateOAuth2Application(ctx context.Context, opts UpdateOAuth2ApplicationOp
294295
return nil, err
295296
}
296297
if app.UID != opts.UserID {
297-
return nil, fmt.Errorf("UID mismatch")
298+
return nil, errors.New("UID mismatch")
298299
}
299300
builtinApps := BuiltinApplications()
300301
if _, builtin := builtinApps[app.ClientID]; builtin {

0 commit comments

Comments
 (0)