mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-25 08:59:31 -05:00
Make the vscode clone link respect transport protocol (#20557)
This commit is contained in:
parent
5f127a729e
commit
86ed47e622
2 changed files with 6 additions and 1 deletions
|
@ -1,6 +1,8 @@
|
||||||
<script>
|
<script>
|
||||||
// synchronously set clone button states and urls here to avoid flickering
|
// synchronously set clone button states and urls here to avoid flickering
|
||||||
// on page load. initRepoCloneLink calls this when proto changes.
|
// on page load. initRepoCloneLink calls this when proto changes.
|
||||||
|
// this applies the protocol-dependant clone url to all elements with the
|
||||||
|
// `js-clone-url` and `js-clone-url-vsc` classes.
|
||||||
// TODO: This localStorage setting should be moved to backend user config
|
// TODO: This localStorage setting should be moved to backend user config
|
||||||
// so it's available during rendering, then this inline script can be removed.
|
// so it's available during rendering, then this inline script can be removed.
|
||||||
(window.updateCloneStates = function() {
|
(window.updateCloneStates = function() {
|
||||||
|
@ -19,5 +21,8 @@
|
||||||
for (const el of document.getElementsByClassName('js-clone-url')) {
|
for (const el of document.getElementsByClassName('js-clone-url')) {
|
||||||
el[el.nodeName === 'INPUT' ? 'value' : 'textContent'] = link;
|
el[el.nodeName === 'INPUT' ? 'value' : 'textContent'] = link;
|
||||||
}
|
}
|
||||||
|
for (const el of document.getElementsByClassName('js-clone-url-vsc')) {
|
||||||
|
el['href'] = 'vscode://vscode.git/clone?url=' + encodeURIComponent(link);
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -126,7 +126,7 @@
|
||||||
<a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip" 16 "mr-3"}}{{.locale.Tr "repo.download_tar"}}</a>
|
<a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip" 16 "mr-3"}}{{.locale.Tr "repo.download_tar"}}</a>
|
||||||
<a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.bundle" rel="nofollow">{{svg "octicon-package" 16 "mr-3"}}{{.locale.Tr "repo.download_bundle"}}</a>
|
<a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.bundle" rel="nofollow">{{svg "octicon-package" 16 "mr-3"}}{{.locale.Tr "repo.download_bundle"}}</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
<a class="item" href="vscode://vscode.git/clone?url={{$.RepoCloneLink.HTTPS}}">{{svg "gitea-vscode" 16 "mr-3"}}{{.locale.Tr "repo.clone_in_vsc"}}</a>
|
<a class="item js-clone-url-vsc" href="vscode://vscode.git/clone?url={{.CloneButtonOriginLink.HTTPS}}">{{svg "gitea-vscode" 16 "mr-3"}}{{.locale.Tr "repo.clone_in_vsc"}}</a>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue