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

Expose avatar URL #46

Closed ubitux closed 3 years ago

ubitux commented 4 years ago

The avatar can not be guessed from the exposed yaml information because the avatar contains the extension: https://forum.openra.net/download/file.php?avatar=XXXX.{png,jpg,...}. Would be nice to expose it somehow.

ghost commented 4 years ago

If the link (or rather the filename with the extension) is saved somewhere in phpbb''s db, it can be included in the query in https://github.com/OpenRA/openrauseraccounts/blob/3201df98e25c0f49902c002afd80c6c89f2dfff6/core/core.php#L42 and then exposed in the yaml output https://github.com/OpenRA/openrauseraccounts/blob/3201df98e25c0f49902c002afd80c6c89f2dfff6/controller/main.php#L87.

AMHOL commented 4 years ago

https://www.phpbb.com/community/viewtopic.php?f=71&t=588422&st=0&sk=t&sd=a

dragunoff commented 3 years ago

@ubitux Does something like that cut it:

Player:
    Fingerprint: 6b8ef7b26517e53fd25a7779c3d5cbf768108ede
    PublicKey: LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQkl6QU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FSQUFNSUlCQ3dLQ0FRRUFzZjhlK0dIQSsxTUdMN2p2WnVHawpTWDBGVUhnUWpGNVI0Y09FZlBMYWpwRWZhRFQ2KzVOMVphQTZKbkFBVXpWa1AySnZGTGtWOHFJOVc0VjZKSVIzCk9hV1B6WDAvQ1NYdGt4eVdXOWp2VDdwbVFrRHpMSGIyMjQ3clR6bEdjcm00bzB4bWVNckoyZU1JaFQ4MnhqUlMKSG5rSzRJYTdFSmF0alhEeC8xdlBGU1ZhU3RiMVN2UHhtYVlsZklJdHJmLzgrNHRTb1JOK2hGZnZJdk5FQytMMQpINEd0RkNORmc1Z1gzOWpmVDg1S1RKc1F2UHRZSFlkK0c2aWdSdk5mVlNUVDAwQVBYUFI5cWlpM00yQmRwbW1RClR3YkZhMFNmMi8xUmd1bDBiejA3OWpJVHk5TlFrUkJzL2R5d0Q3NHhYaEtLV1RTeTZWVFFueFpwUHRNVzNPeFUKNHdJRUFBRUFBUT09Ci0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQ==
    KeyRevoked: false
    ProfileID: 49
    ProfileName: dragunoff
    ProfileRank: Registered User
    Avatar:
        Src: //secure.gravatar.com/avatar/3ce1b8bd421382de9af13dfc55384426?s=90
        Width: 90
        Height: 90
    Badges:
ubitux commented 3 years ago

@ubitux Does something like that cut it:

Player:
  Fingerprint: 6b8ef7b26517e53fd25a7779c3d5cbf768108ede
  PublicKey: LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQkl6QU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FSQUFNSUlCQ3dLQ0FRRUFzZjhlK0dIQSsxTUdMN2p2WnVHawpTWDBGVUhnUWpGNVI0Y09FZlBMYWpwRWZhRFQ2KzVOMVphQTZKbkFBVXpWa1AySnZGTGtWOHFJOVc0VjZKSVIzCk9hV1B6WDAvQ1NYdGt4eVdXOWp2VDdwbVFrRHpMSGIyMjQ3clR6bEdjcm00bzB4bWVNckoyZU1JaFQ4MnhqUlMKSG5rSzRJYTdFSmF0alhEeC8xdlBGU1ZhU3RiMVN2UHhtYVlsZklJdHJmLzgrNHRTb1JOK2hGZnZJdk5FQytMMQpINEd0RkNORmc1Z1gzOWpmVDg1S1RKc1F2UHRZSFlkK0c2aWdSdk5mVlNUVDAwQVBYUFI5cWlpM00yQmRwbW1RClR3YkZhMFNmMi8xUmd1bDBiejA3OWpJVHk5TlFrUkJzL2R5d0Q3NHhYaEtLV1RTeTZWVFFueFpwUHRNVzNPeFUKNHdJRUFBRUFBUT09Ci0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQ==
  KeyRevoked: false
  ProfileID: 49
  ProfileName: dragunoff
  ProfileRank: Registered User
  Avatar:
      Src: //secure.gravatar.com/avatar/3ce1b8bd421382de9af13dfc55384426?s=90
      Width: 90
      Height: 90
  Badges:

Yeah that should be fine, but not all avatars are on gravatar, right? If they were, the API could just provide the hash so as a user I could just request any size (that would be the best option).

dragunoff commented 3 years ago

@ubitux Sorry for not providing context, it was late and I had just managed to hack together a solution. phpBB supports different types of avatars - upload, choose from a gallery, paste a remote url, gravatar, etc. Special casing the gravatar would be possible but too much work IMO because we'll have to do it in our custom code as phpBB doesn't provide an easy way to obtain the hash. It doesn't even have a way to get just the URL for the avatar - all it gives us is a complete <img/> tag via the function phpbb_get_avatar. So the solution that I put together scrapes the URL from the src attribute of the tag.

dragunoff commented 3 years ago

We do however know the type of the avatar, so I can add another field to the output which hints at how to handle the url:

    Avatar:
        Src: //secure.gravatar.com/avatar/3ce1b8bd421382de9af13dfc55384426?s=90
        Width: 90
        Height: 90
        Type: avatar.driver.gravatar