|
|
@ -151,6 +151,10 @@ app.setAsDefaultProtocolClient('lightning') |
|
|
|
app.on('open-url', function (event, url) { |
|
|
|
event.preventDefault() |
|
|
|
|
|
|
|
if (!mainWindow) { |
|
|
|
throw new Error('"mainWindow" is not defined') |
|
|
|
} |
|
|
|
|
|
|
|
const payreq = url.split(':')[1] |
|
|
|
mainWindow.webContents.send('lightningPaymentUri', { payreq }) |
|
|
|
mainWindow.show() |
|
|
@ -196,7 +200,7 @@ export const startLnd = () => { |
|
|
|
} |
|
|
|
|
|
|
|
// Pass current clock height progress to front end for loading state UX
|
|
|
|
if (line.includes('Caught up to height') || line.includes('Catching up block hashes to height')) { |
|
|
|
if (mainWindow && (line.includes('Caught up to height') || line.includes('Catching up block hashes to height'))) { |
|
|
|
// const blockHeight = line.slice(line.indexOf('Caught up to height') + 'Caught up to height'.length).trim()
|
|
|
|
const blockHeight = line.slice(line.indexOf('Caught up to height') + 'Caught up to height'.length).trim() |
|
|
|
mainWindow.webContents.send('lndStdout', line) |
|
|
@ -234,10 +238,12 @@ const sendLndSyncing = () => { |
|
|
|
if (didFinishLoad) { |
|
|
|
clearInterval(sendLndSyncingInterval) |
|
|
|
|
|
|
|
if (mainWindow) { |
|
|
|
console.log('SENDING SYNCING') |
|
|
|
startedSync = true |
|
|
|
mainWindow.webContents.send('lndSyncing') |
|
|
|
} |
|
|
|
} |
|
|
|
}, 1000) |
|
|
|
} |
|
|
|
|
|
|
@ -247,9 +253,11 @@ const sendLndSynced = () => { |
|
|
|
if (didFinishLoad && startedSync) { |
|
|
|
clearInterval(sendLndSyncedInterval) |
|
|
|
|
|
|
|
if (mainWindow) { |
|
|
|
console.log('SENDING SYNCED') |
|
|
|
mainWindow.webContents.send('lndSynced') |
|
|
|
} |
|
|
|
} |
|
|
|
}, 1000) |
|
|
|
} |
|
|
|
|
|
|
@ -259,9 +267,11 @@ const sendGrpcDisconnected = () => { |
|
|
|
if (didFinishLoad) { |
|
|
|
clearInterval(sendGrpcDisonnectedInterval) |
|
|
|
|
|
|
|
if (mainWindow) { |
|
|
|
sentGrpcDisconnect = true |
|
|
|
mainWindow.webContents.send('grpcDisconnected') |
|
|
|
} |
|
|
|
} |
|
|
|
}, 1000) |
|
|
|
} |
|
|
|
|
|
|
@ -271,7 +281,9 @@ const sendGrpcConnected = () => { |
|
|
|
if (didFinishLoad && sentGrpcDisconnect) { |
|
|
|
clearInterval(sendGrpcConnectedInterval) |
|
|
|
|
|
|
|
if (mainWindow) { |
|
|
|
mainWindow.webContents.send('grpcConnected') |
|
|
|
} |
|
|
|
} |
|
|
|
}, 1000) |
|
|
|
} |
|
|
|