diff --git a/app/index.js b/app/index.js index b72d210..08980a8 100644 --- a/app/index.js +++ b/app/index.js @@ -305,8 +305,7 @@ module.exports.logout = function () { // Gracefully close shared browser if (!shared.isolation && _browser !== null) { - _browser.close() - .then(() => _browser = null); + _browser.close().then(() => (_browser = null)); } }; //#endregion diff --git a/app/scripts/classes/game-download.js b/app/scripts/classes/game-download.js index e05ee5c..6b81f52 100644 --- a/app/scripts/classes/game-download.js +++ b/app/scripts/classes/game-download.js @@ -1,43 +1,37 @@ -'use strict'; +"use strict"; class GameDownload { - constructor() { - /** - * @public - * Platform that hosts game files - * @type String - */ - this.hosting = ""; - /** - * @public - * Link to game files - * @type String - */ - this.link = null; - /** - * @public - * Operating systems supported by the game version indicated in this class. - * Can be *WINDOWS/LINUX/MACOS* - * @type String[] - */ - this.supportedOS = []; - } - + constructor() { /** * @public - * Download the game data in the indicated path - * @param {string} path Save path + * Platform that hosts game files + * @type String */ - download(path){ + this.hosting = ""; + /** + * @public + * Link to game files + * @type String + */ + this.link = null; + /** + * @public + * Operating systems supported by the game version indicated in this class. + * Can be *WINDOWS/LINUX/MACOS* + * @type String[] + */ + this.supportedOS = []; + } - } + /** + * @public + * Download the game data in the indicated path + * @param {string} path Save path + */ + download(path) {} } module.exports = GameDownload; -function downloadMEGA(url){ +function downloadMEGA(url) {} -} - -function downloadNOPY(url){ - -} \ No newline at end of file +function downloadNOPY(url) {} diff --git a/app/scripts/classes/game-info.js b/app/scripts/classes/game-info.js index 58abc9a..09ea559 100644 --- a/app/scripts/classes/game-info.js +++ b/app/scripts/classes/game-info.js @@ -1,6 +1,6 @@ -'use strict'; +"use strict"; -const UNKNOWN = 'Unknown'; +const UNKNOWN = "Unknown"; class GameInfo { constructor() { @@ -71,8 +71,8 @@ class GameInfo { */ this.gameDir = UNKNOWN; /** - * Information on game file download links, - * including information on hosting platforms + * Information on game file download links, + * including information on hosting platforms * and operating system supported by the specific link * @type GameDownload[] */ @@ -97,8 +97,8 @@ class GameInfo { lastPlayed: this.lastPlayed, isMod: this.isMod, gameDir: this.gameDir, - downloadInfo: this.downloadInfo - } + downloadInfo: this.downloadInfo, + }; } /** @@ -110,4 +110,4 @@ class GameInfo { return Object.assign(new GameInfo(), json); } } -module.exports = GameInfo; \ No newline at end of file +module.exports = GameInfo; diff --git a/app/scripts/classes/user-data.js b/app/scripts/classes/user-data.js index ac76a9c..d6fead0 100644 --- a/app/scripts/classes/user-data.js +++ b/app/scripts/classes/user-data.js @@ -1,26 +1,26 @@ -'use strict'; +"use strict"; /** * Class containing the data of the user currently connected to the F95Zone platform. */ class UserData { - constructor() { - /** - * User username. - * @type String - */ - this.username = ""; - /** - * Path to the user's profile picture. - * @type String - */ - this.avatarSrc = null; - /** - * List of followed thread URLs. - * @type URL[] - */ - this.watchedThreads = []; - } + constructor() { + /** + * User username. + * @type String + */ + this.username = ""; + /** + * Path to the user's profile picture. + * @type String + */ + this.avatarSrc = null; + /** + * List of followed thread URLs. + * @type URL[] + */ + this.watchedThreads = []; + } } -module.exports = UserData; \ No newline at end of file +module.exports = UserData; diff --git a/app/scripts/shared.js b/app/scripts/shared.js index a488343..2b15887 100644 --- a/app/scripts/shared.js +++ b/app/scripts/shared.js @@ -1,159 +1,159 @@ -'use strict'; +"use strict"; // Core modules -const { join } = require('path'); +const { join } = require("path"); /** * Class containing variables shared between modules. */ class Shared { - //#region Properties - /** - * Shows log messages and other useful functions for module debugging. - * @type Boolean - */ - static _debug = false; - /** - * Indicates whether a user is logged in to the F95Zone platform or not. - * @type Boolean - */ - static _isLogged = false; - /** - * List of cookies obtained from the F95Zone platform. - * @type Object[] - */ - static _cookies = null; - /** - * List of possible game engines used for development. - * @type String[] - */ - static _engines = null; - /** - * List of possible development statuses that a game can assume. - * @type String[] - */ - static _statuses = null; - /** - * Wait instruction for the browser created by puppeteer. - * @type String - */ - static WAIT_STATEMENT = 'domcontentloaded'; - /** - * Path to the directory to save the cache generated by the API. - * @type String - */ - static _cacheDir = './f95cache'; - /** - * If true, it opens a new browser for each request to - * the F95Zone platform, otherwise it reuses the same. - * @type Boolean - */ - static _isolation = false; - //#endregion Properties + //#region Properties + /** + * Shows log messages and other useful functions for module debugging. + * @type Boolean + */ + static _debug = false; + /** + * Indicates whether a user is logged in to the F95Zone platform or not. + * @type Boolean + */ + static _isLogged = false; + /** + * List of cookies obtained from the F95Zone platform. + * @type Object[] + */ + static _cookies = null; + /** + * List of possible game engines used for development. + * @type String[] + */ + static _engines = null; + /** + * List of possible development statuses that a game can assume. + * @type String[] + */ + static _statuses = null; + /** + * Wait instruction for the browser created by puppeteer. + * @type String + */ + static WAIT_STATEMENT = "domcontentloaded"; + /** + * Path to the directory to save the cache generated by the API. + * @type String + */ + static _cacheDir = "./f95cache"; + /** + * If true, it opens a new browser for each request to + * the F95Zone platform, otherwise it reuses the same. + * @type Boolean + */ + static _isolation = false; + //#endregion Properties - //#region Getters - /** - * Shows log messages and other useful functions for module debugging. - * @returns {Boolean} - */ - static get debug() { - return this._debug; - } - /** - * Indicates whether a user is logged in to the F95Zone platform or not. - * @returns {Boolean} - */ - static get isLogged() { - return this._isLogged; - } - /** - * List of cookies obtained from the F95Zone platform. - * @returns {Object[]} - */ - static get cookies() { - return this._cookies; - } - /** - * List of possible game engines used for development. - * @returns {String[]} - */ - static get engines() { - return this._engines; - } - /** - * List of possible development states that a game can assume. - * @returns {String[]} - */ - static get statuses() { - return this._statuses; - } - /** - * Directory to save the API cache. - * @returns {String} - */ - static get cacheDir() { - return this._cacheDir; - } - /** - * Path to the F95 platform cache. - * @returns {String} - */ - static get cookiesCachePath() { - return join(this._cacheDir, 'cookies.json'); - } - /** - * Path to the game engine cache. - * @returns {String} - */ - static get enginesCachePath() { - return join(this._cacheDir, 'engines.json'); - } - /** - * Path to the cache of possible game states. - * @returns {String} - */ - static get statusesCachePath() { - return join(this._cacheDir, 'statuses.json'); - } - /** - * If true, it opens a new browser for each request - * to the F95Zone platform, otherwise it reuses the same. - * @returns {Boolean} - */ - static get isolation() { - return this._isolation; - } - //#endregion Getters + //#region Getters + /** + * Shows log messages and other useful functions for module debugging. + * @returns {Boolean} + */ + static get debug() { + return this._debug; + } + /** + * Indicates whether a user is logged in to the F95Zone platform or not. + * @returns {Boolean} + */ + static get isLogged() { + return this._isLogged; + } + /** + * List of cookies obtained from the F95Zone platform. + * @returns {Object[]} + */ + static get cookies() { + return this._cookies; + } + /** + * List of possible game engines used for development. + * @returns {String[]} + */ + static get engines() { + return this._engines; + } + /** + * List of possible development states that a game can assume. + * @returns {String[]} + */ + static get statuses() { + return this._statuses; + } + /** + * Directory to save the API cache. + * @returns {String} + */ + static get cacheDir() { + return this._cacheDir; + } + /** + * Path to the F95 platform cache. + * @returns {String} + */ + static get cookiesCachePath() { + return join(this._cacheDir, "cookies.json"); + } + /** + * Path to the game engine cache. + * @returns {String} + */ + static get enginesCachePath() { + return join(this._cacheDir, "engines.json"); + } + /** + * Path to the cache of possible game states. + * @returns {String} + */ + static get statusesCachePath() { + return join(this._cacheDir, "statuses.json"); + } + /** + * If true, it opens a new browser for each request + * to the F95Zone platform, otherwise it reuses the same. + * @returns {Boolean} + */ + static get isolation() { + return this._isolation; + } + //#endregion Getters - //#region Setters - static set cookies(val) { - this._cookies = val; - } + //#region Setters + static set cookies(val) { + this._cookies = val; + } - static set engines(val) { - this._engines = val; - } + static set engines(val) { + this._engines = val; + } - static set statuses(val) { - this._statuses = val; - } + static set statuses(val) { + this._statuses = val; + } - static set cacheDir(val) { - this._cacheDir = val; - } + static set cacheDir(val) { + this._cacheDir = val; + } - static set debug(val) { - this._debug = val; - } + static set debug(val) { + this._debug = val; + } - static set isLogged(val) { - this._isLogged = val; - } + static set isLogged(val) { + this._isLogged = val; + } - static set isolation(val) { - this._isolation = val; - } - //#endregion Setters + static set isolation(val) { + this._isolation = val; + } + //#endregion Setters } -module.exports = Shared; \ No newline at end of file +module.exports = Shared; diff --git a/app/scripts/urls-helper.js b/app/scripts/urls-helper.js index 3220efa..9eb2ba7 100644 --- a/app/scripts/urls-helper.js +++ b/app/scripts/urls-helper.js @@ -1,4 +1,4 @@ -'use strict'; +"use strict"; // Public modules from npm const isUrl = require("is-url-superb"); @@ -7,9 +7,7 @@ const ky = require("ky-universal").create({ }); // Modules from file -const { - F95_BASE_URL -} = require('./constants/urls.js'); +const { F95_BASE_URL } = require("./constants/urls.js"); /** * @protected @@ -17,10 +15,10 @@ const { * @param {String} url URL to check * @returns {Boolean} true if the url belongs to the domain, false otherwise */ -module.exports.isF95URL = function(url) { - if (url.toString().startsWith(F95_BASE_URL)) return true; - else return false; -} +module.exports.isF95URL = function (url) { + if (url.toString().startsWith(F95_BASE_URL)) return true; + else return false; +}; /** * @protected @@ -60,4 +58,4 @@ module.exports.urlExists = async function(url, checkRedirect) { } return valid; -} \ No newline at end of file +}