If there is a & character in a message, Miscord chokes parsing it.
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}
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.
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.
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.
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 :)
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?
~~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.
You can edit the Client.ts when rebooting the miscord
I built a custom docker image that includes the fix. My Dockerfile is attached for anyone that might want it. miscord-fixed.zip
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
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.