From c7bdfb7f9842b9e4ee517c09cc624825f8e7e22d Mon Sep 17 00:00:00 2001 From: pavanjoshi914 Date: Wed, 7 Feb 2024 12:03:58 +0530 Subject: [PATCH] chore: revert intermediate steps for btcpay --- src/app/router/connectorRoutes.tsx | 27 +--- .../index.tsx | 4 +- .../ConnectBtcpayCommando/index.tsx | 144 ------------------ .../screens/connectors/ConnectLnc/index.tsx | 2 +- src/i18n/locales/en/translation.json | 23 +-- static/assets/icons/lnd_lnc.png | Bin 5397 -> 0 bytes 6 files changed, 15 insertions(+), 185 deletions(-) rename src/app/screens/connectors/{ConnectBtcpayLND => ConnectBtcpay}/index.tsx (97%) delete mode 100644 src/app/screens/connectors/ConnectBtcpayCommando/index.tsx delete mode 100644 static/assets/icons/lnd_lnc.png diff --git a/src/app/router/connectorRoutes.tsx b/src/app/router/connectorRoutes.tsx index e9626b393b..c1330dc54e 100644 --- a/src/app/router/connectorRoutes.tsx +++ b/src/app/router/connectorRoutes.tsx @@ -1,4 +1,5 @@ import ChooseConnector from "@screens/connectors/ChooseConnector"; +import ConnectBtcpay from "@screens/connectors/ConnectBtcpay"; import ConnectCitadel from "@screens/connectors/ConnectCitadel"; import ConnectEclair from "@screens/connectors/ConnectEclair"; import ConnectGaloy, { galoyUrls } from "@screens/connectors/ConnectGaloy"; @@ -13,8 +14,6 @@ import ConnectUmbrel from "@screens/connectors/ConnectUmbrel"; import { Route } from "react-router-dom"; import i18n from "~/i18n/i18nConfig"; -import ConnectBtcpayCommando from "~/app/screens/connectors/ConnectBtcpayCommando"; -import ConnectBtcpayLND from "~/app/screens/connectors/ConnectBtcpayLND"; import ConnectNWC from "~/app/screens/connectors/ConnectNWC"; import ConnectVoltage from "~/app/screens/connectors/ConnectVoltage"; import ConnectCommando from "../screens/connectors/ConnectCommando"; @@ -82,24 +81,18 @@ const connectorMap: { [key: string]: ConnectorRoute } = { title: i18n.t("translation:choose_connector.umbrel_lightning_node.title"), logo: lightning_node, }, - "btcpay-lnd": { - path: "lnd", - element: , - title: i18n.t("translation:choose_connector.lnd.title"), - logo: lnd, - }, - "btcpay-commando": { - path: "commando", - element: , - title: i18n.t("translation:choose_connector.commando.title"), - logo: core_ln, - }, "raspiblitz-lnd": { path: "lnd", element: , title: i18n.t("translation:choose_connector.lnd.title"), logo: lnd, }, + btcpay: { + path: "btcpay", + element: , + title: i18n.t("translation:choose_connector.btcpay.title"), + logo: btcpay, + }, "mynode-lnd": { path: "lnd", element: , @@ -210,10 +203,6 @@ const distributionMap: { [key: string]: { logo: string; children: Route[] } } = connectorMap["lnbits"], ], }, - btcpay: { - logo: btcpay, - children: [connectorMap["btcpay-lnd"], connectorMap["btcpay-commando"]], - }, umbrel: { logo: umbrel, children: [ @@ -261,7 +250,7 @@ function getConnectorRoutes(): ConnectorRoute[] { connectorMap["lnbits"], connectorMap["lnd-hub-go"], connectorMap["eclair"], - getDistribution("btcpay"), + connectorMap["btcpay"], connectorMap["voltage"], connectorMap[galoyPaths.blink], connectorMap[galoyPaths.bitcoinJungle], diff --git a/src/app/screens/connectors/ConnectBtcpayLND/index.tsx b/src/app/screens/connectors/ConnectBtcpay/index.tsx similarity index 97% rename from src/app/screens/connectors/ConnectBtcpayLND/index.tsx rename to src/app/screens/connectors/ConnectBtcpay/index.tsx index 5ece6082ef..5efb6d0376 100644 --- a/src/app/screens/connectors/ConnectBtcpayLND/index.tsx +++ b/src/app/screens/connectors/ConnectBtcpay/index.tsx @@ -18,10 +18,10 @@ const initialFormData = { name: "", }; -export default function ConnectBtcpayLND() { +export default function ConnectBtcpay() { const navigate = useNavigate(); const { t } = useTranslation("translation", { - keyPrefix: "choose_connector.btcpay_lnd", + keyPrefix: "choose_connector.btcpay", }); const [formData, setFormData] = useState(initialFormData); const [loading, setLoading] = useState(false); diff --git a/src/app/screens/connectors/ConnectBtcpayCommando/index.tsx b/src/app/screens/connectors/ConnectBtcpayCommando/index.tsx deleted file mode 100644 index a7c1df15ea..0000000000 --- a/src/app/screens/connectors/ConnectBtcpayCommando/index.tsx +++ /dev/null @@ -1,144 +0,0 @@ -import CompanionDownloadInfo from "@components/CompanionDownloadInfo"; -import ConnectorForm from "@components/ConnectorForm"; -import TextField from "@components/form/TextField"; -import ConnectionErrorToast from "@components/toasts/ConnectionErrorToast"; -import fetchAdapter from "@vespaiach/axios-fetch-adapter"; -import axios from "axios"; -import { useState } from "react"; -import { useTranslation } from "react-i18next"; -import { useNavigate } from "react-router-dom"; -import toast from "~/app/components/Toast"; -import msg from "~/common/lib/msg"; - -import logo from "/static/assets/icons/btcpay.svg"; - -const initialFormData = { - url: "", - macaroon: "", - name: "", -}; - -export default function ConnectBtcpayCommando() { - const navigate = useNavigate(); - const { t } = useTranslation("translation", { - keyPrefix: "choose_connector.btcpay_commando", - }); - const [formData, setFormData] = useState(initialFormData); - const [loading, setLoading] = useState(false); - const [hasTorSupport, setHasTorSupport] = useState(false); - - function getConfigUrl(data: string) { - const configUrl = data.trim().replace("config=", ""); - try { - return new URL(configUrl); - } catch (e) { - return null; - } - } - async function handleChange(event: React.ChangeEvent) { - const configUrl = getConfigUrl(event.target.value); - if (!configUrl) { - return; - } - const host = configUrl.host; - try { - const response = await axios.get<{ - configurations: [{ uri: string; adminMacaroon: string }]; - }>(configUrl.toString(), { adapter: fetchAdapter }); - - if (response.data.configurations[0].uri) { - setFormData({ - url: response.data.configurations[0].uri, - macaroon: response.data.configurations[0].adminMacaroon, - name: host, - }); - } - } catch (e) { - console.error(e); - toast.error(t("errors.connection_failed")); - } - } - - function getConnectorType() { - if (formData.url.match(/\.onion/i) && !hasTorSupport) { - return "nativelnd"; - } - // default to LND - return "lnd"; - } - - async function handleSubmit(event: React.FormEvent) { - event.preventDefault(); - setLoading(true); - const { url, macaroon, name } = formData; - const account = { - name: name || "LND", - config: { - macaroon, - url, - }, - connector: getConnectorType(), - }; - - try { - let validation; - // TODO: for native connectors we currently skip the validation because it is too slow (booting up Tor etc.) - if (account.connector === "nativelnd") { - validation = { valid: true, error: "" }; - } else { - validation = await msg.request("validateAccount", account); - } - - if (validation.valid) { - const addResult = await msg.request("addAccount", account); - if (addResult.accountId) { - await msg.request("selectAccount", { - id: addResult.accountId, - }); - navigate("/test-connection"); - } - } else { - toast.error( - - ); - } - } catch (e) { - console.error(e); - let message = ""; - if (e instanceof Error) { - message += `${e.message}`; - } - toast.error(); - } - setLoading(false); - } - - return ( - - - {formData.url.match(/\.onion/i) && ( -
- { - setHasTorSupport(hasTor); - }} - /> -
- )} -
- ); -} diff --git a/src/app/screens/connectors/ConnectLnc/index.tsx b/src/app/screens/connectors/ConnectLnc/index.tsx index 7e9ada8c1c..79c01ab8d5 100644 --- a/src/app/screens/connectors/ConnectLnc/index.tsx +++ b/src/app/screens/connectors/ConnectLnc/index.tsx @@ -7,7 +7,7 @@ import { useNavigate } from "react-router-dom"; import PasswordViewAdornment from "~/app/components/PasswordViewAdornment"; import toast from "~/app/components/Toast"; import msg from "~/common/lib/msg"; -import logo from "/static/assets/icons/lnd_lnc.png"; +import logo from "/static/assets/icons/lightning_terminal.png"; const initialFormData = Object.freeze({ pairingPhrase: "", diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json index 485bfa5dc8..19c7ed1e4d 100644 --- a/src/i18n/locales/en/translation.json +++ b/src/i18n/locales/en/translation.json @@ -12,9 +12,9 @@ "label": "Let's confirm you typed it correct:" }, "errors": { - "enter_password": "Please enter a password.", - "confirm_password": "Please confirm your password.", - "mismatched_password": "Passwords don't match." + "enter_password": "Please enter a passcode.", + "confirm_password": "Please confirm your passcode.", + "mismatched_password": "Passcodes don't match." } }, "test_connection": { @@ -258,9 +258,7 @@ } }, "btcpay": { - "title": "BTCPay Server" - }, - "btcpay_lnd": { + "title": "BTCPay Server", "page": { "title": "Connect to BTCPay LND", "instructions": "Navigate to your BTCPayServer and log in as an admin. Go to Server Settings > Services > LND REST - See information. Then Click \"See QR Code information\" and copy the QR Code data. Paste it below:" @@ -273,19 +271,6 @@ "connection_failed": "Connection failed. Is the BTCPay connection URL correct and accessible?" } }, - "btcpay_commando": { - "page": { - "title": "Connect to BTCPay CLN", - "instructions": "Navigate to your BTCPayServer and log in as an admin. Go to Server Settings > Services > C- Lightning REST - See information. Then Click \"See QR Code information\" and copy the QR Code data. Paste it below:" - }, - "config": { - "label": "Config data", - "placeholder": "config=https://your-btc-pay.org/lnd-config/212121/lnd.config" - }, - "errors": { - "connection_failed": "Connection failed. Is the BTCPay connection URL correct and accessible?" - } - }, "commando": { "title": "Core Lightning", "page": { diff --git a/static/assets/icons/lnd_lnc.png b/static/assets/icons/lnd_lnc.png deleted file mode 100644 index 6c0ef1da0b4bc71d7ab3cfeb63ad9396baaa1370..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5397 zcmV+w73%7VP)$~2v}89Id$TJtmsLx4Dr8w|A^Q(nfz2HUb6Y;4&wwxoMj_u1>Q*SV5RXE^rN zz4x5`SkG^*z4pEVE!VAQ-LgCoR)iv48Gzmp|Ah1}zQ-^8ov-wrKge@w>)KVHQxkyF zy})j;)?wvBdhF{en{GQ~_?<`RsCEbyae4hu2^CFboj?z1iV)r5R z35_-P}y65m|Lj@D0VoDuKH#7t6G+{ya8(74zXZLp2Lb( z5|THGq#?A1L@hB}@lF{(6v9UJDzc{4%rj_+uM5qUI^=PsIh`qF8)JDh)v9rZMOHi9 zB-&L-6Z^G?$s$y5)t69S)rg<^GPz2nc28DUX;@`WDlBD3^cGDlbyDXQnnbmZqKa3? zsDUtdNbS;~rW5nEWX6g`LPjOP;F%632OHAoln}<0#r_3tQe0U?|L9}CQom7mH=i}% zf%8|v1!9em`oG+i_tY18Y}Ou`+VY%PS=uMwEvYuQ0Ehfd&y$BIrlr3Ul}xxKrMEUu z$go7c4JE|^R4D9I;9j9%0IIB^l4}s7BKD7Dz?3!0G8b)1SO<|=Y9yILiYKgWiL`2P z$#sdpYg~Yg8?7Kc1S~>xw~{f8vLTbRKzGTVWMoM0DpJWBC)JiRWm*ta6|I{I)Fqou zhzz~SqcWM5YI`0(b?iE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