File tree Expand file tree Collapse file tree 3 files changed +47
-1
lines changed Expand file tree Collapse file tree 3 files changed +47
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ export const configSchemata = {
36
36
useManualProxy : z . boolean ( ) ,
37
37
useProxy : z . boolean ( ) ,
38
38
useSystemProxy : z . boolean ( ) ,
39
+ whitelistedProtocols : z . string ( ) . array ( ) ,
39
40
} ;
40
41
41
42
export const enterpriseConfigSchemata = {
Original file line number Diff line number Diff line change @@ -3,10 +3,20 @@ import fs from "node:fs";
3
3
import os from "node:os" ;
4
4
import path from "node:path" ;
5
5
6
+ import * as ConfigUtil from "./config-util.ts" ;
6
7
import { html } from "./html.ts" ;
7
8
9
+ /* Fetches the current protocolLaunchers from settings.json */
10
+ const whitelistedProtocols = ConfigUtil . getConfigItem ( "whitelistedProtocols" , [
11
+ "http:" ,
12
+ "https:" ,
13
+ "mailto:" ,
14
+ "tel:" ,
15
+ "sip:" ,
16
+ ] ) ;
17
+
8
18
export async function openBrowser ( url : URL ) : Promise < void > {
9
- if ( [ "http:" , "https:" , "mailto:" ] . includes ( url . protocol ) ) {
19
+ if ( whitelistedProtocols . includes ( url . protocol ) ) {
10
20
await shell . openExternal ( url . href ) ;
11
21
} else {
12
22
// For security, indirect links to non-whitelisted protocols
Original file line number Diff line number Diff line change
1
+ # Customizing Link Protocols
2
+
3
+ The Zulip app supports opening certain link protocols directly in their associated system applications. These are known as ** whitelisted protocols** .
4
+
5
+ ## Default Whitelisted Protocols
6
+
7
+ By default, the following protocols are whitelisted:
8
+
9
+ ```
10
+ http https mailto tel sip
11
+ ```
12
+
13
+ Links using these protocols are opened directly by the system.
14
+
15
+ All other protocols are considered potentially unsafe and are therefore opened indirectly—through a local HTML file—in your default web browser.
16
+
17
+ ## Extending the Whitelisted Protocols
18
+
19
+ It is possible to customize the list of whitelisted protocols by editing the ` settings.json ` file located at: ` userdata/Zulip/config/settings.json `
20
+
21
+ To add or modify the list, the ` whitelistedProtocols ` key can be updated. For example:
22
+
23
+ ``` json
24
+ {
25
+ ...
26
+ "whitelistedProtocols" : [
27
+ " http:" ,
28
+ " https:" ,
29
+ " mailto:"
30
+ ]
31
+ ...
32
+ }
33
+ ```
34
+
35
+ Note: Each protocol should include the trailing colon (:), e.g., "mailto:" instead of "mailto".
You can’t perform that action at this time.
0 commit comments