From e30728bde544d4b7229e6e3a6bac2c523b4f3cc5 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Fri, 16 Oct 2020 07:45:33 +0000 Subject: [PATCH 1/3] Replace square-bracket notation with dot notation --- app/index.js | 4 ++-- app/scripts/game-scraper.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/index.js b/app/index.js index a44dcbe..82be7c1 100644 --- a/app/index.js +++ b/app/index.js @@ -383,7 +383,7 @@ function isCookieExpired(cookie) { let expiredCookies = false; // Ignore cookies that never expire - const expirationUnixTimestamp = cookie["expire"]; + const expirationUnixTimestamp = cookie.expire; if (expirationUnixTimestamp !== "-1") { // Convert UNIX epoch timestamp to normal Date @@ -392,7 +392,7 @@ function isCookieExpired(cookie) { if (expirationDate < Date.now()) { if (shared.debug) console.log( - "Cookie " + cookie["name"] + " expired, you need to re-authenticate" + "Cookie " + cookie.name + " expired, you need to re-authenticate" ); expiredCookies = true; } diff --git a/app/scripts/game-scraper.js b/app/scripts/game-scraper.js index cc66855..b86a75e 100644 --- a/app/scripts/game-scraper.js +++ b/app/scripts/game-scraper.js @@ -56,9 +56,9 @@ module.exports.getGameInfo = async function (browser, url) { info.f95url = url; info.version = info.isMod ? parsedInfos["MOD VERSION"] - : parsedInfos["VERSION"]; + : parsedInfos.VERSION; info.lastUpdate = info.isMod - ? parsedInfos["UPDATED"] + ? parsedInfos.UPDATED : parsedInfos["THREAD UPDATED"]; info.previewSource = await previewSource; info.changelog = (await changelog) || "Unknown changelog"; From aa31215b4bd26610ae6edf912e53193b258aea79 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Fri, 16 Oct 2020 07:45:45 +0000 Subject: [PATCH 2/3] Format code with prettier This commit fixes the style issues introduced in e30728b according to the output from prettier. Details: https://deepsource.io/gh/MillenniumEarl/F95API/transform/075afe6c-3c63-4bd3-9866-78b555209044/ --- app/scripts/game-scraper.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/scripts/game-scraper.js b/app/scripts/game-scraper.js index b86a75e..c816bae 100644 --- a/app/scripts/game-scraper.js +++ b/app/scripts/game-scraper.js @@ -54,9 +54,7 @@ module.exports.getGameInfo = async function (browser, url) { info.overview = overview; info.tags = await tags; info.f95url = url; - info.version = info.isMod - ? parsedInfos["MOD VERSION"] - : parsedInfos.VERSION; + info.version = info.isMod ? parsedInfos["MOD VERSION"] : parsedInfos.VERSION; info.lastUpdate = info.isMod ? parsedInfos.UPDATED : parsedInfos["THREAD UPDATED"]; From 4f4a51854c965fb394a0f66ca05b1b350f1690ca Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Fri, 16 Oct 2020 07:49:16 +0000 Subject: [PATCH 3/3] Format code with prettier This commit fixes the style issues introduced in 0f5c827 according to the output from prettier. Details: https://deepsource.io/gh/MillenniumEarl/F95API/transform/4813d371-dce8-4240-8e92-aaea9566b0c8/ --- app/scripts/game-scraper.js | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/app/scripts/game-scraper.js b/app/scripts/game-scraper.js index a52f338..8276a7b 100644 --- a/app/scripts/game-scraper.js +++ b/app/scripts/game-scraper.js @@ -7,16 +7,10 @@ const puppeteer = require("puppeteer"); // skipcq: JS-0128 // Modules from file const shared = require("./shared.js"); const selectors = require("./constants/css-selectors.js"); -const { - preparePage -} = require("./puppeteer-helper.js"); +const { preparePage } = require("./puppeteer-helper.js"); const GameDownload = require("./classes/game-download.js"); const GameInfo = require("./classes/game-info.js"); -const { - isStringAValidURL, - isF95URL, - urlExists -} = require("./urls-helper.js"); +const { isStringAValidURL, isF95URL, urlExists } = require("./urls-helper.js"); /** * @protected @@ -153,8 +147,7 @@ async function getGameAuthor(page) { // Get the game/mod name (without square brackets) const titleHTML = await page.evaluate( /* istanbul ignore next */ - (selector) => - document.querySelector(selector).innerHTML, + (selector) => document.querySelector(selector).innerHTML, selectors.GAME_TITLE ); const structuredTitle = HTMLParser.parse(titleHTML); @@ -227,8 +220,7 @@ async function getGameTitle(page) { // Get the game/mod name (without square brackets) const titleHTML = await page.evaluate( /* istanbul ignore next */ - (selector) => - document.querySelector(selector).innerHTML, + (selector) => document.querySelector(selector).innerHTML, selectors.GAME_TITLE ); const structuredTitle = HTMLParser.parse(titleHTML); @@ -411,8 +403,8 @@ function extractGameHostingData(platform, text) { // Find the end of the container if (endIndex === -1) endIndex = - text.indexOf(CONTAINER_SPAN_CLOSE, startIndex) + - CONTAINER_SPAN_CLOSE.length; + text.indexOf(CONTAINER_SPAN_CLOSE, startIndex) + + CONTAINER_SPAN_CLOSE.length; text = text.substring(startIndex, endIndex);