Update prosody-modules (mod_muc_moderation, mod_auth_http)

This commit is contained in:
John Livingston 2022-01-05 01:09:55 +01:00
parent 8ac16b6bdf
commit cf8a013195
No known key found for this signature in database
GPG Key ID: B17B5640CE66CDBC
4 changed files with 41 additions and 58 deletions

View File

@ -6,9 +6,10 @@
* Builtin Prosody, Share chat url: ability to show/hide the scrollbar in readonly mode.
### Fixes
### Minor changes and fixes
* ConverseJS plugin livechatWindowTitlePlugin: Avoid errors when model is not initialized.
* Update prosody-modules (mod_muc_moderation, mod_auth_http)
## 5.2.4

View File

@ -58,54 +58,13 @@ and `user_exists`. Unsupported methods should return a HTTP status code
of `501 Not Implemented`, but other error codes will also be handled by
Prosody.
### register
**HTTP method:**
: POST
**Success codes:**
: 201
**Error codes:**
: 409 (user exists)
### check_password
**HTTP method:**
: GET
**Success codes:**
: 200
**Response:**
: A text string of `true` if the user exists, or `false` otherwise.
### user_exists
**HTTP method:**
: GET
**Success codes:**
: 200
**Response:**
: A text string of `true` if the user exists, or `false` otherwise.
### set_password
**HTTP method:**
: POST
**Success codes:**
: 200, 201, or 204
### remove_user
**HTTP method:**
: POST
**Success codes:**
: 200, 201 or 204
Method HTTP method Success codes Error codes Response
-------- ---- --- ----------------- -----------------------------------------------------------------
register POST 201 409 (user exists)
check\_password GET 200 A text string of `true` if the user exists, or `false` otherwise.
user\_exists GET 200 A text string of `true` if the user exists, or `false` otherwise.
set\_password POST 200, 201 or 204
remove\_user POST 200, 201 or 204
## Examples

View File

@ -30,3 +30,11 @@ modules_enabled = {
- Tested with [Converse.js](https://conversejs.org/)
[v6.0.1](https://github.com/conversejs/converse.js/releases/tag/v6.0.1)
### Feature requests
- [Conv](https://github.com/iNPUTmice/Conversations/issues/3722)[ersa](https://github.com/iNPUTmice/Conversations/issues/3920)[tions](https://github.com/iNPUTmice/Conversations/issues/4227)
- [Dino](https://github.com/dino/dino/issues/1133)
- [Gajim](https://dev.gajim.org/gajim/gajim/-/issues/10107)
- [Poezio](https://lab.louiz.org/poezio/poezio/-/issues/3543)
- [Profanity](https://github.com/profanity-im/profanity/issues/1336)

View File

@ -1,6 +1,6 @@
-- mod_muc_moderation
--
-- Copyright (C) 2015-2020 Kim Alvefur
-- Copyright (C) 2015-2021 Kim Alvefur
--
-- This file is MIT licensed.
--
@ -44,6 +44,7 @@ module:hook("iq-set/bare/" .. xmlns_fasten .. ":apply-to", function (event)
if not moderate_tag then return end -- some other kind of fastening?
local reason = moderate_tag:get_child_text("reason");
local retract = moderate_tag:get_child("retract", xmlns_retract);
local room_jid = stanza.attr.to;
local room_node = jid.split(room_jid);
@ -55,12 +56,21 @@ module:hook("iq-set/bare/" .. xmlns_fasten .. ":apply-to", function (event)
local actor = stanza.attr.from;
local actor_nick = room:get_occupant_jid(actor);
local affiliation = room:get_affiliation(actor);
-- Retrieve their current role, iff they are in the room, otherwise what they
-- would have based on affiliation.
local role = room:get_role(actor_nick) or room:get_default_role(affiliation);
if valid_roles[role or "none"] < valid_roles.moderator then
origin.send(st.error_reply(stanza, "auth", "forbidden", "You need a role of at least 'moderator'"));
return true;
end
if not actor_nick then
local reserved_nickname = room:get_affiliation_data(jid.bare(actor), "reserved_nickname");
if reserved_nickname then
actor_nick = room.jid .. "/" .. reserved_nickname;
end
end
-- Original stanza to base tombstone on
local original, err;
if muc_log_archive.get then
@ -83,23 +93,28 @@ module:hook("iq-set/bare/" .. xmlns_fasten .. ":apply-to", function (event)
return true;
end
-- Replacements
local tombstone = st.message({ from = original.attr.from, type = "groupchat", id = original.attr.id })
:tag("moderated", { xmlns = xmlns_moderate, by = actor_nick })
:tag("retracted", { xmlns = xmlns_retract, stamp = dt.datetime() }):up();
local announcement = st.message({ from = room_jid, type = "groupchat", id = id.medium(), })
:tag("apply-to", { xmlns = xmlns_fasten, id = stanza_id })
:tag("moderated", { xmlns = xmlns_moderate, by = actor_nick })
:tag("retract", { xmlns = xmlns_retract }):up();
if retract then
announcement:tag("retract", { xmlns = xmlns_retract }):up();
end
if reason then
tombstone:text_tag("reason", reason);
announcement:text_tag("reason", reason);
end
if muc_log_archive.set then
-- Tombstone
if muc_log_archive.set and retract then
local tombstone = st.message({ from = original.attr.from, type = "groupchat", id = original.attr.id })
:tag("moderated", { xmlns = xmlns_moderate, by = actor_nick })
:tag("retracted", { xmlns = xmlns_retract, stamp = dt.datetime() }):up();
if reason then
tombstone:text_tag("reason", reason);
end
local was_replaced = muc_log_archive:set(room_node, stanza_id, tombstone);
if not was_replaced then
origin.send(st.error_reply(stanza, "wait", "internal-server-error"));