soruly / trace.moe

Anime Scene Search by Image
https://trace.moe
MIT License
4.49k stars 233 forks source link

image-proxy and Discord #48

Closed SentientCrab closed 3 years ago

SentientCrab commented 4 years ago

image-proxy fails on discord, says "This content is no longer available"

Edit: example url for testing https://cdn.discordapp.com/attachments/473214112969654282/676078778396573706/unknown.png

soruly commented 4 years ago

Yes this is an known issue. I'm not sure what was causing it. Probably because both Discord and trace.moe are served via cloudflare, which may be blocked by some firewall settings on Discord's server side?

SentientCrab commented 4 years ago

What about a setting to disable image proxy and do the request client side?

soruly commented 4 years ago

What about a setting to disable image proxy and do the request client side?

This would be blocked by browsers' security policy

SentientCrab commented 4 years ago

Oh duh, always forget about CORS being bad

ImUrX commented 4 years ago

CORS has its own reasons for existing... and its configurable by the site :p

soruly commented 4 years ago

CORS has its own reasons for existing... and its configurable by the site :p

Yes it's possible to load the image with CORS, but then the image would become "tainted canvas", which cannot be convereted to binary format to via toBlob or toDataURI.

ImUrX commented 4 years ago

sorry, not saying it should be done. i havent checked the codebase :p

soruly commented 4 years ago

Resolved in da5a1135311fba81a0bc6883425e2b5b6c684c67

ref: https://github.com/soruly/trace.moe-image-proxy (Deployed to ZEIT)

soruly commented 3 years ago

now.sh (ZEIT, a.k.a Vercel) blocked the image proxy because it's not allowed in its fair use policy. Now switching back to cloudflare workers for the moment. Need to look for new solutions.