Merge pull request #29 from MillenniumEarl/deepsource-fix-fd03307c
Replace square-bracket notation with dot notationpull/31/head
commit
4697e6f535
|
@ -383,7 +383,7 @@ function isCookieExpired(cookie) {
|
||||||
let expiredCookies = false;
|
let expiredCookies = false;
|
||||||
|
|
||||||
// Ignore cookies that never expire
|
// Ignore cookies that never expire
|
||||||
const expirationUnixTimestamp = cookie["expire"];
|
const expirationUnixTimestamp = cookie.expire;
|
||||||
|
|
||||||
if (expirationUnixTimestamp !== "-1") {
|
if (expirationUnixTimestamp !== "-1") {
|
||||||
// Convert UNIX epoch timestamp to normal Date
|
// Convert UNIX epoch timestamp to normal Date
|
||||||
|
@ -392,7 +392,7 @@ function isCookieExpired(cookie) {
|
||||||
if (expirationDate < Date.now()) {
|
if (expirationDate < Date.now()) {
|
||||||
if (shared.debug)
|
if (shared.debug)
|
||||||
console.log(
|
console.log(
|
||||||
"Cookie " + cookie["name"] + " expired, you need to re-authenticate"
|
"Cookie " + cookie.name + " expired, you need to re-authenticate"
|
||||||
);
|
);
|
||||||
expiredCookies = true;
|
expiredCookies = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,16 +7,10 @@ const puppeteer = require("puppeteer"); // skipcq: JS-0128
|
||||||
// Modules from file
|
// Modules from file
|
||||||
const shared = require("./shared.js");
|
const shared = require("./shared.js");
|
||||||
const selectors = require("./constants/css-selectors.js");
|
const selectors = require("./constants/css-selectors.js");
|
||||||
const {
|
const { preparePage } = require("./puppeteer-helper.js");
|
||||||
preparePage
|
|
||||||
} = require("./puppeteer-helper.js");
|
|
||||||
const GameDownload = require("./classes/game-download.js");
|
const GameDownload = require("./classes/game-download.js");
|
||||||
const GameInfo = require("./classes/game-info.js");
|
const GameInfo = require("./classes/game-info.js");
|
||||||
const {
|
const { isStringAValidURL, isF95URL, urlExists } = require("./urls-helper.js");
|
||||||
isStringAValidURL,
|
|
||||||
isF95URL,
|
|
||||||
urlExists
|
|
||||||
} = require("./urls-helper.js");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @protected
|
* @protected
|
||||||
|
@ -60,12 +54,10 @@ module.exports.getGameInfo = async function (browser, url) {
|
||||||
info.overview = overview;
|
info.overview = overview;
|
||||||
info.tags = await tags;
|
info.tags = await tags;
|
||||||
info.f95url = url;
|
info.f95url = url;
|
||||||
info.version = info.isMod ?
|
info.version = info.isMod ? parsedInfos["MOD VERSION"] : parsedInfos.VERSION;
|
||||||
parsedInfos["MOD VERSION"] :
|
info.lastUpdate = info.isMod
|
||||||
parsedInfos["VERSION"];
|
? parsedInfos.UPDATED
|
||||||
info.lastUpdate = info.isMod ?
|
: parsedInfos["THREAD UPDATED"];
|
||||||
parsedInfos["UPDATED"] :
|
|
||||||
parsedInfos["THREAD UPDATED"];
|
|
||||||
info.previewSource = await previewSource;
|
info.previewSource = await previewSource;
|
||||||
info.changelog = (await changelog) || "Unknown changelog";
|
info.changelog = (await changelog) || "Unknown changelog";
|
||||||
//info.downloadInfo = await downloadData;
|
//info.downloadInfo = await downloadData;
|
||||||
|
@ -155,8 +147,7 @@ async function getGameAuthor(page) {
|
||||||
// Get the game/mod name (without square brackets)
|
// Get the game/mod name (without square brackets)
|
||||||
const titleHTML = await page.evaluate(
|
const titleHTML = await page.evaluate(
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
(selector) =>
|
(selector) => document.querySelector(selector).innerHTML,
|
||||||
document.querySelector(selector).innerHTML,
|
|
||||||
selectors.GAME_TITLE
|
selectors.GAME_TITLE
|
||||||
);
|
);
|
||||||
const structuredTitle = HTMLParser.parse(titleHTML);
|
const structuredTitle = HTMLParser.parse(titleHTML);
|
||||||
|
@ -229,8 +220,7 @@ async function getGameTitle(page) {
|
||||||
// Get the game/mod name (without square brackets)
|
// Get the game/mod name (without square brackets)
|
||||||
const titleHTML = await page.evaluate(
|
const titleHTML = await page.evaluate(
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
(selector) =>
|
(selector) => document.querySelector(selector).innerHTML,
|
||||||
document.querySelector(selector).innerHTML,
|
|
||||||
selectors.GAME_TITLE
|
selectors.GAME_TITLE
|
||||||
);
|
);
|
||||||
const structuredTitle = HTMLParser.parse(titleHTML);
|
const structuredTitle = HTMLParser.parse(titleHTML);
|
||||||
|
|
Loading…
Reference in New Issue