File

mod_ogp/README.md @ 6199:fe8222112cf4

mod_conversejs: Serve base app at / This makes things slightly less awkward for the browser to figure out which URLs belong to a PWA. The app's "start URL" was previously without the '/' and therefore was not considered within the scope of the PWA. Now the canonical app URL will always have a '/'. Prosody/mod_http should take care of redirecting existing links without the trailing / to the new URL. If you have an installation at https://prosody/conversejs then it is now at https://prosody/conversejs/ (the first URL will now redirect to the second URL if you use it). The alternative would be to make the PWA scope include the parent, i.e. the whole of https://prosody/ in this case. This might get messy if other PWAs are provided by the same site or Prosody installation, however.
author Matthew Wild <mwild1@gmail.com>
date Tue, 11 Feb 2025 13:18:38 +0000
parent 6003:fe081789f7b5
line wrap: on
line source

# mod_ogp

This module adds [Open Graph Protocol](https://ogp.me) metadata to URLs sent inside a MUC.

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.
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:

```xml
<message id="example" from="chatroom@muc.example.org" to="user@chat.example.org/resource">
<apply-to xmlns="urn:xmpp:fasten:0" id="origin-id-X">
<meta xmlns="http://www.w3.org/1999/xhtml" property="og:title" content="The Rock"/>
<meta xmlns="http://www.w3.org/1999/xhtml" property="og:url" content="https://www.imdb.com/title/tt0117500/"/>
<meta xmlns="http://www.w3.org/1999/xhtml" property="og:image" content="https://ia.media-imdb.com/images/rock.jpg"/>
</apply-to>
</message>
```

The module is intentionally simple in the sense that it is basically a transport for https://ogp.me/

Configuration
-------------

You can present an allowlist or denylist of domains for which OGP metadata will be fetched
via the `ogp_domain_allowlist` and `ogp_domain_denylist` settings repectively.

For example:

```lua
Component "muc.example.org" "muc"
  modules_enabled = { "ogp" }
  ogp_domain_allowlist = { "prosody.im" }
```