初始提交: Gitea 项目代码

This commit is contained in:
root
2026-05-30 22:47:36 +08:00
commit f288f76350
6116 changed files with 776822 additions and 0 deletions
@@ -0,0 +1,58 @@
<h4 class="ui top attached header">
{{ctx.Locale.Tr "actions.general.cross_repo"}}
</h4>
<div class="ui attached segment">
<form class="ui form form-fetch-action " action="{{.Link}}" method="post">
<!-- Cross-Repository Access -->
<div class="help">{{ctx.Locale.Tr "actions.general.cross_repo_desc"}}</div>
<!-- Allowed Repositories List -->
<div class="field tw-mt-4">
<h5 class="ui header">
{{ctx.Locale.Tr "actions.general.cross_repo_target_repos"}}
</h5>
<div class="ui attached segment tw-p-2">
<div class="ui divided relaxed list flex-items-block muted-links">
{{range $repo := .AllowedRepos}}
<div class="item">
{{template "repo/icon" $repo}}
<a class="tw-flex-1" href="{{$repo.Link}}">{{$repo.FullName}}</a>
<button class="ui red compact tiny button link-action" type="button" data-url="?cross_repo_remove_target_id={{$repo.ID}}">{{ctx.Locale.Tr "remove"}}</button>
</div>
{{else}}
<div class="item">
{{ctx.Locale.Tr "org.repos.none"}}
</div>
{{end}}
</div>
</div>
<h5 class="ui header">
{{ctx.Locale.Tr "actions.general.cross_repo_add"}}
</h5>
<div class="flex-text-block">
<div data-global-init="initSearchRepoBox" data-uid="{{.OwnerID}}" data-exclusive="true" class="ui search tw-flex-1">
<div class="ui input">
<input class="prompt" name="cross_repo_add_target_name" required placeholder="{{ctx.Locale.Tr "search.repo_kind"}}" autocomplete="off">
</div>
</div>
<button class="ui primary button" type="submit" name="cross_repo_add_target" value="true">{{ctx.Locale.Tr "add"}}</button>
</div>
</div>
</form>
</div>
<h4 class="ui top attached header">
{{ctx.Locale.Tr "actions.general.permissions"}}
</h4>
<div class="ui attached segment">
<form class="ui form form-fetch-action" action="{{.Link}}" method="post" data-global-init="initOwnerActionsPermissionsForm">
{{template "shared/actions/permission_mode_select" .}}
<div class="divider"></div>
{{template "shared/actions/permissions_table" .}}
<div class="field">
<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button>
</div>
</form>
</div>
@@ -0,0 +1,18 @@
<div class="field js-permission-mode-section">
<label>{{ctx.Locale.Tr "actions.general.token_permissions.mode"}}</label>
<div class="help">{{ctx.Locale.Tr "actions.general.token_permissions.mode.desc"}}</div>
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="token_permission_mode" value="{{.TokenPermissionModePermissive}}" {{if eq .TokenPermissionMode .TokenPermissionModePermissive}}checked{{end}}>
<label>{{ctx.Locale.Tr "actions.general.token_permissions.mode.permissive"}}</label>
<div class="help">{{ctx.Locale.Tr "actions.general.token_permissions.mode.permissive.desc"}}</div>
</div>
</div>
<div class="field">
<div class="ui radio checkbox">
<input type="radio" name="token_permission_mode" value="{{.TokenPermissionModeRestricted}}" {{if eq .TokenPermissionMode .TokenPermissionModeRestricted}}checked{{end}}>
<label>{{ctx.Locale.Tr "actions.general.token_permissions.mode.restricted"}}</label>
<div class="help">{{ctx.Locale.Tr "actions.general.token_permissions.mode.restricted.desc"}}</div>
</div>
</div>
</div>
@@ -0,0 +1,77 @@
<div class="field">
<label>{{ctx.Locale.Tr "actions.general.token_permissions.maximum"}}</label>
<div class="help">
{{ctx.Locale.Tr "actions.general.token_permissions.maximum.description"}}
<br>
{{ctx.Locale.Tr "actions.general.token_permissions.fork_pr_note"}}
</div>
<div class="field">
<div class="ui checkbox">
<input type="checkbox" name="enable_max_permissions" {{if .EnableMaxTokenPermissions}}checked{{end}}>
<label>{{ctx.Locale.Tr "actions.general.token_permissions.customize_max_permissions"}}</label>
</div>
</div>
<table class="ui celled table js-permissions-table">
<thead>
<tr>
<th class="tw-w-2/5">{{ctx.Locale.Tr "units.unit"}}</th>
<th class="tw-text-center">{{ctx.Locale.Tr "org.teams.none_access"}}
<span class="tw-align-middle" data-tooltip-content="{{ctx.Locale.Tr "org.teams.none_access_helper"}}">{{svg "octicon-question" 16 "tw-ml-1"}}</span>
</th>
<th class="tw-text-center">{{ctx.Locale.Tr "org.teams.read_access"}}
<span class="tw-align-middle" data-tooltip-content="{{ctx.Locale.Tr "org.teams.read_access_helper"}}">{{svg "octicon-question" 16 "tw-ml-1"}}</span>
</th>
<th class="tw-text-center">{{ctx.Locale.Tr "org.teams.write_access"}}
<span class="tw-align-middle" data-tooltip-content="{{ctx.Locale.Tr "org.teams.write_access_helper"}}">{{svg "octicon-question" 16 "tw-ml-1"}}</span>
</th>
</tr>
</thead>
<tbody>
{{template "shared/actions/permissions_table_unit" (dict
"UnitType" ctx.Consts.RepoUnitTypeCode
"UnitDisplayName" (ctx.Locale.Tr "repo.code")
"UnitDisplayDesc" (ctx.Locale.Tr "repo.code.desc")
"UnitAccessMode" (index $.MaxTokenPermissions.UnitAccessModes ctx.Consts.RepoUnitTypeCode)
)}}
{{template "shared/actions/permissions_table_unit" (dict
"UnitType" ctx.Consts.RepoUnitTypeIssues
"UnitDisplayName" (ctx.Locale.Tr "repo.issues")
"UnitDisplayDesc" (ctx.Locale.Tr "repo.issues.desc")
"UnitAccessMode" (index $.MaxTokenPermissions.UnitAccessModes ctx.Consts.RepoUnitTypeIssues)
)}}
{{template "shared/actions/permissions_table_unit" (dict
"UnitType" ctx.Consts.RepoUnitTypePullRequests
"UnitDisplayName" (ctx.Locale.Tr "repo.pulls")
"UnitDisplayDesc" (ctx.Locale.Tr "repo.pulls.desc")
"UnitAccessMode" (index $.MaxTokenPermissions.UnitAccessModes ctx.Consts.RepoUnitTypePullRequests)
)}}
{{template "shared/actions/permissions_table_unit" (dict
"UnitType" ctx.Consts.RepoUnitTypeWiki
"UnitDisplayName" (ctx.Locale.Tr "repo.wiki")
"UnitDisplayDesc" (ctx.Locale.Tr "repo.wiki.desc")
"UnitAccessMode" (index $.MaxTokenPermissions.UnitAccessModes ctx.Consts.RepoUnitTypeWiki)
)}}
{{template "shared/actions/permissions_table_unit" (dict
"UnitType" ctx.Consts.RepoUnitTypeReleases
"UnitDisplayName" (ctx.Locale.Tr "repo.releases")
"UnitDisplayDesc" (ctx.Locale.Tr "repo.releases.desc")
"UnitAccessMode" (index $.MaxTokenPermissions.UnitAccessModes ctx.Consts.RepoUnitTypeReleases)
)}}
{{template "shared/actions/permissions_table_unit" (dict
"UnitType" ctx.Consts.RepoUnitTypeProjects
"UnitDisplayName" (ctx.Locale.Tr "repo.projects")
"UnitDisplayDesc" (ctx.Locale.Tr "repo.projects.desc")
"UnitAccessMode" (index $.MaxTokenPermissions.UnitAccessModes ctx.Consts.RepoUnitTypeProjects)
)}}
{{template "shared/actions/permissions_table_unit" (dict
"UnitType" ctx.Consts.RepoUnitTypeActions
"UnitDisplayName" (ctx.Locale.Tr "repo.actions")
"UnitDisplayDesc" (ctx.Locale.Tr "actions.unit.desc")
"UnitAccessMode" (index $.MaxTokenPermissions.UnitAccessModes ctx.Consts.RepoUnitTypeActions)
)}}
</tbody>
</table>
</div>
@@ -0,0 +1,24 @@
<tr>
<td>
<strong>{{.UnitDisplayName}}</strong>
<div class="help">{{.UnitDisplayDesc}}</div>
</td>
<td class="tw-text-center">
<div class="ui radio checkbox">
<input type="radio" name="max_unit_access_mode_{{.UnitType}}" value="none" {{if not .UnitAccessMode}}checked{{end}} title="{{ctx.Locale.Tr "org.teams.none_access"}}">
<label></label>
</div>
</td>
<td class="tw-text-center">
<div class="ui radio checkbox">
<input type="radio" name="max_unit_access_mode_{{.UnitType}}" value="read" {{if eq .UnitAccessMode 1}}checked{{end}} title="{{ctx.Locale.Tr "org.teams.read_access"}}">
<label></label>
</div>
</td>
<td class="tw-text-center">
<div class="ui radio checkbox">
<input type="radio" name="max_unit_access_mode_{{.UnitType}}" value="write" {{if eq .UnitAccessMode 2}}checked{{end}} title="{{ctx.Locale.Tr "org.teams.write_access"}}">
<label></label>
</div>
</td>
</tr>
@@ -0,0 +1,15 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="{{.Badge.Width}}" height="20"
role="img" aria-label="{{.Badge.Label.Text}}: {{.Badge.Message.Text}}">
<title>{{.Badge.Label.Text}}: {{.Badge.Message.Text}}</title>
<g shape-rendering="crispEdges">
<rect width="{{.Badge.Label.Width}}" height="20" fill="#555" />
<rect x="{{.Badge.Label.Width}}" width="{{.Badge.Message.Width}}" height="20" fill="{{.Badge.Color}}" />
</g>
<g fill="#fff" text-anchor="middle" font-family="{{.Badge.FontFamily}}"
text-rendering="geometricPrecision" font-size="{{.Badge.FontSize}}">
<text x="{{.Badge.Label.X}}" y="140"
transform="scale(.1)" fill="#fff" textLength="{{.Badge.Label.TextLength}}">{{.Badge.Label.Text}}</text>
<text x="{{.Badge.Message.X}}" y="140" transform="scale(.1)" fill="#fff"
textLength="{{.Badge.Message.TextLength}}">{{.Badge.Message.Text}}</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 924 B

