update reaction patcher

This commit is contained in:
Jon 2022-03-31 17:11:41 +01:00
parent 8a1ffe10f3
commit c8775fb054

View File

@ -1,37 +1,46 @@
#!/bin/bash #!/bin/bash
set -euo pipefail
LWD="$PWD"
echo Backing up EmojiProvider.tsx... # TODO: cleanup, generify backup
echo 'Backing up EmojiProvider.tsx...'
if [ ! -f ../node_modules/matrix-react-sdk/src/autocomplete/EmojiProvider_backup.tsx ]; then if [ ! -f ../node_modules/matrix-react-sdk/src/autocomplete/EmojiProvider_backup.tsx ]; then
cp ../node_modules/matrix-react-sdk/src/autocomplete/EmojiProvider.tsx ../node_modules/matrix-react-sdk/src/autocomplete/EmojiProvider_backup.tsx cp ../node_modules/matrix-react-sdk/src/autocomplete/EmojiProvider.tsx ../node_modules/matrix-react-sdk/src/autocomplete/EmojiProvider_backup.tsx
else else
cp ../node_modules/matrix-react-sdk/src/autocomplete/EmojiProvider_backup.tsx ../node_modules/matrix-react-sdk/src/autocomplete/EmojiProvider.tsx cp ../node_modules/matrix-react-sdk/src/autocomplete/EmojiProvider_backup.tsx ../node_modules/matrix-react-sdk/src/autocomplete/EmojiProvider.tsx
fi fi
echo Backing up compact.json... echo 'Backing up compact.json...'
if [ ! -f ../node_modules/emojibase-data/en/compact_backup.json ]; then if [ ! -f ../node_modules/emojibase-data/en/compact_backup.json ]; then
cp ../node_modules/emojibase-data/en/compact.json ../node_modules/emojibase-data/en/compact_backup.json cp ../node_modules/emojibase-data/en/compact.json ../node_modules/emojibase-data/en/compact_backup.json
else else
cp ../node_modules/emojibase-data/en/compact_backup.json ../node_modules/emojibase-data/en/compact.json cp ../node_modules/emojibase-data/en/compact_backup.json ../node_modules/emojibase-data/en/compact.json
fi fi
echo Adding custom emoji... echo 'Adding custom emoji...'
jq -s -c '.[0] + .[1]' "../node_modules/emojibase-data/en/compact_backup.json" "./emoji.json" > "../node_modules/emojibase-data/en/compact.json" {
cd ./reactions;
./generate.sh > "./data-injects~.json";
jq -sc '.[0] + .[1]' "../node_modules/emojibase-data/en/compact_backup.json" "./data-injects~.json" > "../node_modules/emojibase-data/en/compact.json";
rm "./data-injects~.json";
cd "$LWD";
} || { echo "Failed to inject reactions: Exit code $?" 1>&2; exit $?; }
echo 'Copying custom login background...'
echo Copying custom login background...
cp -f ./lake.jpg ../res/themes/element/img/backgrounds/lake.jpg cp -f ./lake.jpg ../res/themes/element/img/backgrounds/lake.jpg
echo Copying custom config.json... echo 'Copying custom config.json...'
cp -f ./config.json ../config.sample.json cp -f ./config.json ../config.sample.json
echo Backing up _EmojiPicker.scss... echo 'Backing up _EmojiPicker.scss...'
if [ ! -f ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.scss.backup ]; then if [ ! -f ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.scss.backup ]; then
cp ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.scss ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.scss.backup cp ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.scss ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.scss.backup
else else
cp ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.scss.backup ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.scss cp ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.scss.backup ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.scss
fi fi
echo Adding custom emoji picker CSS... echo 'Adding custom emoji picker CSS...'
echo " echo "
.mx_EmojiPicker_item_wrapper { .mx_EmojiPicker_item_wrapper {
text-overflow: clip; text-overflow: clip;
@ -40,13 +49,13 @@ echo "
}" >> ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.scss }" >> ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.scss
echo Adding greentext patch... echo 'Adding greentext patch...'
patch "../node_modules/commonmark/dist/commonmark.js" ./greentext.patch patch "../node_modules/commonmark/dist/commonmark.js" ./greentext.patch
echo running component index fix... echo 'running component index fix...'
cd ../node_modules/matrix-react-sdk cd ../node_modules/matrix-react-sdk
yarn reskindex yarn reskindex
cd ../../element-web-patches cd ../../element-web-patches
echo running kick fix... echo 'running kick fix...'
./fix_kick.sh ./fix_kick.sh