Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mod_webpresence: avatar are available under /image/avatar #330

Open
bjacquin opened this issue Feb 18, 2024 · 1 comment
Open

mod_webpresence: avatar are available under /image/avatar #330

bjacquin opened this issue Feb 18, 2024 · 1 comment

Comments

@bjacquin
Copy link

bjacquin commented Feb 18, 2024

Hi,

mod_webpresence documentation installed on 23.10 describes /presence/jid/<user>/<server>/avatar/ as a valid URI to access user overall status, however experimentation show that URL should be /presence/jid/<user>/<server>/image/avatar/ as otherwise 404 error are returned:

  • URL according to documentation
$ curl -vD - -H 'Host: xmpp.lan' http://[::1]:5280/presence/jid/user/xmpp.lan/avatar/
*   Trying [::1]:5280...
* Connected to ::1 (::1) port 5280
> GET /presence/jid/user/xmpp.lan/avatar/ HTTP/1.1
> Host: xmpp.lan
> User-Agent: curl/8.5.0
> Accept: */*
>
< HTTP/1.1 404 Not Found
HTTP/1.1 404 Not Found
< Content-Type: text/html; charset=utf-8
Content-Type: text/html; charset=utf-8
< Content-Length: 330
Content-Length: 330

<
<?xml version='1.0'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
* Connection #0 to host ::1 left intact
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'/></head><body><h1>Not found</h1></body></html>
  • URL according to experimentation
$ curl -vD - -H 'Host: xmpp.lan' http://[::1]:5280/presence/jid/user/xmpp.lan/image/avatar/ ; echo
*   Trying [::1]:5280...
* Connected to ::1 (::1) port 5280
> GET /presence/jid/user/xmpp.lan/image/avatar/ HTTP/1.1
> Host: xmpp.lan
> User-Agent: curl/8.5.0
> Accept: */*
>
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Content-Length: 527
Content-Length: 527
< Content-Type: image/png
Content-Type: image/png

<
Warning: Binary output can mess up your terminal. Use "--output -" to tell
Warning: curl to output it to your terminal anyway, or consider "--output
Warning: <FILE>" to save to a file.
* Failure writing output to destination
* Closing connection

However, the code path within src/mod_webpresence.erl looks to be correct according to documentation, but I'm not an expert enough with Erlang to properly troubleshoot the issue.

Thanks,
Bertrand

@badlop
Copy link
Member

badlop commented Feb 19, 2024

curl -vD - -H 'Host: xmpp.lan' http://[::1]:5280/presence/jid/user/xmpp.lan/image/avatar/

Here you are requesting image: an image that represents the client presence status, that is, one of the pixmaps that represents if the user is online, away, offline, busy...

And the string that you added later in the URL, avatar, is interpreted following this documentation sentence:

For output types image and avatar, you can append any string to a valid URI.

In other words, ejabberd processes your URL the same way that http://[::1]:5280/presence/jid/user/xmpp.lan/image/anyrandomtext00000.png

And of course you can simply use the URL:
http://[::1]:5280/presence/jid/user/xmpp.lan/image/


If you want to get the account avatar, you should use
http://[::1]:5280/presence/jid/user/xmpp.lan/avatar/

As you learned now, you can append any random string to that URL, and ejabberd will return the same result, for example this is completely equivalent to the previous URL:
http://[::1]:5280/presence/jid/user/xmpp.lan/avatar/somerandomtext1234596789.png

In your case, requesting the avatar returns 404 error... It seems the avatar was not stored. Notice that this module gets the user avatar using https://xmpp.org/extensions/xep-0054.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants