Fixing non-free software link removal patch. Adding feature to replace they/them/their.

This commit is contained in:
q
2026-02-15 17:23:19 -05:00
parent 29e80e9148
commit 6dedff6a1f
7 changed files with 60 additions and 51 deletions

View File

@@ -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_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 ">". | | 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. | | 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_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_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 | | replace_notification_sound.sh | Allows you to replace the notification sound |

View File

@@ -22,6 +22,6 @@ LWD="$PWD"
echo "Adding greentext..." echo "Adding greentext..."
cd $1 cd $1
patch -p1 < $LWD/files/greentext.patch patch --forward -p1 < $LWD/files/greentext.patch
patch -p1 < $LWD/files/greentext_command.patch patch --forward -p1 < $LWD/files/greentext_command.patch
cd $LWD cd $LWD

View File

@@ -36,4 +36,4 @@ patch_content=$(cat << EOF
EOF EOF
) )
(cd "${1}" && echo "${patch_content}" | patch -p1) || error (cd "${1}" && echo "${patch_content}" | patch --forward -p1) || error

View File

@@ -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}`,

View File

@@ -21,7 +21,7 @@ element=../element-web
./add_greentext.sh $element ./add_greentext.sh $element
./delete_login_footer.sh $element ./delete_login_footer.sh $element
./remove_share_to_nonfree_services.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_config_file.sh $element
./replace_login_background.sh $element ./replace_login_background.sh $element
./replace_notification_sound.sh $element ./replace_notification_sound.sh $element

View File

@@ -20,49 +20,6 @@ LWD="$PWD"
echo "Removing links to nonfree services..." echo "Removing links to nonfree services..."
error() { cd $1
echo "Failed to patch, exiting..." patch --forward -p1 < $LWD/files/remove_nonfree.patch
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 $LWD cd $LWD

View File

@@ -34,6 +34,10 @@ capital_ban_command="Gas"
capital_ban_command_plural="Gasses" capital_ban_command_plural="Gasses"
capital_ban_command_past_tense="Gassed" capital_ban_command_past_tense="Gassed"
their="his"
them="him"
they="he"
error() { error() {
echo "Failed to rename, exiting..." echo "Failed to rename, exiting..."
exit 1 exit 1
@@ -41,7 +45,7 @@ error() {
# Remove # Remove
sed -i -e "s/remove/${remove_command}/g" \ 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" \ 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 -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/\"Remove,/\"${capital_remove_command},/g" \
-e "s/You were removed/You were ${remove_command_past_tense}/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 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 -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 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" \ 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 %(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/\"Ban\"/\"${capital_ban_command}\"/g" \
-e "s/\"Banned by %(displayName)s\",/\"${capital_ban_command_past_tense} by %(displayName)s\",/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" \ -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/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: %(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 -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