Files
Gitea/templates/repo/settings/deploy_keys.tmpl
T
ToastyTheBot 646ea0f253 feat: add deploy tokens (#37306)
Deploy keys only work over SSH. A deploy token is their counterpart for HTTPS: a repository scoped credential, used as the password of a Git request, with read or read and write access. It covers Git operations and LFS, and can be regenerated in place.

Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: Claude Mythos <noreply@anthropic.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: bircni <bircni@icloud.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-08-26 19:32:44 +00:00

76 lines
3.6 KiB
Handlebars

{{template "repo/settings/layout_head" (dict "pageClass" "repository settings")}}
<div class="repo-setting-content">
<h4 class="ui top attached header">
{{ctx.Locale.Tr "repo.settings.deploy_keys"}}
<div class="ui right">
{{if not .DisableSSH}}
<button class="ui primary compact tiny button show-panel toggle" data-panel="#add-deploy-key-ssh-panel" data-panel-hide="#add-deploy-key-token-panel">{{ctx.Locale.Tr "repo.settings.add_deploy_key_ssh"}}</button>
{{else}}
<button class="ui primary compact tiny button disabled">{{ctx.Locale.Tr "settings.ssh_disabled"}}</button>
{{end}}
<button class="ui primary compact tiny button show-panel toggle" data-panel="#add-deploy-key-token-panel" data-panel-hide="#add-deploy-key-ssh-panel">{{ctx.Locale.Tr "repo.settings.generate_deploy_token"}}</button>
</div>
</h4>
<div class="ui attached segment">
<div class="tw-hidden tw-mb-4" id="add-deploy-key-ssh-panel">
<form class="ui form form-fetch-action" action="{{.Link}}" method="post">
<div class="field">{{ctx.Locale.Tr "repo.settings.deploy_key_ssh_desc"}}</div>
<div class="field">
<label>{{ctx.Locale.Tr "repo.settings.title"}}</label>
<input name="title" autofocus required>
</div>
<div class="field">
<label>{{ctx.Locale.Tr "settings.key_content"}}</label>
<textarea name="content" placeholder="{{ctx.Locale.Tr "settings.key_content_ssh_placeholder"}}" required></textarea>
</div>
<div class="field">
<div class="ui checkbox">
<input name="is_writable" type="checkbox" value="1">
<label>{{ctx.Locale.Tr "repo.settings.is_writable"}}</label>
<small class="tw-pl-[20px]">{{ctx.Locale.Tr "repo.settings.is_writable_info"}}</small>
</div>
</div>
<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.add_deploy_key_ssh"}}</button>
<button class="ui hide-panel button" data-panel="#add-deploy-key-ssh-panel">{{ctx.Locale.Tr "cancel"}}</button>
</form>
<div class="divider"></div>
</div>
<div class="tw-hidden tw-mb-4" id="add-deploy-key-token-panel">
<form class="ui form form-fetch-action" action="{{.Link}}/generate-token" method="post">
<div class="field">{{ctx.Locale.Tr "repo.settings.deploy_key_token_desc"}}</div>
<div class="field">
<label>{{ctx.Locale.Tr "repo.settings.title"}}</label>
<input name="title" autofocus required>
</div>
<div class="field">
<div class="ui checkbox">
<input name="is_writable" type="checkbox" value="1">
<label>{{ctx.Locale.Tr "repo.settings.is_writable"}}</label>
<small class="tw-pl-[20px]">{{ctx.Locale.Tr "repo.settings.is_writable_info"}}</small>
</div>
</div>
<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.generate_deploy_token"}}</button>
<button class="ui hide-panel button" data-panel="#add-deploy-key-token-panel">{{ctx.Locale.Tr "cancel"}}</button>
</form>
<div class="divider"></div>
</div>
{{template "repo/settings/deploy_key_list" dict "RepoDeployKeys" .RepoDeployKeys}}
</div>
</div>
<div class="ui small modal" id="repo-deploy-key-delete-modal">
<div class="header">{{svg "octicon-trash"}} {{ctx.Locale.Tr "remove"}}</div>
<div class="content"><p>{{ctx.Locale.Tr "repo.settings.deploy_key_deletion_desc"}}</p></div>
{{template "base/modal_actions_confirm" .}}
</div>
<div class="ui small modal" id="repo-deploy-token-regenerate-modal">
<div class="header">{{svg "octicon-sync"}} {{ctx.Locale.Tr "settings.regenerate_token"}}</div>
<div class="content"><p>{{ctx.Locale.Tr "repo.settings.regenerate_deploy_token_desc"}}</p></div>
{{template "base/modal_actions_confirm" .}}
</div>
{{template "repo/settings/layout_footer" .}}