Skip to content

Commit 5eb8947

Browse files
authored
Merge branch 'main' into schedule
2 parents 0815696 + 371520d commit 5eb8947

File tree

19 files changed

+73
-33
lines changed

19 files changed

+73
-33
lines changed

custom/conf/app.example.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1848,7 +1848,7 @@ ROUTER = console
18481848
;ENABLED = true
18491849
;;
18501850
;; Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
1851-
;ALLOWED_TYPES = .csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip
1851+
;ALLOWED_TYPES = .csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.patch,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip
18521852
;;
18531853
;; Max size of each file. Defaults to 4MB
18541854
;MAX_SIZE = 4

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ Default templates for project boards:
841841
## Issue and pull request attachments (`attachment`)
842842

843843
- `ENABLED`: **true**: Whether issue and pull request attachments are enabled.
844-
- `ALLOWED_TYPES`: **.csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip**: Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
844+
- `ALLOWED_TYPES`: **.csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.patch,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip**: Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
845845
- `MAX_SIZE`: **4**: Maximum size (MB).
846846
- `MAX_FILES`: **5**: Maximum number of attachments that can be uploaded at once.
847847
- `STORAGE_TYPE`: **local**: Storage type for attachments, `local` for local disk or `minio` for s3 compatible object storage service, default is `local` or other name defined with `[storage.xxx]`

models/actions/runner.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ type ActionRunner struct {
2525
ID int64
2626
UUID string `xorm:"CHAR(36) UNIQUE"`
2727
Name string `xorm:"VARCHAR(255)"`
28+
Version string `xorm:"VARCHAR(64)"`
2829
OwnerID int64 `xorm:"index"` // org level runner, 0 means system
2930
Owner *user_model.User `xorm:"-"`
3031
RepoID int64 `xorm:"index"` // repo level runner, if orgid also is zero, then it's a global

models/migrations/migrations.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,8 @@ var migrations = []Migration{
474474
// v247 -> v248
475475
NewMigration("Fix incorrect project type", v1_20.FixIncorrectProjectType),
476476
// v248 -> v249
477+
NewMigration("Add version column to action_runner table", v1_20.AddVersionToActionRunner),
478+
// v249 -> v250
477479
NewMigration("Add action schedule table", v1_20.AddActionScheduleTable),
478480
}
479481

models/migrations/v1_20/v248.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2023 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
package v1_20 //nolint
5+
6+
import "xorm.io/xorm"
7+
8+
func AddVersionToActionRunner(x *xorm.Engine) error {
9+
type ActionRunner struct {
10+
Version string `xorm:"VARCHAR(64)"` // the version of act_runner
11+
}
12+
13+
return x.Sync(new(ActionRunner))
14+
}

models/project/project.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,21 @@ func (p *Project) Link() string {
144144
return ""
145145
}
146146

147+
func (p *Project) IconName() string {
148+
if p.IsRepositoryProject() {
149+
return "octicon-project"
150+
}
151+
return "octicon-project-symlink"
152+
}
153+
147154
func (p *Project) IsOrganizationProject() bool {
148155
return p.Type == TypeOrganization
149156
}
150157

158+
func (p *Project) IsRepositoryProject() bool {
159+
return p.Type == TypeRepository
160+
}
161+
151162
func init() {
152163
db.RegisterModel(new(Project))
153164
}

modules/setting/attachment.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func loadAttachmentFrom(rootCfg ConfigProvider) {
2626

2727
Attachment.Storage = getStorage(rootCfg, "attachments", storageType, sec)
2828

29-
Attachment.AllowedTypes = sec.Key("ALLOWED_TYPES").MustString(".csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip")
29+
Attachment.AllowedTypes = sec.Key("ALLOWED_TYPES").MustString(".csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.patch,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip")
3030
Attachment.MaxSize = sec.Key("MAX_SIZE").MustInt64(4)
3131
Attachment.MaxFiles = sec.Key("MAX_FILES").MustInt(5)
3232
Attachment.Enabled = sec.Key("ENABLED").MustBool(true)

options/locale/locale_en-US.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3355,6 +3355,7 @@ runners.status.unspecified = Unknown
33553355
runners.status.idle = Idle
33563356
runners.status.active = Active
33573357
runners.status.offline = Offline
3358+
runners.version = Version
33583359
33593360
runs.all_workflows = All Workflows
33603361
runs.open_tab = %d Open

routers/api/actions/runner/interceptor.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ import (
2121
)
2222

2323
const (
24-
uuidHeaderKey = "x-runner-uuid"
25-
tokenHeaderKey = "x-runner-token"
24+
uuidHeaderKey = "x-runner-uuid"
25+
tokenHeaderKey = "x-runner-token"
26+
versionHeaderKey = "x-runner-version"
27+
28+
versionUnknown = "Unknown"
2629
)
2730

2831
var withRunner = connect.WithInterceptors(connect.UnaryInterceptorFunc(func(unaryFunc connect.UnaryFunc) connect.UnaryFunc {
@@ -33,6 +36,12 @@ var withRunner = connect.WithInterceptors(connect.UnaryInterceptorFunc(func(unar
3336
}
3437
uuid := request.Header().Get(uuidHeaderKey)
3538
token := request.Header().Get(tokenHeaderKey)
39+
version := request.Header().Get(versionHeaderKey)
40+
if util.IsEmptyString(version) {
41+
version = versionUnknown
42+
}
43+
version, _ = util.SplitStringAtByteN(version, 64)
44+
3645
runner, err := actions_model.GetRunnerByUUID(ctx, uuid)
3746
if err != nil {
3847
if errors.Is(err, util.ErrNotExist) {
@@ -45,6 +54,10 @@ var withRunner = connect.WithInterceptors(connect.UnaryInterceptorFunc(func(unar
4554
}
4655

4756
cols := []string{"last_online"}
57+
if runner.Version != version {
58+
runner.Version = version
59+
cols = append(cols, "version")
60+
}
4861
runner.LastOnline = timeutil.TimeStampNow()
4962
if methodName == "UpdateTask" || methodName == "UpdateLog" {
5063
runner.LastActive = timeutil.TimeStampNow()

routers/api/packages/pypi/pypi.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"io"
99
"net/http"
1010
"regexp"
11+
"sort"
1112
"strings"
1213

1314
packages_model "code.gitea.io/gitea/models/packages"
@@ -62,6 +63,11 @@ func PackageMetadata(ctx *context.Context) {
6263
return
6364
}
6465

66+
// sort package descriptors by version to mimic PyPI format
67+
sort.Slice(pds, func(i, j int) bool {
68+
return strings.Compare(pds[i].Version.Version, pds[j].Version.Version) < 0
69+
})
70+
6571
ctx.Data["RegistryURL"] = setting.AppURL + "api/packages/" + ctx.Package.Owner.Name + "/pypi"
6672
ctx.Data["PackageDescriptor"] = pds[0]
6773
ctx.Data["PackageDescriptors"] = pds

0 commit comments

Comments
 (0)