@@ -0,0 +1,27 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="{{.Badge.Width}}" height="20"
role="img" aria-label="{{.Badge.Label.Text}}: {{.Badge.Message.Text}}">
<title>{{.Badge.Label.Text}}: {{.Badge.Message.Text}}</title>
<linearGradient id="{{.Badge.IDPrefix}}s" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1" />
<stop offset="1" stop-opacity=".1" />
</linearGradient>
<clipPath id="{{.Badge.IDPrefix}}r">
<rect width="{{.Badge.Width}}" height="20" rx="3" fill="#fff" />
</clipPath>
<g clip-path="url(#{{.Badge.IDPrefix}}r)">
<rect width="{{.Badge.Label.Width}}" height="20" fill="#555" />
<rect x="{{.Badge.Label.Width}}" width="{{.Badge.Message.Width}}" height="20" fill="{{.Badge.Color}}" />
<rect width="{{.Badge.Width}}" height="20" fill="url(#{{.Badge.IDPrefix}}s)" />
</g>
<g fill="#fff" text-anchor="middle" font-family="{{.Badge.FontFamily}}"
text-rendering="geometricPrecision" font-size="{{.Badge.FontSize}}">
<text aria-hidden="true" x="{{.Badge.Label.X}}" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)"
textLength="{{.Badge.Label.TextLength}}">{{.Badge.Label.Text}}</text>
<text x="{{.Badge.Label.X}}" y="140"
transform="scale(.1)" fill="#fff" textLength="{{.Badge.Label.TextLength}}">{{.Badge.Label.Text}}</text>
<text aria-hidden="true" x="{{.Badge.Message.X}}" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)"
textLength="{{.Badge.Message.TextLength}}">{{.Badge.Message.Text}}</text>
<text x="{{.Badge.Message.X}}" y="140" transform="scale(.1)" fill="#fff"
textLength="{{.Badge.Message.TextLength}}">{{.Badge.Message.Text}}</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

