mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-14 00:01:44 -04:00
Compare commits
5 Commits
30668e0047
...
371520d7ab
Author | SHA1 | Date | |
---|---|---|---|
|
371520d7ab | ||
|
af3711100a | ||
|
dbdb5ba33e | ||
|
1a4efa0ee9 | ||
|
0206882e8a |
@ -1848,7 +1848,7 @@ ROUTER = console
|
||||
;ENABLED = true
|
||||
;;
|
||||
;; Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
|
||||
;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
|
||||
;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
|
||||
;;
|
||||
;; Max size of each file. Defaults to 4MB
|
||||
;MAX_SIZE = 4
|
||||
|
@ -841,7 +841,7 @@ Default templates for project boards:
|
||||
## Issue and pull request attachments (`attachment`)
|
||||
|
||||
- `ENABLED`: **true**: Whether issue and pull request attachments are enabled.
|
||||
- `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.
|
||||
- `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.
|
||||
- `MAX_SIZE`: **4**: Maximum size (MB).
|
||||
- `MAX_FILES`: **5**: Maximum number of attachments that can be uploaded at once.
|
||||
- `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]`
|
||||
|
@ -25,6 +25,7 @@ type ActionRunner struct {
|
||||
ID int64
|
||||
UUID string `xorm:"CHAR(36) UNIQUE"`
|
||||
Name string `xorm:"VARCHAR(255)"`
|
||||
Version string `xorm:"VARCHAR(64)"`
|
||||
OwnerID int64 `xorm:"index"` // org level runner, 0 means system
|
||||
Owner *user_model.User `xorm:"-"`
|
||||
RepoID int64 `xorm:"index"` // repo level runner, if orgid also is zero, then it's a global
|
||||
|
@ -473,6 +473,8 @@ var migrations = []Migration{
|
||||
NewMigration("Add missed column owner_id for project table", v1_20.AddNewColumnForProject),
|
||||
// v247 -> v248
|
||||
NewMigration("Fix incorrect project type", v1_20.FixIncorrectProjectType),
|
||||
// v248 -> v249
|
||||
NewMigration("Add version column to action_runner table", v1_20.AddVersionToActionRunner),
|
||||
}
|
||||
|
||||
// GetCurrentDBVersion returns the current db version
|
||||
|
14
models/migrations/v1_20/v248.go
Normal file
14
models/migrations/v1_20/v248.go
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright 2023 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package v1_20 //nolint
|
||||
|
||||
import "xorm.io/xorm"
|
||||
|
||||
func AddVersionToActionRunner(x *xorm.Engine) error {
|
||||
type ActionRunner struct {
|
||||
Version string `xorm:"VARCHAR(64)"` // the version of act_runner
|
||||
}
|
||||
|
||||
return x.Sync(new(ActionRunner))
|
||||
}
|
@ -144,10 +144,21 @@ func (p *Project) Link() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (p *Project) IconName() string {
|
||||
if p.IsRepositoryProject() {
|
||||
return "octicon-project"
|
||||
}
|
||||
return "octicon-project-symlink"
|
||||
}
|
||||
|
||||
func (p *Project) IsOrganizationProject() bool {
|
||||
return p.Type == TypeOrganization
|
||||
}
|
||||
|
||||
func (p *Project) IsRepositoryProject() bool {
|
||||
return p.Type == TypeRepository
|
||||
}
|
||||
|
||||
func init() {
|
||||
db.RegisterModel(new(Project))
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ func loadAttachmentFrom(rootCfg ConfigProvider) {
|
||||
|
||||
Attachment.Storage = getStorage(rootCfg, "attachments", storageType, sec)
|
||||
|
||||
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")
|
||||
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")
|
||||
Attachment.MaxSize = sec.Key("MAX_SIZE").MustInt64(4)
|
||||
Attachment.MaxFiles = sec.Key("MAX_FILES").MustInt(5)
|
||||
Attachment.Enabled = sec.Key("ENABLED").MustBool(true)
|
||||
|
@ -3355,6 +3355,7 @@ runners.status.unspecified = Unknown
|
||||
runners.status.idle = Idle
|
||||
runners.status.active = Active
|
||||
runners.status.offline = Offline
|
||||
runners.version = Version
|
||||
|
||||
runs.all_workflows = All Workflows
|
||||
runs.open_tab = %d Open
|
||||
|
@ -21,8 +21,11 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
uuidHeaderKey = "x-runner-uuid"
|
||||
tokenHeaderKey = "x-runner-token"
|
||||
uuidHeaderKey = "x-runner-uuid"
|
||||
tokenHeaderKey = "x-runner-token"
|
||||
versionHeaderKey = "x-runner-version"
|
||||
|
||||
versionUnknown = "Unknown"
|
||||
)
|
||||
|
||||
var withRunner = connect.WithInterceptors(connect.UnaryInterceptorFunc(func(unaryFunc connect.UnaryFunc) connect.UnaryFunc {
|
||||
@ -33,6 +36,12 @@ var withRunner = connect.WithInterceptors(connect.UnaryInterceptorFunc(func(unar
|
||||
}
|
||||
uuid := request.Header().Get(uuidHeaderKey)
|
||||
token := request.Header().Get(tokenHeaderKey)
|
||||
version := request.Header().Get(versionHeaderKey)
|
||||
if util.IsEmptyString(version) {
|
||||
version = versionUnknown
|
||||
}
|
||||
version, _ = util.SplitStringAtByteN(version, 64)
|
||||
|
||||
runner, err := actions_model.GetRunnerByUUID(ctx, uuid)
|
||||
if err != nil {
|
||||
if errors.Is(err, util.ErrNotExist) {
|
||||
@ -45,6 +54,10 @@ var withRunner = connect.WithInterceptors(connect.UnaryInterceptorFunc(func(unar
|
||||
}
|
||||
|
||||
cols := []string{"last_online"}
|
||||
if runner.Version != version {
|
||||
runner.Version = version
|
||||
cols = append(cols, "version")
|
||||
}
|
||||
runner.LastOnline = timeutil.TimeStampNow()
|
||||
if methodName == "UpdateTask" || methodName == "UpdateLog" {
|
||||
runner.LastActive = timeutil.TimeStampNow()
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
packages_model "code.gitea.io/gitea/models/packages"
|
||||
@ -62,6 +63,11 @@ func PackageMetadata(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// sort package descriptors by version to mimic PyPI format
|
||||
sort.Slice(pds, func(i, j int) bool {
|
||||
return strings.Compare(pds[i].Version.Version, pds[j].Version.Version) < 0
|
||||
})
|
||||
|
||||
ctx.Data["RegistryURL"] = setting.AppURL + "api/packages/" + ctx.Package.Owner.Name + "/pypi"
|
||||
ctx.Data["PackageDescriptor"] = pds[0]
|
||||
ctx.Data["PackageDescriptors"] = pds
|
||||
|
@ -154,7 +154,7 @@ func Migrate(ctx *context.APIContext) {
|
||||
Issues: form.Issues,
|
||||
Milestones: form.Milestones,
|
||||
Labels: form.Labels,
|
||||
Comments: true,
|
||||
Comments: form.Issues || form.PullRequests,
|
||||
PullRequests: form.PullRequests,
|
||||
Releases: form.Releases,
|
||||
GitServiceType: gitServiceType,
|
||||
|
@ -38,7 +38,7 @@
|
||||
<div class="milestone list">
|
||||
{{range .Projects}}
|
||||
<li class="item">
|
||||
{{svg "octicon-project-symlink"}} <a href="{{.Link}}">{{.Title}}</a>
|
||||
{{svg .IconName}} <a href="{{.Link}}">{{.Title}}</a>
|
||||
<div class="meta">
|
||||
{{$closedDate:= TimeSinceUnix .ClosedDateUnix $.locale}}
|
||||
{{if .IsClosed}}
|
||||
|
@ -100,8 +100,7 @@
|
||||
</div>
|
||||
{{range .OpenProjects}}
|
||||
<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}}">
|
||||
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
|
||||
{{.Title}}
|
||||
{{svg .IconName 18 "gt-mr-3"}}{{.Title}}
|
||||
</a>
|
||||
{{end}}
|
||||
{{end}}
|
||||
@ -112,8 +111,7 @@
|
||||
</div>
|
||||
{{range .ClosedProjects}}
|
||||
<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}}">
|
||||
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
|
||||
{{.Title}}
|
||||
{{svg .IconName 18 "gt-mr-3"}}{{.Title}}
|
||||
</a>
|
||||
{{end}}
|
||||
{{end}}
|
||||
@ -273,8 +271,7 @@
|
||||
</div>
|
||||
{{range .OpenProjects}}
|
||||
<div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/projects">
|
||||
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
|
||||
{{.Title}}
|
||||
{{svg .IconName 18 "gt-mr-3"}}{{.Title}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
@ -285,8 +282,7 @@
|
||||
</div>
|
||||
{{range .ClosedProjects}}
|
||||
<div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/projects">
|
||||
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
|
||||
{{.Title}}
|
||||
{{svg .IconName 18 "gt-mr-3"}}{{.Title}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
@ -134,8 +134,7 @@
|
||||
</div>
|
||||
{{range .OpenProjects}}
|
||||
<a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link}}">
|
||||
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
|
||||
{{.Title}}
|
||||
{{svg .IconName 18 "gt-mr-3"}}{{.Title}}
|
||||
</a>
|
||||
{{end}}
|
||||
{{end}}
|
||||
@ -146,8 +145,7 @@
|
||||
</div>
|
||||
{{range .ClosedProjects}}
|
||||
<a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link}}">
|
||||
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
|
||||
{{.Title}}
|
||||
{{svg .IconName 18 "gt-mr-3"}}{{.Title}}
|
||||
</a>
|
||||
{{end}}
|
||||
{{end}}
|
||||
@ -159,8 +157,7 @@
|
||||
<div class="selected">
|
||||
{{if .Project}}
|
||||
<a class="item muted sidebar-item-link" href="{{.Project.Link}}">
|
||||
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
|
||||
{{.Project.Title}}
|
||||
{{svg .Project.IconName 18 "gt-mr-3"}}{{.Project.Title}}
|
||||
</a>
|
||||
{{end}}
|
||||
</div>
|
||||
|
@ -196,8 +196,7 @@
|
||||
</div>
|
||||
{{range .OpenProjects}}
|
||||
<a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link}}">
|
||||
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
|
||||
{{.Title}}
|
||||
{{svg .IconName 18 "gt-mr-3"}}{{.Title}}
|
||||
</a>
|
||||
{{end}}
|
||||
{{end}}
|
||||
@ -208,8 +207,7 @@
|
||||
</div>
|
||||
{{range .ClosedProjects}}
|
||||
<a class="item muted sidebar-item-link" data-id="{{.ID}}" data-href="{{.Link}}">
|
||||
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
|
||||
{{.Title}}
|
||||
{{svg .IconName 18 "gt-mr-3"}}{{.Title}}
|
||||
</a>
|
||||
{{end}}
|
||||
{{end}}
|
||||
@ -220,8 +218,7 @@
|
||||
<div class="selected">
|
||||
{{if .Issue.ProjectID}}
|
||||
<a class="item muted sidebar-item-link" href="{{.Issue.Project.Link}}">
|
||||
{{if .IsOrganizationProject}}{{svg "octicon-project-symlink" 18 "gt-mr-3"}}{{else}}{{svg "octicon-project" 18 "gt-mr-3"}}{{end}}
|
||||
{{.Issue.Project.Title}}
|
||||
{{svg .Issue.Project.IconName 18 "gt-mr-3"}}{{.Issue.Project.Title}}
|
||||
</a>
|
||||
{{end}}
|
||||
</div>
|
||||
|
@ -40,7 +40,7 @@
|
||||
<div class="milestone list">
|
||||
{{range .Projects}}
|
||||
<li class="item">
|
||||
{{svg "octicon-project"}} <a href="{{.Link}}">{{.Title}}</a>
|
||||
{{svg .IconName}} <a href="{{.Link}}">{{.Title}}</a>
|
||||
<div class="meta">
|
||||
{{$closedDate:= TimeSinceUnix .ClosedDateUnix $.locale}}
|
||||
{{if .IsClosed}}
|
||||
|
@ -49,6 +49,7 @@
|
||||
<th data-sortt-asc="online" data-sortt-desc="offline">{{.locale.Tr "actions.runners.status"}}</th>
|
||||
<th data-sortt-asc="alphabetically">{{.locale.Tr "actions.runners.id"}}</th>
|
||||
<th>{{.locale.Tr "actions.runners.name"}}</th>
|
||||
<th>{{.locale.Tr "actions.runners.version"}}</th>
|
||||
<th>{{.locale.Tr "actions.runners.owner_type"}}</th>
|
||||
<th>{{.locale.Tr "actions.runners.labels"}}</th>
|
||||
<th>{{.locale.Tr "actions.runners.last_online"}}</th>
|
||||
@ -64,6 +65,7 @@
|
||||
</td>
|
||||
<td>{{.ID}}</td>
|
||||
<td><p class="tooltip" data-content="{{.Description}}">{{.Name}}</p></td>
|
||||
<td>{{.Version}}</td>
|
||||
<td>{{.OwnType}}</td>
|
||||
<td class="runner-tags">
|
||||
{{range .AllLabels}}<span class="ui label">{{.}}</span>{{end}}
|
||||
|
@ -88,7 +88,7 @@
|
||||
{{end}}
|
||||
{{if .Project}}
|
||||
<a class="project" href="{{.Project.Link}}">
|
||||
{{if .Project.IsOrganizationProject}}{{svg "octicon-project-symlink" 14 "gt-mr-2"}}{{else}}{{svg "octicon-project" 14 "gt-mr-2"}}{{end}}{{.Project.Title}}
|
||||
{{svg .Project.IconName 14 "gt-mr-2"}}{{.Project.Title}}
|
||||
</a>
|
||||
{{end}}
|
||||
{{if .Ref}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user