AminoJS / Amino.JS

A powerful JavaScript library for interacting with the Amino API :star2:
MIT License
27 stars 5 forks source link

sendImage.js encode GIF as JPG #61

Closed kurai021 closed 5 years ago

kurai021 commented 5 years ago

Describe the bug I want to send a GIF with sendImage.js module

To Reproduce I use this code:

await amino.sendImage( auth.amino.community, receiver, 'example.gif' )

Expected behavior The receiver should be able to see the GIF

Desktop (please complete the following information):

akatsukilevi commented 5 years ago

Hey, sorry for delayed reply(got university exams and some events) When you send a gif this way, what does it send? It sends a empty image or a static image instead of the gif?

kurai021 commented 5 years ago

It sends a static image with the first GIF frame

akatsukilevi commented 5 years ago

I'm doing reverse engineering of the bug, and i'm trying to find out what causes the gif to be sent as a single frame image As i'm observing, the mediaType field pass to another value instead of 100 Once i discover what is causing it, i'll be sending here the right value to put there

kurai021 commented 5 years ago

I have captured some requests from the web version and I find it very strange that the mediaType is 100 for JPG and GIF images. There is a detail that is not clear to me, in sendImage.js you pass the base64 value without the filetype, I feel that that a parameter is missing and this parameter indicates to the server how to encode it

akatsukilevi commented 5 years ago

Do you have the payload from both requests(the jpg and the gif)? I can analyze them and check to see what's different I'll be making some experiments to try and see what's the difference between them Maybe the missing file type is causing it to be parsed as a static image

kurai021 commented 5 years ago

https://gist.github.com/kurai021/ecdd1c2578704cab352edc1f6e182401

I do not know if this is enough, I notice that the endpoint that returns each image is different

kurai021 commented 5 years ago

the missing value in the request is mediaUploadValueContentType according to this code.

I already tested and it works :D

akatsukilevi commented 5 years ago

Hey, Sorry again for the late reply And okay! Will be doing a commit to fix it soon!

akatsukilevi commented 5 years ago

Hey, Been a long time since i last got free time But i added a commit to the 3.0.0-nightly repo making the fix! EDIT: now the sendImage has a 4th argument(imageType), where you can set the MIME type of the image

akatsukilevi commented 5 years ago

Marking this as closed due to inactivity