+108
View File
@@ -0,0 +1,108 @@
<div class="runner-container">
<h4 class="ui top attached header">
{{ctx.Locale.Tr "actions.runners.runner_title"}} {{.Runner.ID}} {{.Runner.Name}}
</h4>
<div class="ui attached segment">
<form class="ui form" method="post">
{{template "base/disable_form_autofill"}}
<div class="runner-basic-info">
<div class="field tw-inline-block tw-mr-4">
<label>{{ctx.Locale.Tr "actions.runners.status"}}</label>
<span class="ui {{if .Runner.IsOnline}}green{{else}}basic{{end}} label">{{.Runner.StatusLocaleName ctx.Locale}}</span>
</div>
<div class="field tw-inline-block tw-mr-4">
<label>{{ctx.Locale.Tr "actions.runners.availability"}}</label>
<span class="ui {{if .Runner.IsDisabled}}grey{{else}}green{{end}} label">
{{if .Runner.IsDisabled}}
{{ctx.Locale.Tr "disabled"}}
{{else}}
{{ctx.Locale.Tr "enabled"}}
{{end}}
</span>
</div>
<div class="field tw-inline-block tw-mr-4">
<label>{{ctx.Locale.Tr "actions.runners.last_online"}}</label>
<span>{{if .Runner.LastOnline}}{{DateUtils.TimeSince .Runner.LastOnline}}{{else}}{{ctx.Locale.Tr "never"}}{{end}}</span>
</div>
<div class="field tw-inline-block tw-mr-4">
<label>{{ctx.Locale.Tr "actions.runners.labels"}}</label>
<span class="flex-text-inline tw-flex-wrap">
{{range .Runner.AgentLabels}}
<span class="ui label">{{.}}</span>
{{end}}
</span>
</div>
<div class="field tw-inline-block tw-mr-4">
<label>{{ctx.Locale.Tr "actions.runners.owner_type"}}</label>
<span data-tooltip-content="{{.Runner.BelongsToOwnerName}}">{{.Runner.BelongsToOwnerType.LocaleString ctx.Locale}}</span>
</div>
</div>
<div class="divider"></div>
<div class="field">
<label for="description">{{ctx.Locale.Tr "actions.runners.description"}}</label>
<input id="description" name="description" value="{{.Runner.Description}}">
</div>
<div class="divider"></div>
<div class="field">
<button class="ui primary button" data-url="{{.Link}}">{{ctx.Locale.Tr "actions.runners.update_runner"}}</button>
<button type="button" class="ui button link-action" data-url="{{.Link}}/update-runner?disabled={{not .Runner.IsDisabled}}">
{{if .Runner.IsDisabled}}{{ctx.Locale.Tr "actions.runners.enable_runner"}}{{else}}{{ctx.Locale.Tr "actions.runners.disable_runner"}}{{end}}
</button>
<button class="ui red button delete-button" data-url="{{.Link}}/delete" data-modal="#runner-delete-modal">
{{ctx.Locale.Tr "actions.runners.delete_runner"}}</button>
</div>
</form>
</div>
<h4 class="ui top attached header">
{{ctx.Locale.Tr "actions.runners.task_list"}}
</h4>
<div class="ui attached segment">
<table class="ui very basic table unstackable">
<thead>
<tr>
<th>{{ctx.Locale.Tr "actions.runners.task_list.run"}}</th>
<th>{{ctx.Locale.Tr "actions.runners.task_list.status"}}</th>
<th>{{ctx.Locale.Tr "actions.runners.task_list.repository"}}</th>
<th>{{ctx.Locale.Tr "actions.runners.task_list.commit"}}</th>
<th>{{ctx.Locale.Tr "actions.runners.task_list.done_at"}}</th>
</tr>
</thead>
<tbody>
{{range .Tasks}}
<tr>
<td><a href="{{.GetRunLink}}" target="_blank">{{.ID}}</a></td>
<td><span class="ui label task-status-{{.Status.String}}">{{.Status.LocaleString ctx.Locale}}</span></td>
<td><a href="{{.GetRepoLink}}" target="_blank">{{.GetRepoName}}</a></td>
<td>
<a class="ui sha label" href="{{.GetCommitLink}}" target="_blank">{{ShortSha .CommitSHA}}</a>
</td>
<td>{{if .IsStopped}}
<span>{{DateUtils.TimeSince .Stopped}}</span>
{{else}}-{{end}}</td>
</tr>
{{end}}
{{if not .Tasks}}
<tr>
<td colspan="5">{{ctx.Locale.Tr "actions.runners.task_list.no_tasks"}}</td>
</tr>
{{end}}
</tbody>
</table>
{{template "base/paginate" .}}
</div>
<div class="ui g-modal-confirm delete modal" id="runner-delete-modal">
<div class="header">
{{svg "octicon-trash"}}
{{ctx.Locale.Tr "actions.runners.delete_runner_header"}}
</div>
<div class="content">
<p>{{ctx.Locale.Tr "actions.runners.delete_runner_notice"}}</p>
</div>
{{template "base/modal_actions_confirm" .}}
</div>
</div>
+117
View File
@@ -0,0 +1,117 @@
<div class="runner-container">
<h4 class="ui top attached header">
{{ctx.Locale.Tr "actions.runners.runner_manage_panel"}} ({{ctx.Locale.Tr "admin.total" .Total}})
<div class="ui right">
<div class="ui top right pointing dropdown jump">
<button class="ui primary tiny button">
{{ctx.Locale.Tr "actions.runners.new"}}
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
</button>
<div class="menu">
<div class="item">
<a href="https://docs.gitea.com/usage/actions/act-runner">{{ctx.Locale.Tr "actions.runners.new_notice"}}</a>
</div>
<div class="divider"></div>
<div class="header">
Registration Token
</div>
<div class="ui action input">
<input type="text" value="{{.RegistrationToken}}" readonly>
<button class="ui basic label button" aria-label="{{ctx.Locale.Tr "copy"}}" data-clipboard-text="{{.RegistrationToken}}">
{{svg "octicon-copy" 14}}
</button>
</div>
<div class="divider"></div>
<div class="item">
<a class="link-action" data-url="{{$.Link}}/reset_registration_token"
data-modal-confirm="{{ctx.Locale.Tr "actions.runners.reset_registration_token_confirm"}}"
>
{{ctx.Locale.Tr "actions.runners.reset_registration_token"}}
</a>
</div>
</div>
</div>
</div>
</h4>
<div class="ui attached segment">
<form class="ui form ignore-dirty" id="user-list-search-form" action="{{$.Link}}">
{{template "shared/search/combo" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.runner_kind")}}
</form>
</div>
{{if .AllowBulkActions}}
<div class="ui attached segment tw-hidden" data-global-init="initRunnerBulkToolbar">
<form action="{{$.Link}}/bulk" method="post" class="form-fetch-action">
<input type="hidden" name="ids">
<button class="ui small button" name="action" value="disable">{{ctx.Locale.Tr "actions.runners.disable_runner"}} <span class="runner-bulk-count"></span></button>
<button class="ui small button" name="action" value="enable">{{ctx.Locale.Tr "actions.runners.enable_runner"}} <span class="runner-bulk-count"></span></button>
<button class="ui small red button" name="action" value="delete"
data-modal-confirm-header="{{ctx.Locale.Tr "actions.runners.delete_runner_header"}}"
data-modal-confirm-content="{{ctx.Locale.Tr "actions.runners.delete_runner_notice"}}"
>{{ctx.Locale.Tr "actions.runners.delete_runner"}} <span class="runner-bulk-count"></span>
</button>
</form>
</div>
{{end}}
{{if .Runners}}
<div class="ui attached table segment">
<table class="ui very basic table unstackable">
<thead>
<tr>
{{if .AllowBulkActions}}
<th class="tw-w-8"><div class="ui checkbox tw-flex"><input type="checkbox" class="runner-bulk-select-all" aria-label="{{ctx.Locale.Tr "admin.notices.select_all"}}"></div></th>
{{end}}
<th data-sortt-asc="online" data-sortt-desc="offline">
{{ctx.Locale.Tr "actions.runners.status"}}
{{SortArrow "online" "offline" .SortType false}}
</th>
<th data-sortt-asc="newest" data-sortt-desc="oldest">
{{ctx.Locale.Tr "actions.runners.id"}}
{{SortArrow "oldest" "newest" .SortType false}}
</th>
<th data-sortt-asc="alphabetically" data-sortt-desc="reversealphabetically">
{{ctx.Locale.Tr "actions.runners.name"}}
{{SortArrow "alphabetically" "reversealphabetically" .SortType false}}
</th>
<th>{{ctx.Locale.Tr "actions.runners.version"}}</th>
<th>{{ctx.Locale.Tr "actions.runners.owner_type"}}</th>
<th>{{ctx.Locale.Tr "actions.runners.labels"}}</th>
<th>{{ctx.Locale.Tr "actions.runners.last_online"}}</th>
<th>{{ctx.Locale.Tr "edit"}}</th>
</tr>
</thead>
<tbody>
{{range .Runners}}
<tr>
{{if $.AllowBulkActions}}
<td><div class="ui checkbox tw-flex"><input type="checkbox" class="runner-bulk-select" data-runner-id="{{.ID}}" aria-label="{{ctx.Locale.Tr "repo.issues.action_check"}}: {{.Name}}"></div></td>
{{end}}
<td>
<span class="ui label {{if .IsOnline}}green{{end}}">{{.StatusLocaleName ctx.Locale}}</span>
{{if .IsDisabled}}<span class="ui grey label">{{ctx.Locale.Tr "actions.runners.disabled"}}</span>{{end}}
</td>
<td>{{.ID}}</td>
<td><p data-tooltip-content="{{.Description}}">{{.Name}}</p></td>
<td>{{if .Version}}{{.Version}}{{else}}{{ctx.Locale.Tr "unknown"}}{{end}}</td>
<td><span data-tooltip-content="{{.BelongsToOwnerName}}">{{.BelongsToOwnerType.LocaleString ctx.Locale}}</span></td>
<td>
<span class="flex-text-inline tw-flex-wrap">{{range .AgentLabels}}<span class="ui label">{{.}}</span>{{end}}</span>
</td>
<td>{{if .LastOnline}}{{DateUtils.TimeSince .LastOnline}}{{else}}{{ctx.Locale.Tr "never"}}{{end}}</td>
<td>
{{if .EditableInContext $.RunnerOwnerID $.RunnerRepoID}}
<a href="{{$.Link}}/{{.ID}}">{{svg "octicon-pencil"}}</a>
{{end}}
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
{{else}}
<div class="ui attached segment tw-text-center">{{ctx.Locale.Tr "actions.runners.none"}}</div>
{{end}}
{{template "base/paginate" .}}
</div>