From cf4b3e1269bc98a940ec57945781122f61f8c15c Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sat, 10 Oct 2020 14:27:28 +0000 Subject: [PATCH] Format code with prettier This commit fixes the style issues introduced in 262e922 according to the output from prettier. Details: https://deepsource.io/gh/MillenniumEarl/F95API/transform/c3bfc52a-3e9c-4ab0-9f9e-a9140d581cf1/ --- app/scripts/classes/game-download.js | 18 ++++++++++-------- app/scripts/game-scraper.js | 10 +++++----- test/test.js | 7 ++++--- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/app/scripts/classes/game-download.js b/app/scripts/classes/game-download.js index 695a490..a3cd136 100644 --- a/app/scripts/classes/game-download.js +++ b/app/scripts/classes/game-download.js @@ -4,7 +4,7 @@ const fs = require("fs"); // Public modules from npm -const { File } = require('megajs'); +const { File } = require("megajs"); // Modules from file const { prepareBrowser, preparePage } = require("../puppeteer-helper.js"); @@ -41,8 +41,10 @@ class GameDownload { * @return {Promise} Result of the operation */ async download(path) { - if (this.link.includes("mega.nz")) return await downloadMEGA(this.link, path); - else if (this.link.includes("nopy.to")) return await downloadNOPY(this.link, path); + if (this.link.includes("mega.nz")) + return await downloadMEGA(this.link, path); + else if (this.link.includes("nopy.to")) + return await downloadNOPY(this.link, path); } } module.exports = GameDownload; @@ -83,9 +85,9 @@ async function downloadNOPY(url, savepath) { await page.waitForSelector("#download"); // Set the save path - await page._client.send('Page.setDownloadBehavior', { - behavior: 'allow', - downloadPath: path.basename(path.dirname(savepath)) // Is a directory + await page._client.send("Page.setDownloadBehavior", { + behavior: "allow", + downloadPath: path.basename(path.dirname(savepath)), // Is a directory }); // Obtain the download button and click it @@ -94,8 +96,8 @@ async function downloadNOPY(url, savepath) { // Await for all the connections to close await page.waitForNavigation({ - waitUntil: 'networkidle0', - timeout: 0 // Disable timeout + waitUntil: "networkidle0", + timeout: 0, // Disable timeout }); // Close browser and page diff --git a/app/scripts/game-scraper.js b/app/scripts/game-scraper.js index 4c42bef..0134290 100644 --- a/app/scripts/game-scraper.js +++ b/app/scripts/game-scraper.js @@ -17,7 +17,7 @@ const { isStringAValidURL, isF95URL, urlExists } = require("./urls-helper.js"); * Get information from the game's main page. * @param {puppeteer.Browser} browser Browser object used for navigation * @param {String} url URL (String) of the game/mod to extract data from - * @return {Promise} Complete information about the game you are + * @return {Promise} Complete information about the game you are * looking for or null if the URL doesn't exists */ module.exports.getGameInfo = async function (browser, url) { @@ -61,10 +61,10 @@ module.exports.getGameInfo = async function (browser, url) { : parsedInfos["THREAD UPDATED"]; info.previewSource = await previewSource; //info.downloadInfo = await downloadData; - /* Downloading games without going directly to - * the platform appears to be prohibited by - * the guidelines. It is therefore useless to - * keep the links for downloading the games. */ + /* Downloading games without going directly to + * the platform appears to be prohibited by + * the guidelines. It is therefore useless to + * keep the links for downloading the games. */ await page.close(); // Close the page if (shared.debug) console.log("Founded data for " + info.name); diff --git a/test/test.js b/test/test.js index 2b749cc..6845e5f 100644 --- a/test/test.js +++ b/test/test.js @@ -1,4 +1,4 @@ -const {join} = require("path"); +const { join } = require("path"); const { debug, login, @@ -40,8 +40,9 @@ async function downloadGameNOPY() { async function downloadGameMEGA() { let gd = new GameDownload(); gd.hosting = "NOPY"; - gd.link = "https://f95zone.to/masked/mega.nz/2733/1470797/4O5LKwMx4ZSlw0QYTVMP0uDK660/hoobTb44f0IKx7Yio2SE2w/loX_px2vLRyNRQCnkNn5U7nnQe7jGmpEVERvH1tk7RjAFkQbs2kH_vCK6zVmRDuqiypPoIx358MNHHCd3QCdVvEsClSiAq4rwjK0r_ruXIs"; + gd.link = + "https://f95zone.to/masked/mega.nz/2733/1470797/4O5LKwMx4ZSlw0QYTVMP0uDK660/hoobTb44f0IKx7Yio2SE2w/loX_px2vLRyNRQCnkNn5U7nnQe7jGmpEVERvH1tk7RjAFkQbs2kH_vCK6zVmRDuqiypPoIx358MNHHCd3QCdVvEsClSiAq4rwjK0r_ruXIs"; let savepath = join(__dirname, "Kingdom_of_Deception-pc0.10.8.zip"); let result = await gd.download(savepath); console.log(result); -} \ No newline at end of file +}