Skip to content

Instantly share code, notes, and snippets.

@5n00p4eg
Created September 10, 2019 08:10
Show Gist options
  • Save 5n00p4eg/bb66842f684f51abdbfd75b853413f66 to your computer and use it in GitHub Desktop.
Save 5n00p4eg/bb66842f684f51abdbfd75b853413f66 to your computer and use it in GitHub Desktop.
#!/bin/bash
FILEPATH=/var/lib/flatpak/app/com.slack.Slack/current/active/files/extra/lib/slack/resources/app.asar.unpacked/src/static/ssb-interop.js
COMMENT_START="//SolorizePatchStart//"
COMMENT_END="//SolorizePatchEnd//"
CODE="
document.addEventListener('DOMContentLoaded', function() {
$.ajax({
url: 'https://raw.githubusercontent.com/nakedsushi/solarized-slack/e6bf977ed15d1fdfeb91b354e500a87ce455e985/css/solarized.css',
success: function(css) {
\$(\"<style></style>\").appendTo('head').html(css);
}
});
});
"
if grep -q "$COMMENT_START" "$FILEPATH"; then
echo "File $FILEPATH elready patched"
else
echo "Patching file $FILEPATH"
echo "$COMMENT_START" >> $FILEPATH
echo "$CODE" >> $FILEPATH
echo "$COMMENT_END" >> $FILEPATH
echo "File patched"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment