From c8775fb05430c231b17559d71464c47c8f524690 Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 31 Mar 2022 17:11:41 +0100 Subject: [PATCH 01/13] update reaction patcher --- code_patches.sh | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/code_patches.sh b/code_patches.sh index 803468f..32ad321 100755 --- a/code_patches.sh +++ b/code_patches.sh @@ -1,37 +1,46 @@ #!/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 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 -echo Backing up compact.json... +echo 'Backing up compact.json...' 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 -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" +echo 'Adding custom emoji...' +{ + 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 -echo Copying custom config.json... +echo 'Copying custom config.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 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 -echo Adding custom emoji picker CSS... +echo 'Adding custom emoji picker CSS...' echo " .mx_EmojiPicker_item_wrapper { text-overflow: clip; @@ -40,13 +49,13 @@ echo " }" >> ../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 -echo running component index fix... +echo 'running component index fix...' cd ../node_modules/matrix-react-sdk yarn reskindex cd ../../element-web-patches -echo running kick fix... +echo 'running kick fix...' ./fix_kick.sh From aafc13488e19c6d5a9fb2bb3b40eae0cd79b267d Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 31 Mar 2022 17:11:55 +0100 Subject: [PATCH 02/13] TODO: Check `set -euo pipefail` compat --- fix_kick.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/fix_kick.sh b/fix_kick.sh index 7440b56..da1d8a7 100755 --- a/fix_kick.sh +++ b/fix_kick.sh @@ -1,4 +1,5 @@ #!/bin/sh +# TODO: Check `set -euo pipefail` compat # just to fix kick sed -i -e 's/remove/holocaust/g' \ -e 's/Removes/Holocausts/g' ../node_modules/matrix-react-sdk/src/SlashCommands.tsx From 29966b66d198058be54e6f1aa005f5d55f5fbb02 Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 31 Mar 2022 17:12:03 +0100 Subject: [PATCH 03/13] remove --- emoji.json | 276 ----------------------------------------------------- 1 file changed, 276 deletions(-) delete mode 100755 emoji.json diff --git a/emoji.json b/emoji.json deleted file mode 100755 index bd6e884..0000000 --- a/emoji.json +++ /dev/null @@ -1,276 +0,0 @@ -[ - { - "annotation": "based", - "group": 0, - "hexcode": "1F600", - "order": 1, - "shortcodes": [ - "based" - ], - "tags": [ - "based" - ], - "unicode": "based" - }, - { - "annotation": "cringe", - "group": 0, - "hexcode": "1F600", - "order": 1, - "shortcodes": [ - "cringe" - ], - "tags": [ - "cringe" - ], - "unicode": "cringe" - }, - { - "annotation": "yikes", - "group": 0, - "hexcode": "1F600", - "order": 1, - "shortcodes": [ - "yikes" - ], - "tags": [ - "yikes" - ], - "unicode": "yikes" - }, - { - "annotation": "cope", - "group": 0, - "hexcode": "1F600", - "order": 1, - "shortcodes": [ - "cope" - ], - "tags": [ - "cope" - ], - "unicode": "cope" - }, - { - "annotation": "Yes.", - "group": 0, - "hexcode": "1F600", - "order": 1, - "shortcodes": [ - "Yes." - ], - "tags": [ - "Yes." - ], - "unicode": "Yes." - }, - { - "annotation": "No.", - "group": 0, - "hexcode": "1F600", - "order": 1, - "shortcodes": [ - "No." - ], - "tags": [ - "No." - ], - "unicode": "No." - }, - { - "annotation": "(You)", - "group": 0, - "hexcode": "1F600", - "order": 1, - "shortcodes": [ - "(You)" - ], - "tags": [ - "(You)" - ], - "unicode": "(You)" - }, - { - "annotation": "lol", - "group": 0, - "hexcode": "1F600", - "order": 1, - "shortcodes": [ - "lol" - ], - "tags": [ - "lol" - ], - "unicode": "lol" - }, - { - "annotation": "RAPE", - "group": 0, - "hexcode": "1F600", - "order": 1, - "shortcodes": [ - "RAPE" - ], - "tags": [ - "RAPE" - ], - "unicode": "RAPE" - }, - { - "annotation": "F", - "group": 0, - "hexcode": "1F600", - "order": 1, - "shortcodes": [ - "F" - ], - "tags": [ - "F" - ], - "unicode": "F" - }, - { - "annotation": "vaggot", - "group": 0, - "hexcode": "1F600", - "order": 1, - "shortcodes": [ - "vaggot" - ], - "tags": [ - "vaggot" - ], - "unicode": "vaggot" - }, - { - "annotation": "vaxnigger", - "group": 0, - "hexcode": "1F600", - "order": 1, - "shortcodes": [ - "vaxnigger" - ], - "tags": [ - "vaxnigger" - ], - "unicode": "vaxnigger" - }, - { - "annotation": "Fag", - "group": 0, - "hexcode": "1F600", - "order": 1, - "shortcodes": [ - "Fag" - ], - "tags": [ - "Fag" - ], - "unicode": "Fag" - }, - { - "annotation": "simp", - "group": 0, - "hexcode": "1F600", - "order": 1, - "shortcodes": [ - "Fag" - ], - "tags": [ - "simp" - ], - "unicode": "simp" - }, - { - "annotation": "piss", - "group": 0, - "hexcode": "1F600", - "order": 1, - "shortcodes": [ - "piss" - ], - "tags": [ - "piss" - ], - "unicode": "piss" - }, - { - "annotation": "jelq", - "group": 0, - "hexcode": "1F600", - "order": 1, - "shortcodes": [ - "jelq" - ], - "tags": [ - "jelq" - ], - "unicode": "jelq" - }, - { - "annotation": "coom", - "group": 0, - "hexcode": "1F600", - "order": 1, - "shortcodes": [ - "coom" - ], - "tags": [ - "coom" - ], - "unicode": "coom" - }, - { - "annotation": "booba", - "group": 0, - "hexcode": "1F600", - "order": 1, - "shortcodes": [ - "booba" - ], - "tags": [ - "booba" - ], - "unicode": "booba" - }, - { - "annotation": "sinner", - "group": 0, - "hexcode": "1F600", - "order": 1, - "shortcodes": [ - "sinner" - ], - "tags": [ - "sinner" - ], - "unicode": "sinner" - }, - - { - "annotation": "repent", - "group": 0, - "hexcode": "1F600", - "order": 1, - "shortcodes": [ - "repent" - ], - "tags": [ - "repent" - ], - "unicode": "repent" - }, - { - "annotation": "卐", - "group": 0, - "hexcode": "1F600", - "order": 1, - "shortcodes": [ - "swastika" - ], - "tags": [ - "卐" - ], - "unicode": "卐" - } -] From eca44ef85690bd225bcc84480189eb9c1e7d363d Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 31 Mar 2022 17:12:19 +0100 Subject: [PATCH 04/13] add --- reactions/reactions.yaml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 reactions/reactions.yaml diff --git a/reactions/reactions.yaml b/reactions/reactions.yaml new file mode 100644 index 0000000..016ef64 --- /dev/null +++ b/reactions/reactions.yaml @@ -0,0 +1,31 @@ +- based +- cringe +- yikes +- cope +- seethe +- dilate +- '>' +- 't. jewish' +- 't. tard' +- '>implying' +- '>she' +- '>her' +- 'tard moment' +- 'woman moment' +- Yes. +- No. +- (You) +- lol +- RAPE +- F +- vaggot +- vaxnigger +- Fag +- simp +- piss +- jelq +- coom +- booba +- sinner +- repent +- 卐 From 6362b0a28d4b340ae92ce300b7401d1cdc752e25 Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 31 Mar 2022 17:12:23 +0100 Subject: [PATCH 05/13] add --- reactions/fetch-latest-format.sh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 reactions/fetch-latest-format.sh diff --git a/reactions/fetch-latest-format.sh b/reactions/fetch-latest-format.sh new file mode 100755 index 0000000..da0b8f3 --- /dev/null +++ b/reactions/fetch-latest-format.sh @@ -0,0 +1,6 @@ +#!/bin/sh +base="https://raw.githubusercontent.com/milesj/emojibase/master/packages/data/en" +for file in compact.raw.json data.raw.json; do + echo "$file:" + curl -sf "$base/$file" | jq '.[] | select(.hexcode == "2721")' || exit $? +done From 373b9116ccbc7ea9454b9379ecbff1b183dd3cfe Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 31 Mar 2022 17:12:27 +0100 Subject: [PATCH 06/13] add --- reactions/generate.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 reactions/generate.sh diff --git a/reactions/generate.sh b/reactions/generate.sh new file mode 100755 index 0000000..3d51c31 --- /dev/null +++ b/reactions/generate.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# Run fetch-latest-format.sh for the most up-to-date emojibase format. Target is raw.json +reactions="$(yq . /dev/stdin < reactions.yaml)" +jq -n --argjson reactions "$reactions" \ + '[ + $reactions[] | { + label: ., + hexcode: "2721", + tags: [ . ], + emoji: ., + text: ., + type: 0, + order: 0, + group: 8, + subgroup: 93, + version: 0.7 + } +]' + + From 39e0eb51769655f0dfb4c444072c5f49ade19afe Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 31 Mar 2022 17:37:09 +0100 Subject: [PATCH 07/13] add shortcodes, --- reactions/generate.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/reactions/generate.sh b/reactions/generate.sh index 3d51c31..ecc7b32 100755 --- a/reactions/generate.sh +++ b/reactions/generate.sh @@ -6,6 +6,7 @@ jq -n --argjson reactions "$reactions" \ $reactions[] | { label: ., hexcode: "2721", + shortcodes: [ . ], tags: [ . ], emoji: ., text: ., From 16eddee67cc88a839336e3f71dbc0656d82c9bc0 Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 31 Mar 2022 17:40:42 +0100 Subject: [PATCH 08/13] add tags optional --- reactions/generate.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/reactions/generate.sh b/reactions/generate.sh index ecc7b32..65ea26f 100755 --- a/reactions/generate.sh +++ b/reactions/generate.sh @@ -4,12 +4,12 @@ reactions="$(yq . /dev/stdin < reactions.yaml)" jq -n --argjson reactions "$reactions" \ '[ $reactions[] | { - label: ., + label: .emoji, hexcode: "2721", - shortcodes: [ . ], - tags: [ . ], - emoji: ., - text: ., + shortcodes: [ .emoji ], + tags: (.tags? + [ .emoji ]), + emoji: .emoji, + text: .emoji, type: 0, order: 0, group: 8, From 501b95e6966e30bca3db7d9674befd5d39ae100b Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 31 Mar 2022 17:40:52 +0100 Subject: [PATCH 09/13] add tag for swastika --- reactions/reactions.yaml | 64 +++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/reactions/reactions.yaml b/reactions/reactions.yaml index 016ef64..9c98003 100644 --- a/reactions/reactions.yaml +++ b/reactions/reactions.yaml @@ -1,31 +1,33 @@ -- based -- cringe -- yikes -- cope -- seethe -- dilate -- '>' -- 't. jewish' -- 't. tard' -- '>implying' -- '>she' -- '>her' -- 'tard moment' -- 'woman moment' -- Yes. -- No. -- (You) -- lol -- RAPE -- F -- vaggot -- vaxnigger -- Fag -- simp -- piss -- jelq -- coom -- booba -- sinner -- repent -- 卐 +- emoji: based +- emoji: cringe +- emoji: yikes +- emoji: cope +- emoji: seethe +- emoji: dilate +- emoji: '>' +- emoji: 't. jewish' +- emoji: 't. tard' +- emoji: '>implying' +- emoji: '>she' +- emoji: '>her' +- emoji: 'tard moment' +- emoji: 'woman moment' +- emoji: Yes. +- emoji: No. +- emoji: (You) +- emoji: lol +- emoji: RAPE +- emoji: F +- emoji: vaggot +- emoji: vaxnigger +- emoji: Fag +- emoji: simp +- emoji: piss +- emoji: jelq +- emoji: coom +- emoji: booba +- emoji: sinner +- emoji: repent +- emoji: 卐 + tags: + - swastika From a9e11f008111c8cdd403f63f526798e463a65ba4 Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 31 Mar 2022 19:33:50 +0100 Subject: [PATCH 10/13] fix ref --- code_patches.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code_patches.sh b/code_patches.sh index 32ad321..aac48ba 100755 --- a/code_patches.sh +++ b/code_patches.sh @@ -22,7 +22,7 @@ echo 'Adding custom emoji...' { 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"; + 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 $?; } From a06355d913574bdb470f7b32eae02219c2c17023 Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 31 Mar 2022 19:46:33 +0100 Subject: [PATCH 11/13] add emoticon --- reactions/generate.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/reactions/generate.sh b/reactions/generate.sh index 65ea26f..d70dfd0 100755 --- a/reactions/generate.sh +++ b/reactions/generate.sh @@ -5,6 +5,7 @@ jq -n --argjson reactions "$reactions" \ '[ $reactions[] | { label: .emoji, + emoticon: .emoji, hexcode: "2721", shortcodes: [ .emoji ], tags: (.tags? + [ .emoji ]), From b0e36c1a8e2f0688d0a7c1a7e2ccc2ce2226d60f Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 31 Mar 2022 19:55:09 +0100 Subject: [PATCH 12/13] work damnit --- reactions/generate.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/reactions/generate.sh b/reactions/generate.sh index d70dfd0..93a4ca1 100755 --- a/reactions/generate.sh +++ b/reactions/generate.sh @@ -4,9 +4,11 @@ reactions="$(yq . /dev/stdin < reactions.yaml)" jq -n --argjson reactions "$reactions" \ '[ $reactions[] | { + annotation: .emoji, label: .emoji, emoticon: .emoji, hexcode: "2721", + unicode: .emoji, shortcodes: [ .emoji ], tags: (.tags? + [ .emoji ]), emoji: .emoji, From ac628d6a81ae44ee5cc4bb569c249f3b07087e75 Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 31 Mar 2022 20:15:31 +0100 Subject: [PATCH 13/13] merge tags with shortcodes --- reactions/generate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactions/generate.sh b/reactions/generate.sh index 93a4ca1..19230e0 100755 --- a/reactions/generate.sh +++ b/reactions/generate.sh @@ -9,7 +9,7 @@ jq -n --argjson reactions "$reactions" \ emoticon: .emoji, hexcode: "2721", unicode: .emoji, - shortcodes: [ .emoji ], + shortcodes: (.tags? + [ .emoji ]), tags: (.tags? + [ .emoji ]), emoji: .emoji, text: .emoji,