Mercurial > prosody-modules
view mod_discoitems/mod_discoitems.lua @ 5405:c7a5caad28ef
mod_http_oauth2: Enforce response type encoded in client_id
The client promises to only use this response type, so we should hold
them to that.
This makes it fail earlier if the response type is disabled or the
client is trying to use one that it promised not to use. Better than
failing after login and consent.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 02 May 2023 16:31:25 +0200 |
parents | ae91c98b7e4c |
children |
line wrap: on
line source
-- mod_discoitems.lua -- -- In the config, you can add: -- -- disco_items = { -- {"proxy.eu.jabber.org", "Jabber.org SOCKS5 service"}; -- {"conference.jabber.org", "The Jabber.org MUC"}; -- }; -- local st = require "util.stanza"; local result_query = st.stanza("query", {xmlns="http://jabber.org/protocol/disco#items"}); for _, item in ipairs(module:get_option("disco_items") or {}) do result_query:tag("item", {jid=item[1], name=item[2]}):up(); end module:hook('iq/host/http://jabber.org/protocol/disco#items:query', function(event) local stanza = event.stanza; local query = stanza.tags[1]; if stanza.attr.type == 'get' and not query.attr.node then event.origin.send(st.reply(stanza):add_child(result_query)); return true; end end, 100);