From 6dedff6a1f9b7af6179d8b33c37415b87481e41b Mon Sep 17 00:00:00 2001 From: q Date: Sun, 15 Feb 2026 17:23:19 -0500 Subject: [PATCH] Fixing non-free software link removal patch. Adding feature to replace they/them/their. --- README.md | 2 +- patches/add_greentext.sh | 4 +- patches/delete_login_footer.sh | 2 +- patches/files/remove_nonfree.patch | 29 ++++++++++++ patches/patch_all.sh | 2 +- patches/remove_share_to_nonfree_services.sh | 47 +------------------ ..._remove_and_ban.sh => sanitize_strings.sh} | 25 +++++++++- 7 files changed, 60 insertions(+), 51 deletions(-) create mode 100644 patches/files/remove_nonfree.patch rename patches/{rename_remove_and_ban.sh => sanitize_strings.sh} (71%) diff --git a/README.md b/README.md index a6ecdd8..e218080 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ | add_custom_reactions.sh | Adds custom text reactions to the emoji picker. Edit reactions.yaml to set which reactions are added. | | add_greentext.sh | Adds greentext, both as a /greentext command and by starting a message with ">". | | delete_login_footer.sh | Will delete the footer at the bottom of the login/register screen, removing useless links and making it cleaner. | -| rename_remove_and_ban.sh | Allows you to rename 'Remove' and 'Ban' to something else, you can change it by editing the script. | +| sanitize_strings.sh | Allows you to rename 'Remove' and 'Ban', and replace incorrect usages of they/them/their. You can change it by editing the script. | | replace_config_file.sh | Swaps the default config.json with your own. | | replace_login_background.sh | Allows you to replace the background on the login/register screen | | replace_notification_sound.sh | Allows you to replace the notification sound | diff --git a/patches/add_greentext.sh b/patches/add_greentext.sh index cf942f4..52cd780 100755 --- a/patches/add_greentext.sh +++ b/patches/add_greentext.sh @@ -22,6 +22,6 @@ LWD="$PWD" echo "Adding greentext..." cd $1 -patch -p1 < $LWD/files/greentext.patch -patch -p1 < $LWD/files/greentext_command.patch +patch --forward -p1 < $LWD/files/greentext.patch +patch --forward -p1 < $LWD/files/greentext_command.patch cd $LWD diff --git a/patches/delete_login_footer.sh b/patches/delete_login_footer.sh index 6c0256b..6036881 100755 --- a/patches/delete_login_footer.sh +++ b/patches/delete_login_footer.sh @@ -36,4 +36,4 @@ patch_content=$(cat << EOF EOF ) -(cd "${1}" && echo "${patch_content}" | patch -p1) || error +(cd "${1}" && echo "${patch_content}" | patch --forward -p1) || error diff --git a/patches/files/remove_nonfree.patch b/patches/files/remove_nonfree.patch new file mode 100644 index 0000000..7a8e9c6 --- /dev/null +++ b/patches/files/remove_nonfree.patch @@ -0,0 +1,29 @@ +--- a/src/components/views/dialogs/ShareDialog.tsx 2026-02-15 16:02:44.000000000 -0500 ++++ b/src/components/views/dialogs/ShareDialog.tsx 2026-02-15 16:11:14.557058244 -0500 +@@ -25,26 +25,6 @@ + /* eslint-disable @typescript-eslint/no-require-imports */ + const SOCIALS = [ + { +- name: "Facebook", +- img: require("../../../../res/img/social/facebook.png"), +- url: (url: string) => `https://www.facebook.com/sharer/sharer.php?u=${url}`, +- }, +- { +- name: "Twitter", +- img: require("../../../../res/img/social/twitter-2.png"), +- url: (url: string) => `https://twitter.com/home?status=${url}`, +- }, +- { +- name: "LinkedIn", +- img: require("../../../../res/img/social/linkedin.png"), +- url: (url: string) => `https://www.linkedin.com/shareArticle?mini=true&url=${url}`, +- }, +- { +- name: "Reddit", +- img: require("../../../../res/img/social/reddit.png"), +- url: (url: string) => `https://www.reddit.com/submit?url=${url}`, +- }, +- { + name: "email", + img: require("../../../../res/img/social/email-1.png"), + url: (url: string) => `mailto:?body=${url}`, diff --git a/patches/patch_all.sh b/patches/patch_all.sh index b37404f..c8472d9 100755 --- a/patches/patch_all.sh +++ b/patches/patch_all.sh @@ -21,7 +21,7 @@ element=../element-web ./add_greentext.sh $element ./delete_login_footer.sh $element ./remove_share_to_nonfree_services.sh $element -./rename_remove_and_ban.sh $element +./sanitize_strings.sh $element ./replace_config_file.sh $element ./replace_login_background.sh $element ./replace_notification_sound.sh $element diff --git a/patches/remove_share_to_nonfree_services.sh b/patches/remove_share_to_nonfree_services.sh index c7b1329..6974fb1 100755 --- a/patches/remove_share_to_nonfree_services.sh +++ b/patches/remove_share_to_nonfree_services.sh @@ -20,49 +20,6 @@ LWD="$PWD" echo "Removing links to nonfree services..." -error() { - echo "Failed to patch, exiting..." - exit 1 -} - -cd "${1}" - - -if test -f ".${1}/src/components/views/dialogs/ShareDialog.tsx"; then - -patchtsx_content=$(cat << EOF ---- a${1}/src/components/views/dialogs/ShareDialog.tsx -+++ b${1}/src/components/views/dialogs/ShareDialog.tsx -@@ -24,26 +24,6 @@ import { useSettingValue } from "../../../hooks/useSettings.ts"; - - /* eslint-disable @typescript-eslint/no-require-imports */ - const SOCIALS = [ -- { -- name: "Facebook", -- img: require("../../../../res/img/social/facebook.png"), -- url: (url: string) => `https://www.facebook.com/sharer/sharer.php?u=${url}`, -- }, -- { -- name: "Twitter", -- img: require("../../../../res/img/social/twitter-2.png"), -- url: (url: string) => `https://twitter.com/home?status=${url}`, -- }, -- { -- name: "LinkedIn", -- img: require("../../../../res/img/social/linkedin.png"), -- url: (url: string) => `https://www.linkedin.com/shareArticle?mini=true&url=${url}`, -- }, -- { -- name: "Reddit", -- img: require("../../../../res/img/social/reddit.png"), -- url: (url: string) => `https://www.reddit.com/submit?url=${url}`, -- }, - { - name: "email", - img: require("../../../../res/img/social/email-1.png"), -EOF -) - -echo "${patchtsx_content}" | patch -t -p1 || error -fi +cd $1 +patch --forward -p1 < $LWD/files/remove_nonfree.patch cd $LWD diff --git a/patches/rename_remove_and_ban.sh b/patches/sanitize_strings.sh similarity index 71% rename from patches/rename_remove_and_ban.sh rename to patches/sanitize_strings.sh index 36679df..8676993 100755 --- a/patches/rename_remove_and_ban.sh +++ b/patches/sanitize_strings.sh @@ -34,6 +34,10 @@ capital_ban_command="Gas" capital_ban_command_plural="Gasses" capital_ban_command_past_tense="Gassed" +their="his" +them="him" +they="he" + error() { echo "Failed to rename, exiting..." exit 1 @@ -41,7 +45,7 @@ error() { # Remove sed -i -e "s/remove/${remove_command}/g" \ - -e "s/Removes/${capital_remove_command_plural}/g" "${1}"/src/SlashCommands.tsx + -e "s/Removes/${capital_remove_command_plural}/g" "${1}"/src/slash-commands/SlashCommands.tsx sed -i -e "s/\"Remove/\"${capital_remove_command}/g" \ -e "s/Failed to remove/Failed to ${remove_command}/g" "${1}"/src/components/views/right_panel/UserInfo.tsx @@ -51,6 +55,7 @@ sed -i -e "s/Removes user/${capital_remove_command_plural} user/g" \ -e "s/\"Remove,/\"${capital_remove_command},/g" \ -e "s/You were removed/You were ${remove_command_past_tense}/g" \ -e "s/Remove from/${capital_remove_command} from/g" \ + -e "s/\"Remove them/\"${capital_remove_command} ${them}/g" \ -e "s/removed\"/${remove_command_past_tense}\"/g" "${1}"/src/i18n/strings/en_EN.json sed -i -e "s/senderName)s removed %(targetName/senderName)s ${remove_command_past_tense} %(targetName/g" "${1}"/src/TextForEvent.tsx @@ -64,6 +69,9 @@ sed -i -e "s/\"Ban\"/\"${capital_ban_command}\"/g" "${1}"/src/components/views/r sed -i -e "s/Bans user with given id\",/${capital_ban_command_plural} user with given id\",/g" \ -e "s/\"Ban from %(roomName)s\",/\"${capital_ban_command} from %(roomName)s\",/g" \ + -e "s/\"Ban from room\",/\"${capital_ban_command}\",/g" \ + -e "s/\"Ban from space\",/\"${capital_ban_command}\",/g" \ + -e "s/\"Ban them/\"${capital_ban_command} ${them}/g" \ -e "s/\"Ban\"/\"${capital_ban_command}\"/g" \ -e "s/\"Banned by %(displayName)s\",/\"${capital_ban_command_past_tense} by %(displayName)s\",/g" \ -e "s/\"Banned users\",/\"${capital_ban_command_past_tense} users\",/g" \ @@ -74,3 +82,18 @@ sed -i -e "s/Bans user with given id\",/${capital_ban_command_plural} user with -e "s/were banned %(count)s times\",/were ${ban_command_past_tense} %(count)s times\",/g" \ -e "s/s banned %(targetName)s: %(reason)s\",/s ${ban_command_past_tense} %(targetName)s: %(reason)s\",/g" \ -e "s/s banned %(targetName)s\",/s ${ban_command_past_tense} %(targetName)s\",/g" "${1}"/src/i18n/strings/en_EN.json || error + +echo "Replacing gender neutral pronouns..." +# Gender neutral pronouns +sed -i -e "s/oneUser)schanged their profile picture/oneUser)schanged ${their} profile picture/g" \ + -e "s/oneUser)schanged their name/oneUser)schanged ${their} name/g" \ + -e "s/someone using their name/someone using ${their} name/g" \ + -e "s/their display name/${their} display name/g" \ + -e "s/senderName)s changed their profile picture/senderName)s changed ${their} profile picture/g" \ + -e "s/senderName)s removed their profile picture/senderName)s removed ${their} profile picture/g" \ + -e "s/send them your invite link/send ${them} your invite link/g" \ + -e "s/\"Unban them/\"Unban ${them}/g" \ + -e "s/before they can be invited/before ${they} can be invited/g" \ + -e "s/until they are unbanned/until ${they} is unbanned/g" \ + -e "s/them out and prevent them from logging back in. Additionally, they will leave all the rooms they are/${them} out and prevent ${them} from logging back in. Additionally, ${they} will leave all the rooms ${they} is/g" \ + -e "s/oneUser)shad their invitation/oneUser)shad ${their} invitation/g" "${1}"/src/i18n/strings/en_EN.json || error