OpenRA / openrauseraccounts

Connect phpBB forum accounts to OpenRA installations
https://forum.openra.net/ucp.php?i=232
GNU General Public License v2.0
3 stars 3 forks source link

Add a node with data about the user avatar to the output #48

Closed dragunoff closed 3 years ago

dragunoff commented 3 years ago

Expose the avatar url in the MiniYaml output of the info endpoint. phpBB doesn't make it easy to obtain the URL directly so I went with a simple regex solution that scrapes the url from the src attribute of an <img/> tag. The output contains the src, width, height and type of the avatar. Since phpBB supports different types of avatars, the Type node may be useful by giving a hint on how to handle the url in Src.

# Output for a gravatar
Player:
    Avatar:
        Src: //secure.gravatar.com/avatar/3ce1b8bd421382de9af13dfc55384426?s=90
        Width: 90
        Height: 90
        Type: avatar.driver.gravatar

# Output for an uploaded image
Player:
    Avatar:
        Src: ./../../download/file.php?avatar=49_1605732962.gif
        Width: 80
        Height: 80
        Type: avatar.driver.upload

# Output when there is no avatar
Player:
    Avatar:

Closes #46

dragunoff commented 3 years ago

For anyone looking to test this, here is a docker-compose.yml that I used to develop this - you can use it to quickly get a local environment up: https://gist.github.com/dragunoff/3f956bbd0b83ad70deeaae41a9c67928

dragunoff commented 3 years ago

ping @pchote for review

deleted-user-1 commented 3 years ago

You could also craft the url without using the horrible phpBB methods. See https://github.com/OpenRA/openrauseraccounts/commit/5806e2abd86d2835bbb5d59481e64eb657e1729e for my dumb but working version.

pchote commented 3 years ago

Closing in favour of #49.