Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5eb8947

Browse files
authoredMar 20, 2023
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

+1-1
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

+1-1
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

+1
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

+2
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

+14
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

+11
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

+1-1
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

+1
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

+15-2
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

+6
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

‎routers/api/v1/repo/migrate.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func Migrate(ctx *context.APIContext) {
154154
Issues: form.Issues,
155155
Milestones: form.Milestones,
156156
Labels: form.Labels,
157-
Comments: true,
157+
Comments: form.Issues || form.PullRequests,
158158
PullRequests: form.PullRequests,
159159
Releases: form.Releases,
160160
GitServiceType: gitServiceType,

‎templates/projects/list.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<div class="milestone list">
3939
{{range .Projects}}
4040
<li class="item">
41-
{{svg "octicon-project-symlink"}} <a href="{{.Link}}">{{.Title}}</a>
41+
{{svg .IconName}} <a href="{{.Link}}">{{.Title}}</a>
4242
<div class="meta">
4343
{{$closedDate:= TimeSinceUnix .ClosedDateUnix $.locale}}
4444
{{if .IsClosed}}

‎templates/repo/issue/list.tmpl

+4-8
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@
100100
</div>
101101
{{range .OpenProjects}}
102102
<a class="{{if $.ProjectID}}{{if eq $.ProjectID .ID}}active selected{{end}}{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{.ID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">
103-
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
104-
{{.Title}}
103+
{{svg .IconName 18 "gt-mr-3"}}{{.Title}}
105104
</a>
106105
{{end}}
107106
{{end}}
@@ -112,8 +111,7 @@
112111
</div>
113112
{{range .ClosedProjects}}
114113
<a class="{{if $.ProjectID}}{{if eq $.ProjectID .ID}}active selected{{end}}{{end}} item" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{.ID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}">
115-
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
116-
{{.Title}}
114+
{{svg .IconName 18 "gt-mr-3"}}{{.Title}}
117115
</a>
118116
{{end}}
119117
{{end}}
@@ -273,8 +271,7 @@
273271
</div>
274272
{{range .OpenProjects}}
275273
<div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/projects">
276-
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
277-
{{.Title}}
274+
{{svg .IconName 18 "gt-mr-3"}}{{.Title}}
278275
</div>
279276
{{end}}
280277
{{end}}
@@ -285,8 +282,7 @@
285282
</div>
286283
{{range .ClosedProjects}}
287284
<div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/projects">
288-
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
289-
{{.Title}}
285+
{{svg .IconName 18 "gt-mr-3"}}{{.Title}}
290286
</div>
291287
{{end}}
292288
{{end}}

‎templates/repo/issue/new_form.tmpl

+3-6
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@
134134
</div>
135135
{{range .OpenProjects}}
136136
<a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link}}">
137-
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
138-
{{.Title}}
137+
{{svg .IconName 18 "gt-mr-3"}}{{.Title}}
139138
</a>
140139
{{end}}
141140
{{end}}
@@ -146,8 +145,7 @@
146145
</div>
147146
{{range .ClosedProjects}}
148147
<a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link}}">
149-
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
150-
{{.Title}}
148+
{{svg .IconName 18 "gt-mr-3"}}{{.Title}}
151149
</a>
152150
{{end}}
153151
{{end}}
@@ -159,8 +157,7 @@
159157
<div class="selected">
160158
{{if .Project}}
161159
<a class="item muted sidebar-item-link" href="{{.Project.Link}}">
162-
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
163-
{{.Project.Title}}
160+
{{svg .Project.IconName 18 "gt-mr-3"}}{{.Project.Title}}
164161
</a>
165162
{{end}}
166163
</div>

‎templates/repo/issue/view_content/sidebar.tmpl

