Software / code / prosody-modules
Comparison
mod_ogp/README.markdown @ 4483:c4f11a4b5ac7
mod_ogp: Add the ability to whitelist domains
| author | JC Brand <jc@opkode.com> |
|---|---|
| date | Tue, 02 Mar 2021 13:36:10 +0100 |
| parent | 4460:205e50fdcebc |
| child | 4484:6813a00878ea |
comparison
equal
deleted
inserted
replaced
| 4482:21698b960bd6 | 4483:c4f11a4b5ac7 |
|---|---|
| 4 | 4 |
| 5 With mod_ogp enabled, when a user sends a URL in a MUC (where the message has its `id` equal to its `origin-id`), the module calls the URL and parses the result for `<meta>` html tags that have any `og:...` properties. | 5 With mod_ogp enabled, when a user sends a URL in a MUC (where the message has its `id` equal to its `origin-id`), the module calls the URL and parses the result for `<meta>` html tags that have any `og:...` properties. |
| 6 If it finds any, it sends a [XEP-0422 fastening](https://xmpp.org/extensions/xep-0422.html) applied to the original message that looks like: | 6 If it finds any, it sends a [XEP-0422 fastening](https://xmpp.org/extensions/xep-0422.html) applied to the original message that looks like: |
| 7 | 7 |
| 8 ``` | 8 ``` |
| 9 <message id="example" from="chatroom@chatservice.example" to="chatroom@chatservice.example"> | 9 <message id="example" from="chatroom@muc.example.org" to="chatroom@muc.example.org"> |
| 10 <apply-to xmlns="urn:xmpp:fasten:0" id="origin-id-X"> | 10 <apply-to xmlns="urn:xmpp:fasten:0" id="origin-id-X"> |
| 11 <meta xmlns="http://www.w3.org/1999/xhtml" property="og:title" content="The Rock"/> | 11 <meta xmlns="http://www.w3.org/1999/xhtml" property="og:title" content="The Rock"/> |
| 12 <meta xmlns="http://www.w3.org/1999/xhtml" property="og:url" content="https://www.imdb.com/title/tt0117500/"/> | 12 <meta xmlns="http://www.w3.org/1999/xhtml" property="og:url" content="https://www.imdb.com/title/tt0117500/"/> |
| 13 <meta xmlns="http://www.w3.org/1999/xhtml" property="og:image" content="https://ia.media-imdb.com/images/rock.jpg"/> | 13 <meta xmlns="http://www.w3.org/1999/xhtml" property="og:image" content="https://ia.media-imdb.com/images/rock.jpg"/> |
| 14 </apply-to> | 14 </apply-to> |
| 15 </message> | 15 </message> |
| 16 ``` | 16 ``` |
| 17 | 17 |
| 18 The module is intentionally simple in the sense that it is basically a transport for https://ogp.me/ | 18 The module is intentionally simple in the sense that it is basically a transport for https://ogp.me/ |
| 19 | |
| 20 Configuration | |
| 21 ------------- | |
| 22 | |
| 23 You can present a whitelist of domains for which OGP metadata will be fetched | |
| 24 via the `ogp_domain_whitelist` setting. | |
| 25 | |
| 26 For example: | |
| 27 | |
| 28 Component "muc.example.org" "muc" | |
| 29 modules_enabled = { "ogp" } | |
| 30 ogp_domain_whitelist = { "prosody.im" } |