extensions icon indicating copy to clipboard operation
extensions copied to clipboard

Add upload extension

Open ClaytonTDM opened this issue 2 years ago • 16 comments

Pretty simple extension that can't be replicated with pre-existing extensions

ClaytonTDM avatar Jul 03 '23 12:07 ClaytonTDM

What would this be useful for?

BlueDome77 avatar Jul 04 '23 01:07 BlueDome77

I used it in my cloud chat project to have an upload file button that posts a link to the file in chat

ClaytonTDM avatar Jul 04 '23 04:07 ClaytonTDM

Is this extension already possible through a combination of files and the HTTP/fetch/Network extensions?

GarboMuffin avatar Jul 09 '23 01:07 GarboMuffin

Nope, because of how multipart/form-data uploads are created (see below), it isn't yet possible.

POST /upload HTTP/1.1
Content-Length: 428
Content-Type: multipart/form-data; boundary=abcde12345
--abcde12345
Content-Disposition: form-data; name="id"
Content-Type: text/plain
123e4567-e89b-12d3-a456-426655440000
--abcde12345
Content-Disposition: form-data; name="address"
Content-Type: application/json
{
  "street": "3, Garden St",
  "city": "Hillsbery, UT"
}
--abcde12345
Content-Disposition: form-data; name="profileImage "; filename="image1.png"
Content-Type: application/octet-stream
{…file content…}
--abcde12345--

ClaytonTDM avatar Jul 10 '23 10:07 ClaytonTDM

Would it be possible to turn this into a more general file uploading extension?

At least a block like "set file host to [ ]", even if it only has one option for now

GarboMuffin avatar Jul 17 '23 03:07 GarboMuffin

Would it be possible to turn this into a more general file uploading extension?

At least a block like "set file host to [ ]", even if it only has one option for now

It depends on the case. For a service like Gofile, they have multiple servers (store1, store2, etc) so there would have to be custom logic to grab the correct server from their API. Although, it could work better with both the current upload file to URL, and "upload file to [dropdown]" so there aren't any unnecessary blocks. That's one thing I hate about extensions such as numerical encoding, why have a block that just sets a custom variable when you could have a single reporter?

Anyways, I'll get started on the new block now.

ClaytonTDM avatar Jul 18 '23 02:07 ClaytonTDM

Hey. something that's annoying with gofile and file.io is they dont provide direct links to the raw image. This really adds tons of limitations so I can't have the image show in my turbowarp project. Is there another hosting exactly like gofile that actually gives you the link to the raw hosted image, so i can have a plugin display the image in the project?

SaFireGalaxy avatar Aug 01 '23 01:08 SaFireGalaxy

As far as I know, no. If I find one, I'll be sure to add support for it though.

ClaytonTDM avatar Aug 01 '23 10:08 ClaytonTDM

Thanks @ClaytonTDM!

SaFireGalaxy avatar Aug 01 '23 17:08 SaFireGalaxy

Is this getting merged or what?

ahinojos0029 avatar Aug 27 '23 03:08 ahinojos0029

Is this getting merged or what?

Please have patience, we're all volunteers here. As stated in CONTRIBUTING.md, "We'll get to you as soon as we can, so please be patient".

Edit: nevermind, patience is not required here lmao

LilyMakesThings avatar Aug 27 '23 03:08 LilyMakesThings

hi, sorry for the delay, currently whittling away at a review queue that pilled up during months of long days at work

here's the deal for this extension -

  • The HTTP extension does support multipart now, so this is not as necessary (but still happy to merge it, if you resolve the issues below)
  • It would be great if the extension was not limited to just files on your computer already, but if it also allowed any text, such as data: URI snapshots of the stage from looks+
  • Your scripts need to handle what happens when someone cancels the file dialog. At a bare minimum you can listen for the cancel event, which is a new thing for dealing with this, but support is still very new. This is why the file extension insists on showing a modal.
  • Errors in getGofileServer (for example, if someone denies the fetch) need to be handled

GarboMuffin avatar Aug 27 '23 03:08 GarboMuffin

Sure! I've added all the changes and fixes you mentioned.

ClaytonTDM avatar Aug 27 '23 23:08 ClaytonTDM

its been like a year

ClaytonTDM avatar Aug 14 '24 20:08 ClaytonTDM

its been like a year

Indeed.

yuri-kiss avatar Dec 24 '24 18:12 yuri-kiss