add env variable for lightning domain leveraging redirect capability
This commit is contained in:
parent
c90def94a7
commit
92176bea83
3 changed files with 14 additions and 5 deletions
|
|
@ -6,6 +6,12 @@ VITE_ADMIN_PUBKEYS=["your-admin-pubkey-here"]
|
|||
VITE_LNBITS_BASE_URL=http://localhost:5000
|
||||
VITE_API_KEY=your-api-key-here
|
||||
|
||||
# Lightning Address Domain (optional)
|
||||
# Override the domain used for Lightning Addresses
|
||||
# If not set, domain will be extracted from VITE_LNBITS_BASE_URL
|
||||
# Example: mydomain.com will show addresses as username@mydomain.com
|
||||
VITE_LIGHTNING_DOMAIN=
|
||||
|
||||
# Push Notifications
|
||||
VITE_VAPID_PUBLIC_KEY=your-vapid-public-key
|
||||
VITE_PUSH_NOTIFICATIONS_ENABLED=true
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ interface NostrConfig {
|
|||
interface ApiConfig {
|
||||
baseUrl: string
|
||||
key: string
|
||||
lightningDomain?: string // Optional override for Lightning Address domain
|
||||
}
|
||||
|
||||
interface PushConfig {
|
||||
|
|
@ -56,7 +57,8 @@ export const config: AppConfig = {
|
|||
},
|
||||
api: {
|
||||
baseUrl: import.meta.env.VITE_LNBITS_BASE_URL || '',
|
||||
key: import.meta.env.VITE_API_KEY || ''
|
||||
key: import.meta.env.VITE_API_KEY || '',
|
||||
lightningDomain: import.meta.env.VITE_LIGHTNING_DOMAIN // Optional override for Lightning Address domain
|
||||
},
|
||||
push: {
|
||||
vapidPublicKey: import.meta.env.VITE_VAPID_PUBLIC_KEY || '',
|
||||
|
|
|
|||
|
|
@ -148,8 +148,8 @@ export default class WalletService extends BaseService {
|
|||
payLink.lnurl = `${baseUrl}/lnurlp/${payLink.id}`
|
||||
|
||||
if (payLink.username) {
|
||||
// Extract domain from base URL
|
||||
const domain = new URL(baseUrl).hostname
|
||||
// Use custom Lightning domain if configured, otherwise extract from base URL
|
||||
const domain = config.api.lightningDomain || new URL(baseUrl).hostname
|
||||
payLink.lnaddress = `${payLink.username}@${domain}`
|
||||
}
|
||||
|
||||
|
|
@ -310,7 +310,8 @@ export default class WalletService extends BaseService {
|
|||
if (response.ok) {
|
||||
const links = await response.json()
|
||||
const baseUrl = config.api.baseUrl
|
||||
const domain = new URL(baseUrl).hostname
|
||||
// Use custom Lightning domain if configured, otherwise extract from base URL
|
||||
const domain = config.api.lightningDomain || new URL(baseUrl).hostname
|
||||
|
||||
// Add LNURL and Lightning Address to each link
|
||||
this._payLinks.value = links.map((link: PayLink) => ({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue