mirror of
https://github.com/PR0M3TH3AN/VoxVera.git
synced 2025-09-09 15:38:43 +00:00
gui: show onion address
This commit is contained in:
@@ -3,15 +3,17 @@ const { spawn } = require('child_process');
|
||||
const path = require('path');
|
||||
const which = require('which');
|
||||
|
||||
let mainWindow;
|
||||
|
||||
function createWindow() {
|
||||
const win = new BrowserWindow({
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, 'preload.js')
|
||||
}
|
||||
});
|
||||
win.loadFile('index.html');
|
||||
mainWindow.loadFile('index.html');
|
||||
}
|
||||
|
||||
app.whenReady().then(createWindow);
|
||||
@@ -26,7 +28,18 @@ ipcMain.handle('run-quickstart', async () => {
|
||||
return -1;
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
const proc = spawn(voxveraPath, ['quickstart'], { stdio: 'inherit' });
|
||||
const proc = spawn(voxveraPath, ['quickstart']);
|
||||
proc.stdout.on('data', data => {
|
||||
const line = data.toString();
|
||||
process.stdout.write(line);
|
||||
const m = line.match(/Onion URL:\s*(https?:\/\/[a-z0-9.-]+\.onion)/i);
|
||||
if (m && mainWindow) {
|
||||
mainWindow.webContents.send('onion-url', m[1]);
|
||||
}
|
||||
});
|
||||
proc.stderr.on('data', data => {
|
||||
process.stderr.write(data);
|
||||
});
|
||||
proc.on('close', code => resolve(code));
|
||||
proc.on('error', err => reject(err));
|
||||
});
|
||||
|
Reference in New Issue
Block a user