Merge branch 'master' of https://github.com/MillenniumEarl/F95API into master

pull/10/head
MillenniumEarl 2020-10-09 16:43:18 +02:00
commit 1c25e2806d
6 changed files with 203 additions and 212 deletions

View File

@ -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

View File

@ -1,4 +1,4 @@
'use strict';
"use strict";
class GameDownload {
constructor() {
@ -28,16 +28,10 @@ class GameDownload {
* Download the game data in the indicated path
* @param {string} path Save path
*/
download(path){
}
download(path) {}
}
module.exports = GameDownload;
function downloadMEGA(url){
function downloadMEGA(url) {}
}
function downloadNOPY(url){
}
function downloadNOPY(url) {}

View File

@ -1,6 +1,6 @@
'use strict';
"use strict";
const UNKNOWN = 'Unknown';
const UNKNOWN = "Unknown";
class GameInfo {
constructor() {
@ -97,8 +97,8 @@ class GameInfo {
lastPlayed: this.lastPlayed,
isMod: this.isMod,
gameDir: this.gameDir,
downloadInfo: this.downloadInfo
}
downloadInfo: this.downloadInfo,
};
}
/**

View File

@ -1,4 +1,4 @@
'use strict';
"use strict";
/**
* Class containing the data of the user currently connected to the F95Zone platform.

View File

@ -1,7 +1,7 @@
'use strict';
"use strict";
// Core modules
const { join } = require('path');
const { join } = require("path");
/**
* Class containing variables shared between modules.
@ -37,12 +37,12 @@ class Shared {
* Wait instruction for the browser created by puppeteer.
* @type String
*/
static WAIT_STATEMENT = 'domcontentloaded';
static WAIT_STATEMENT = "domcontentloaded";
/**
* Path to the directory to save the cache generated by the API.
* @type String
*/
static _cacheDir = './f95cache';
static _cacheDir = "./f95cache";
/**
* If true, it opens a new browser for each request to
* the F95Zone platform, otherwise it reuses the same.
@ -99,21 +99,21 @@ class Shared {
* @returns {String}
*/
static get cookiesCachePath() {
return join(this._cacheDir, 'cookies.json');
return join(this._cacheDir, "cookies.json");
}
/**
* Path to the game engine cache.
* @returns {String}
*/
static get enginesCachePath() {
return join(this._cacheDir, 'engines.json');
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');
return join(this._cacheDir, "statuses.json");
}
/**
* If true, it opens a new browser for each request

View File

@ -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) {
module.exports.isF95URL = function (url) {
if (url.toString().startsWith(F95_BASE_URL)) return true;
else return false;
}
};
/**
* @protected