diff --git a/index.js b/index.js index b96f9f4..66425fb 100644 --- a/index.js +++ b/index.js @@ -1,8 +1,10 @@ -const DEBUG = true; +const DEBUG = false; var isMobile = false; //initiate as false const dbp = (msg) => { - console.log(msg); + if(DEBUG){ + console.log(msg); + } }; const SwalConfig = { @@ -104,7 +106,7 @@ const generateSSH = async (name, id, token) => { authToken: token }; $.post("https://tty.hackers.town/auth/setKey.php", payload, (response) => { - console.log(response); + dbp(response); // debugger; if(response.status){ Swal.fire({ @@ -119,10 +121,10 @@ const generateSSH = async (name, id, token) => { }); } }).fail(() => { - console.log("Failed"); + dbp("Failed"); }); }).catch((err) => { - console.log(err); + dbp(err); }); } @@ -153,7 +155,7 @@ const beginOauth = () => { $.ajax({ url: "https://tty.hackers.town/auth?act=id" }).then((data) => { - console.table(data); + // console.table(data); if(data.id){ var redirect = "https://hackers.town/oauth/authorize?"+ "response_type=code&client_id="+data.id+"&redirect_uri="+ @@ -185,12 +187,18 @@ $(() => { disableNonDesktopElements(); } // Auto Retry + var isRetry = false; if(window.location.pathname.includes("auth")){ var ErrorMsg = document.getElementById("ErrorResult"); dbp(typeof ErrorMsg); if(typeof ErrorMsg !== 'undefined' && ErrorMsg.innerText.includes("Retry")){ dbp("attempt retry"); + isRetry = true; beginOauth(); } } + // Console Welcome + if(!isRetry){ + console.log("%cWelcome Hacker!", "color: #ff0000; font-size: 7em; font-style: italic; font-family: 'Times New Roman', Times, serif;"); + } }); \ No newline at end of file