miscord icon indicating copy to clipboard operation
miscord copied to clipboard

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

Open bruce-armstrong opened this issue 4 years ago • 10 comments

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}

bruce-armstrong avatar Apr 24 '21 02:04 bruce-armstrong

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.

ptrcnull avatar Apr 24 '21 12:04 ptrcnull

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.

Coffeeist avatar May 01 '21 04:05 Coffeeist

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.

bruce-armstrong avatar May 02 '21 22:05 bruce-armstrong

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

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 :)

Coffeeist avatar May 23 '21 00:05 Coffeeist

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?

cypherkey avatar Jun 12 '21 17:06 cypherkey

~~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 :sweat_smile: You might try to run tsc then, or somehow fix the compiled .js file.

ptrcnull avatar Jun 12 '21 17:06 ptrcnull

You can edit the Client.ts when rebooting the miscord

evlyou666 avatar Jun 12 '21 22:06 evlyou666

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

cypherkey avatar Jun 13 '21 04:06 cypherkey

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

hopolapopola avatar Jun 24 '21 07:06 hopolapopola

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.

bruce-armstrong avatar Jun 24 '21 17:06 bruce-armstrong