From e655dce59400604a9ab1c370a235d0412bd62c0e Mon Sep 17 00:00:00 2001 From: Tiago Santos Date: Mon, 10 Oct 2022 11:24:07 -0300 Subject: [PATCH 1/4] Update unity.js I'm using Unity 2022.1.19f1 and in it the message that the certificate was activated changed to this new phrase --- src/unity.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/unity.js b/src/unity.js index 0248b31..fac5cb9 100644 --- a/src/unity.js +++ b/src/unity.js @@ -19,7 +19,7 @@ async function createManualActivationFile(unityPath) { async function activateManualLicense(unityPath, licenseData) { fs.writeFileSync('license.ulf', licenseData); const stdout = await executeUnity(unityPath, `-batchmode -nographics -quit -logFile "-" -manualLicenseFile license.ulf`); - if (!stdout.includes('Next license update check is after')) { + if (!stdout.includes('Next license update check is after') || !stdout.includes('Successfully processed offline license activation request')) { throw new Error('Activation failed'); } } @@ -43,4 +43,4 @@ async function execute(command, ignoreReturnCode) { listeners: { stdout: buffer => stdout += buffer.toString() } }); return stdout; -} \ No newline at end of file +} From 04fb16ba45c45bf01376c9f3449c0ab4eb1372d1 Mon Sep 17 00:00:00 2001 From: Tiago Santos Date: Mon, 10 Oct 2022 11:54:54 -0300 Subject: [PATCH 2/4] Update unity.js changing or to and --- src/unity.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unity.js b/src/unity.js index fac5cb9..02eb34a 100644 --- a/src/unity.js +++ b/src/unity.js @@ -19,7 +19,7 @@ async function createManualActivationFile(unityPath) { async function activateManualLicense(unityPath, licenseData) { fs.writeFileSync('license.ulf', licenseData); const stdout = await executeUnity(unityPath, `-batchmode -nographics -quit -logFile "-" -manualLicenseFile license.ulf`); - if (!stdout.includes('Next license update check is after') || !stdout.includes('Successfully processed offline license activation request')) { + if (!stdout.includes('Next license update check is after') && !stdout.includes('Successfully processed offline license activation request')) { throw new Error('Activation failed'); } } From 7596e475ebf889a75804a7f132b63e9c014a9941 Mon Sep 17 00:00:00 2001 From: Tiago Santos Date: Mon, 13 May 2024 07:40:57 -0300 Subject: [PATCH 3/4] add options skip two-factor authentication if I didn't ask for it --- src/license-robot.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/license-robot.js b/src/license-robot.js index c81be35..44d7cf6 100644 --- a/src/license-robot.js +++ b/src/license-robot.js @@ -51,7 +51,11 @@ async function licensePage_login(page, username, password, authenticatorKey) { page.waitForNavigation({ waitUntil: 'networkidle0' }) ]); - const verifyCodeInput = await page.$('#conversations_tfa_required_form_verify_code'); + const [verifyCodeInput, licenseFileInput] = await Promise.race([ + page.$('#conversations_tfa_required_form_verify_code'), + page.$('#licenseFile') + ]); + if (verifyCodeInput) { console.log("License robot. Passing two-factor authentication..."); if (!authenticatorKey) { @@ -68,6 +72,10 @@ async function licensePage_login(page, username, password, authenticatorKey) { page.waitForNavigation({ waitUntil: 'networkidle0' }) ]); } + if (licenseFileInput) { + console.log("License robot. Skip two-factor authentication"); + } + } /** From ca99a091ad32333edf9c5eb215d6ab9f5437b2be Mon Sep 17 00:00:00 2001 From: Tiago Santos Date: Mon, 13 May 2024 07:47:57 -0300 Subject: [PATCH 4/4] add options skip two-factor authentication if I didn't ask for it --- src/license-robot.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/license-robot.js b/src/license-robot.js index 44d7cf6..a11f1a5 100644 --- a/src/license-robot.js +++ b/src/license-robot.js @@ -51,10 +51,11 @@ async function licensePage_login(page, username, password, authenticatorKey) { page.waitForNavigation({ waitUntil: 'networkidle0' }) ]); - const [verifyCodeInput, licenseFileInput] = await Promise.race([ - page.$('#conversations_tfa_required_form_verify_code'), - page.$('#licenseFile') - ]); + const verifyCodeInputPromise = page.$('#conversations_tfa_required_form_verify_code'); + const licenseFileInputPromise = page.$('#licenseFile'); + + const verifyCodeInput = await verifyCodeInputPromise.catch(() => null); + const licenseFileInput = await licenseFileInputPromise.catch(() => null); if (verifyCodeInput) { console.log("License robot. Passing two-factor authentication...");