OpenRA / openrauseraccounts

Connect phpBB forum accounts to OpenRA installations

Home Page:https://forum.openra.net/ucp.php?i=232

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Expose avatar URL

ubitux opened this issue · comments

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.

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

'SELECT' => 'pubkey.item_id, pubkey.user_id, pubkey.public_key, pubkey.fingerprint, pubkey.revoked, user.username',
and then exposed in the yaml output
$yaml = "Player:\n";
.

@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 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).

@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.

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