From 730079969aa4cdc4c7d3f876aeeb47c3f3f81958 Mon Sep 17 00:00:00 2001 From: Kevin Novak Date: Thu, 27 Aug 2020 00:46:48 -0400 Subject: [PATCH] Format files --- app.js | 36 ++++++++++++++++++++---------------- data/selectors.json | 2 +- data/urls.json | 2 +- scheduler.js | 2 +- utilities/logger.js | 4 ++-- utilities/timer.js | 4 ++-- 6 files changed, 27 insertions(+), 23 deletions(-) diff --git a/app.js b/app.js index 5ec7dd4..fde51c0 100644 --- a/app.js +++ b/app.js @@ -12,7 +12,7 @@ const descriptions = config.bump.descriptions.list; // Browser options var browserOptions = { - headless: config.browser.hide + headless: config.browser.hide, }; if (config.browser.custom.enabled) { @@ -52,11 +52,13 @@ async function bumpServer() { // Nagivate to "Edit Server" page logger.log('Navigating to "Edit Server" page...'); - await page.goto(`${urls.base}${urls.pages.edit}?${urls.queries.serverId}=${config.account.serverId}`); + await page.goto( + `${urls.base}${urls.pages.edit}?${urls.queries.serverId}=${config.account.serverId}` + ); // Check if editing is allowed const selector = selectors.error; - const success = await page.evaluate((selector) => { + const success = await page.evaluate(selector => { return document.querySelectorAll(selector).length === 0; }, selector); @@ -72,15 +74,15 @@ async function bumpServer() { if (config.bump.descriptions.enabled) { const selector = selectors.fields.description; const description = getRandomDescription(); - await page.evaluate(({ - selector, - description - }) => { - document.querySelector(selector).value = description; - }, { - selector, - description - }); + await page.evaluate( + ({ selector, description }) => { + document.querySelector(selector).value = description; + }, + { + selector, + description, + } + ); } // Bump server @@ -109,7 +111,9 @@ async function launchBrowser() { }); return browser; } catch (error) { - logger.error('Failed to launch browser. Please check if the executable path is correct or try changing the browser hide option.'); + logger.error( + 'Failed to launch browser. Please check if the executable path is correct or try changing the browser hide option.' + ); exit(); } } @@ -127,7 +131,7 @@ async function delay(page) { if (delaysEnabled) { const delay = generateRandomDelay(); const time = timer.format(timer.getTimeAfterMs(delay)); - logger.log(`Waiting ${delay/1000} seconds, until "${time}"...`); + logger.log(`Waiting ${delay / 1000} seconds, until "${time}"...`); await page.waitFor(delay); } } @@ -153,5 +157,5 @@ if (!module.parent) { } module.exports = { - bumpServer -}; \ No newline at end of file + bumpServer, +}; diff --git a/data/selectors.json b/data/selectors.json index 8df834f..107b465 100644 --- a/data/selectors.json +++ b/data/selectors.json @@ -11,4 +11,4 @@ "dashboard": "th.n1" }, "error": "div.errormsg" -} \ No newline at end of file +} diff --git a/data/urls.json b/data/urls.json index bb08c89..85d8aee 100644 --- a/data/urls.json +++ b/data/urls.json @@ -8,4 +8,4 @@ "queries": { "serverId": "server_id" } -} \ No newline at end of file +} diff --git a/scheduler.js b/scheduler.js index 608172c..9caa34d 100644 --- a/scheduler.js +++ b/scheduler.js @@ -39,4 +39,4 @@ function logNextRun() { } logger.log('Started the built-in scheduler.'); -logNextRun(); \ No newline at end of file +logNextRun(); diff --git a/utilities/logger.js b/utilities/logger.js index 74caba4..5c31d86 100644 --- a/utilities/logger.js +++ b/utilities/logger.js @@ -14,5 +14,5 @@ function now() { module.exports = { log, - error -}; \ No newline at end of file + error, +}; diff --git a/utilities/timer.js b/utilities/timer.js index 03f8928..356b187 100644 --- a/utilities/timer.js +++ b/utilities/timer.js @@ -10,5 +10,5 @@ function getTimeAfterMs(delay, date = Date.now()) { module.exports = { format, - getTimeAfterMs -}; \ No newline at end of file + getTimeAfterMs, +};