diff --git a/app/scripts/shared.js b/app/scripts/shared.js index cbefd62..b6bd3c8 100644 --- a/app/scripts/shared.js +++ b/app/scripts/shared.js @@ -1,6 +1,10 @@ /* istanbul ignore file */ "use strict"; +// Core modules +const {tmpdir} = require("os"); +const {join} = require("path"); + // Public modules from npm const log4js = require("log4js"); @@ -16,14 +20,24 @@ class Shared { static #_isLogged = false; /** * List of possible game engines used for development. - * @type String[] + * @type Object */ - static #_engines = ["ADRIFT", "Flash", "HTML", "Java", "Others", "QSP", "RAGS", "RPGM", "Ren'Py", "Tads", "Unity", "Unreal Engine", "WebGL", "Wolf RPG"]; + static #_engines = {}; /** * List of possible development statuses that a game can assume. - * @type String[] + * @type Object */ - static #_statuses = ["Completed", "Onhold", "Abandoned"]; + static #_statuses = {}; + /** + * List of other prefixes that a game can assume. + * @type Object + */ + static #_others = {}; + /** + * List of possible tags that a game can assume. + * @type Object + */ + static #_tags = {}; /** * Logger object used to write to both file and console. * @type log4js.Logger @@ -33,33 +47,53 @@ class Shared { //#region Getters /** - * Indicates whether a user is logged in to the F95Zone platform or not. - * @returns {Boolean} - */ + * Indicates whether a user is logged in to the F95Zone platform or not. + * @returns {Boolean} + */ static get isLogged() { return this.#_isLogged; } /** - * List of possible game engines used for development. - * @returns {String[]} - */ + * List of possible game engines used for development. + * @returns @returns {Object} + */ static get engines() { return this.#_engines; } /** - * List of possible development states that a game can assume. - * @returns {String[]} - */ + * List of possible development states that a game can assume. + * @returns {Object} + */ static get statuses() { return this.#_statuses; } /** - * Logger object used to write to both file and console. - * @returns {log4js.Logger} - */ + * List of other prefixes that a game can assume. + * @returns {Object} + */ + static get others() { + return this.#_others; + } + /** + * List of possible tags that a game can assume. + * @returns {Object} + */ + static get tags() { + return this.#_tags; + } + /** + * Logger object used to write to both file and console. + * @returns {log4js.Logger} + */ static get logger() { return this.#_logger; } + /** + * Path to the cache used by this module wich contains engines, statuses, tags... + */ + static get cachePath() { + return join(tmpdir(), "f95cache.json"); + } //#endregion Getters //#region Setters @@ -71,6 +105,14 @@ class Shared { this.#_statuses = val; } + static set tags(val) { + this.#_tags = val; + } + + static set others(val) { + this.#_others = val; + } + static set isLogged(val) { this.#_isLogged = val; }