manu-sapiens commited on
Commit
6a0c182
·
1 Parent(s): c1dc99b

refreshing the windows when omnitool has started

Browse files
Files changed (1) hide show
  1. myNodeServer.js +13 -3
myNodeServer.js CHANGED
@@ -74,6 +74,13 @@ async function startOmnitoolServer()
74
  {
75
  omnitoolLogs.push(data.toString());
76
  console.log(`omnitool stdout: ${data}`);
 
 
 
 
 
 
 
77
  });
78
 
79
  omnitoolStartProcess.stderr.on('data', (data) =>
@@ -243,6 +250,9 @@ function getButtonsString(buttonsHTML, gotoUrl)
243
  logContainer.innerText = data.logs.join("\\n");
244
  if (data.ready) {
245
  clearInterval(interval);
 
 
 
246
  }
247
  else {
248
  scrollToBottom(logContainer);
@@ -267,13 +277,14 @@ async function handleGetRoot(req, res)
267
  console.log(`req.session.isVisited = ${req.session.isVisited}`);
268
  console.log(`global.OMNITOOL_RUNNING = ${global.OMNITOOL_RUNNING}`);
269
 
270
- if (!req.session.isVisited)
271
  {
272
  await checkOmnitoolStatus();
273
  }
274
 
275
  if (!global.OMNITOOL_RUNNING)
276
  {
 
277
  let startButtonClass = 'highlight-button';
278
  let buttonsHTML = `<button id="startServerButton" class="${startButtonClass}" onclick="startServer()">Start Omnitool Server</button>`;
279
  const html = getButtonsString(buttonsHTML, global.LOCAL_URL);
@@ -285,8 +296,7 @@ async function handleGetRoot(req, res)
285
 
286
  if (!req.session.isVisited)
287
  {
288
- console.log(`-----> global.LOCAL_URL = ${global.LOCAL_URL}`);
289
-
290
  const gotoButtonClass = 'highlight-button';
291
  const buttonsHTML = `<button id="exitIframeButton" class="${gotoButtonClass}" onclick="exitIframe()">GOTO OMNITOOL</button>`;
292
  const html = getButtonsString(buttonsHTML, global.LOCAL_URL);
 
74
  {
75
  omnitoolLogs.push(data.toString());
76
  console.log(`omnitool stdout: ${data}`);
77
+
78
+ if (data.toString().includes(`Server has started and is ready to accept connections`))
79
+ {
80
+ console.log('Omnitool server started successfully');
81
+ setOmnitoolRunning(true);
82
+ }
83
+
84
  });
85
 
86
  omnitoolStartProcess.stderr.on('data', (data) =>
 
250
  logContainer.innerText = data.logs.join("\\n");
251
  if (data.ready) {
252
  clearInterval(interval);
253
+ setTimeout(function() {
254
+ window.location.reload(1);
255
+ }, 5000);
256
  }
257
  else {
258
  scrollToBottom(logContainer);
 
277
  console.log(`req.session.isVisited = ${req.session.isVisited}`);
278
  console.log(`global.OMNITOOL_RUNNING = ${global.OMNITOOL_RUNNING}`);
279
 
280
+ if (!req.session.isVisited || !global.OMNITOOL_RUNNING)
281
  {
282
  await checkOmnitoolStatus();
283
  }
284
 
285
  if (!global.OMNITOOL_RUNNING)
286
  {
287
+ console.log('Omnitool server is not running')
288
  let startButtonClass = 'highlight-button';
289
  let buttonsHTML = `<button id="startServerButton" class="${startButtonClass}" onclick="startServer()">Start Omnitool Server</button>`;
290
  const html = getButtonsString(buttonsHTML, global.LOCAL_URL);
 
296
 
297
  if (!req.session.isVisited)
298
  {
299
+ console.log('First time visitor')
 
300
  const gotoButtonClass = 'highlight-button';
301
  const buttonsHTML = `<button id="exitIframeButton" class="${gotoButtonClass}" onclick="exitIframe()">GOTO OMNITOOL</button>`;
302
  const html = getButtonsString(buttonsHTML, global.LOCAL_URL);