xmpp: Fix webhook not working if using avatar relaying

This commit is contained in:
PapaTutuWawa 2021-09-16 18:09:59 +02:00
parent 963deb705a
commit edf70774a2
2 changed files with 12 additions and 6 deletions

View File

@ -74,4 +74,5 @@ class AvatarManager:
""" """
Returns either the URL to the avatar of @jid or None. Returns either the URL to the avatar of @jid or None.
""" """
return self._avatars.get(jid, None) filename = self._avatars.get(jid, None)
return self._public + filename if filename else None

View File

@ -263,11 +263,16 @@ class BridgeComponent(ComponentXMPP):
self._logger.debug("Webhook: %s", str(webhook)) self._logger.debug("Webhook: %s", str(webhook))
requests.post(self._webhooks[muc], req = requests.post(self._webhooks[muc],
data=webhook, data=webhook,
headers={ headers={
"Content-Type": "application/json" "Content-Type": "application/json"
}) })
if req.status_code != 200:
self._logger.error("Failed to POST to %s with content %s: %s",
self._webhooks[muc],
str(webhook),
req.text)
def virtual_user_update_presence(self, muc, uid, pshow, pstatus=None): def virtual_user_update_presence(self, muc, uid, pshow, pstatus=None):
""" """