edsu / anon

tweet about anonymous Wikipedia edits from particular IP address ranges
Creative Commons Zero v1.0 Universal
976 stars 152 forks source link

Screenshots cutting off #182

Closed ineffyble closed 3 years ago

ineffyble commented 3 years ago

For a few months now, @AussieParlEdits has been tweeting screenshots where most of the image is cut off, wherever the edit is long. Example tweet is here: https://twitter.com/AussieParlEdits/status/1340830913412927489

I thought this might be solved by the change from phantom to puppeteer/chromium, but this bot is hosted on the Wikimedia instance, which I assume is running the latest version.

On a side note, I tried to take a look at the Wikimedia instance to make some ranges tweaks, but all the infra has changed since I last looked. From what I can tell, there's no running pod for anon on tools-dev.wmflabs.org or tools-login.wmflabs.org (according to anon status). Where do I need to go to edit the used config?

edsu commented 3 years ago

Hi @ineffyble. I'm sorry for the delay in responding. I ran into some trouble a few months ago running anon on the Wikimedia kubernetes infrastructure.

https://phabricator.wikimedia.org/T262734

This prompted me to start running the same configuration on my on VPS (just under a tmux session instead of Kubernetes). It seems to be running pretty well there, but I would have to do some work to make it available to you.

I'm trying again at Wikimedia to see if anything has changed recently.

Your point about the cutoff in the screenshots is well taken. You can see the same behavior in the congressedits bot running in the fediverse right? I think it may not be waiting long enough for the page to render?

edsu commented 3 years ago

The saga continues:

https://phabricator.wikimedia.org/T271082

The bot at least appears to run now, but is missing a shared library when launching the headless browser....

ruebot commented 3 years ago

Hey @edsu :smile:

I see this occasionally in gccaedits too. Here's an example.

edsu commented 3 years ago

I'm still seeing it too. It's almost like it's not waiting long enough for the page to render before doing the screenshot?

ruebot commented 3 years ago

Maybe we can add something along these lines here?

edsu commented 3 years ago

I think that the problem is that the call to screenshot() is using the dimensions of the DOM element containing the diff, but those dimensions often will exceed the height of the browser viewport (currently 768). I'm going to experiment with setting the viewport to a height that includes the full diff before the screenshot is taken.

edsu commented 3 years ago

I think this is finally fixed! e.g.

https://twitter.com/gccaedits/status/1440027946484338693

ruebot commented 3 years ago

Thank you @edsu :pray:

edsu commented 3 years ago

Thank you for being patient -- it took me an absurdly long time to fix this. Blame it on the A D D.

ruebot commented 3 years ago

No problem! I was going to hack on it a while back, but didn't want to mess anything up in prod since it always takes me a while to re-familiarize myself :sweat: