Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

If there is a & character in a message, Miscord chokes parsing it. #484

Open
bruce-armstrong opened this issue Apr 24, 2021 · 10 comments
Open

Comments

@bruce-armstrong
Copy link

Miscord version 5.0.4

Original message text (in Facebook) was "& where also Lucky Friends"

Resulting error:

Error while parsing the following message:
(▬qBa0CkBERfqqz+6fe1NmsQ{"deltas":[{"deltaNewMessage":{"messageMetadata":{"threadKey":{"threadFbId":2213615022018380},"messageId":"mid.$gAAfdRWkOj0x_MwXYvV5AcCQHdZsP","offlineThreadingId":6791551538120989455,"actorFbId":100045161614852,"timestamp":1619232067773,"shouldBuzzDevice":true,"tags":["source:chat:light_speed","app_id:437626316973788"],"threadReadStateEffect":2,"skipBumpThread":false,"unsendType":"deny_for_non_sender","cid":{"conversationFbid":2213615022018380}},"body":"& where also Lucky Friends","attachments":[],"data":{}}}],"firstDeltaSeqId":6263,"lastIssuedSeqId":6263,"queueEntityId":100065700634362}

@ptrcnull
Copy link
Member

It's not a problem with the & character, but with Messenger's new app for iOS (codenamed light_speed) - it sends some gibberish before the actual message, thus breaking the parsing code in the library.

@Coffeeist
Copy link

Just a heads up, The Lightspeed code seems to have made its way past iOS. Getting a very similar looking error message (which does also have source:chat:light_speed) intermittently when sending via the facebook.com/messenger on Windows Edge Chromium. I am using it via PWA, though from a quick glance I don't see anything that makes me suspect this behavior is any different due to using PWA over conventional browser.

@bruce-armstrong
Copy link
Author

Just a heads up, The Lightspeed code seems to have made its way past iOS. Getting a very similar looking error message (which does also have source:chat:light_speed) intermittently when sending via the facebook.com/messenger on Windows Edge Chromium. I am using it via PWA, though from a quick glance I don't see anything that makes me suspect this behavior is any different due to using PWA over conventional browser.

Yeah, the bad news is I'm seeing it now too with Chrome.

@Coffeeist
Copy link

Linked a Gist in the comment with a suggested fix (albeit a quick&dirty one) on an Issue in the libfb repo:
ChatPlug/libfb-js#78 (comment)

Yeah, the bad news is I'm seeing it now too with Chrome.

Yep, as expected same on the Edge Chromium PWA I use. Came in handy for testing at least :)

@cypherkey
Copy link

With the fix listed above, is it possible to patch an existing instance? For example, in the container there is ./usr/local/lib/node_modules/miscord/node_modules/libfb/src/Client.ts. If I patch that file, is it possible to recompile libfb and then miscord?

@ptrcnull
Copy link
Member

ptrcnull commented Jun 12, 2021

JS is an interpreted language, there's nothing to compile - once you edit the file, you might be able to just restart the container.

EDIT: I forgot that my own project was ported to TypeScript at some point 😅
You might try to run tsc then, or somehow fix the compiled .js file.

@evlyou666
Copy link

You can edit the Client.ts when rebooting the miscord

@cypherkey
Copy link

I built a custom docker image that includes the fix. My Dockerfile is attached for anyone that might want it.
miscord-fixed.zip

@hopolapopola
Copy link

I built a custom docker image that includes the fix. My Dockerfile is attached for anyone that might want it.
miscord-fixed.zip

I'm running an instance in docker using that, I still get errors parsing messages from messenger

@bruce-armstrong
Copy link
Author

I use the windows compiled version. I've included the fix in a local copy of the code, used tsc to compile the typescript to javascript and then used "npx pkg -t latest-win-x64 --public . -o ./build/miscord-5.0.4-win.exe" to create a new windows executable with the fix. It's working for me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants