aboutsummaryrefslogtreecommitdiffstats
path: root/docs/backend_api.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/backend_api.md')
-rw-r--r--docs/backend_api.md22
1 files changed, 11 insertions, 11 deletions
diff --git a/docs/backend_api.md b/docs/backend_api.md
index a9d29ac..a46927b 100644
--- a/docs/backend_api.md
+++ b/docs/backend_api.md
@@ -1,8 +1,8 @@
1# Backend API 1# Backend API
2 2
3Provides a set of helper functions to integrate the recipe into [Ferdi](https://ferdium.org). 3Provides a set of helper functions to integrate the recipe into [Ferdium](https://ferdium.org).
4 4
5## Ferdi Backend Class Methods 5## Ferdium Backend Class Methods
6 6
7* [validateUrl](#validateurl) 7* [validateUrl](#validateurl)
8* [overrideUserAgent](#overrideuseragent) 8* [overrideUserAgent](#overrideuseragent)
@@ -29,7 +29,7 @@ Validate if the given URL is a valid service instance.
29 29
30```js 30```js
31// RocketChat integration 31// RocketChat integration
32module.exports = Ferdi => class RocketChat extends Ferdi { 32module.exports = Ferdium => class RocketChat extends Ferdium {
33 async validateUrl(url) { 33 async validateUrl(url) {
34 try { 34 try {
35 const resp = await window.fetch(`${url}/api/info`, { 35 const resp = await window.fetch(`${url}/api/info`, {
@@ -61,11 +61,11 @@ Override the user agent used inside the service webview.
61#### Usage 61#### Usage
62 62
63```js 63```js
64module.exports = Ferdi => class Discord extends Ferdi { 64module.exports = Ferdium => class Discord extends Ferdium {
65 overrideUserAgent() { 65 overrideUserAgent() {
66 // Remove Ferdi's signature from the user agent 66 // Remove Ferdium's signature from the user agent
67 return window.navigator.userAgent.replace( 67 return window.navigator.userAgent.replace(
68 /(Ferdi|Electron)\/\S+ \([^)]+\)/g, 68 /(Ferdium|Electron)\/\S+ \([^)]+\)/g,
69 "" 69 ""
70 ); 70 );
71 } 71 }
@@ -73,7 +73,7 @@ module.exports = Ferdi => class Discord extends Ferdi {
73``` 73```
74 74
75```js 75```js
76module.exports = Ferdi => class Example extends Ferdi { 76module.exports = Ferdium => class Example extends Ferdium {
77 overrideUserAgent() { 77 overrideUserAgent() {
78 // Use a completely different user agent 78 // Use a completely different user agent
79 return "Mozilla/2.02Gold (Win95; I)"; 79 return "Mozilla/2.02Gold (Win95; I)";
@@ -98,7 +98,7 @@ Valid URL patterns can be referred from [here](https://www.electronjs.org/docs/a
98 98
99```js 99```js
100// Hangouts Chat integration 100// Hangouts Chat integration
101module.exports = Ferdi => class HangoutsChat extends Ferdi { 101module.exports = Ferdium => class HangoutsChat extends Ferdium {
102 modifyRequestHeaders() { 102 modifyRequestHeaders() {
103 return [{ 103 return [{
104 // Adding an origin header for all http requests from this recipe 104 // Adding an origin header for all http requests from this recipe
@@ -123,7 +123,7 @@ Specify an array of known hosts from where certificates can be issued for this s
123 123
124```js 124```js
125// msteams Chat integration 125// msteams Chat integration
126module.exports = Ferdi => class MicrosoftTeams extends Ferdi { 126module.exports = Ferdium => class MicrosoftTeams extends Ferdium {
127 knownCertificateHosts() { 127 knownCertificateHosts() {
128 return [ 128 return [
129 'aka.ms', 129 'aka.ms',
@@ -152,14 +152,14 @@ module.exports = Ferdi => class MicrosoftTeams extends Ferdi {
152 152
153### Events 153### Events
154 154
155Ferdi recipes can hook into the [electron webview events](https://electron.atom.io/docs/api/webview-tag/#dom-events) to trigger custom functions. 155Ferdium recipes can hook into the [electron webview events](https://electron.atom.io/docs/api/webview-tag/#dom-events) to trigger custom functions.
156 156
157This is necessary for services like TweetDeck where custom URL forwarding is needed during login. 157This is necessary for services like TweetDeck where custom URL forwarding is needed during login.
158 158
159#### Usage 159#### Usage
160 160
161```js 161```js
162module.exports = Ferdi => class Tweetdeck extends Ferdi { 162module.exports = Ferdium => class Tweetdeck extends Ferdium {
163 events = { 163 events = {
164 'did-get-redirect-request': '_redirectFix', 164 'did-get-redirect-request': '_redirectFix',
165 } 165 }