Remove clone_script.tmpl or is it still required? #10069

Closed
opened 2025-11-02 08:57:21 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @rdwz on GitHub (Jan 8, 2023).

I came across this file and would like this to be discussed: as far as I can tell at the frontend the code seems not to be necessary, am I wrong, what about the backend-side of this?

  • there is clone_script.tmpl, but as I already mentioned all works fine without editing this and I also tested the case of an empty clone_script and it doesn't break the functionality or the generated links.
  • and the file has this comments:

// synchronously set clone button states and urls here to avoid flickering
// 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
// so it's available during rendering, then this inline script can be removed.

to me it seems that it can be removed, but I guess this is another issue and should be discussed seperately?!

Originally posted by @redwerkz in https://github.com/go-gitea/gitea/issues/21123#issuecomment-1374705079

Originally created by @rdwz on GitHub (Jan 8, 2023). I came across this file and would like this to be discussed: as far as I can tell at the frontend the code seems not to be necessary, am I wrong, what about the backend-side of this? - there is clone_script.tmpl, but as I already mentioned all works fine without editing this and I also tested the case of an empty clone_script and it doesn't break the functionality or the generated links. - and the file has this comments: > // synchronously set clone button states and urls here to avoid flickering > // 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 > // so it's available during rendering, then this inline script can be removed. to me it seems that it can be removed, but I guess this is another issue and should be discussed seperately?! _Originally posted by @redwerkz in https://github.com/go-gitea/gitea/issues/21123#issuecomment-1374705079_
Author
Owner

@rdwz commented on GitHub (Jan 8, 2023):

A little more background about this.

I wanted to add a button to clone a repo in VSCodium like it is already possible to do for VSCode. And this script inside clone_script.tmpl handles or handled the link behind the button that includes a custom handle like vscode:// or vscodium://

Screenshot_20230108_053715

@rdwz commented on GitHub (Jan 8, 2023): A little more background about this. I wanted to add a button to clone a repo in VSCodium like it is already possible to do for VSCode. And this script inside `clone_script.tmpl` handles or handled the link behind the button that includes a custom handle like `vscode://` or `vscodium://` ![Screenshot_20230108_053715](https://user-images.githubusercontent.com/8125196/211180698-7b3b5791-57ce-49f4-a5f6-da47e93f781f.png)
Author
Owner

@wxiaoguang commented on GitHub (Jan 8, 2023):

Can clone_script.tmpl be removed?

No at the moment.

How it works?

The Clone URLs are updated by that script. Users may:

  • Disable HTTPS clone, then only SSH URL should be used
  • Set SSH as default clone method, then the UI should show the SSH URL by default.

You can do a full test on your side to see how the Clone URL works.

@wxiaoguang commented on GitHub (Jan 8, 2023): ### Can `clone_script.tmpl` be removed? No at the moment. ### How it works? The Clone URLs are updated by that script. Users may: * Disable HTTPS clone, then only SSH URL should be used * Set SSH as default clone method, then the UI should show the SSH URL by default. You can do a full test on your side to see how the Clone URL works.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10069