FarisHijazi / Rarbg-Enhancer-UserScript

Browser extension for Rarbg.to to add autoCAPTCHA, magnet links, and enhance the interface
MIT License
108 stars 9 forks source link

Image Thumbnail 403 Forbidden [ISSUE] #32

Closed tyhallcsu closed 6 months ago

tyhallcsu commented 6 months ago

1) Image Thumbnail 403 Forbidden Fix

So some images refuse to load inside another website due to CORS headers refusing assets loading outside it's own domain. Is there a fix for 403 forbidden images?

Here is a visual:

CleanShot 2024-01-02 at 23 42 05@2x

Example code: Just try to load the image inside another page, it does not work

<a href="https://psa.wf/wp-content/uploads/2023/12/hlps.jpg" class="description-tb" target="_blank" style="font-size: 20px; display: grid;"><img src="https://psa.wf/wp-content/uploads/2023/12/hlps.jpg" alt="thumbnail" class="description zoom" style="max-width: 350px;"></a>

CleanShot 2024-01-02 at 23 50 55@2x

FarisHijazi commented 6 months ago

hey, I'll get on these when I can

could you tell me if this is a consistent problem?

one thing I tried doing is using duckduckgo proxy, and even then it doesn't always work. something like this: https://proxy.duckduckgo.com/iu/?u=https%3A%2F%2Fpsa.wf%2Fwp-content%2Fuploads%2F2023%2F12%2Fhlps.jpg&f=1

but the thing is.. the 403 issue is inconsistent, if you refresh a few times the same image will open after a few times

IDK the solution but if you find a way let me know, rarbg mirrors are weird anyway

tyhallcsu commented 6 months ago

hey, I'll get on these when I can

could you tell me if this is a consistent problem?

one thing I tried doing is using duckduckgo proxy, and even then it doesn't always work. something like this: https://proxy.duckduckgo.com/iu/?u=https%3A%2F%2Fpsa.wf%2Fwp-content%2Fuploads%2F2023%2F12%2Fhlps.jpg&f=1*

but the thing is.. the 403 issue is inconsistent, if you refresh a few times the same image will open after a few times

IDK the solution but if you find a way let me know, rarbg mirrors are weird anyway

So this is an issue of trying to load images from websites that define cross-domain headers.

It is a consistent issue (on a per-domain basis). I picked the psa.wf domain specifically because that image will never load even with refreshing.

Proxy will never work for those specific domains.

Instead, you would need to load the image independently, THEN append it into the page from local storage.

I think an elegant solution for the time being would be to just replace the 403 images with a placeholder (like below) to prevent page shifting while hovering the missing 403 images. ...And if in the future a local storage swap method can be found, then implement that.

image