Fixing login footer and non-free share removal to work on latest Element Web

This commit is contained in:
q 2025-01-04 15:48:40 -05:00
parent 5455ff77f1
commit 39432e16ad
4 changed files with 73 additions and 135 deletions

View File

@ -23,29 +23,13 @@ error() {
}
patch_content=$(cat << EOF
--- a/components.json
+++ b/components.json
@@ -1,5 +1,4 @@
{
- "src/components/views/auth/AuthFooter.tsx": "src/components/views/auth/VectorAuthFooter.tsx",
"src/components/views/auth/AuthHeaderLogo.tsx": "src/components/views/auth/VectorAuthHeaderLogo.tsx",
"src/components/views/auth/AuthPage.tsx": "src/components/views/auth/VectorAuthPage.tsx"
}
--- a/src/components/views/auth/VectorAuthPage.tsx
+++ b/src/components/views/auth/VectorAuthPage.tsx
@@ -8,7 +8,6 @@ Please see LICENSE files in the repository root for full details.
import * as React from "react";
import SdkConfig from "../../../SdkConfig";
-import VectorAuthFooter from "./VectorAuthFooter";
export default class VectorAuthPage extends React.PureComponent<React.PropsWithChildren> {
private static welcomeBackgroundUrl?: string;
@@ -68,7 +67,6 @@ export default class VectorAuthPage extends React.PureComponent<React.PropsWithC
--- a/src/components/views/auth/AuthPage.tsx
+++ b/src/components/views/auth/AuthPage.tsx
@@ -70,7 +70,6 @@ export default class AuthPage extends React.PureComponent<React.PropsWithChildre
{this.props.children}
</div>
</div>
- <VectorAuthFooter />
- <AuthFooter />
</div>
);
}
@ -53,6 +37,3 @@ EOF
)
(cd "${1}" && echo "${patch_content}" | patch -p1) || error
rm -f "${1}"/src/components/views/auth/VectorAuthFooter.tsx \
"${1}"/test/unit-tests/components/views/auth/VectorAuthFooter-test.tsx \
"${1}"/test/unit-tests/components/views/auth/__snapshots__/VectorAuthFooter-test.tsx.snap

View File

@ -20,7 +20,7 @@ element=../element-web
./add_custom_reactions.sh $element
./add_greentext.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
./replace_config_file.sh $element
./replace_login_background.sh $element

View File

@ -1,111 +0,0 @@
#!/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 "./node_modules/matrix-react-sdk/lib/components/views/dialogs/ShareDialog.js"; then
patchjs_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}\`
EOF
)
echo "${patchjs_content}" | patch -t -p1 || error
fi
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
@@ -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
)
echo "${patchtsx_content}" | patch -t -p1 || error
fi
cd $LWD

View File

@ -0,0 +1,68 @@
#!/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