Skip to content

Commit 72bcd38

Browse files
Cleanups
1 parent d27dee6 commit 72bcd38

File tree

2 files changed

+29
-36
lines changed

2 files changed

+29
-36
lines changed

src/index.html

+15-15
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
<html>
33
<head>
44
<meta charset="UTF-8" />
5-
<title>Hello World!</title>
6-
5+
<title>PeerViewer 1.0.0</title>
76
</head>
87
<body>
9-
<h1>💖 Hello World!</h1>
10-
<p>Welcome to your Electron application.</p>
11-
<button onclick="runShellCommand()">Run Shell Command</button>
12-
<script>
13-
const { ipcRenderer } = require('electron');
14-
//const { ipcRenderer } = window.require('electron');
15-
16-
function runShellCommand() {
17-
ipcRenderer.send('run-command', 'zenity --info --text blaaa');
18-
console.log("done");
19-
}
20-
</script>
21-
8+
<h1>PeerViewer</h1>
9+
<p>The peer-to-peer, completely free alternative to TeamViewer.</p>
10+
<button onclick="runServer()">Run Server</button>
11+
<script>
12+
const { ipcRenderer } = require('electron');
13+
function runServer() {
14+
ipcRenderer.send('run-server');
15+
console.log("run-server done");
16+
}
17+
// Listen for the response from the main process
18+
ipcRenderer.on('node-code-result', (event, result) => {
19+
console.log("got result:" + result);
20+
});
21+
</script>
2222
</body>
2323
</html>

src/main.js

+14-21
Original file line numberDiff line numberDiff line change
@@ -50,30 +50,23 @@ app.on('activate', () => {
5050
}
5151
});
5252

53-
// In this file you can include the rest of your app's specific main process
54-
// code. You can also put them in separate files and import them here.
55-
5653
// Listen for the 'run-node-code' message from the renderer process
57-
ipcMain.on('run-command', (event) => {
58-
const { exec } = require('child_process');
54+
ipcMain.on('run-server', (event) => {
55+
const { exec } = require('child_process');
5956

60-
exec('zenity --info --text bla', (error, stdout, stderr) => {
61-
if (error) {
62-
console.error(`error: ${error.message}`);
63-
return;
64-
}
57+
exec('x0tigervncserver -PasswordFile tigervnc/passwd', (error, stdout, stderr) => {
58+
if (error) {
59+
console.error(`error: ${error.message}`);
60+
return;
61+
}
6562

66-
if (stderr) {
67-
console.error(`stderr: ${stderr}`);
68-
return;
69-
}
63+
if (stderr) {
64+
console.error(`stderr: ${stderr}`);
65+
return;
66+
}
7067

71-
console.log(`stdout:\n${stdout}`);
72-
});
68+
console.log(`stdout:\n${stdout}`);
69+
});
7370

74-
// Execute your Node.js code here
75-
const result = 'Node.js code executed successfully!';
76-
77-
// Send a response back to the renderer process
78-
event.reply('node-code-result', result);
71+
event.reply('node-code-result', 'run-server result');
7972
});

0 commit comments

Comments
 (0)