freenet / freenet-core

Declare your digital independence
https://freenet.org/
Apache License 2.0
2.2k stars 74 forks source link

freenet: URI for use with custom Freenet browser #670

Open sanity opened 1 year ago

sanity commented 1 year ago

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:

  1. 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.

  2. MacOS: It requires you to add some keys to the Info.plist file of your application's bundle, specifically CFBundleURLTypes, CFBundleURLSchemes, and potentially CFBundleURLName. Check out Apple's documentation on Configuring Custom URL Schemes for Your App.

  3. 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 a MimeType entry that includes x-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.

Destroyinator69420 commented 1 year ago

I think that a custom locutus browser would just add more hassle. I would recommend a simpler solution of using the users preferred browser with a custom browser extension, perhaps called locutus buddy, which would isolate locutus tabs from http tabs. It would also integrate jShelter on strict mode to lock down javascript so that it cannot be exploited. Firefox makes this very easy with container tabs, more work will be needed with chrome and its derivatives.