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

🩹 fix: parsing logic for GuestUser to correctly handle Gravatar URLs #25

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

r74tech
Copy link
Contributor

@r74tech r74tech commented Oct 5, 2024

Updated user_parse function to correctly parse GuestUser elements by detecting Gravatar URLs.
If the element contains an image with a Gravatar URL, it is parsed as a GuestUser, and the Gravatar URL is set as the avatar_url attribute.

Wikidot uses Gravatar to display avatars for guest users, as described in the official documentation:
https://www.wikidot.com/more:explore-features#toc13

Examples of GuestUser:

  1. http://scp-jp.wikidot.com/forum/t-2268977/
<span class="printuser avatarhover">
  <a href="javascript:;">
    <img class="small" src="http://www.gravatar.com/avatar.php?gravatar_id=23463b99b62a72f26ed677cc556c44e8&default=http://www.wikidot.com/common--images/avatars/default/a16.png&size=16" alt="">
  </a>guest (ゲスト)
</span>
  1. http://wikirb.wikidot.com/forum/t-16957468/guest2#post-6679087 (when user icons are disabled)
<span class="printuser avatarhover">
  <a href="javascript:;">
    <img class="small" src="http://www.gravatar.com/avatar.php?gravatar_id=55502f40dc8b7c769880b10874abc9d0&default=http://www.wikidot.com/common--images/avatars/default/a16.png&size=16" alt="">
  </a>guest2 (guest)
</span>

In both examples, the presence of a Gravatar URL in the img tag is used to identify the user as a GuestUser.

Modified the user_parse function to identify GuestUser by the presence of Gravatar URLs.
The Gravatar image URL is extracted and set as the avatar_url attribute for the GuestUser.
@ukwhatn ukwhatn merged commit 978e5e5 into ukwhatn:main Oct 8, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants