freenet: URI for use with custom Freenet browser #670
Labels
A-os-integration
Area: OS integration
C-feature
Category: New feature or request
C-proposal
Category: A proposal seeking feedback
E-easy
Experience needed to fix/implement: Easy / not much
Register a URI handler in the OS for "freenet:" that launches the custom Freenet browser.
Notes
Yes, it's possible to create custom URI schemes on Windows, MacOS, and Linux, and associate them with an application. This allows you to launch that application from a browser or another application using a URI that starts with your custom scheme.
Here's a general idea on how you can do this in each OS:
Windows: You need to add some keys to the Windows registry to create a new protocol. Then, in the command key, specify the command line that should be used to launch your application. You can refer to the Microsoft documentation on Registering an Application to a URI Scheme for more details.
MacOS: It requires you to add some keys to the
Info.plist
file of your application's bundle, specificallyCFBundleURLTypes
,CFBundleURLSchemes
, and potentiallyCFBundleURLName
. Check out Apple's documentation on Configuring Custom URL Schemes for Your App.Linux: Linux doesn't have a central mechanism for this, but many desktop environments, like Gnome or KDE, support xdg-open, which delegates to the environment's default browser or file opener. You'll need to add a
.desktop
file for your app in/usr/share/applications
or~/.local/share/applications
, and define aMimeType
entry that includesx-scheme-handler/your-uri
.Remember, in all these cases, your application will need to be able to parse the URIs that it is given and take appropriate action. And there's no guarantee that every browser will respect these settings, although the major ones generally do.
Lastly, be aware that creating custom URL schemes can have security implications. Make sure to validate and sanitize all inputs to your application. You may not want to allow any arbitrary URL to be used to launch your app, as this could potentially be exploited by an attacker.
The text was updated successfully, but these errors were encountered: