Skip to content

Commit 6ef385b

Browse files
authored
Merge branch 'master' into oidc-core-implementation
2 parents 91012b5 + ef825bd commit 6ef385b

File tree

27 files changed

+189
-135
lines changed

27 files changed

+189
-135
lines changed

CHANGELOG.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,42 @@ This changelog goes through all the changes that have been made in each release
44
without substantial changes to our git log; to see the highlights of what has
55
been added to each release, please refer to the [blog](https://blog.gitea.io).
66

7+
## [1.13.1](https://github.com/go-gitea/gitea/releases/tag/v1.13.1) - 2020-12-29
8+
9+
* SECURITY
10+
* Hide private participation in Orgs (#13994) (#14031)
11+
* Fix escaping issue in diff (#14153) (#14154)
12+
* BUGFIXES
13+
* Fix bug of link query order on markdown render (#14156) (#14171)
14+
* Drop long repo topics during migration (#14152) (#14155)
15+
* Ensure that search term and page are not lost on adoption page-turn (#14133) (#14143)
16+
* Fix storage config implementation (#14091) (#14095)
17+
* Fix panic in BasicAuthDecode (#14046) (#14048)
18+
* Always wait for the cmd to finish (#14006) (#14039)
19+
* Don't use simpleMDE editor on mobile devices for 1.13 (#14029)
20+
* Fix incorrect review comment diffs (#14002) (#14011)
21+
* Trim the branch prefix from action.GetBranch (#13981) (#13986)
22+
* Ensure template renderer is available before storage handler (#13164) (#13982)
23+
* Whenever the password is updated ensure that the hash algorithm is too (#13966) (#13967)
24+
* Enforce setting HEAD in wiki to master (#13950) (#13961)
25+
* Fix feishu webhook caused by API changed (#13938)
26+
* Fix Quote Reply button on review diff (#13830) (#13898)
27+
* Fix Pull Merge when tag with same name as base branch exist (#13882) (#13896)
28+
* Fix mermaid chart size (#13865)
29+
* Fix branch/tag notifications in mirror sync (#13855) (#13862)
30+
* Fix crash in short link processor (#13839) (#13841)
31+
* Update font stack to bootstrap's latest (#13834) (#13837)
32+
* Make sure email recipients can see issue (#13820) (#13827)
33+
* Reply button is not removed when deleting a code review comment (#13824)
34+
* When reinitialising DBConfig reset the database use flags (#13796) (#13811)
35+
* ENHANCEMENTS
36+
* Add emoji in label to project boards (#13978) (#14021)
37+
* Send webhook when tag is removed via Web UI (#14015) (#14019)
38+
* Use Process Manager to create own Context (#13792) (#13793)
39+
* API
40+
* GetCombinedCommitStatusByRef always return json & swagger doc fixes (#14047)
41+
* Return original URL of Repositories (#13885) (#13886)
42+
743
## [1.13.0](https://github.com/go-gitea/gitea/releases/tag/v1.13.0) - 2020-12-01
844
* SECURITY
945
* Add Allow-/Block-List for Migrate & Mirrors (#13610) (#13776)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ For more information and instructions about how to install Gitea, please look at
7373
If you have questions that are not covered by the documentation, you can get in contact with us on our [Discord server](https://discord.gg/Gitea) or create a post in the [discourse forum](https://discourse.gitea.io/).
7474

7575
We maintain a list of Gitea-related projects at [gitea/awesome-gitea](https://gitea.com/gitea/awesome-gitea).
76-
The hugo-based documentationt theme is hosted at [gitea/theme](https://gitea.com/gitea/theme).
76+
The hugo-based documentation theme is hosted at [gitea/theme](https://gitea.com/gitea/theme).
7777
The official Gitea CLI is developed at [gitea/tea](https://gitea.com/gitea/tea).
7878

7979
## Authors

docs/config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ params:
1818
description: Git with a cup of tea
1919
author: The Gitea Authors
2020
website: https://docs.gitea.io
21-
version: 1.13.0
21+
version: 1.13.1
2222
minGoVersion: 1.13
2323
goVersion: 1.15
2424
minNodeVersion: 10.13
@@ -51,7 +51,7 @@ menu:
5151
- name: Shop
5252
url: https://shop.gitea.io/
5353
weight: 40
54-
pre: code
54+
pre: shopping-cart
5555
- name: Translation
5656
url: https://crowdin.com/project/gitea
5757
weight: 41

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,5 @@ require (
126126
)
127127

128128
replace github.com/hashicorp/go-version => github.com/6543/go-version v1.2.4
129+
130+
replace github.com/microcosm-cc/bluemonday => github.com/lunny/bluemonday v1.0.5-0.20201227154428-ca34796141e8

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,8 @@ github.com/lib/pq v1.8.1-0.20200908161135-083382b7e6fc h1:ERSU1OvZ6MdWhHieo2oT7x
743743
github.com/lib/pq v1.8.1-0.20200908161135-083382b7e6fc/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
744744
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
745745
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
746+
github.com/lunny/bluemonday v1.0.5-0.20201227154428-ca34796141e8 h1:1omo92DLtxQu6VwVPSZAmduHaK5zssed6cvkHyl1XOg=
747+
github.com/lunny/bluemonday v1.0.5-0.20201227154428-ca34796141e8/go.mod h1:8iwZnFn2CDDNZ0r6UXhF4xawGvzaqzCRa1n3/lO3W2w=
746748
github.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96 h1:uNwtsDp7ci48vBTTxDuwcoTXz4lwtDTe7TjCQ0noaWY=
747749
github.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96/go.mod h1:mmIfjCSQlGYXmJ95jFN84AkQFnVABtKuJL8IrzwvUKQ=
748750
github.com/lunny/log v0.0.0-20160921050905-7887c61bf0de h1:nyxwRdWHAVxpFcDThedEgQ07DbcRc5xgNObtbTp76fk=
@@ -801,8 +803,6 @@ github.com/mgechev/revive v1.0.3-0.20200921231451-246eac737dc7 h1:ydVkpU/M4/c45y
801803
github.com/mgechev/revive v1.0.3-0.20200921231451-246eac737dc7/go.mod h1:no/hfevHbndpXR5CaJahkYCfM/FFpmM/dSOwFGU7Z1o=
802804
github.com/mholt/archiver/v3 v3.5.0 h1:nE8gZIrw66cu4osS/U7UW7YDuGMHssxKutU8IfWxwWE=
803805
github.com/mholt/archiver/v3 v3.5.0/go.mod h1:qqTTPUK/HZPFgFQ/TJ3BzvTpF/dPtFVJXdQbCmeMxwc=
804-
github.com/microcosm-cc/bluemonday v1.0.4 h1:p0L+CTpo/PLFdkoPcJemLXG+fpMD7pYOoDEq1axMbGg=
805-
github.com/microcosm-cc/bluemonday v1.0.4/go.mod h1:8iwZnFn2CDDNZ0r6UXhF4xawGvzaqzCRa1n3/lO3W2w=
806806
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
807807
github.com/minio/md5-simd v1.1.0 h1:QPfiOqlZH+Cj9teu0t9b1nTBfPbyTl16Of5MeuShdK4=
808808
github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw=

modules/markup/html_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func TestRender_links(t *testing.T) {
142142
`<p><a href="ftp://gitea.com/file.txt" rel="nofollow">ftp://gitea.com/file.txt</a></p>`)
143143
test(
144144
"magnet:?xt=urn:btih:5dee65101db281ac9c46344cd6b175cdcadabcde&dn=download",
145-
`<p><a href="magnet:?dn=download&xt=urn%3Abtih%3A5dee65101db281ac9c46344cd6b175cdcadabcde" rel="nofollow">magnet:?xt=urn:btih:5dee65101db281ac9c46344cd6b175cdcadabcde&amp;dn=download</a></p>`)
145+
`<p><a href="magnet:?xt=urn%3Abtih%3A5dee65101db281ac9c46344cd6b175cdcadabcde&dn=download" rel="nofollow">magnet:?xt=urn:btih:5dee65101db281ac9c46344cd6b175cdcadabcde&amp;dn=download</a></p>`)
146146

147147
// Test that should *not* be turned into URL
148148
test(

modules/repository/init.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ func adoptRepository(ctx models.DBContext, repoPath string, u *models.User, repo
243243
found := false
244244
hasDefault := false
245245
hasMaster := false
246+
hasMain := false
246247
for _, branch := range branches {
247248
if branch == repo.DefaultBranch {
248249
found = true
@@ -251,13 +252,17 @@ func adoptRepository(ctx models.DBContext, repoPath string, u *models.User, repo
251252
hasDefault = true
252253
} else if branch == "master" {
253254
hasMaster = true
255+
} else if branch == "main" {
256+
hasMain = true
254257
}
255258
}
256259
if !found {
257260
if hasDefault {
258261
repo.DefaultBranch = setting.Repository.DefaultBranch
259262
} else if hasMaster {
260263
repo.DefaultBranch = "master"
264+
} else if hasMain {
265+
repo.DefaultBranch = "main"
261266
} else if len(branches) > 0 {
262267
repo.DefaultBranch = branches[0]
263268
} else {

modules/templates/helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ func NewFuncMap() []template.FuncMap {
371371
"RenderLabels": func(labels []*models.Label) template.HTML {
372372
html := `<span class="labels-list">`
373373
for _, label := range labels {
374-
html += fmt.Sprintf("<div class='ui label' style='color: %s; background-color: %s'>%s</div>",
374+
html += fmt.Sprintf("<div class='ui label' style='color: %s; background-color: %s'>%s</div> ",
375375
label.ForegroundColor(), label.Color, RenderEmoji(label.Name))
376376
}
377377
html += "</span>"

options/locale/locale_ja-JP.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ my_mirrors=自分のミラー
216216
view_home=%s を表示
217217
search_repos=リポジトリを探す…
218218
filter=その他のフィルター
219+
filter_by_team_repositories=チームリポジトリで絞り込み
219220

220221
show_archived=アーカイブ
221222
show_both_archived_unarchived=アーカイブと非アーカイブの両方を表示
@@ -555,6 +556,7 @@ principal_state_desc=このプリンシパルは過去7日以内に使用され
555556
show_openid=プロフィールに表示する
556557
hide_openid=プロフィールに表示しない
557558
ssh_disabled=SSHは無効です
559+
ssh_externally_managed=このユーザー用に外部で管理されているSSHキーです
558560
manage_social=関連付けられているソーシャルアカウントを管理
559561
social_desc=これらのソーシャルアカウントがGiteaアカウントと連携されています。 これらすべてが、あなたのGiteaアカウントのサインインに使用してよいものであることを、十分確認してください。
560562
unbind=連携の解除
@@ -653,6 +655,7 @@ email_notifications.submit=メール設定を保存
653655

654656
[repo]
655657
owner=オーナー
658+
owner_helper=リポジトリ数の上限により、一部の組織はドロップダウンに表示されない場合があります。
656659
repo_name=リポジトリ名
657660
repo_name_helper=短く、覚えやすく、かつ他と重複しないキーワードを使用するのが良いリポジトリ名です。
658661
repo_size=リポジトリサイズ
@@ -1523,6 +1526,7 @@ settings.trust_model.collaborator.long=共同作業者: 共同作業者による
15231526
settings.trust_model.collaborator.desc=このリポジトリの共同作業者による正常な署名は、(署名がコミッターのものかどうかにかかわらず)「信頼済み」とみなします。 署名が共同作業者ではないコミッターのものであれば「信頼不可」、それ以外は「不一致」となります。
15241527
settings.trust_model.committer=コミッター
15251528
settings.trust_model.committer.long=コミッター: コミッターによる署名を信頼します (これはGitHub方式であり、Giteaの署名が付いたコミットはコミッターがGitea自身であることが強制されます)
1529+
settings.trust_model.committer.desc=正常な署名は、コミッターに一致する場合のみ「信頼済み」とみなし、それ以外は「不一致」となります。 Giteaは署名付きでコミットすることが強制され、本来のコミッターはコミットの最後に Co-authored-by: と Co-committed-by: で追加されます。 Giteaのデフォルト鍵はデータベース内のユーザー1人とマッチしなければなりません。
15261530
settings.trust_model.collaboratorcommitter=共同作業者+コミッター
15271531
settings.trust_model.collaboratorcommitter.long=共同作業者+コミッター: コミッターと一致する共同作業者による署名を信頼します
15281532
settings.trust_model.collaboratorcommitter.desc=このリポジトリの共同作業者による正常な署名は、コミッターと一致する場合に「信頼済み」とみなします。 それ以外の正常な署名のうち、コミッターに一致するものは「信頼不可」、他は「不一致」となります。 Giteaが署名付きコミットのコミッターであることが強制され、本来のコミッターはコミットの最後に Co-Authored-By: と Co-Committed-By: で追加されます。 Giteaのデフォルト鍵はデータベース内のユーザー1人とマッチしなければなりません。
@@ -2198,6 +2202,7 @@ auths.enable_tls=TLS暗号化を有効にする
21982202
auths.skip_tls_verify=TLS検証を省略
21992203
auths.pam_service_name=PAMサービス名
22002204
auths.oauth2_provider=OAuth2プロバイダー
2205+
auths.oauth2_icon_url=アイコンのURL
22012206
auths.oauth2_clientID=クライアントID (キー)
22022207
auths.oauth2_clientSecret=クライアント シークレット
22032208
auths.openIdConnectAutoDiscoveryURL=OpenID Connect自動検出URL

options/locale/locale_tr-TR.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2202,6 +2202,7 @@ auths.enable_tls=TLS Şifrelemeyi Aktifleştir
22022202
auths.skip_tls_verify=TLS Doğrulamasını Atla
22032203
auths.pam_service_name=PAM Servis Adı
22042204
auths.oauth2_provider=OAuth2 Sağlayıcısı
2205+
auths.oauth2_icon_url=Simge URL'si
22052206
auths.oauth2_clientID=İstemci Kimliği (Anahtar)
22062207
auths.oauth2_clientSecret=İstemci Gizliliği
22072208
auths.openIdConnectAutoDiscoveryURL=OpenID Connect Otomatik Keşif URL’si

options/locale/locale_zh-TW.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ my_mirrors=我的鏡像
215215
view_home=訪問 %s
216216
search_repos=搜尋儲存庫...
217217
filter=其他篩選條件
218+
filter_by_team_repositories=以團隊儲存庫篩選
218219

219220
show_archived=已封存
220221
show_both_archived_unarchived=顯示已封存和未封存
@@ -2200,6 +2201,7 @@ auths.enable_tls=啟用 TLS 加密
22002201
auths.skip_tls_verify=忽略 TLS 驗證
22012202
auths.pam_service_name=PAM 服務名稱
22022203
auths.oauth2_provider=OAuth2 提供者
2204+
auths.oauth2_icon_url=圖示 URL
22032205
auths.oauth2_clientID=客戶端 ID (金鑰)
22042206
auths.oauth2_clientSecret=客戶端密鑰
22052207
auths.openIdConnectAutoDiscoveryURL=OpenID 連接自動探索 URL

routers/private/hook.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,8 @@ func HookPostReceive(ctx *macaron.Context, opts private.HookOptions) {
412412
RepoName: repoName,
413413
}
414414
updates = append(updates, &option)
415-
if repo.IsEmpty && option.IsBranch() && option.BranchName() == "master" {
416-
// put the master branch first
415+
if repo.IsEmpty && option.IsBranch() && (option.BranchName() == "master" || option.BranchName() == "main") {
416+
// put the master/main branch first
417417
copy(updates[1:], updates)
418418
updates[0] = &option
419419
}

routers/user/setting/profile.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,9 @@ func Repos(ctx *context.Context) {
235235
root := filepath.Join(models.UserPath(ctxUser.Name))
236236
if err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
237237
if err != nil {
238+
if os.IsNotExist(err) {
239+
return nil
240+
}
238241
return err
239242
}
240243
if !info.IsDir() || path == root {

services/mirror/mirror.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,7 @@ func checkAndUpdateEmptyRepository(m *models.Mirror, gitRepo *git.Repository, re
521521

522522
hasDefault := false
523523
hasMaster := false
524+
hasMain := false
524525
defaultBranchName := m.Repo.DefaultBranch
525526
if len(defaultBranchName) == 0 {
526527
defaultBranchName = setting.Repository.DefaultBranch
@@ -540,13 +541,16 @@ func checkAndUpdateEmptyRepository(m *models.Mirror, gitRepo *git.Repository, re
540541

541542
hasDefault = hasDefault || name == defaultBranchName
542543
hasMaster = hasMaster || name == "master"
544+
hasMain = hasMain || name == "main"
543545
}
544546

545547
if len(firstName) > 0 {
546548
if hasDefault {
547549
m.Repo.DefaultBranch = defaultBranchName
548550
} else if hasMaster {
549551
m.Repo.DefaultBranch = "master"
552+
} else if hasMain {
553+
m.Repo.DefaultBranch = "main"
550554
} else {
551555
m.Repo.DefaultBranch = firstName
552556
}

templates/repo/clone_buttons.tmpl

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{{if not $.DisableHTTP}}
2+
<button class="ui basic clone button no-transition" id="repo-clone-https" data-link="{{.CloneLink.HTTPS}}">
3+
{{if UseHTTPS}}HTTPS{{else}}HTTP{{end}}
4+
</button>
5+
{{end}}
6+
{{if and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH)}}
7+
<button class="ui basic clone button no-transition" id="repo-clone-ssh" data-link="{{.CloneLink.SSH}}">
8+
SSH
9+
</button>
10+
{{end}}
11+
{{if not $.DisableHTTP}}
12+
<input id="repo-clone-url" value="{{$.CloneLink.HTTPS}}" readonly>
13+
{{else if and (not .DisableSSH) (or $.IsSigned $.ExposeAnonSSH)}}
14+
<input id="repo-clone-url" value="{{$.CloneLink.SSH}}" readonly>
15+
{{end}}
16+
{{if or (not $.DisableHTTP) (and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH))}}
17+
<button class="ui basic icon button poping up clipboard" id="clipboard-btn" data-original="{{.i18n.Tr "repo.copy_link"}}" data-success="{{.i18n.Tr "repo.copy_link_success"}}" data-error="{{.i18n.Tr "repo.copy_link_error"}}" data-content="{{.i18n.Tr "repo.copy_link"}}" data-variation="inverted tiny" data-clipboard-target="#repo-clone-url">
18+
{{svg "octicon-clippy"}}
19+
</button>
20+
{{end}}
21+
{{if not (and $.DisableHTTP $.DisableSSH)}}
22+
<script defer>
23+
const isSSH = localStorage.getItem('repo-clone-protocol') === 'ssh';
24+
const sshButton = document.getElementById('repo-clone-ssh');
25+
const httpsButton = document.getElementById('repo-clone-https');
26+
const input = document.getElementById('repo-clone-url');
27+
if (input) input.value = (isSSH ? sshButton : httpsButton).dataset.link;
28+
if (sshButton) sshButton.classList[isSSH ? 'add' : 'remove']('primary');
29+
if (httpsButton) httpsButton.classList[isSSH ? 'remove' : 'add']('primary');
30+
setTimeout(() => {
31+
if (sshButton) sshButton.classList.remove('no-transition');
32+
if (httpsButton) httpsButton.classList.remove('no-transition');
33+
}, 100);
34+
</script>
35+
{{end}}

templates/repo/empty.tmpl

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,7 @@
1818
<div class="item">
1919
<h3>{{.i18n.Tr "repo.clone_this_repo"}} <small>{{.i18n.Tr "repo.clone_helper" "http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository" | Str2html}}</small></h3>
2020
<div class="ui action small input">
21-
{{if not $.DisableHTTP}}
22-
<button class="ui basic clone button" id="repo-clone-https" data-link="{{.CloneLink.HTTPS}}">
23-
{{if UseHTTPS}}HTTPS{{else}}HTTP{{end}}
24-
</button>
25-
{{end}}
26-
{{if not $.DisableSSH}}
27-
<button class="ui basic clone button" id="repo-clone-ssh" data-link="{{.CloneLink.SSH}}">
28-
SSH
29-
</button>
30-
{{end}}
31-
{{if not $.DisableHTTP}}
32-
<input id="repo-clone-url" value="{{$.CloneLink.HTTPS}}" readonly>
33-
{{else}}
34-
<input id="repo-clone-url" value="{{$.CloneLink.SSH}}" readonly>
35-
{{end}}
36-
{{if not (and $.DisableHTTP $.DisableSSH)}}
37-
<button class="ui basic button poping up clipboard" id="clipboard-btn" data-original="{{.i18n.Tr "repo.copy_link"}}" data-success="{{.i18n.Tr "repo.copy_link_success"}}" data-error="{{.i18n.Tr "repo.copy_link_error"}}" data-content="{{.i18n.Tr "repo.copy_link"}}" data-variation="inverted tiny" data-clipboard-target="#repo-clone-url">
38-
{{svg "octicon-clippy"}}
39-
</button>
40-
{{end}}
21+
{{template "repo/clone_buttons" .}}
4122
</div>
4223
</div>
4324

templates/repo/home.tmpl

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -106,43 +106,10 @@
106106
{{end}}
107107
</div>
108108
<div class="fitted item">
109-
110109
<!-- Only show clone panel in repository home page -->
111110
{{if eq $n 0}}
112111
<div class="ui action tiny input" id="clone-panel">
113-
{{if not $.DisableHTTP}}
114-
<button class="ui basic clone button no-transition" id="repo-clone-https" data-link="{{.CloneLink.HTTPS}}">
115-
{{if UseHTTPS}}HTTPS{{else}}HTTP{{end}}
116-
</button>
117-
{{end}}
118-
{{if and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH)}}
119-
<button class="ui basic clone button no-transition" id="repo-clone-ssh" data-link="{{.CloneLink.SSH}}">
120-
SSH
121-
</button>
122-
{{end}}
123-
{{if not $.DisableHTTP}}
124-
<input id="repo-clone-url" value="{{$.CloneLink.HTTPS}}" readonly>
125-
{{else if and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH)}}
126-
<input id="repo-clone-url" value="{{$.CloneLink.SSH}}" readonly>
127-
{{end}}
128-
<script defer>
129-
const isSSH = localStorage.getItem('repo-clone-protocol') === 'ssh';
130-
const sshButton = document.getElementById('repo-clone-ssh');
131-
const httpsButton = document.getElementById('repo-clone-https');
132-
const input = document.getElementById('repo-clone-url');
133-
if (input) input.value = (isSSH ? sshButton : httpsButton).dataset.link;
134-
if (sshButton) sshButton.classList[isSSH ? 'add' : 'remove']('primary');
135-
if (httpsButton) httpsButton.classList[isSSH ? 'remove' : 'add']('primary');
136-
setTimeout(() => {
137-
if (sshButton) sshButton.classList.remove('no-transition');
138-
if (httpsButton) httpsButton.classList.remove('no-transition');
139-
}, 100);
140-
</script>
141-
{{if or (not $.DisableHTTP) (and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH))}}
142-
<button class="ui basic icon button poping up clipboard" id="clipboard-btn" data-original="{{.i18n.Tr "repo.copy_link"}}" data-success="{{.i18n.Tr "repo.copy_link_success"}}" data-error="{{.i18n.Tr "repo.copy_link_error"}}" data-content="{{.i18n.Tr "repo.copy_link"}}" data-variation="inverted tiny" data-clipboard-target="#repo-clone-url">
143-
{{svg "octicon-clippy"}}
144-
</button>
145-
{{end}}
112+
{{template "repo/clone_buttons" .}}
146113
<div class="ui basic jump dropdown icon button poping up" data-content="{{.i18n.Tr "repo.download_archive"}}" data-variation="tiny inverted" data-position="top right">
147114
{{svg "octicon-download"}}
148115
<div class="menu">

0 commit comments

Comments
 (0)