aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorLibravatar vantezzen <hello@vantezzen.io>2020-05-10 10:41:58 +0200
committerLibravatar vantezzen <hello@vantezzen.io>2020-05-10 10:41:58 +0200
commitd927902163200b9ab30f27a9d7919abf0811c727 (patch)
tree237c8b657811d30f014aca8b414319d5eef17e74 /docs
parentAdd create script (diff)
parentMerge pull request #153 from dnlnrs/master (diff)
downloadferdium-recipes-d927902163200b9ab30f27a9d7919abf0811c727.tar.gz
ferdium-recipes-d927902163200b9ab30f27a9d7919abf0811c727.tar.zst
ferdium-recipes-d927902163200b9ab30f27a9d7919abf0811c727.zip
Merge branch 'master' of https://github.com/getferdi/recipes
Diffstat (limited to 'docs')
-rw-r--r--docs/backend_api.md28
1 files changed, 28 insertions, 0 deletions
diff --git a/docs/backend_api.md b/docs/backend_api.md
index 512912b..dc3bfaa 100644
--- a/docs/backend_api.md
+++ b/docs/backend_api.md
@@ -5,6 +5,7 @@ Provides a set of helper functions to integrate the recipe into [Ferdi](https://
5## Ferdi Backend Class Methods 5## Ferdi Backend Class Methods
6* [validateUrl](#user-content-validateurl) 6* [validateUrl](#user-content-validateurl)
7* [overrideUserAgent](#user-content-overrideuseragent) 7* [overrideUserAgent](#user-content-overrideuseragent)
8* [modifyRequestHeaders](#user-content-modifyrequestheaders)
8 9
9## Events 10## Events
10* [webview events](#user-content-events) 11* [webview events](#user-content-events)
@@ -72,6 +73,32 @@ module.exports = Ferdi => class Example extends Ferdi {
72}; 73};
73``` 74```
74 75
76### modifyRequestHeaders()
77Modify headers of HTTP requests sent from a recipe's webview
78Any standard HTTP header can be added to the requests.
79
80#### Returns
81`Array` containing objects, each of which should have two properties.
82- `headers` - Object containing the header params and their values in key-value format
83- `requestFilters` - Array of URL patterns used to filter requests for which the headers need to be added.
84Valid URL patterns can be referred from [here](https://www.electronjs.org/docs/api/web-request#webrequestonbeforerequestfilter-listener)
85
86#### Usage
87
88```js
89// Hangouts Chat integration
90module.exports = Ferdi => class HangoutsChat extends Ferdi {
91 modifyRequestHeaders() {
92 return [{
93 // Adding an origin header for all http requests from this recipe
94 headers: { 'origin': 'https://chat.google.com' },
95 requestFilters: {
96 urls: ['*://*/*']
97 }
98 }]
99 }
100};
101```
75 102
76### Events 103### Events
77Ferdi recipes can hook into the [electron webview events](https://electron.atom.io/docs/api/webview-tag/#dom-events) to trigger custom functions. 104Ferdi recipes can hook into the [electron webview events](https://electron.atom.io/docs/api/webview-tag/#dom-events) to trigger custom functions.
@@ -95,3 +122,4 @@ module.exports = Ferdi => class Tweetdeck extends Ferdi {
95 } 122 }
96}; 123};
97``` 124```
125