Lack of interest Allow webmasters to redefine Gravatar URL to a mirror inside of Mainland China.

This suggestion has been closed automatically because it did not receive enough votes over an extended period of time. If you wish to see this, please search for an open suggestion and, if you don't find any, post a new one.

ShikiSuen

Well-known member
At present, Gravatar is hard-walled in Mainland China GFW Circle.
This tremendously brings down the speed of accessing every webpage of a Xenforo website (with Gravatar enabled) hosted outside this circle...
Plus, until all Gravatar loadings gets finished (or ended with an error), the Froala Editor simply DOESN'T load.
(TBO, I tested the access from Guangzhou and seeing that Chris Deeming's gravatar failed to be loaded after averagely 50 seconds, always.)

There are only two choices:
One is to completely disable Gravatar in the admin panel;
The other one is to use a self-built mirror of Gravatar to bypass the GFW block.

For instance that the W3TT (World Wide Testing Team, an NGO) provided their gravatar mirror, and we can see that Chris's avatar loads successfully:
https://gravatar.w3tt.com/avatar/6a47eeb728f63ec47960fdeffffe750a?s=96
6a47eeb728f63ec47960fdeffffe750a


There is a trust issue that not every mirror are always reliable, hence my thoughts:
Allowing site admins to decide which Gravatar mirror they can use by putting their trusted Gravatar mirror URL.
Meanwhile, if this value has not been set, then by default XenForo just throw a universal avatar icon to all visitors whose IP addresses are from Mainland China, saving dozens of seconds of webpage loading time.
 
Upvote 1
This suggestion has been closed. Votes are no longer accepted.
Meanwhile, until XF officially ships this experience improvement (if they are glad to), site visitors from Mainland China can simply modify their HOSTS file on their computers to put secure.gravatar.com to 127.0.0.9 which triggers an SSL error, letting their browsers immediately cut down the long-waiting connection between themselves and the Gravatar official server. Now they can enjoy the blazing-fast XenForo visiting experience.
 
I wonder whether this helps... Lemme note it here first.
Code:
document.body.innerHTML = document.body.innerHTML.replace(/https\:\/\/secure\.gravatar\.com/g, '{$xf.options.gravatarMirror}');
1620131108314.webp
 
Update: I successfully injected the Javascript to the webpage.
However, it is not effective to those popups like "alerts" and "member tooltips", etc.
=======
Template: PAGE_CONTAINER
Modification key: Modify_Gravatar_Mirror
Search Type: Single Replacement
Find: </head>
Replace:
Code:
<script language="javascript">
    document.addEventListener("DOMContentLoaded", function(){
        document.body.innerHTML = document.body.innerHTML.replace(/https:\/\/secure\.gravatar\.com/g, '{$xf.options.gravatarMirror}');
    });
</script>
$0
Executive Order: 1
Automatically apply template modification: Checked.
=======
1620135746407.webp
I need to find a way to hook it into every place right after every usage of "xf:avatar"
 
Last edited:
Won't need any template replacements, can just extend the XF\Entity\User::getAvatarUrl function and automatically hit all avatar places.
Looks like I need to find a PHP expert to deal with this by following your suggestion.
(I know nothing about PHP programming at this moment.)

An alternative workaround is to ask end users to install this browser addon...
justjavac/ReplaceGoogleCDN: 一个 Chrome 插件:将 Google CDN 替换为国内的。 (github.com)
This fixes the Gravatar access issue from the client's side.
However, the Chrome version of this addon requires virtual private network to install...
 
I still need it. Onegaishimas.
Please try the attached add-on. :) After installing, go to the Users options in the ACP. The new options are below the normal "Enable Gravatar Support" checkbox.

In the "Gravatar URL" enter your new URL to use like https://gravatar.w3tt.com/avatar/ (or other alternate URL). If the URL you are trying doesn't work just let me know and I'll take a look.

There are some other new options as well based on the Gravatar docs.
 

Attachments

Please try the attached add-on. :) After installing, go to the Users options in the ACP. The new options are below the normal "Enable Gravatar Support" checkbox.
It has also been added here to the XF Resources area.


If any of the XF staff are reading this, can you delete the attachment in the post above and change it to a link to the XF Resource? Thanks :)
 
It has also been added here to the XF Resources area.


If any of the XF staff are reading this, can you delete the attachment in the post above and change it to a link to the XF Resource? Thanks :)
Report the post and tell them what you want them to do, best way to get it done.
 
Report the post and tell them what you want them to do, best way to get it done.
It's not important enough; if any staff members happened to come across this thread, so be it, but it won't affect anything either way since the attached zip works fine and is the same as what was added to XFRM. If there was anything wrong with the attached file (like a bug or security issue) then I would've already reported it.
 
Back
Top Bottom