element-web-patches/patches/remove-share-to-nonfree-services.sh

98 lines
3.5 KiB
Bash
Executable File

#!/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/>.
echo "Removing links to nonfree services..."
error() {
echo "Failed to patch, exiting..."
exit 1
}
patch_content=$(cat << EOF
--- a/node_modules/matrix-react-sdk/lib/components/views/dialogs/ShareDialog.js
+++ b/node_modules/matrix-react-sdk/lib/components/views/dialogs/ShareDialog.js
@@ -37,28 +37,6 @@
*/
const socials = [{
- name: "Facebook",
- img: require("../../../../res/img/social/facebook.png"),
- url: url => \`https://www.facebook.com/sharer/sharer.php?u=\${url}\`
-}, {
- name: "Twitter",
- img: require("../../../../res/img/social/twitter-2.png"),
- url: url => \`https://twitter.com/home?status=\${url}\`
-},
-/* // icon missing
- name: 'Google Plus',
- img: 'img/social/',
- url: (url) => \`https://plus.google.com/share?url=\${url}\`,
-},*/
-{
- name: "LinkedIn",
- img: require("../../../../res/img/social/linkedin.png"),
- url: url => \`https://www.linkedin.com/shareArticle?mini=true&url=\${url}\`
-}, {
- name: "Reddit",
- img: require("../../../../res/img/social/reddit.png"),
- url: url => \`https://www.reddit.com/submit?url=\${url}\`
-}, {
name: "email",
img: require("../../../../res/img/social/email-1.png"),
url: url => \`mailto:?body=\${url}\`
--- a/node_modules/matrix-react-sdk/src/components/views/dialogs/ShareDialog.tsx
+++ b/node_modules/matrix-react-sdk/src/components/views/dialogs/ShareDialog.tsx
@@ -31,30 +31,6 @@
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}\`,
- },
- /* // icon missing
- name: 'Google Plus',
- img: 'img/social/',
- url: (url) => \`https://plus.google.com/share?url=\${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}\`,
EOF
)
(cd "${1}" && echo "${patch_content}" | patch -p1) || error
rm -f "${1}"/node_modules/matrix-react-sdk/res/img/social/facebook.png \
"${1}"/node_modules/matrix-react-sdk/res/img/social/linkedin.png \
"${1}"/node_modules/matrix-react-sdk/res/img/social/reddit.png \
"${1}"/node_modules/matrix-react-sdk/res/img/social/twitter-2.png \