diff --git a/alby/models.go b/alby/models.go index b73a840c..c773e7d7 100644 --- a/alby/models.go +++ b/alby/models.go @@ -34,15 +34,19 @@ type AlbyLinkAccountRequest struct { Renewal string `json:"renewal"` } +type AlbyMeHub struct { + LatestVersion string `json:"latest_version"` +} type AlbyMe struct { - Identifier string `json:"identifier"` - NPub string `json:"nostr_pubkey"` - LightningAddress string `json:"lightning_address"` - Email string `json:"email"` - Name string `json:"name"` - Avatar string `json:"avatar"` - KeysendPubkey string `json:"keysend_pubkey"` - SharedNode bool `json:"shared_node"` + Identifier string `json:"identifier"` + NPub string `json:"nostr_pubkey"` + LightningAddress string `json:"lightning_address"` + Email string `json:"email"` + Name string `json:"name"` + Avatar string `json:"avatar"` + KeysendPubkey string `json:"keysend_pubkey"` + SharedNode bool `json:"shared_node"` + Hub AlbyMeHub `json:"hub"` } type AlbyBalance struct { diff --git a/api/api.go b/api/api.go index 51b2a789..38443aa1 100644 --- a/api/api.go +++ b/api/api.go @@ -580,7 +580,6 @@ func (api *api) GetInfo(ctx context.Context) (*InfoResponse, error) { info.AlbyAuthUrl = api.albyOAuthSvc.GetAuthUrl() info.OAuthRedirect = !api.cfg.GetEnv().IsDefaultClientId() info.Version = version.Tag - info.LatestVersion = version.GetLatestReleaseTag() albyUserIdentifier, err := api.albyOAuthSvc.GetUserIdentifier() if err != nil { logger.Logger.WithError(err).Error("Failed to get alby user identifier") diff --git a/api/models.go b/api/models.go index f922f9f6..baa5be0d 100644 --- a/api/models.go +++ b/api/models.go @@ -154,7 +154,6 @@ type InfoResponse struct { AlbyUserIdentifier string `json:"albyUserIdentifier"` AlbyAccountConnected bool `json:"albyAccountConnected"` Version string `json:"version"` - LatestVersion string `json:"latestVersion"` Network string `json:"network"` } diff --git a/frontend/src/assets/suggested-apps/bitcoin-connect.png b/frontend/src/assets/suggested-apps/bitcoin-connect.png deleted file mode 100644 index 81859503..00000000 Binary files a/frontend/src/assets/suggested-apps/bitcoin-connect.png and /dev/null differ diff --git a/frontend/src/components/SidebarHint.tsx b/frontend/src/components/SidebarHint.tsx index 67bf68f7..3aa1a1c4 100644 --- a/frontend/src/components/SidebarHint.tsx +++ b/frontend/src/components/SidebarHint.tsx @@ -49,6 +49,7 @@ function SidebarHint() { // User has funds to migrate if ( hasChannelManagement && + info?.backendType === "LDK" && albyBalance && albyBalance.sats * (1 - ALBY_SERVICE_FEE) > ALBY_MIN_BALANCE + 50000 /* accomodate for onchain fees */ diff --git a/frontend/src/components/SuggestedAppData.tsx b/frontend/src/components/SuggestedAppData.tsx index 7fb22672..159c1c93 100644 --- a/frontend/src/components/SuggestedAppData.tsx +++ b/frontend/src/components/SuggestedAppData.tsx @@ -1,6 +1,5 @@ import alby from "src/assets/suggested-apps/alby.png"; import amethyst from "src/assets/suggested-apps/amethyst.png"; -import bc from "src/assets/suggested-apps/bitcoin-connect.png"; import damus from "src/assets/suggested-apps/damus.png"; import hablanews from "src/assets/suggested-apps/habla-news.png"; import kiwi from "src/assets/suggested-apps/kiwi.png"; @@ -126,13 +125,6 @@ export const suggestedApps: SuggestedApp[] = [ webLink: "https://lume.nu/", logo: lume, }, - { - id: "bitcoin-connect", - title: "Bitcoin Connect", - description: "Connect to apps", - webLink: "https://bitcoin-connect.com/", - logo: bc, - }, { id: "kiwi", title: "Kiwi", diff --git a/frontend/src/components/layouts/AppLayout.tsx b/frontend/src/components/layouts/AppLayout.tsx index 96eb9eac..bde01f65 100644 --- a/frontend/src/components/layouts/AppLayout.tsx +++ b/frontend/src/components/layouts/AppLayout.tsx @@ -185,10 +185,9 @@ export default function AppLayout() { const upToDate = info?.version && - info.latestVersion && + albyMe?.hub.latest_version && info.version.startsWith("v") && - info.latestVersion.startsWith("v") && - info.version.substring(1) >= info.latestVersion.substring(1); + info.version.substring(1) >= albyMe?.hub.latest_version; return ( <> @@ -224,7 +223,9 @@ export default function AppLayout() { {upToDate ? (

Alby Hub is up to date!

) : ( -

Alby Hub {info?.latestVersion} available!

+

+ Alby Hub {albyMe?.hub.latest_version} available! +

)} diff --git a/frontend/src/components/ui/theme-provider.tsx b/frontend/src/components/ui/theme-provider.tsx index bb897bf9..d9be4651 100644 --- a/frontend/src/components/ui/theme-provider.tsx +++ b/frontend/src/components/ui/theme-provider.tsx @@ -35,7 +35,8 @@ export function ThemeProvider({ ...props }: ThemeProviderProps) { const [theme, setTheme] = useState(() => { - return (localStorage.getItem(storageKey) as Theme) || defaultTheme; + const themeFromStorage = localStorage.getItem(storageKey) as Theme; + return Themes.includes(themeFromStorage) ? themeFromStorage : defaultTheme; }); const [darkMode, setDarkMode] = useState(() => { diff --git a/frontend/src/lib/clipboard.ts b/frontend/src/lib/clipboard.ts index a35baa50..b7f16bdb 100644 --- a/frontend/src/lib/clipboard.ts +++ b/frontend/src/lib/clipboard.ts @@ -11,12 +11,15 @@ export async function copyToClipboard(content: string) { textArea.style.position = "absolute"; textArea.style.opacity = "0"; document.body.appendChild(textArea); - selectElement(textArea); + textArea.focus(); + textArea.select(); + if (document.execCommand("copy")) { resolve(content); } else { reject(); } + textArea.remove(); } }); @@ -31,13 +34,3 @@ export async function copyToClipboard(content: string) { }); } } - -function selectElement(element: Element) { - const selection = window.getSelection(); - if (selection) { - selection.removeAllRanges(); - const range = document.createRange(); - range.selectNode(element); - selection.addRange(range); - } -} diff --git a/frontend/src/screens/apps/AppCreated.tsx b/frontend/src/screens/apps/AppCreated.tsx index 44bd88eb..e03e494d 100644 --- a/frontend/src/screens/apps/AppCreated.tsx +++ b/frontend/src/screens/apps/AppCreated.tsx @@ -27,7 +27,6 @@ export default function AppCreated() { const queryParams = new URLSearchParams(search); const appId = queryParams.get("app") ?? ""; const appstoreApp = suggestedApps.find((app) => app.id === appId); - console.info(appstoreApp, appId); const [timeout, setTimeout] = useState(false); const [isQRCodeVisible, setIsQRCodeVisible] = useState(false); diff --git a/frontend/src/screens/channels/Channels.tsx b/frontend/src/screens/channels/Channels.tsx index 8f4c3f03..1356a7a7 100644 --- a/frontend/src/screens/channels/Channels.tsx +++ b/frontend/src/screens/channels/Channels.tsx @@ -363,9 +363,9 @@ export default function Channels() { - {/* + - */} + diff --git a/frontend/src/screens/channels/CurrentChannelOrder.tsx b/frontend/src/screens/channels/CurrentChannelOrder.tsx index 47149a5e..a18f5ce2 100644 --- a/frontend/src/screens/channels/CurrentChannelOrder.tsx +++ b/frontend/src/screens/channels/CurrentChannelOrder.tsx @@ -356,6 +356,11 @@ function PayBitcoinChannelOrderTopup({ order }: { order: NewChannelOrder }) { Topup with your credit card or bank account + + + ); diff --git a/frontend/src/screens/channels/IncreaseOutgoingCapacity.tsx b/frontend/src/screens/channels/IncreaseOutgoingCapacity.tsx index 5e578b8e..242f478b 100644 --- a/frontend/src/screens/channels/IncreaseOutgoingCapacity.tsx +++ b/frontend/src/screens/channels/IncreaseOutgoingCapacity.tsx @@ -1,4 +1,4 @@ -import { Box, ChevronDown, Zap } from "lucide-react"; +import { ChevronDown } from "lucide-react"; import React, { FormEvent } from "react"; import { Link, useNavigate } from "react-router-dom"; import AppHeader from "src/components/AppHeader"; @@ -78,21 +78,13 @@ function NewChannelInternal({ network }: { network: Network }) { return _channelPeerSuggestions ? [ ..._channelPeerSuggestions.filter( - (peer) => - peer.paymentMethod !== "lightning" || peer.lspType !== "LSPS1" + (peer) => peer.paymentMethod !== "lightning" ), customOption, ] : undefined; }, [_channelPeerSuggestions, network]); - function setPaymentMethod(paymentMethod: "onchain" | "lightning") { - setOrder((current) => ({ - ...current, - paymentMethod, - })); - } - function setPublic(isPublic: boolean) { setOrder((current) => ({ ...current, @@ -131,21 +123,9 @@ function NewChannelInternal({ network }: { network: Network }) { host: selectedPeer.host, })); } - if ( - selectedPeer.paymentMethod === "lightning" && - order.paymentMethod === "lightning" - ) { - setOrder((current) => ({ - ...current, - lspType: selectedPeer.lspType, - lspUrl: selectedPeer.lspUrl, - })); - } } }, [order.paymentMethod, selectedPeer]); - const selectedCardStyles = "border-primary border-2 font-medium"; - const [showAdvanced, setShowAdvanced] = React.useState(false); function onSubmit(e: FormEvent) { @@ -219,6 +199,15 @@ function NewChannelInternal({ network }: { network: Network }) { + + + + + } />
{showAdvanced && ( <> -
- -
- setPaymentMethod("onchain")} - className="flex-1" - > -
- - Onchain -
- - setPaymentMethod("lightning")}> -
- - Lightning -
- -
-
{selectedPeer && - (selectedPeer.paymentMethod === "lightning" || - (order.paymentMethod === "onchain" && - selectedPeer.pubkey === order.pubkey)) && ( + order.paymentMethod === "onchain" && + selectedPeer.pubkey === order.pubkey && (