Open BoomerScratch opened 4 years ago
Okay, this is kinda hard to do 😅
or, y'know, OffscreenCanvas
@easrng Yes, that is what I tried. I noticed some days ago that canvg isn't needed; it's built-in in most browsers.
Currently, the thumbnails don't support SVG. But there's a way of still doing it: Using assets.scratch.mit.edu.
@NoobTracker assets.scratch.mit.edu is not whitelisted.
Ohhh it's possible. I found an exploit that makes that possible. Look at this, someone either copied my idea or discovered it too. And it is technically whitelisted.
@NoobTracker Oh, that's interesting.
Indeed. You need to use get_image/
or something like that (y'know, one of the whitelisted paths) and then you need to get one directory higher by using ../,
but since ..
is blacklisted in URLs, you need to use %2E%2E/
.
Ping @JeffaloBob, assets are possible.
I already told Jeffalo, he tried it.
Currently, if you upload an SVG image, the image will not appear and a 500 error occurs. We should convert the SVG to PNG. This is easy: you can create a canvas element, render the SVG on it, and finally grab a picture of the canvas using canvas.toDataURL. The harder part is that it doesn't work if the canvas is offscreen. To fix that, we can use @canvg. Create a file called canvg.js with these contents, and also add it to the content scripts in manifest.json. We first need to merge #20 before I can start working on it.