diff --git a/src/app/router/connectorRoutes.tsx b/src/app/router/connectorRoutes.tsx index 98ce63cfa7..af28bac715 100644 --- a/src/app/router/connectorRoutes.tsx +++ b/src/app/router/connectorRoutes.tsx @@ -21,7 +21,7 @@ import ConnectVoltage from "~/app/screens/connectors/ConnectVoltage"; import ConnectCommando from "../screens/connectors/ConnectCommando"; import albyhub from "/static/assets/icons/albyhub.png"; import btcpay from "/static/assets/icons/btcpay.svg"; -import citadel from "/static/assets/icons/citadel.png"; +import citadel from "/static/assets/icons/citadel.svg"; import core_ln from "/static/assets/icons/core_ln.svg"; import eclair from "/static/assets/icons/eclair.jpg"; import galoyBitcoinJungle from "/static/assets/icons/galoy_bitcoin_jungle.png"; @@ -33,6 +33,7 @@ import lnbits from "/static/assets/icons/lnbits.png"; import lnd from "/static/assets/icons/lnd.png"; import lndhubGo from "/static/assets/icons/lndhub_go.png"; import mynode from "/static/assets/icons/mynode.png"; +import nirvati from "/static/assets/icons/nirvati.svg"; import nwc from "/static/assets/icons/nwc.svg"; import raspiblitz from "/static/assets/icons/raspiblitz.png"; import startos from "/static/assets/icons/startos.png"; @@ -204,12 +205,12 @@ function getDistribution(key: string): ConnectorRoute { const distributionMap: { [key: string]: { logo: string; children: Route[] } } = { - citadel: { - logo: citadel, + nirvati: { + logo: nirvati, children: [ - connectorMap["citadel"], + //connectorMap["citadel"], connectorMap["lnc"], - connectorMap["commando"], + //connectorMap["commando"], connectorMap["lnbits"], ], }, @@ -264,7 +265,7 @@ function getConnectorRoutes(): ConnectorRoute[] { getDistribution("startos"), getDistribution("raspiblitz"), getDistribution("mynode"), - getDistribution("citadel"), + getDistribution("nirvati"), connectorMap["btcpay"], connectorMap["voltage"], connectorMap[galoyPaths.blink], diff --git a/src/app/screens/connectors/ConnectCitadel/index.tsx b/src/app/screens/connectors/ConnectCitadel/index.tsx index eb0be4e6e8..136b73b98d 100644 --- a/src/app/screens/connectors/ConnectCitadel/index.tsx +++ b/src/app/screens/connectors/ConnectCitadel/index.tsx @@ -8,49 +8,61 @@ 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/citadel.png"; +import utils from "~/common/lib/utils"; +import logo from "/static/assets/icons/citadel.svg"; + +const initialFormData = { + url: "", + macaroon: "", +}; export default function ConnectCitadel() { const navigate = useNavigate(); const { t } = useTranslation("translation", { keyPrefix: "choose_connector.citadel", }); - const [passwordViewVisible, setPasswordViewVisible] = useState(false); - const [formData, setFormData] = useState({ - password: "", - url: "", - }); + const [formData, setFormData] = useState(initialFormData); const [loading, setLoading] = useState(false); const [hasTorSupport, setHasTorSupport] = useState(false); + const [lndconnectUrlVisible, setLndconnectUrlVisible] = useState(false); - function handleChange(event: React.ChangeEvent) { - setFormData({ - ...formData, - [event.target.name]: event.target.value.trim(), - }); + function handleLndconnectUrl(event: React.ChangeEvent) { + try { + const lndconnectUrl = event.target.value.trim(); + let lndconnect = new URL(lndconnectUrl); + lndconnect.protocol = "http:"; + lndconnect = new URL(lndconnect.toString()); + const url = `https://${lndconnect.host}${lndconnect.pathname}`; + let macaroon = lndconnect.searchParams.get("macaroon") || ""; + macaroon = utils.urlSafeBase64ToHex(macaroon); + // const cert = lndconnect.searchParams.get("cert"); // TODO: handle LND certs with the native connector + setFormData({ + ...formData, + url, + macaroon, + }); + } catch (e) { + console.error("invalid lndconnect string", e); + } } function getConnectorType() { if (formData.url.match(/\.onion/i) && !hasTorSupport) { - return "nativecitadel"; + return "nativelnd"; } - return "citadel"; + // default to LND + return "lnd"; } async function handleSubmit(event: React.FormEvent) { event.preventDefault(); setLoading(true); - const { password, url } = formData; - /** The URL with an http:// in front if the protocol is missing */ - const fullUrl = - url.startsWith("http://") || url.startsWith("https://") - ? url - : `http://${url}`; + const { url, macaroon } = formData; const account = { name: "Citadel", config: { - url: fullUrl, - password, + macaroon, + url, }, connector: getConnectorType(), }; @@ -58,11 +70,12 @@ export default function ConnectCitadel() { try { let validation; // TODO: for native connectors we currently skip the validation because it is too slow (booting up Tor etc.) - if (account.connector === "nativecitadel") { + 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) { @@ -73,7 +86,10 @@ export default function ConnectCitadel() { } } else { toast.error( - + ); } } catch (e) { @@ -101,38 +117,40 @@ export default function ConnectCitadel() { /> } - description={t("page.instructions")} + description={ + ,
]} + /> + } logo={logo} submitLoading={loading} - submitDisabled={formData.password === "" || formData.url === ""} + submitDisabled={formData.url === "" || formData.macaroon === ""} onSubmit={handleSubmit} + // fixMe: fix link when screen is publicly accessible + image="https://cdn.getalby-assets.com/connector-guides/citadel.png" > -
+
{ - setPasswordViewVisible(passwordView); + setLndconnectUrlVisible(passwordView); }} /> } />
- {formData.url.match(/\.onion/i) && (
Citadel", - "instructions": "Aktuálně nefunguje v případě, že máte zapnutou dvoufaktorovou autentizaci (2FA)." + "title": "Připojení k uzlu <0>Citadel" }, "password": { "label": "Heslo k Citadel" diff --git a/src/i18n/locales/da/translation.json b/src/i18n/locales/da/translation.json index ebe7beeb3d..5f7ef29fa1 100644 --- a/src/i18n/locales/da/translation.json +++ b/src/i18n/locales/da/translation.json @@ -125,8 +125,7 @@ }, "citadel": { "page": { - "title": "Opret forbindelse til <0>Citadel node", - "instructions": "Dette virker i øjeblikket ikke, hvis 2FA er slået til." + "title": "Opret forbindelse til <0>Citadel node" }, "password": { "label": "Citadel adgangskode" diff --git a/src/i18n/locales/de/translation.json b/src/i18n/locales/de/translation.json index f52f16fdb5..07ffbd3bb9 100644 --- a/src/i18n/locales/de/translation.json +++ b/src/i18n/locales/de/translation.json @@ -107,7 +107,6 @@ "description": "Verbinden mit deiner externen Lightning Wallet oder Node", "citadel": { "page": { - "instructions": "Das funktioniert aktuell nicht, wenn 2FA ausgewählt ist.", "title": "Verbinden mit <0>Citadel Node" }, "password": { diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json index 06d28000b2..035df0da3c 100644 --- a/src/i18n/locales/en/translation.json +++ b/src/i18n/locales/en/translation.json @@ -149,16 +149,16 @@ "title": "Citadel", "page": { "title": "Connect to <0>Citadel node", - "instructions": "This currently doesn't work if 2FA is enabled." + "instructions": "1. In the Citadel section of your Nirvati dashboard go to <0>Connect wallet<1/>2. Select <0>Alby (Tor) or <0>Alby (Local Network) mode<1/>3. Copy the <0>lndconnect URL and paste it below" }, - "password": { - "label": "Citadel Password" - }, - "url": { - "label": "Citadel URL", - "placeholder": "http://citadel.local" + "rest_url": { + "label": "lndconnect REST URL", + "placeholder": "lndconnect://yournode:8080?..." } }, + "nirvati": { + "title": "Nirvati" + }, "umbrel": { "title": "Umbrel", "page": { @@ -366,8 +366,8 @@ "umbrel": { "name": "Umbrel" }, - "citadel": { - "name": "Citadel" + "nirvati": { + "name": "Nirvati" }, "btcpay": { "name": "BTCPay" diff --git a/src/i18n/locales/eo/translation.json b/src/i18n/locales/eo/translation.json index 31b01dd20f..3dd97b57f1 100644 --- a/src/i18n/locales/eo/translation.json +++ b/src/i18n/locales/eo/translation.json @@ -92,8 +92,7 @@ }, "citadel": { "page": { - "title": "", - "instructions": "" + "title": "" }, "password": { "label": "Citadel-pasvorto" diff --git a/src/i18n/locales/es/translation.json b/src/i18n/locales/es/translation.json index c7db0ec877..2c43be3bc8 100644 --- a/src/i18n/locales/es/translation.json +++ b/src/i18n/locales/es/translation.json @@ -94,8 +94,7 @@ "placeholder": "http://citadel.local" }, "page": { - "title": "Conectar a nodo Citadel", - "instructions": "Esto actualmente no funciona si el 2FA está activado." + "title": "Conectar a nodo Citadel" } }, "umbrel": { diff --git a/src/i18n/locales/fa/translation.json b/src/i18n/locales/fa/translation.json index 2e9839c225..94a8197ec5 100644 --- a/src/i18n/locales/fa/translation.json +++ b/src/i18n/locales/fa/translation.json @@ -142,8 +142,7 @@ }, "citadel": { "page": { - "title": "به گره <0>Citadel متصل شوید", - "instructions": "در حال حاضر در صورت فعال بودن تایید دو مرحله ای، این کار نمی کند." + "title": "به گره <0>Citadel متصل شوید" }, "password": { "label": "گذرواژه Citadel" diff --git a/src/i18n/locales/fi/translation.json b/src/i18n/locales/fi/translation.json index 56d18ace80..6e70e408a1 100644 --- a/src/i18n/locales/fi/translation.json +++ b/src/i18n/locales/fi/translation.json @@ -101,8 +101,7 @@ }, "citadel": { "page": { - "title": "Yhdistä <0>Citadel solmuun", - "instructions": "Tämä ei tällä hetkellä toimi, jos 2FA on käytössä." + "title": "Yhdistä <0>Citadel solmuun" }, "password": { "label": "Citadel-salasana" diff --git a/src/i18n/locales/fr/translation.json b/src/i18n/locales/fr/translation.json index 87b8f0cf02..e4c4de2121 100644 --- a/src/i18n/locales/fr/translation.json +++ b/src/i18n/locales/fr/translation.json @@ -132,8 +132,7 @@ }, "citadel": { "page": { - "title": "Connectez-vous au nœud <0>Citadelle", - "instructions": "Cela ne fonctionne pas actuellement si 2FA est activé." + "title": "Connectez-vous au nœud <0>Citadelle" }, "password": { "label": "Mot de passe Citadelle" diff --git a/src/i18n/locales/hi/translation.json b/src/i18n/locales/hi/translation.json index 980bf8205d..d3702f753e 100644 --- a/src/i18n/locales/hi/translation.json +++ b/src/i18n/locales/hi/translation.json @@ -132,8 +132,7 @@ }, "citadel": { "page": { - "title": "<0>Citadel node से कनेक्ट करें", - "instructions": "यह वर्तमान में काम नहीं करता है अगर 2FA सक्षम है।" + "title": "<0>Citadel node से कनेक्ट करें" }, "password": { "label": "Citadel पासवर्ड" diff --git a/src/i18n/locales/id/translation.json b/src/i18n/locales/id/translation.json index 670425097b..05c3521d95 100644 --- a/src/i18n/locales/id/translation.json +++ b/src/i18n/locales/id/translation.json @@ -132,8 +132,7 @@ }, "citadel": { "page": { - "title": "Sambungkan dengan node <0>Citadel", - "instructions": "Saat ini tidak berfungsi jika 2FA diaktifkan." + "title": "Sambungkan dengan node <0>Citadel" }, "password": { "label": "Kata sandi Citadel" diff --git a/src/i18n/locales/it/translation.json b/src/i18n/locales/it/translation.json index c10a8a205d..596f0a7bc6 100644 --- a/src/i18n/locales/it/translation.json +++ b/src/i18n/locales/it/translation.json @@ -92,8 +92,7 @@ }, "citadel": { "page": { - "title": "Collega un nodo <0>Citadel", - "instructions": "Attualmente non funziona se è abilitata la 2FA." + "title": "Collega un nodo <0>Citadel" }, "password": { "label": "Password Citadel" diff --git a/src/i18n/locales/ja/translation.json b/src/i18n/locales/ja/translation.json index 412543090e..bb359f164b 100644 --- a/src/i18n/locales/ja/translation.json +++ b/src/i18n/locales/ja/translation.json @@ -132,8 +132,7 @@ }, "citadel": { "page": { - "title": "<0>Citadelノードに接続", - "instructions": "現在のところ、2要素認証(2FA)が有効になっている場合は機能しません。" + "title": "<0>Citadelノードに接続" }, "password": { "label": "Citadelのパスワード" diff --git a/src/i18n/locales/mr/translation.json b/src/i18n/locales/mr/translation.json index f75bbf10ec..48076e37ff 100644 --- a/src/i18n/locales/mr/translation.json +++ b/src/i18n/locales/mr/translation.json @@ -125,8 +125,7 @@ }, "citadel": { "page": { - "title": "<0>Citadel node ला कनेक्ट करा", - "instructions": "This currently doesn't work if 2FA is enabled." + "title": "<0>Citadel node ला कनेक्ट करा" }, "password": { "label": "Citadel Password" diff --git a/src/i18n/locales/nl/translation.json b/src/i18n/locales/nl/translation.json index 47582b669f..0d58c0a891 100644 --- a/src/i18n/locales/nl/translation.json +++ b/src/i18n/locales/nl/translation.json @@ -92,8 +92,7 @@ }, "citadel": { "page": { - "title": "Verbinding maken met <0>Citadel node", - "instructions": "Dit werkt momenteel niet als 2FA is ingeschakeld." + "title": "Verbinding maken met <0>Citadel node" }, "password": { "label": "Citadel-wachtwoord" diff --git a/src/i18n/locales/pl/translation.json b/src/i18n/locales/pl/translation.json index 84220de50c..644c52b436 100644 --- a/src/i18n/locales/pl/translation.json +++ b/src/i18n/locales/pl/translation.json @@ -131,8 +131,7 @@ }, "citadel": { "page": { - "title": "Podłącz do węzła <0>Citadel", - "instructions": "Ta funkcja nie działa jeśli 2FA jest włączone." + "title": "Podłącz do węzła <0>Citadel" }, "password": { "label": "Hasło Citadel" diff --git a/src/i18n/locales/pt_BR/translation.json b/src/i18n/locales/pt_BR/translation.json index 6cd1d4e3af..86f8ea6ef6 100644 --- a/src/i18n/locales/pt_BR/translation.json +++ b/src/i18n/locales/pt_BR/translation.json @@ -87,8 +87,7 @@ }, "citadel": { "page": { - "title": "Conecte-se no servidor <0>Citadel", - "instructions": "Não funciona se o 2FA estiver ativado." + "title": "Conecte-se no servidor <0>Citadel" }, "password": { "label": "Senha Citadel" diff --git a/src/i18n/locales/ro/translation.json b/src/i18n/locales/ro/translation.json index 5e1ededd2c..e16b2e4769 100644 --- a/src/i18n/locales/ro/translation.json +++ b/src/i18n/locales/ro/translation.json @@ -125,8 +125,7 @@ }, "citadel": { "page": { - "title": "Conectare la <0>Citadel", - "instructions": "Momentan nu functioneaza daca autentificarea in 2-factori (2FA) este activata." + "title": "Conectare la <0>Citadel" }, "password": { "label": "Parola Citadel" diff --git a/src/i18n/locales/ru/translation.json b/src/i18n/locales/ru/translation.json index a29fe5a1bf..5e59604631 100644 --- a/src/i18n/locales/ru/translation.json +++ b/src/i18n/locales/ru/translation.json @@ -140,8 +140,7 @@ }, "citadel": { "page": { - "title": "", - "instructions": "" + "title": "" }, "password": { "label": "" diff --git a/src/i18n/locales/si/translation.json b/src/i18n/locales/si/translation.json index 5f8313d6f0..f1861acc10 100644 --- a/src/i18n/locales/si/translation.json +++ b/src/i18n/locales/si/translation.json @@ -146,8 +146,7 @@ }, "citadel": { "page": { - "title": "<0>සිටඩෙල්(Citadel) node වෙත සම්බන්ධ කරන්න", - "instructions": "2FA සබල කර ඇත්නම් මෙය දැනට ක්‍රියා නොකරයි." + "title": "<0>සිටඩෙල්(Citadel) node වෙත සම්බන්ධ කරන්න" }, "password": { "label": "සිටඩෙල්(Citadel) මුරපදය" diff --git a/src/i18n/locales/sl/translation.json b/src/i18n/locales/sl/translation.json index 58c989e77e..641ab00a99 100644 --- a/src/i18n/locales/sl/translation.json +++ b/src/i18n/locales/sl/translation.json @@ -169,8 +169,7 @@ }, "citadel": { "page": { - "title": "Poveži <0>Citadel vozlišče", - "instructions": "Tole trenutno ne deluje, če je vklopljen 2FA." + "title": "Poveži <0>Citadel vozlišče" }, "url": { "placeholder": "http://citadel.local", diff --git a/src/i18n/locales/sv/translation.json b/src/i18n/locales/sv/translation.json index 4ed4124ba0..34d383e5b0 100644 --- a/src/i18n/locales/sv/translation.json +++ b/src/i18n/locales/sv/translation.json @@ -98,8 +98,7 @@ }, "citadel": { "page": { - "title": "Anslut <0>Citadel-nod", - "instructions": "Detta fungerar för tillfället inte om 2FA är aktiverat." + "title": "Anslut <0>Citadel-nod" }, "password": { "label": "Citadel lösenord" diff --git a/src/i18n/locales/th/translation.json b/src/i18n/locales/th/translation.json index f47ac8df60..368a6d4749 100644 --- a/src/i18n/locales/th/translation.json +++ b/src/i18n/locales/th/translation.json @@ -421,8 +421,7 @@ }, "citadel": { "page": { - "title": "เชื่อมต่อกับ<0>Citaddel node", - "instructions": "ไม่ทำงานในปัจจุบันหากเปิดใช้งาน 2FA" + "title": "เชื่อมต่อกับ<0>Citaddel node" }, "password": { "label": "รหัสผ่าน Citadel" diff --git a/src/i18n/locales/tl/translation.json b/src/i18n/locales/tl/translation.json index 35967a4c67..d0e4059bb4 100644 --- a/src/i18n/locales/tl/translation.json +++ b/src/i18n/locales/tl/translation.json @@ -92,8 +92,7 @@ }, "citadel": { "page": { - "title": "", - "instructions": "" + "title": "" }, "password": { "label": "" diff --git a/src/i18n/locales/uk/translation.json b/src/i18n/locales/uk/translation.json index 9b450dc873..f754e0ba86 100644 --- a/src/i18n/locales/uk/translation.json +++ b/src/i18n/locales/uk/translation.json @@ -125,8 +125,7 @@ }, "citadel": { "page": { - "title": "", - "instructions": "" + "title": "" }, "password": { "label": "" diff --git a/src/i18n/locales/zh_Hans/translation.json b/src/i18n/locales/zh_Hans/translation.json index 91c7b6c7bd..0233e42058 100644 --- a/src/i18n/locales/zh_Hans/translation.json +++ b/src/i18n/locales/zh_Hans/translation.json @@ -69,8 +69,7 @@ }, "citadel": { "page": { - "title": "连接<0>Citadel节点", - "instructions": "目前,如果启用了2FA,这就用不了了。" + "title": "连接<0>Citadel节点" }, "password": { "label": "Citadel密码" diff --git a/src/i18n/locales/zh_Hant/translation.json b/src/i18n/locales/zh_Hant/translation.json index b9958f44c7..6279c4b35f 100644 --- a/src/i18n/locales/zh_Hant/translation.json +++ b/src/i18n/locales/zh_Hant/translation.json @@ -131,8 +131,7 @@ }, "citadel": { "page": { - "title": "連接 <0>Citadel 節點", - "instructions": "如果啟用了 2FA,這目前不可用。" + "title": "連接 <0>Citadel 節點" }, "password": { "label": "Citadel 密碼" diff --git a/static/assets/icons/citadel.png b/static/assets/icons/citadel.png deleted file mode 100644 index 4768953a69..0000000000 Binary files a/static/assets/icons/citadel.png and /dev/null differ diff --git a/static/assets/icons/citadel.svg b/static/assets/icons/citadel.svg new file mode 100644 index 0000000000..53b43ebe58 --- /dev/null +++ b/static/assets/icons/citadel.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/static/assets/icons/nirvati.svg b/static/assets/icons/nirvati.svg new file mode 100644 index 0000000000..c7a6d61580 --- /dev/null +++ b/static/assets/icons/nirvati.svg @@ -0,0 +1 @@ +