element-web-patches/code_patches.sh

62 lines
2.3 KiB
Bash
Raw Normal View History

2022-02-26 08:30:06 -05:00
#!/bin/bash
2022-03-31 12:11:41 -04:00
set -euo pipefail
LWD="$PWD"
2022-02-26 08:30:06 -05:00
2022-03-31 12:11:41 -04:00
# TODO: cleanup, generify backup
echo 'Backing up EmojiProvider.tsx...'
2022-02-26 08:30:06 -05:00
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
else
cp ../node_modules/matrix-react-sdk/src/autocomplete/EmojiProvider_backup.tsx ../node_modules/matrix-react-sdk/src/autocomplete/EmojiProvider.tsx
fi
2022-03-31 12:11:41 -04:00
echo 'Backing up compact.json...'
2022-02-26 08:30:06 -05:00
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
else
cp ../node_modules/emojibase-data/en/compact_backup.json ../node_modules/emojibase-data/en/compact.json
fi
2022-03-31 12:11:41 -04:00
echo 'Adding custom emoji...'
{
cd ./reactions;
./generate.sh > "./data-injects~.json";
2022-03-31 14:33:50 -04:00
jq -sc '.[0] + .[1]' "../../node_modules/emojibase-data/en/compact_backup.json" "./data-injects~.json" > "../../node_modules/emojibase-data/en/compact.json";
2022-03-31 12:11:41 -04:00
rm "./data-injects~.json";
cd "$LWD";
} || { echo "Failed to inject reactions: Exit code $?" 1>&2; exit $?; }
2022-02-26 08:30:06 -05:00
2022-03-31 12:11:41 -04:00
echo 'Copying custom login background...'
2022-02-26 08:30:06 -05:00
cp -f ./lake.jpg ../res/themes/element/img/backgrounds/lake.jpg
2022-03-31 12:11:41 -04:00
echo 'Copying custom config.json...'
2022-02-26 08:30:06 -05:00
cp -f ./config.json ../config.sample.json
2022-03-31 12:11:41 -04:00
echo 'Backing up _EmojiPicker.scss...'
2022-02-26 08:30:06 -05:00
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
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
fi
2022-03-31 12:11:41 -04:00
echo 'Adding custom emoji picker CSS...'
2022-02-26 08:30:06 -05:00
echo "
.mx_EmojiPicker_item_wrapper {
text-overflow: clip;
white-space: nowrap;
overflow: hidden;
}" >> ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.scss
2022-03-31 12:11:41 -04:00
echo 'Adding greentext patch...'
2022-02-26 08:30:06 -05:00
patch "../node_modules/commonmark/dist/commonmark.js" ./greentext.patch
2022-03-31 12:11:41 -04:00
echo 'running component index fix...'
2022-02-26 08:30:06 -05:00
cd ../node_modules/matrix-react-sdk
yarn reskindex
cd ../../element-web-patches
2022-03-29 18:42:24 -04:00
2022-03-31 12:11:41 -04:00
echo 'running kick fix...'
2022-03-29 18:42:24 -04:00
./fix_kick.sh