Windows - Online Server Browser Links - Custom Protocol

General Stuff about Armagetron, That doesn't belong anywhere else...
Post Reply
User avatar
Light
Reverse Outside Corner Grinder
Posts: 1667
Joined: Thu Oct 20, 2011 2:11 pm

Windows - Online Server Browser Links - Custom Protocol

Post by Light »

The following link will help you set up a custom protocol allowing you to use armagetronad:// links in your browser. This means that pages such as my server browser ( https://lightron.org/#Servers ) will allow you to click the title of the server you want to join and automatically open Armagetronad and connect you directly to the server you've chosen in your browser.

Warning: Registry changes can cause your system to no longer work properly if done incorrectly. You should not make a habit of accepting scripts such as these from strangers, so I suggest you look over it and know what you're adding to your registry. All I can give is my personal assurance that I'm not attempting to cause any harm to your system.

Edit: Knocked my forums offline, so I'll quote my post here.
This is a quick and easy way to add a protocol handler for armagetronad links. What this means is that when you use server browsers, such as the one hosted here on Lightron, links starting with "armagetronad://" can open your client and connect you directly to the server you've chosen.

To accomplish this, simply copy the following script into Notepad. Replace the file path to Armagetronad.exe with your own, noting that the path is escaped. This means that any slashes "\" will need escaped with an extra slash, causing them to become "\\". Save this file with any filename you like, but be sure to give it a ".reg" extension. Where your file may normally be "file.txt", it needs to be saved as "file.reg". Finally, double click the file and allow it to run as admin, and you're done!

When you use a browser such as Google Chrome, you may be asked to allow the link to open an external program. You can usually check the box to remember the option, then click allow and it will no longer require your permission.

Only replace piece of the script: D:\\armagetronad\\Armagetronad.exe

Code: Select all

REGEDIT4

[HKEY_CLASSES_ROOT\armagetronad]
@="URL:armagetronad Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\armagetronad\shell]

[HKEY_CLASSES_ROOT\armagetronad\shell\open]

[HKEY_CLASSES_ROOT\armagetronad\shell\open\command]
@="\"D:\\armagetronad\\Armagetronad.exe\" \"--connect\" %1"
Last edited by Light on Sun Sep 10, 2017 12:48 pm, edited 1 time in total.
User avatar
delinquent
Match Winner
Posts: 760
Joined: Sat Jul 07, 2012 3:07 am

Re: Windows - Online Server Browser Links - Custom Protocol

Post by delinquent »

This would be cool, albeit wholly unnecessary, to add to the installer.
User avatar
sinewav
Graphic Artist
Posts: 6413
Joined: Wed Jan 23, 2008 3:37 am
Contact:

Re: Windows - Online Server Browser Links - Custom Protocol

Post by sinewav »

Cool beans. I remember something like this being posted on these forums years ago by epsy, I think. I was never able to get it working. Want to post a tutorial for Linux? :D
User avatar
delinquent
Match Winner
Posts: 760
Joined: Sat Jul 07, 2012 3:07 am

Re: Windows - Online Server Browser Links - Custom Protocol

Post by delinquent »

In linux it should really be handled by the window environment, off the top of my head one might configure Gnome like so:

Code: Select all

gconftool-2 -t string -s /desktop/gnome/url-handlers/armagetron/command "<path-to-arma> %s/
Edit: Scratch that, I think it's out of date. You'll need to build something for armagetronad.desktop and add it to ~/.local/share/applications

Code: Select all

[Desktop Entry]
Name=armagetronad
Exec=/path/to/arma %u
Type=Application
Terminal=false
MimeType=x-scheme-handler/armagetronad;
You'll also need to add a mimeapps.list entry under ~/.local/share/applications/mimeapps.list

Code: Select all

x-scheme-handler/armagetronad=armagetronad.desktop
And then update the desktop in memory:

Code: Select all

update-desktop-database ~/.local/share/applications
That, in theory, should work across all browsers that support protocols. Also, arma might not be referred to as armagetronad in Linux, you'll need to double-check that.
User avatar
Light
Reverse Outside Corner Grinder
Posts: 1667
Joined: Thu Oct 20, 2011 2:11 pm

Re: Windows - Online Server Browser Links - Custom Protocol

Post by Light »

delinquent wrote:You'll need to build something for armagetronad.desktop and add it to ~/.local/share/applications
That was how I had previously set it up I believe. There's also times where I added things to xdg-open file, but I wouldn't recommend that since it's a messy alternative. If bash was requried, you're better off just linking the .desktop file to a bash file and have that execute the program.

Yeah .. Linux is much simpler. Took me a bit to get it right in Windows.
User avatar
delinquent
Match Winner
Posts: 760
Joined: Sat Jul 07, 2012 3:07 am

Re: Windows - Online Server Browser Links - Custom Protocol

Post by delinquent »

Light wrote:xdg-open
Yeah that's really not designed for a URL, its use case is better suited to scripts or desktop applications. Although, it's usually bad practice to use it as root, in which case it's a good idea to spawn a separate [s]thread[/s] process with "&" and step down in privilege before using it. Although, I'm still not sure how implementing "wait" will work cross-privilege...
Post Reply