I'd just like to know how to git clone a file onto a user's desktop when they click a button.
Is it possible? If it is, what measures can I take to prevent any input and or meddling from the user?
I really, really do not someone to hack their way in there and cause people to rm -rf / their computer.
While giving access to the command line from the browser is generally impossible/restricted, you still can trigger a git repo clone from a browser.
See:
That is because those buttons are links using a protocol (like the x-github-client
protocol) which register an action (here: "opening GitHub Desktop")
This is a protocol:
[HKEY_CLASSES_ROOT\x-github-client] @="URL:x-github-client" "URL Protocol"=""
This is a protocol handler:
[HKEY_CLASSES_ROOT\someapp\shell] [HKEY_CLASSES_ROOT\someapp\shell\open] [HKEY_CLASSES_ROOT\someapp\shell\open\command] @=someapp.exe \"%1\"
This is what associates an app to a protocol:
[HKEY_LOCAL_MACHINE\SOFTWARE\SomeApp\Capabilities\UrlAssociations] "x-github-client"="someapp"