zulip-desktop icon indicating copy to clipboard operation
zulip-desktop copied to clipboard

LinkUtils custom application launcher protocols

Open jonassorgenfrei opened this issue 2 years ago • 2 comments

Hey,

we are using Zulip and are having a problem for some of our custom launcher we'd link to linkify. The links are :// unfortunatly this will always be opened in the browser as the custom protocol is not part of the list. ["http:", "https:", "mailto:"]

Would there be an option to ad custom protocol launcher to the settings which will look like: "protocolLaunchers": { "": "mylauncher", }

In https://github.com/zulip/zulip-desktop/blob/main/app/common/link-util.ts

The pseudo-code my look like:

...
if (["http:", "https:", "mailto:"].includes(url.protocol)) {
    await shell.openExternal(url.href);
} elif (procolLaunchers.includes(url.protocol)) {
    executable = procolLaunchers[url.protocol]
    command = url.pathname.replace(/^\/+/g, "") + url.search + url.hash
    
    await shell.openExternal(executable + " " + command );
}
else
....

This is an option which might gives the opertunity that users can create clickable links which e.g. open files in applications while keeping the secruity menitoned in: // For security, indirect links to non-whitelisted protocols // through a real web browser via a local HTML file.

As the protocolLaunchers can be configured manually.

What do you think about this, happy to help/cotnribute this with a PR if it's cool :)

jonassorgenfrei avatar Mar 17 '23 15:03 jonassorgenfrei

Actually i found out that it's way easier to just expose the whitelistedProtocol list, which i will do in a PR!

jonassorgenfrei avatar Apr 06 '23 11:04 jonassorgenfrei