element-web-patches/code_patches.sh

63 lines
2.5 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
echo 'Backing up _EmojiPicker.pcss...'
if [ ! -f ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.pcss.backup ]; then
cp ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.pcss ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.pcss.backup
2022-02-26 08:30:06 -05:00
else
cp ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.pcss.backup ../node_modules/matrix-react-sdk/res/css/views/emojipicker/_EmojiPicker.pcss
2022-02-26 08:30:06 -05:00
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.pcss
2022-02-26 08:30:06 -05:00
#echo 'Adding greentext patch...'
#patch "../node_modules/commonmark/dist/commonmark.js" ./greentext.patch
2022-02-26 08:30:06 -05:00
2022-03-31 12:11:41 -04:00
echo 'running kick fix...'
2022-03-29 18:42:24 -04:00
./fix_kick.sh
2024-04-13 16:39:46 -04:00
echo 'Adding custom notification sound...'
cp ./message.mp3 ../webapp/media/message.mp3
cp ./message.mp3 ../node_modules/matrix-react-sdk/res/media/message.mp3
cp ./message.ogg ../webapp/media/message.ogg
cp ./message.ogg ../node_modules/matrix-react-sdk/res/media/message.ogg