+3-6
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,7 @@
196196
</div>
197197
{{range .OpenProjects}}
198198
<a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link}}">
199-
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
200-
{{.Title}}
199+
{{svg .IconName 18 "gt-mr-3"}}{{.Title}}
201200
</a>
202201
{{end}}
203202
{{end}}
@@ -208,8 +207,7 @@
208207
</div>
209208
{{range .ClosedProjects}}
210209
<a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link}}">
211-
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
212-
{{.Title}}
210+
{{svg .IconName 18 "gt-mr-3"}}{{.Title}}
213211
</a>
214212
{{end}}
215213
{{end}}
@@ -220,8 +218,7 @@
220218
<div class="selected">
221219
{{if .Issue.ProjectID}}
222220
<a class="item muted sidebar-item-link" href="{{.Issue.Project.Link}}">
223-
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
224-
{{.Issue.Project.Title}}
221+
{{svg .Issue.Project.IconName 18 "gt-mr-3"}}{{.Issue.Project.Title}}
225222
</a>
226223
{{end}}
227224
</div>

‎templates/repo/projects/list.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<div class="milestone list">
4141
{{range .Projects}}
4242
<li class="item">
43-
{{svg "octicon-project"}} <a href="{{.Link}}">{{.Title}}</a>
43+
{{svg .IconName}} <a href="{{.Link}}">{{.Title}}</a>
4444
<div class="meta">
4545
{{$closedDate:= TimeSinceUnix .ClosedDateUnix $.locale}}
4646
{{if .IsClosed}}

‎templates/shared/actions/runner_list.tmpl

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
<th data-sortt-asc="online" data-sortt-desc="offline">{{.locale.Tr "actions.runners.status"}}</th>
5050
<th data-sortt-asc="alphabetically">{{.locale.Tr "actions.runners.id"}}</th>
5151
<th>{{.locale.Tr "actions.runners.name"}}</th>
52+
<th>{{.locale.Tr "actions.runners.version"}}</th>
5253
<th>{{.locale.Tr "actions.runners.owner_type"}}</th>
5354
<th>{{.locale.Tr "actions.runners.labels"}}</th>
5455
<th>{{.locale.Tr "actions.runners.last_online"}}</th>
@@ -64,6 +65,7 @@
6465
</td>
6566
<td>{{.ID}}</td>
6667
<td><p class="tooltip" data-content="{{.Description}}">{{.Name}}</p></td>
68+
<td>{{.Version}}</td>
6769
<td>{{.OwnType}}</td>
6870
<td class="runner-tags">
6971
{{range .AllLabels}}<span class="ui label">{{.}}</span>{{end}}

‎templates/shared/issuelist.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
{{end}}
8989
{{if .Project}}
9090
<a class="project" href="{{.Project.Link}}">
91-
{{if .Project.IsOrganizationProject}}{{svg "octicon-project-symlink" 14 "gt-mr-2"}}{{else}}{{svg "octicon-project" 14 "gt-mr-2"}}{{end}}{{.Project.Title}}
91+
{{svg .Project.IconName 14 "gt-mr-2"}}{{.Project.Title}}
9292
</a>
9393
{{end}}
9494
{{if .Ref}}

‎web_src/css/base.css

+4-4
Original file line numberDiff line numberDiff line change
@@ -2540,10 +2540,10 @@ table th[data-sortt-desc] .svg {
25402540
height: auto; /* reset the ".ui.dropdown > .dropdown.icon {height}", otherwise the icon would be too small */
25412541
}
25422542

2543-
.ui.selection.dropdown > .search.icon,
2544-
.ui.selection.dropdown > .delete.icon,
2545-
.ui.selection.dropdown > .dropdown.icon {
2546-
top: 0 !important;
2543+
.ui.selection.dropdown > .svg.search.icon,
2544+
.ui.selection.dropdown > .svg.delete.icon,
2545+
.ui.selection.dropdown > .svg.dropdown.icon {
2546+
top: 0 !important; /* reset the ".ui.selection.dropdown > .xxx.icon {top}" if the icon is svg instead of the fomantic icon */
25472547
}
25482548

25492549
.ui.dropdown.no-text > .dropdown.icon {

0 commit comments

Comments
 (0)
Please sign in to comment.