mlemgroup / mlem

Mlem for Lemmy
https://lemmy.ml/c/mlemapp
GNU General Public License v3.0
180 stars 31 forks source link

Bypass Image Proxy #1322

Closed EricBAndrews closed 2 months ago

EricBAndrews commented 2 months ago

Checklist

Pull Request Information

This PR adds the option to bypass image proxies if loading fails. If an image fails to load from an instances that performs proxying, a new "proxy failure" placeholder will be shown. On large images, a button will appear with the option to load directly.

The first time a user attempts to load directly, an explanatory sheet will appear detailing the image proxy and its behavior. This gives the user the option of manually bypassing, automatically bypassing on failure, or aborting.

Auto-bypass behavior can also be toggled in settings.

Sjmarf commented 2 months ago

I'm struggling to get this to trigger 😅 Do you have an example post?

lemmy.ml performs image proxying. The ImageLoader logic appears to be looking for a url= parameter in the image URL, from which it gets the un-proxied URL. I can't find a post for which this parameter is present - for me, they're all like this:

Optional(https://lemmy.ml/pictrs/image/081135dd-caa3-487e-9005-1854875fd7cd.jpeg?thumbnail=1024)
Optional(https://lemmy.ml/pictrs/image/681476f1-35c8-4e7a-9dee-281727d14567.webp?thumbnail=1024)
Optional(https://lemmy.ml/pictrs/image/64d2a09d-c4b4-4c2f-92f0-74b811d02ea7.jpeg?thumbnail=1024)
Optional(https://lemmy.ml/pictrs/image/f9cd76e8-f77c-4434-8de9-177cbc436608.jpeg?thumbnail=1024)
Optional(https://lemmy.ml/pictrs/image/e7ba91c5-b1ce-434c-9afd-92ff791ecdb7.jpeg?thumbnail=1024)
Optional(https://lemmy.ml/pictrs/image/e14f4be8-9eb6-495a-ad1e-f11793260782.jpeg?thumbnail=1024)
Optional(https://lemmy.ml/pictrs/image/73bff108-9233-444e-bc20-68d55f0ae1b0.jpeg?thumbnail=1024)
Optional(https://lemmy.ml/pictrs/image/681476f1-35c8-4e7a-9dee-281727d14567.webp?thumbnail=1024)
Optional(https://lemmy.ml/pictrs/image/980ae2b1-7452-47b7-acdb-1dd673e4ed47.jpeg?thumbnail=1024)
Optional(https://lemmy.ml/pictrs/image/f9908f4f-e62d-4f90-b2f1-8705512e24c9.png?thumbnail=1024)
Optional(https://lemmy.ml/pictrs/image/e7ba91c5-b1ce-434c-9afd-92ff791ecdb7.jpeg?thumbnail=1024)
Optional(https://lemmy.ml/pictrs/image/06e5a505-c4b5-4951-9abf-d22cd0604683.png?thumbnail=1024)
Optional(https://lemmy.ml/pictrs/image/73bff108-9233-444e-bc20-68d55f0ae1b0.jpeg?thumbnail=1024)
Optional(https://lemmy.ml/pictrs/image/254ede65-f348-462c-8191-e1c2e4fc16ad.jpeg?thumbnail=1024)
Optional(https://lemmy.ml/pictrs/image/d717c52f-60aa-476e-b1ba-98341869d1e3.jpeg?thumbnail=1024)
Optional(https://lemmy.ml/pictrs/image/27359c13-80bf-4125-8329-1fef5449979a.jpeg?thumbnail=1024)
EricBAndrews commented 2 months ago

Opening https://mander.xyz/post/17946691 from lemm.ee reproduces the behavior