Open DJCrashdummy opened 5 years ago
I like this idea, like you I actually find the packages I want on the webpage first (easier than searching through the CLI IMO).
So having this would definitely make it easier. Seems to be pretty easy to set up as well, changing a few registry settings to pass the correct arguments to the client and updating the website to have a link with the correct protocol.
@AdmiringWorm @DJCrashdummy if I have understood this correctly, we would need the ability to pass a navigation parameter into Chocolatey GUI to directly navigate to a Package Details page. Or have I misunderstood this?
@AdmiringWorm which registry keys are you referring to? Do you have a link to what you are describing?
if I have understood this correctly, we would need the ability to pass a navigation parameter into Chocolatey GUI to directly navigate to a Package Details page. Or have I misunderstood this?
No, to the CLI itself. And not to navigate, but to actually install (unless I misunderstood it myself).
@AdmiringWorm which registry keys are you referring to? Do you have a link to what you are describing?
Something along the line of:
[HKEY_CLASSES_ROOT\apt]
@="URL:Apt Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\apt\shell]
[HKEY_CLASSES_ROOT\apt\shell\open]
[HKEY_CLASSES_ROOT\apt\shell\open\command]
@="\"choco\" install \"%1\""
^^ may need full path to choco.exe
I believe the above would allow for urls like apt://git
(for installing git)
It may be possible for something along the lines of using:
[HKEY_CLASSES_ROOT\apt]
@="URL:Apt Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\apt\shell]
[HKEY_CLASSES_ROOT\apt\shell\open]
[HKEY_CLASSES_ROOT\apt\shell\open\command]
@="\"choco\" %1 \"%2\""
To allow for urls like apt://install/git
or apt://upgrade/git
(but this is something I have no idea if it works)
source was found here: https://support.shotgunsoftware.com/hc/en-us/articles/219031308-Launching-applications-using-custom-browser-protocols
NOTE: I have not yet tested this myself, but have seen something similar being used in the past.
Could this be accomplished as well via a browser plugin to open nuspkg files using "choco install" upon download?
@bcurran3 said: Could this be accomplished as well via a browser plugin to open nuspkg files using "choco install" upon download?
I honestly don't know, but it probably could.
~Anyways, I tested out the registry changes, and it does indeed work. Unfortunately due to the nature of chocolatey where it needs to run as an admin, this is something I haven't yet been able to do 😢~
EDIT: Scratch that, support for apt:// urls would still need to be baked into choco, as the whole url is passed to it 😢
Setting cinst.exe as "Run this program as an administrator"
and
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\nupkg_auto_file]
[HKEY_CLASSES_ROOT\nupkg_auto_file\shell]
[HKEY_CLASSES_ROOT\nupkg_auto_file\shell\open]
[HKEY_CLASSES_ROOT\nupkg_auto_file\shell\open\command] @="\"C:\ProgramData\chocolatey\bin\cinst.exe\" \"%1\""
...allows double clicking on .nupkg files to autorun/autoinstall
Maybe there's something to run with here...
if I have understood this correctly, we would need the ability to pass a navigation parameter into Chocolatey GUI to directly navigate to a Package Details page. Or have I misunderstood this?
No, to the CLI itself. And not to navigate, but to actually install (unless I misunderstood it myself).
@gep13 and @AdmiringWorm yes and no:
for sure the execution is done at choco.exe
but i highly recommend to somehow ask for confirmation before doing so, because hardly any noob looks at the URL behind a link before he clicks it. - doing this in the shell will scare off noobs, so some kind of GUI should be involved.
at debian/ubuntu/etc. apturl
is a separate package and it doesn't open any package manager, but a small window to ask for a confirmation:
an other not so advanced approach would be to open the existing package details page of chocolateygui
... but still an improvement compared to now. - and what the URL does/opens can still be changed/improved later.
@DJCrashdummy I don't know about other browsers, but I do know that chrome asks for confirmation to run the executable associated with the custom protocol.
IMO, this should be enough (if other browsers behave the same)
I can't say I quite have my head wrapped around the apt "protocol" portion, but I will say that the intent is completely doable. I've already done a proof of concept and created a scope of work for a package that I will create that will allow you to click download a package from chocolatey.org (or elsewhere) and auto-install the package from Chrome.
A small step towards making chocolatey.org pseudo-similar to ninite.com...
SIDENOTE: http://appnr.com/ is pretty damn cool, never saw that site before.
As for implementing it natively in Chocolatey, I think the challenge is adding the support for a "choco://" protocol to all browsers. It would require constantly checking for and updating various browser configs to support it. (i.e. When Chocolatey is initially installed it might not find Chrome, FireFox, or Opera installed because Chocolatey is going to be used to install them. So Chocolatey would then need to keep looking for browsers to inject support for a "choco://" protocol. Seems very cumbersome.) The key thing to take away here is that browser support is needed.
Non-native support via plug-ins for browsers would probably be the best route to go.
Looking at the apt:// method using aptlinex and apturl support programs as an example, a small executable could be used to approve/cancel installation of a package would be a good addition.
My plan to make this intent possible:
Not really very hard!
(Then look at implementing via FireFox.)
I still think this is best done via browser extensions, but I've never written one. Any volunteers? There's probably one out there that I could copy, paste, and modify... :)
maybe it is useful... a wiki-link of apturl
with integration steps into some browsers:
https://help.ubuntu.com//community/AptURL
another wiki-link with integration steps (translated from german): https://translate.google.com/translate?sl=de&tl=en&js=y&prev=_t&hl=de&ie=UTF-8&u=https%3A%2F%2Fwiki.ubuntuusers.de%2Fapturl%2F%23Integration-in-andere-Browser&edit-text=&act=url
In the spirit of the original request... And dedicated to @DJCrashdummy.
I present to you: https://chocolatey.org/packages/choco-install-packages-from-web-winconfig
Maybe @AdmiringWorm will find it useful too!
@DJCrashdummy - your original dream is becoming a reality...
https://chocolatey.org/packages/chocoprotocolstub
EDIT: Redone as https://chocolatey.org/packages/choco-protocol-support using Sudo and a batch file instead of a proprietary "assembly" that I wrote.
The following is my personal re-write of the enhancement request:
ENHANCEMENT REQUEST: Add support for custom choco:// protocol
Chocolatey - like yum or apt-get, but for Windows
Requesting Chocolatey feature duplication of AptURL/Apt Protocol. e.g. chocoURL/choco Protocol
IMPLEMENTATION:
CONSIDERATIONS:
RESULT: Chocolatey becomes much more user friendly for the browser-inclined-CLI-neophyte Average Joe. Chocolateasy! (future tm)
PROOF OF CONCEPT:
Proof of concept implemented using a (CLI) handler/stub program I wrote to process the chocoURL and then execute cinst.exe (registry manipulated to run as admin):
https://chocolatey.org/packages/chocoprotocolstub
EDIT: Redone as https://chocolatey.org/packages/choco-protocol-support using Sudo and a batch file instead of a proprietary "assembly."
RELATED/NOT RELATED BUT SIMILAR: Similar functionality available now. https://chocolatey.org/packages/choco-install-packages-from-web-winconfig
I wanted to say this is a duplicate, but I don't see the original (perhaps it is in the old chocolatey/chocolatey repository).
beforehand: sorry for being silent so long, but i was busy at work the last months and had no time to fiddle around with a windows machine.
choco-protocol-support
thank you very much @bcurran3! :+1: it works like a charm (even with edge - i've tested it because it is nowhere mentioned). :clap: but one interesting thing i noticed: (whether it is installed or not) if i try to view the details-page in the Chocolatey GUI it crushes. - this is the only package with this issue so i guess it must have to do with it and/or its description resp. rendering of them in the Chocolatey GUI.
choco-install-packages-from-web-winconfig
unfortunately it does not work for me. :slightly_frowning_face:
i'm pretty sure because cinst.exe
is not executed as admin (although it is explained otherwise in the details). :confused:
PS @bcurran3: may i suggest to strike through all mentions and links of since it was rejected... or is there a reason why it may still be interesting to try?chocoprotocolstub
thank you very much @bcurran3! 👍 it works like a charm
(even with edge - i've tested it because it is nowhere mentioned). 👏
I did some QUICK testing with Edge and it looked like it sandboxed it so quit really fast and moved on. :) (I don't use Edge.) Thanks for letting us (me) know it works with Edge!
but one interesting thing i noticed: (whether it is installed or not) if i try to view the details-page in the Chocolatey GUI it crushes. - this is the only package with this issue so i guess it must have to do with it and/or its description resp. rendering of them in the Chocolatey GUI.
Very weird. Not sure what's causing that. I thought maybe the choco protocol URL was crashing it but it displays it fine in other packages. I opened https://github.com/chocolatey/ChocolateyGUI/issues/649 for @gep13 to check it out.
choco-install-packages-from-web-winconfig unfortunately it does not work for me. 🙁 i'm pretty sure because
cinst.exe
is not executed as admin (although it is explained otherwise in the details). 😕
I'd suggest to remove and reinstall. There's also a possibility that it might not work if you already had .nupkg associated with a program under your USER profile. BUT... I'm putting out a v0.0.2 soon reworked to run a batchfile and use Sudo to keep it inline with it's sister package choco-protocol-support. That way it doesn't need to change the cinst.exe compatibility layer/manifest
PS @bcurran3: may i suggest to strike through all mentions and links of
chocoprotocolstub
since it was rejected... or is there a reason why it may still be interesting to try?
Done. I didn't at first because it works, and works slightly better and faster than choco-protocol-support and people can still use it if they wanted. It was rejected not because it didn't work or work well, @ferventcoder didn't
"...want chocolatey.org to be the first validation in the "web of trust" for assemblies that are placed onto chocolatey.org. Rather, that this validation is asserted elsewhere. What it comes down to is that although we know you as a maintainer and trust the work that you have done in this area, we can't independently verify what is going on with the assembly that you are adding into the package."
So basically it wasn't allowed because they didn't have the source. So I re-imagined it into a batch file that anyone could see what it does.
I have gone back and struck out the references to avoid confusion and edited in a comment that it was replaced/superceded by choco-protocol-support which does the same thing and is "blessed."
(I don't use Edge.) Thanks for letting us (me) know it works with Edge!
me neither, :wink: but i didn't have something else on a virgin test machine. - that was my intention.
I thought maybe the choco protocol URL was crashing it but it displays it fine in other packages.
this was also my first thought, but it is definitely not the case. - yes, very weird.
choco-install-packages-from-web-winconfig I'd suggest to remove and reinstall. [...] I'm putting out a v0.0.2 soon reworked [...]
already tried this and now once again, but no change. i just wanted to let you know... - (since i hardly use windows) no problem, i'll "wait" for v0.0.2.
There is another option that might be easier:
Check out the install button in this link: https://marketplace.visualstudio.com/items?itemName=auchenberg.vscode-browser-preview It is: vscode:extension/auchenberg.vscode-browser-preview
so, the format for choco would be something like this: choco:action/package
This is the documentation for it: https://docs.microsoft.com/en-us/windows/uwp/launch-resume/launch-app-with-uri
It is the same idea as the mailto: link.
although not suggested at my initial post... if not using apt://
but "creating" an own choco://
protocol, supporting chocolaty parameters as discussed at https://github.com/bcurran3/ChocolateyPackages/issues/138 would make sense.
After thinking about this some and some discussion with @gep13, there are a couple of points about how this should be implemented:
choco install
, a new command like choco uri
should be created. This is for security reasons, so someone can't do something like choco install choco://googlechrome --yes --source=https://malware/api
. Having a separate command should allow much more secure parsing.choco://v1/<package to install>
, then later add more features like choco:///v2/<install|upgrade|uninstall>/<package>/<version>?parameter=param
or whatever.This actually appears to be a duplicate of #684, although most of the discussion is happening in this issue.
This issue was added to the 1.0.0 milestone, however, after discussion, we are not going to include this in the 1.0.0 release, but hopefully quite quickly after the 1.0.0 release.
i'm not sure where to post this, so please bear with me if this is the wrong place!
i like AptProtocol for its easiness to suggest installation of a package either on a website, in an email or in any other document via one click (resp. a second one to confirm it's installation).
IMHO a choco-protocol - or maybe also work with
apt://
- would be a nice tool to provide the simplest method possible to install packages from chocolatey. e.g.chocolateygui
is nice but i rather use https://chocolatey.org/packages to browse the packages because it provides more information. after that i have open powershell and type the install-command (which is ok), but noobs have to openchocolateygui
, wait for a refresh and look for the correct package again to install it. instead of this bunch of additional steps and time a little "install now"-button at the homepage would ease the things a lot.