element-web-patches/patches/remove_share_to_nonfree_services.sh

69 lines
2.1 KiB
Bash
Raw Normal View History

#!/bin/sh
# This file is part of the element-web-patches.
#
# element-web-patches is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# element-web-patches is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with element-web-patches. If not, see <https://www.gnu.org/licenses/>.
set -euo pipefail
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 $LWD