@@ -128,8 +128,8 @@ function findResourceFile(filename) {
128
128
129
129
ipcMain . on ( 'run-server' , ( event ) => {
130
130
// Make sure this OS is supported
131
- if ( process . platform !== 'linux' && process . platform !== 'win32' ) {
132
- let error = 'Unsupported platform ' + process . platform + '. Only linux and win32 are supported, darwin (MacOS) not yet. Please reach out!' ;
131
+ if ( process . platform !== 'linux' && process . platform !== 'win32' && process . platform != 'darwin' ) {
132
+ let error = 'Unsupported platform ' + process . platform + '. Only Linux, Windows and MacOS are supported, yours not yet. Please reach out!' ;
133
133
console . log ( error ) ;
134
134
event . reply ( error ) ;
135
135
return - 1 ;
@@ -153,6 +153,8 @@ ipcMain.on('run-server', (event) => {
153
153
serverChild = runProcess ( foundBinary , [ 'SecurityTypes=VncAuth' , 'localhost=1' , 'interface=127.0.0.1' , 'rfbport=55900' , 'PasswordFile=' + dirname + nodePath . sep + 'plain.bin' ] ) ;
154
154
} else if ( process . platform === 'win32' ) {
155
155
serverChild = findAndRunProcess ( 'uvnc-windows\\x64\\winvnc.exe' ) ; // uses the config file next to the binary
156
+ } else if ( process . platform === 'darwin' ) {
157
+ serverChild = findAndRunProcess ( 'macVNC.app/Contents/MacOS/macVNC' , [ '-rfbport' , '55900' , '-passwd' , 'nopassword' ] ) ;
156
158
}
157
159
if ( ! serverChild ) {
158
160
event . reply ( 'run-server-log' , "ERROR: Listening for connections using VNC server failed." ) ;
@@ -165,8 +167,8 @@ ipcMain.on('run-server', (event) => {
165
167
166
168
ipcMain . on ( 'run-client' , ( event , data ) => {
167
169
// Make sure this OS is supported
168
- if ( process . platform !== 'linux' && process . platform !== 'win32' ) {
169
- let error = 'Unsupported platform ' + process . platform + '. Only linux and win32 are supported, darwin (MacOS) not yet. Please reach out!' ;
170
+ if ( process . platform !== 'linux' && process . platform !== 'win32' && process . platform != 'darwin' ) {
171
+ let error = 'Unsupported platform ' + process . platform + '. Only Linux, Windows and MacOS are supported, yours not yet. Please reach out!' ;
170
172
console . log ( error ) ;
171
173
event . reply ( error ) ;
172
174
return - 1 ;
@@ -182,12 +184,23 @@ ipcMain.on('run-client', (event, data) => {
182
184
event . reply ( 'run-client-log' , "Network layer initialized." ) ;
183
185
184
186
event . reply ( 'run-client-log' , "Establishing outgoing connection..." ) ;
185
- if ( process . platform === 'linux' ) {
187
+ if ( process . platform === 'linux' || process . platform === 'darwin' ) {
186
188
let binaryName = 'tigervnc-linux-x86_64/usr/bin/vncviewer' ;
187
- let foundBinary = findResourceFile ( binaryName ) ;
188
- if ( ! foundBinary ) {
189
- console . log ( "Binary " + binaryName + " not found." ) ;
190
- return - 2 ;
189
+ let foundBinary = '' ;
190
+ if ( process . platform === 'linux' ) {
191
+ let binaryName = 'tigervnc-linux-x86_64/usr/bin/vncviewer' ;
192
+ foundBinary = findResourceFile ( binaryName ) ;
193
+ if ( ! foundBinary ) {
194
+ console . log ( "Binary " + binaryName + " not found." ) ;
195
+ return - 2 ;
196
+ }
197
+ } else if ( process . platform === 'darwin' ) {
198
+ let binaryName = 'tigervnc-macos-x86_64/Contents/MacOS/TigerVNC\ Viewer' ;
199
+ foundBinary = findResourceFile ( binaryName ) ;
200
+ if ( ! foundBinary ) {
201
+ console . log ( "Binary " + binaryName + " not found." ) ;
202
+ return - 2 ;
203
+ }
191
204
}
192
205
// PasswordFile of TigerVNC viewer cannot be passed on commandline, so use the file next to the binary.
193
206
let dirname = nodePath . dirname ( foundBinary ) ;
0 commit comments