annotate mod_ogp/README.markdown @ 4515:2e33eeafe962

mod_muc_markers: Prevent any markers from reaching the archive, even if untracked Original intention was to leave alone things that this module isn't handling. However markers in archives are just problematic without more advanced logic about what is markable and what is not. It also requires a more advanced query in mod_muc_rai to determine the latest markable message instead of the latest archived message. I'd rather keep the "is archivable" and "is markable" definition the same for simplicity. I don't want to introduce yet another set of rules for no reason. No markers in MAM.
author Matthew Wild <mwild1@gmail.com>
date Mon, 22 Mar 2021 15:55:02 +0000
parents 2c4b65bfac62
children c858c76d0845
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4460
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
1 # mod_ogp
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
2
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
3 This module adds [Open Graph Protocol](https://ogp.me) metadata to URLs sent inside a MUC.
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
4
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
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.
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
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:
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
7
4484
6813a00878ea mod_ogp/README: Annotate example as XML to enable syntax highlighting
Kim Alvefur <zash@zash.se>
parents: 4483
diff changeset
8 ```xml
4483
c4f11a4b5ac7 mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents: 4460
diff changeset
9 <message id="example" from="chatroom@muc.example.org" to="chatroom@muc.example.org">
c4f11a4b5ac7 mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents: 4460
diff changeset
10 <apply-to xmlns="urn:xmpp:fasten:0" id="origin-id-X">
c4f11a4b5ac7 mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents: 4460
diff changeset
11 <meta xmlns="http://www.w3.org/1999/xhtml" property="og:title" content="The Rock"/>
c4f11a4b5ac7 mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents: 4460
diff changeset
12 <meta xmlns="http://www.w3.org/1999/xhtml" property="og:url" content="https://www.imdb.com/title/tt0117500/"/>
c4f11a4b5ac7 mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents: 4460
diff changeset
13 <meta xmlns="http://www.w3.org/1999/xhtml" property="og:image" content="https://ia.media-imdb.com/images/rock.jpg"/>
c4f11a4b5ac7 mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents: 4460
diff changeset
14 </apply-to>
c4f11a4b5ac7 mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents: 4460
diff changeset
15 </message>
4460
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
16 ```
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
17
205e50fdcebc mod_ogp: Add README
JC Brand <jc@opkode.com>
parents:
diff changeset
18 The module is intentionally simple in the sense that it is basically a transport for https://ogp.me/
4483
c4f11a4b5ac7 mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents: 4460
diff changeset
19
c4f11a4b5ac7 mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents: 4460
diff changeset
20 Configuration
c4f11a4b5ac7 mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents: 4460
diff changeset
21 -------------
c4f11a4b5ac7 mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents: 4460
diff changeset
22
c4f11a4b5ac7 mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents: 4460
diff changeset
23 You can present a whitelist of domains for which OGP metadata will be fetched
c4f11a4b5ac7 mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents: 4460
diff changeset
24 via the `ogp_domain_whitelist` setting.
c4f11a4b5ac7 mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents: 4460
diff changeset
25
c4f11a4b5ac7 mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents: 4460
diff changeset
26 For example:
c4f11a4b5ac7 mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents: 4460
diff changeset
27
4485
2c4b65bfac62 mod_ogp/README: Add Lua language annotation to prosody config snippet
Kim Alvefur <zash@zash.se>
parents: 4484
diff changeset
28 ```lua
2c4b65bfac62 mod_ogp/README: Add Lua language annotation to prosody config snippet
Kim Alvefur <zash@zash.se>
parents: 4484
diff changeset
29 Component "muc.example.org" "muc"
2c4b65bfac62 mod_ogp/README: Add Lua language annotation to prosody config snippet
Kim Alvefur <zash@zash.se>
parents: 4484
diff changeset
30 modules_enabled = { "ogp" }
2c4b65bfac62 mod_ogp/README: Add Lua language annotation to prosody config snippet
Kim Alvefur <zash@zash.se>
parents: 4484
diff changeset
31 ogp_domain_whitelist = { "prosody.im" }
2c4b65bfac62 mod_ogp/README: Add Lua language annotation to prosody config snippet
Kim Alvefur <zash@zash.se>
parents: 4484
diff changeset
32 ```