fsavje / math-with-slack

Rendered math (MathJax) with Slack's desktop client
MIT License
431 stars 62 forks source link

Math not rendered typed, only when slack is restarted #28

Closed prudhomm closed 6 years ago

prudhomm commented 6 years ago

I injected math-with-slack. I restart slack. now I type some math and it is not rendered. I stop and restart slack and it is now rendered.

platform: macos high sierra slack: latest version

issue at install:

sudo bash math_with_slack.sh
Password:
Using Slack installation at: /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static
grep: /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop-lite.js: No such file or directory
grep: /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop-lite.js: No such file or directory
cp: /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop-lite.js: No such file or directory
math-with-slack has been installed. Please restart the Slack client.

ssb-interop-lite.js is present in the slack directory

prudhomm commented 6 years ago

it seems that the install issue is directly linked to #27

glwhart commented 6 years ago

I had the same problem, but restarting again didn't help. If I run the install script again:

✘ Cannot restore from backup. Missing file: /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop-lite.js.mwsbak

If I try to uninstall:


$ sudo bash math_with_slack.sh -u
Password:
Using Slack installation at: /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static
✘ Cannot restore from backup. Missing file: /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop-lite.js.mwsbak```
LaurentHayez commented 6 years ago

Edit:

I forked the repo and created a pull request


I had the same problem and I was able to fix it as follows:

Modify the file math_with_slack.sh from hwagyesa's fork

Change line 219 to : mathjax_script.src = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js'; (this is not critical, it is just for the latest version of MathJax)

Change line 223 to: var target = document.querySelector('#messages_container'); This is the div element on the web application that contains the messages. I believe it was previously named msgs_div, and they changed the name to messages_container.

Re-inject the script

run the following commands in your terminal sudo rm /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop-lite.js sudo bash math_with_slack.sh

Restart Slack

Hope that helps.

fsavje commented 6 years ago

Thank you everyone for the help with this. The issue was indeed that ssb-interop-lite.js was removed. I just pushed a new version that fixes this. Let me know if it doesn't.

@LaurentHayez Thank you for the other updates. They've been incorporated. (Your pull request was to hwagyesa's fork, so I couldn't pull it.)