Files
Gitea/templates/repo/clone_panel.tmpl
T
TowyTowy 8a3daef525 fix(repo): stop advertising HTTP clone URLs when DISABLE_HTTP_GIT is set (#38378)
Fixes #38339

---------

Signed-off-by: TowyTowy <towy@airreps.link>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-07-17 05:17:28 +00:00

57 lines
2.8 KiB
Handlebars

{{$cloneLink := $.CloneButtonOriginLink}}
{{$downloadArchiveLinkPrefix := $.DownloadArchiveLinkPrefix}}
{{$openWithEditorApps := $.OpenWithEditorApps}}
{{$showCloneLinks := or $cloneLink.SupportHTTPS $cloneLink.SupportSSH}}
{{$showOpenWithEditorApps := and $showCloneLinks $openWithEditorApps}}{{/* the editor apps need the clone link */}}
{{if or $showCloneLinks $showOpenWithEditorApps $downloadArchiveLinkPrefix}}
<button class="ui compact primary button" data-global-init="initRepoClonePanel">
{{svg "octicon-code" 16}}
<span>{{ctx.Locale.Tr "repo.code"}}</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
</button>
<div class="clone-panel-popup tippy-target">
{{if $showCloneLinks}}
<div class="flex-text-block clone-panel-field">{{svg "octicon-terminal"}} Clone</div>
<div class="clone-panel-tab">
<!-- tea clone also uses the git HTTPS/SSH transports, so the whole clone section is hidden when both are disabled -->
{{if $cloneLink.SupportHTTPS}}
<button class="item repo-clone-https" data-link="{{$cloneLink.HTTPS}}">HTTPS</button>
{{end}}
{{if $cloneLink.SupportSSH}}
<button class="item repo-clone-ssh" data-link="{{$cloneLink.SSH}}">SSH</button>
{{end}}
{{if not $cloneLink.IsWikiRepo}}
<button class="item repo-clone-tea" data-link="{{$cloneLink.Tea}}">Tea CLI</button>
{{end}}
</div>
<div class="divider"></div>
<div class="clone-panel-field">
<div class="ui input tiny action">
<input size="30" class="repo-clone-url js-clone-url" value="{{Iif $cloneLink.SupportHTTPS $cloneLink.HTTPS $cloneLink.SSH}}" readonly>
<div class="ui small compact icon button" data-clipboard-target=".js-clone-url" data-tooltip-content="{{ctx.Locale.Tr "copy_url"}}">
{{svg "octicon-copy" 14}}
</div>
</div>
</div>
{{end}}
{{if $showOpenWithEditorApps}}
<div class="flex-items-block clone-panel-list repo-clone-with-apps">
{{range $app := $openWithEditorApps}}
<a class="item muted js-clone-url-editor" data-href-template="{{$app.OpenURL}}">{{$app.IconHTML}}{{ctx.Locale.Tr "repo.open_with_editor" $app.DisplayName}}</a>
{{end}}
</div>
{{end}}
{{if $downloadArchiveLinkPrefix}}
{{if $showOpenWithEditorApps}}<div class="divider"></div>{{end}}
<div class="flex-items-block clone-panel-list">
<a class="item muted archive-link" href="{{$downloadArchiveLinkPrefix}}.zip" rel="nofollow">{{svg "octicon-file-zip"}} {{ctx.Locale.Tr "repo.download_zip"}}</a>
<a class="item muted archive-link" href="{{$downloadArchiveLinkPrefix}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip"}} {{ctx.Locale.Tr "repo.download_tar"}}</a>
<a class="item muted archive-link" href="{{$downloadArchiveLinkPrefix}}.bundle" rel="nofollow">{{svg "octicon-package"}} {{ctx.Locale.Tr "repo.download_bundle"}}</a>
</div>
{{end}}
</div>
{{end}}