diff --git a/apps/machine/src/views/SupportView.vue b/apps/machine/src/views/SupportView.vue index adec484..93803e5 100644 --- a/apps/machine/src/views/SupportView.vue +++ b/apps/machine/src/views/SupportView.vue @@ -22,13 +22,27 @@ import { QrCode, ExternalLink } from 'lucide-vue-next' const router = useRouter() const isElectron = typeof window !== 'undefined' && window.electronAPI !== undefined +// Lightning.Pub config loaded at runtime from Electron main process +const lpPubkey = ref('') +const relayUrl = ref('') + +onMounted(async () => { + if (isElectron && window.electronAPI) { + const config = await window.electronAPI.getConfig() + lpPubkey.value = config.lightningPubPubkey || '' + relayUrl.value = config.relayUrl || '' + } else { + // Dev fallback: use Vite env vars + lpPubkey.value = import.meta.env.VITE_LIGHTNING_PUB_PUBKEY || '' + relayUrl.value = import.meta.env.VITE_RELAY_URL || '' + } +}) + // Build nprofile for Lightning.Pub (pubkey + relay hint) const lpNprofile = computed(() => { - const pubkey = import.meta.env.VITE_LIGHTNING_PUB_PUBKEY - if (!pubkey) return '' - const relayUrl = import.meta.env.VITE_RELAY_URL - const relays = relayUrl ? [relayUrl.replace('ws://', 'wss://')] : [] - return nip19.nprofileEncode({ pubkey, relays }) + if (!lpPubkey.value) return '' + const relays = relayUrl.value ? [relayUrl.value.replace('ws://', 'wss://')] : [] + return nip19.nprofileEncode({ pubkey: lpPubkey.value, relays }) }) // Deep link URL: opens ShockWallet with this ATM's Lightning.Pub pre-filled