diff options
Diffstat (limited to 'docs/integration.md')
-rw-r--r-- | docs/integration.md | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/docs/integration.md b/docs/integration.md index ef9e2a5..21d1399 100644 --- a/docs/integration.md +++ b/docs/integration.md | |||
@@ -100,17 +100,32 @@ module.exports = Ferdi => class RocketChat extends Ferdi { | |||
100 | `validateServer` needs to return a [`Promise`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise), otherwise validation will fail. | 100 | `validateServer` needs to return a [`Promise`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise), otherwise validation will fail. |
101 | 101 | ||
102 | 102 | ||
103 | If you need to override the default user-agent in your service, you can do so like the following snippet of code | ||
104 | 103 | ||
104 | By default, Ferdi's user agent looks like this: | ||
105 | ``` | 105 | ``` |
106 | overrideUserAgent() { | 106 | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.141 Safari/537.36 Ferdi/5.4.4-beta.3 (Electron 8.1.1) |
107 | return window.navigator.userAgent.replace( | ||
108 | /(Ferdi|Electron)\/\S+ \([^)]+\)/g, | ||
109 | "" | ||
110 | ); | ||
111 | } | ||
112 | ``` | 107 | ``` |
113 | 108 | ||
109 | Some services may not be compatible with Ferdi adding it's signature to the user agent. | ||
110 | |||
111 | If you encounter such a service, you remove this signature with the following snippet of code | ||
112 | |||
113 | ``` | ||
114 | overrideUserAgent() { | ||
115 | return window.navigator.userAgent.replace( | ||
116 | /(Ferdi|Electron)\/\S+ \([^)]+\)/g, | ||
117 | "" | ||
118 | ); | ||
119 | } | ||
120 | ``` | ||
121 | |||
122 | If you want to change the user agent to a different one, you can simply return the String for the new user agent: | ||
123 | |||
124 | ``` | ||
125 | overrideUserAgent() { | ||
126 | return "Mozilla/2.02Gold (Win95; I)"; | ||
127 | } | ||
128 | ``` | ||
114 | 129 | ||
115 | ### webview.js | 130 | ### webview.js |
116 | The webview.js is the actual script that will be loaded into the webview. Here you can do whatever you want to do in order perfectly integrate the service into Ferdi. For convenience, we have provided a very simple set of functions to set unread message badges (`Ferdi.setBadge()`) and inject CSS files (`Ferdi.injectCSS()`). | 131 | The webview.js is the actual script that will be loaded into the webview. Here you can do whatever you want to do in order perfectly integrate the service into Ferdi. For convenience, we have provided a very simple set of functions to set unread message badges (`Ferdi.setBadge()`) and inject CSS files (`Ferdi.injectCSS()`). |