From 5ffcdcaf85da04b5d0850f221375c3ab3d99950f Mon Sep 17 00:00:00 2001 From: MrFry Date: Wed, 8 Apr 2020 17:46:33 +0200 Subject: [PATCH] Redirect to get veteran client id if user has client ID --- stable.user.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/stable.user.js b/stable.user.js index 780b8dc..4dbe908 100755 --- a/stable.user.js +++ b/stable.user.js @@ -63,7 +63,7 @@ const serverAdress = 'https://qmining.frylabs.net/' // const serverAdress = 'http://localhost:8080/' // const apiAdress = 'https://api.frylabs.net/' - const apiAdress = 'http://localhost:8080/' + const apiAdress = 'http://localhost:80/' const ircAddress = 'https://kiwiirc.com/nextclient/irc.sub.fm/#qmining' // forcing pages for testing. unless you test, do not set these to true! @@ -661,7 +661,11 @@ // : Loading {{{ function HandleQminingSite (url) { try { - Array.from(document.getElementById('sideBarLinks').childNodes).forEach((link) => { + const sideLinks = document.getElementById('sideBarLinks') + if (!sideLinks) { + return + } + Array.from(sideLinks.childNodes).forEach((link) => { link.addEventListener('mousedown', () => { FillFeedbackCID(url, link) }) @@ -1549,6 +1553,8 @@ loginButton.innerText = 'Login' const loginInput = document.createElement('input') loginInput.type = 'text' + loginInput.style.textAlign = 'center' + loginInput.value = getVal('clientId') || '' loginDiv.appendChild(loginInput) loginDiv.appendChild(loginButton) @@ -1556,7 +1562,14 @@ SetStyle(loginButton, buttonStyle) loginButton.addEventListener('click', function () { - Auth(loginInput.value) + if (loginInput.value === getVal('clientId').toString()) { + console.log('opening veteran pw page ...') + openInTab(serverAdress + 'getVeteranPw?cid=' + getVal('clientId'), { + active: true + }) + } else { + Auth(loginInput.value) + } }) ibuttonCell.appendChild(loginDiv)