diff --git a/.d.ts b/.d.ts index 84caf29..b827a0d 100644 --- a/.d.ts +++ b/.d.ts @@ -1,342 +1,337 @@ declare module "discord-dashboard" { - let Dashboard: any + let Dashboard: any - const formTypes: formTypes - const customPagesTypes: customPagesTypes - const DISCORD_FLAGS: { - Permissions: Permissions - } + const formTypes: formTypes + const customPagesTypes: customPagesTypes - const version: string + const version: string } interface RateLimitSettingsObject { - windowMs: Number - max: Number - message: String - store?: any + windowMs: Number + max: Number + message: String + store?: any } interface Dashboard { - new (config: { - port: number - client: { - id: string - secret: string - } - redirectUri: string - domain: string - bot: any - theme: any - settings: category[] - requiredPermissions?: object, - ownerIDs: array, - useTheme404: boolean, - useThemeMaintenance: boolean, - acceptPrivacyPolicy?: boolean - noCreateServer?: boolean - SSL?: { - enabled: boolean - key: string - cert: string - } - minimizedConsoleLogs?: boolean - rateLimits?: { - manage?: RateLimitSettingsObject - guildPage?: RateLimitSettingsObject - settingsUpdatePostAPI?: RateLimitSettingsObject - discordOAuth2?: RateLimitSettingsObject - } - invite?: { - clientId: string - scopes: object - permissions: string - redirectUri: string - otherParams: string - } - supportServer?: { - slash: string - inviteUrl: string - } - guildAfterAuthorization?: { - use: boolean - guildId: string - options?: { - nickname?: string - roles?: [string] - mute?: boolean - deaf?: boolean - } - } - reportError?: (where: string, what: any) => any - assistantsSecureStorageKey?: string - }): any - DBDEvents: () => any - init: () => Promise - getApp: () => any - useThirdPartyModule: (module: any) => any + new(config: { + port: number + client: { + id: string + secret: string + } + redirectUri: string + domain: string + bot: any + theme: any + settings: category[] + ownerIDs: array, + useTheme404: boolean, + useThemeMaintenance: boolean, + noCreateServer?: boolean + SSL?: { + enabled: boolean + key: string + cert: string + } + minimizedConsoleLogs?: boolean + rateLimits?: { + manage?: RateLimitSettingsObject + guildPage?: RateLimitSettingsObject + settingsUpdatePostAPI?: RateLimitSettingsObject + discordOAuth2?: RateLimitSettingsObject + } + invite?: { + clientId: string + scopes: object + permissions: string + redirectUri: string + otherParams: string + } + supportServer?: { + slash: string + inviteUrl: string + } + guildAfterAuthorization?: { + use: boolean + guildId: string + options?: { + nickname?: string + roles?: [string] + mute?: boolean + deaf?: boolean + } + } + reportError?: (where: string, what: any) => any + assistantsSecureStorageKey?: string + }): any + DBDEvents: () => any + init: () => Promise + getApp: () => any + useThirdPartyModule: (module: any) => any } interface category { - categoryId: string - categoryName: string - categoryDescription: string - categoryOptionsList: option[] + categoryId: string + categoryName: string + categoryDescription: string + categoryOptionsList: option[] } interface option { - optionId?: string - optionName?: string - optionDescription?: string - title?: string - description?: string - optionType: - | { - type: string - data?: string | null - function?: any - min?: number | null - max?: number | null - disabled?: boolean | null - required?: boolean | null - themeOptions?: object | null - } - | string - getActualSet?: (options: optionOptions) => Promise - setNew?: (options: optionOptions) => Promise - allowedCheck?: (options: allowedCheckOption) => Promise - themeOptions?: Object + optionId?: string + optionName?: string + optionDescription?: string + title?: string + description?: string + optionType: + | { + type: string + data?: string | null + function?: any + min?: number | null + max?: number | null + disabled?: boolean | null + required?: boolean | null + themeOptions?: object | null + } + | string + getActualSet?: (options: optionOptions) => Promise + setNew?: (options: optionOptions) => Promise + allowedCheck?: (options: allowedCheckOption) => Promise + themeOptions?: Object } interface optionOptions { - guild: { id: string } - user: { id: string } - newData: any + guild: { id: string } + user: { id: string } + newData: any } interface allowedCheckOption { - guild: { id: string } - user: { id: string } + guild: { id: string } + user: { id: string } } interface formTypes { - select: ( - list: object, - disabled?: boolean, - themeOptions?: object - ) => { - type: string - data: { - keys: object - values: object - } - disabled: boolean - themeOptions: object - } + select: ( + list: object, + disabled?: boolean, + themeOptions?: object + ) => { + type: string + data: { + keys: object + values: object + } + disabled: boolean + themeOptions: object + } - multiSelect: ( - list: object, - disabled?: boolean, - required?: boolean, - themeOptions?: object - ) => { - type: string - data: { - keys: object - values: object - } - disabled: boolean | null - required: boolean | null - themeOptions: object - } + multiSelect: ( + list: object, + disabled?: boolean, + required?: boolean, + themeOptions?: object + ) => { + type: string + data: { + keys: object + values: object + } + disabled: boolean | null + required: boolean | null + themeOptions: object + } - input: ( - placeholder?: string, - min?: number, - max?: number, - disabled?: boolean, - required?: boolean, - themeOptions?: object - ) => { - type: string - data: string | null - min: number | null - max: number | null - disabled: boolean | null - required: boolean | null - themeOptions: object | null - } + input: ( + placeholder?: string, + min?: number, + max?: number, + disabled?: boolean, + required?: boolean, + themeOptions?: object + ) => { + type: string + data: string | null + min: number | null + max: number | null + disabled: boolean | null + required: boolean | null + themeOptions: object | null + } - textarea: ( - placeholder?: string, - min?: number, - max?: number, - disabled?: boolean, - required?: boolean, - themeOptions?: object - ) => { - type: string - data: string | null - min: number | null - max: number | null - disabled: boolean | null - required: boolean | null - themeOptions: object | null - } + textarea: ( + placeholder?: string, + min?: number, + max?: number, + disabled?: boolean, + required?: boolean, + themeOptions?: object + ) => { + type: string + data: string | null + min: number | null + max: number | null + disabled: boolean | null + required: boolean | null + themeOptions: object | null + } - switch: ( - disabled?: boolean, - themeOptions?: object - ) => { - type: string - disabled: boolean - themeOptions: object - } + switch: ( + disabled?: boolean, + themeOptions?: object + ) => { + type: string + disabled: boolean + themeOptions: object + } - checkbox: ( - disabled?: boolean, - themeOptions?: object - ) => { - type: string - disabled: boolean - themeOptions: object - } + checkbox: ( + disabled?: boolean, + themeOptions?: object + ) => { + type: string + disabled: boolean + themeOptions: object + } - channelsSelect: ( - disabled?: boolean, - channelTypes?: string[], - hideNSFW?: boolean, - onlyNSFW?: boolean, - hideNoAccess?: boolean, - themeOptions?: object - ) => { - type: string - function: (client: string, guildid: string) => any - disabled: boolean - themeOptions: object - } + channelsSelect: ( + disabled?: boolean, + channelTypes?: string[], + hideNSFW?: boolean, + onlyNSFW?: boolean, + hideNoAccess?: boolean, + themeOptions?: object + ) => { + type: string + function: (client: string, guildid: string) => any + disabled: boolean + themeOptions: object + } - channelsMultiSelect: ( - disabled?: boolean, - required?: boolean, - channelTypes?: string[], - hideNSFW?: boolean, - onlyNSFW?: boolean, - hideNoAccess?: boolean, - themeOptions?: object - ) => { - type: string - function: (client: string, guildid: string) => any - disabled: boolean - required: boolean - themeOptions: object - } + channelsMultiSelect: ( + disabled?: boolean, + required?: boolean, + channelTypes?: string[], + hideNSFW?: boolean, + onlyNSFW?: boolean, + hideNoAccess?: boolean, + themeOptions?: object + ) => { + type: string + function: (client: string, guildid: string) => any + disabled: boolean + required: boolean + themeOptions: object + } - rolesSelect: ( - includeBots: boolean, - disabled?: boolean, - hideHigherRoles?: boolean, - themeOptions?: object - ) => { - type: string - function: (client: string, guildid: string) => any - disabled: boolean - themeOptions: object - } + rolesSelect: ( + includeBots: boolean, + disabled?: boolean, + hideHigherRoles?: boolean, + themeOptions?: object + ) => { + type: string + function: (client: string, guildid: string) => any + disabled: boolean + themeOptions: object + } - rolesMultiSelect: ( - includeBots: boolean, - disabled?: boolean, - required?: boolean, - hideHigherRoles?: boolean, - themeOptions?: object - ) => { - type: string - function: (client: string, guildid: string) => any - disabled: boolean - required: boolean - themeOptions: object - } + rolesMultiSelect: ( + includeBots: boolean, + disabled?: boolean, + required?: boolean, + hideHigherRoles?: boolean, + themeOptions?: object + ) => { + type: string + function: (client: string, guildid: string) => any + disabled: boolean + required: boolean + themeOptions: object + } - colorSelect: ( - defaultState: string, - disabled?: boolean, - themeOptions?: object - ) => { - type: string - data: string - disabled: boolean - themeOptions: object - } + colorSelect: ( + defaultState: string, + disabled?: boolean, + themeOptions?: object + ) => { + type: string + data: string + disabled: boolean + themeOptions: object + } - embedBuilder: ( - defaultSettings: object, - themeOptions?: object - ) => { - type: string - data: object - themeOptions: object - } + embedBuilder: ( + defaultSettings: object, + themeOptions?: object + ) => { + type: string + data: object + themeOptions: object + } } interface EmbedBuilder { - content?: string - embed: { - title?: string - description: string - color?: string | number - timestamp?: any - url?: string - author?: { - name?: string - url?: string - icon_url?: string - } - thumbnail?: { - url?: string - } - image?: { - url?: string - } - footer?: { - text?: string - icon_url?: string - } - fields?: EmbedBuilderField[] - } + content?: string + embed: { + title?: string + description: string + color?: string | number + timestamp?: any + url?: string + author?: { + name?: string + url?: string + icon_url?: string + } + thumbnail?: { + url?: string + } + image?: { + url?: string + } + footer?: { + text?: string + icon_url?: string + } + fields?: EmbedBuilderField[] + } } interface EmbedBuilderField { - name?: string - value?: string - inline?: boolean + name?: string + value?: string + inline?: boolean } interface customPagesTypes { - redirectToUrl: ( - endpoint: string, - getDataFunction: any - ) => { - type: string - endpoint: string - getEndpoint: any - } + redirectToUrl: ( + endpoint: string, + getDataFunction: any + ) => { + type: string + endpoint: string + getEndpoint: any + } - renderHtml: ( - endpoint: string, - getDataFunction: any - ) => { - type: string - endpoint: string - getHtml: any - } + renderHtml: ( + endpoint: string, + getDataFunction: any + ) => { + type: string + endpoint: string + getHtml: any + } - sendJson: ( - endpoint: string, - getDataFunction: any - ) => { - type: string - endpoint: string - getJson: any - } -} + sendJson: ( + endpoint: string, + getDataFunction: any + ) => { + type: string + endpoint: string + getJson: any + } +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 88d625a..25c8fdb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,33 +1,2 @@ -./node_modules/ -node_modules/ -test/ -/test -./test/ -./test/ -./.idea -discord-dashboard-pp -./discord-dashboard-pp -.idea -.devChannel -./.devChannel -./ExternalStatistics/index_unobfuscated.js -ExternalStatistics/index_unobfuscated.js -./dev_project.json -dev_project.json -altometra-dashboard -./altometra-dashboard -index_unobf.js -./index_unobf.js -/altometra-dashoard -altometra-dashboard/ -./altometra-dashboard/ -/altometra-dashoard/ -./licensedDashboardClass_unobfuscated.js -./npmPublish.js -licensedDashboardClass_unobfuscated.js -npmPublish.js -updateObfuscatedIndex.js -./updateObfuscatedIndex.js -.idea -.idea -yarn-error.log \ No newline at end of file +node_modules +package-lock.json \ No newline at end of file diff --git a/404pagedefault.js b/404pagedefault.js index 47b567b..5c53589 100644 --- a/404pagedefault.js +++ b/404pagedefault.js @@ -28,5 +28,4 @@ module.exports = (websiteTitle) => ` - -` +`; \ No newline at end of file diff --git a/HandlerIntegration/index.js b/HandlerIntegration/index.js index ffcbdbb..d829d11 100644 --- a/HandlerIntegration/index.js +++ b/HandlerIntegration/index.js @@ -1,36 +1,26 @@ -const prefix = "[DBD-Storage-Handler]" -const colors = require("colors") -const Keyv = require("keyv") -const { join } = require("path") - -const err = (text) => { - return `🐧${text} Do you need help? Join our Discord server: ${"https://discord.gg/CzfMGtrdaA".blue - }` -} +const prefix = "[DBD-Storage-Handler]"; +const Keyv = require("keyv"); +const { join } = require("path"); class Handler { - constructor(keyvAdapter) { - this.db = new Keyv( - keyvAdapter || `sqlite://${join(__dirname, "/database.sqlite")}` - ) + constructor(keyvAdapter) { + this.db = new Keyv(keyvAdapter || `sqlite://${join(__dirname, "/database.sqlite")}`); - this.db.on("error", (err) => - console.error(`${prefix} ${`Keyv connection error: ${err}`.red}`) - ) + this.db.on("error", (err) => console.error(`${prefix} ${`Keyv connection error: ${err}`.red}`)); - this.Category = require(`${__dirname}/structures/Category`)(this.db) - this.Option = require(`${__dirname}/structures/Option`)(this.db) + this.Category = require(`${__dirname}/structures/Category`)(this.db); + this.Option = require(`${__dirname}/structures/Option`)(this.db); - console.log(`${prefix} Database successfully initialized!`) - } + console.log(`${prefix} Database successfully initialized!`); + } - async fetch(guildId, optionId) { - return await this.db.get(`${guildId}.options.${optionId}`) - } + async fetch(guildId, optionId) { + return await this.db.get(`${guildId}.options.${optionId}`); + } - db() { - return this.db - } + db() { + return this.db; + } } -module.exports = Handler +module.exports = Handler; \ No newline at end of file diff --git a/HandlerIntegration/structures/Category.js b/HandlerIntegration/structures/Category.js index 3f6c279..75c8d1e 100644 --- a/HandlerIntegration/structures/Category.js +++ b/HandlerIntegration/structures/Category.js @@ -1,104 +1,103 @@ -module.exports = (db) => { - return class Category { - constructor( - options = { categoryId: "", categoryName: "", categoryDescription: "" } - ) { - this.categoryId = options.categoryId - this.categoryName = options.categoryName - this.categoryDescription = options.categoryDescription - this.categoryOptionsList = [] +module.exports = db => { + return class Category { + constructor( + options = { + categoryId: "", + categoryName: "", + categoryDescription: "", + }, + ) { + this.categoryId = options.categoryId; + this.categoryName = options.categoryName; + this.categoryDescription = options.categoryDescription; + this.categoryOptionsList = []; - // const db = Handler.getDB() - this.db = db - } + // const db = Handler.getDB() + this.db = db; + } - /** - * - * @param {string} id - The id of the category, must be unique - * @returns - */ - setId(id) { - this.categoryId = id + /** + * + * @param {string} id - The id of the category, must be unique + * @returns + */ + setId(id) { + this.categoryId = id; - return this - } + return this; + } - /** - * - * @param {string} name - The name of the category displayed in the dashboard - * @returns - */ - setName(name) { - this.categoryName = name + /** + * + * @param {string} name - The name of the category displayed in the dashboard + * @returns + */ + setName(name) { + this.categoryName = name; - return this - } + return this; + } - /** - * - * @param {string} description - The description of the category displayed in the dashboard - * @returns - */ - setDescription(description) { - this.categoryDescription = description + /** + * + * @param {string} description - The description of the category displayed in the dashboard + * @returns + */ + setDescription(description) { + this.categoryDescription = description; - return this - } + return this; + } - /** - * - * @param {string} image - Set the image for a Soft UI category, must be a link - * @returns - */ - setImage(image) { - this.categoryImageURL = image + /** + * + * @param {string} image - Set the image for a Soft UI category, must be a link + * @returns + */ + setImage(image) { + this.categoryImageURL = image; - return this - } + return this; + } - /** - * - * @param {boolean} toggleable - Allows Soft UI category to be toggleable - * @returns - */ - setToggleable(toggleable) { - this.toggleable = toggleable + /** + * + * @param {boolean} toggleable - Allows Soft UI category to be toggleable + * @returns + */ + setToggleable(toggleable) { + this.toggleable = toggleable; - this.getActualSet = async ({ guild }) => { - return await this.db.get( - `${guild.id}.categories.${this.categoryId}.toggle` - ) - } + this.getActualSet = async ({ guild }) => { + return await this.db.get(`${guild.id}.categories.${this.categoryId}.toggle`); + }; - this.setNew = async ({ guild, newData }) => { - await this.db.set( - `${guild.id}.categories.${this.categoryId}.toggle`, - newData - ) - } + this.setNew = async ({ guild, newData }) => { + await this.db.set(`${guild.id}.categories.${this.categoryId}.toggle`, newData); + }; - return this - } + return this; + } - /** - * @param {import('./Option')[]} options - The options of the category - * @example - * new Category() - * .setId('setup') - * .setName("Setup") - * .setDescription("Setup your bot with default settings!") - * .addOptions( - * new Option() - * .setId('lang') - * .setName("Language") - * .setDescription("Change bot's language easily") - * .setType(dbd.formTypes.select({"Polish": 'pl', "English": 'en', "French": 'fr'})) - * ) - */ - addOptions() { - this.categoryOptionsList.push(...arguments) + /** + * @param {import('./Option')[]} options - The options of the category + * @example + * new Category() + * .setId('setup') + * .setName("Setup") + * .setDescription("Setup your bot with default settings!") + * .addOptions( + * new Option() + * .setId('lang') + * .setName("Language") + * .setDescription("Change bot's language easily") + * .setType(dbd.formTypes.select({"Polish": 'pl', "English": 'en', "French": 'fr'})) + * ) + */ + addOptions() { + this.categoryOptionsList.push(...arguments); - return this - } - } -} + return this; + } + }; +}; \ No newline at end of file diff --git a/HandlerIntegration/structures/Option.js b/HandlerIntegration/structures/Option.js index 31ff970..a35b782 100644 --- a/HandlerIntegration/structures/Option.js +++ b/HandlerIntegration/structures/Option.js @@ -1,95 +1,88 @@ -const { formTypes } = require("discord-dashboard") +const { formTypes } = require("../../ModuleExportsFunctions/formTypes"); -const ids = [] - -const err = (text) => { - return `🐧${text} Do you need help? Join our Discord server: ${ - "https://discord.gg/CzfMGtrdaA".blue - }` -} +const ids = []; module.exports = (db) => { - return class Option { - constructor( - options = { - optionId: "", - optionName: "", - optionDescription: "", - optionType: formTypes, - } - ) { - // - this.optionId = options.optionId - this.optionName = options.optionName - this.optionDescription = options.optionDescription - this.optionType = options.optionType - - this.categoryId = "default" - - this.setNew = async ({ guild, newData }) => { - await db.set(`${guild.id}.options.${this.optionId}`, newData) - } - - this.getActualSet = async ({ guild }) => { - return await db.get(`${guild.id}.options.${this.optionId}`) - } - } - - /** - * - * @param {string} id - The id of the option, must be unique - * @returns - */ - setId(id) { - this.optionId = id - - if (ids.includes(id)) - throw new Error(err(`Option id ${id} already exists`)) - else ids.push(this.optionId) - - return this - } - - /** - * - * @param {string} name - The name of the option displayed in the dashboard - * @returns - */ - setName(name) { - this.optionName = name - - return this - } - - /** - * - * @param {string} description - The description of the option displayed in the dashboard - * @returns - */ - setDescription(description) { - this.optionDescription = description - - return this - } - - /** - * - * @param {object} options - Set custom options for the formType - * @returns - */ - setOptions(options) { - this.themeOptions = options - } - - /** - * - * @param {formTypes} type - The type of the option - * @returns - */ - setType(type) { - this.optionType = type - - return this - } - } -} + return class Option { + constructor( + options = { + optionId: "", + optionName: "", + optionDescription: "", + optionType: formTypes, + }, + ) { + // + this.optionId = options.optionId; + this.optionName = options.optionName; + this.optionDescription = options.optionDescription; + this.optionType = options.optionType; + + this.categoryId = "default"; + + this.setNew = async ({ guild, newData }) => { + await db.set(`${guild.id}.options.${this.optionId}`, newData); + }; + + this.getActualSet = async ({ guild }) => { + return await db.get(`${guild.id}.options.${this.optionId}`); + }; + } + + /** + * + * @param {string} id - The id of the option, must be unique + * @returns + */ + setId(id) { + this.optionId = id; + + if (ids.includes(id)) throw new Error(`Option id ${id} already exists`); + else ids.push(this.optionId); + + return this; + } + + /** + * + * @param {string} name - The name of the option displayed in the dashboard + * @returns + */ + setName(name) { + this.optionName = name; + + return this; + } + + /** + * + * @param {string} description - The description of the option displayed in the dashboard + * @returns + */ + setDescription(description) { + this.optionDescription = description; + + return this; + } + + /** + * + * @param {object} options - Set custom options for the formType + * @returns + */ + setOptions(options) { + this.themeOptions = options; + } + + /** + * + * @param {formTypes} type - The type of the option + * @returns + */ + setType(type) { + this.optionType = type; + + return this; + } + }; +}; \ No newline at end of file diff --git a/InitFunctions/initServer.js b/InitFunctions/initServer.js index 7808e80..5e809c7 100644 --- a/InitFunctions/initServer.js +++ b/InitFunctions/initServer.js @@ -1,109 +1,51 @@ -const https = require("https") -const http = require("http") -const { Server: SocketServer } = require("socket.io") - -const err = (text) => { - return ( - text + - ` Do you need help? Join our Discord server: ${ - "https://discord.gg/CzfMGtrdaA".blue - }` - ) -} +const https = require("https"); +const http = require("http"); +const { Server: SocketServer } = require("socket.io"); module.exports = (app, config, themeConfig, modules) => { - if (config.noCreateServer) return { io: null, server: null } - let server + if (config.noCreateServer) return { io: null, server: null }; - if (!config.SSL) config.SSL = {} - if (config.SSL.enabled) { - if (!config.SSL.key || !config.SSL.cert) - console.log( - err( - `${ - "discord-dashboard issue:".red - } The SSL preference for Dashboard is selected (config.SSL.enabled), but config does not include key or cert (config.SSL.key, config.SSL.cert).` - ) - ) - let options = { - key: config.SSL.key || "", - cert: config.SSL.cert || "", - } - try { - const https = require("https") - server = https.createServer(options, app) - } catch (e) { - console.log( - err( - `${ - "discord-dashboard issue:".red - } There's a problem while creating server, check if the port specified is already on use.` - ) - ) - } - } else { - const http = require("http") - server = http.createServer(app) - } + let server; - let pport = "" - if (config.port !== 80 && config.port !== 443) { - pport = `:${config.port}` - } + if (!config.SSL) config.SSL = {}; + if (config.SSL.enabled) { + if (!config.SSL.key || !config.SSL.cert) console.log(`${"discord-dashboard issue:".red} The SSL preference for Dashboard is selected (config.SSL.enabled), but config does not include key or cert (config.SSL.key, config.SSL.cert).`); - if (!config.minimizedConsoleLogs) { - console.log( - ` -██████╗ ██████╗ ██████╗ -██╔══██╗██╔══██╗██╔══██╗ -██║ ██║██████╔╝██║ ██║ -██║ ██║██╔══██╗██║ ██║ -██████╔╝██████╔╝██████╔╝ -╚═════╝ ╚═════╝ ╚═════╝ -Discord Bot Dashboard -`.rainbow + - ` -Thanks for using ${ - "discord-dashboard".rainbow - } module! The server is up and running, so head over to the ${ - `${(config.domain || "domain.com") + pport}`.blue - } website and start your fun. + const options = { + key: config.SSL.key || "", + cert: config.SSL.cert || "", + }; -Remember that there are ${ - "themes".rainbow - } available to make the Dashboard look better: ${ - "https://dbd-docs.assistantscenter.com/#/?id=themes".blue - } + try { + server = https.createServer(options, app); + } catch (e) { + console.log(`${"discord-dashboard issue:".red} There's a problem while creating server, check if the port specified is already on use.`); + } + } else { + server = http.createServer(app); + } -If you need help with something or you don't understand something, please visit our ${ - "Discord Support Server".rainbow - }: ${"https://discord.gg/CzfMGtrdaA".blue} -` - ) - } else { - console.log( - `DBD Dashboard running on ${ - `${(config.domain || "domain.com") + pport}`.blue - } !` - ) - } + let pport = ""; + if (config.port != 80 && config.port != 443) pport = `:${config.port}`; - const SocketServer = require("socket.io").Server - const io = new SocketServer(server, { - cors: { - origin: "*", - }, - }) + console.log(`DBD Dashboard running on ${`${(config.domain || "domain.com") + pport}`.blue} !`); - modules.forEach((module) => { - module.server({ - io: io, - server: server, - config: config, - themeConfig: themeConfig, - }) - }) + const io = new SocketServer(server, { + cors: { + origin: "*", + }, + }); - server.listen(config.port) - return { server, io } -} + modules.forEach((module) => { + module.server({ + io: io, + server: server, + config: config, + themeConfig: themeConfig, + }); + }); + + server.listen(config.port); + + return { server, io }; +}; \ No newline at end of file diff --git a/ModuleExportsFunctions/customPagesTypes.js b/ModuleExportsFunctions/customPagesTypes.js index 4aa47a2..c03a87c 100644 --- a/ModuleExportsFunctions/customPagesTypes.js +++ b/ModuleExportsFunctions/customPagesTypes.js @@ -1,23 +1,23 @@ module.exports = { - redirectToUrl: (endpoint, getDataFunction) => { - return { - type: "redirect", - endpoint: endpoint, - getEndpoint: getDataFunction, - } - }, - renderHtml: (endpoint, getDataFunction) => { - return { - type: "html", - endpoint: endpoint, - getHtml: getDataFunction, - } - }, - sendJson: (endpoint, getDataFunction) => { - return { - type: "json", - endpoint: endpoint, - getJson: getDataFunction, - } - }, -} + redirectToUrl: (endpoint, getDataFunction) => { + return { + type: "redirect", + endpoint: endpoint, + getEndpoint: getDataFunction, + }; + }, + renderHtml: (endpoint, getDataFunction) => { + return { + type: "html", + endpoint: endpoint, + getHtml: getDataFunction, + }; + }, + sendJson: (endpoint, getDataFunction) => { + return { + type: "json", + endpoint: endpoint, + getJson: getDataFunction, + }; + }, +}; \ No newline at end of file diff --git a/ModuleExportsFunctions/discordPermissions.js b/ModuleExportsFunctions/discordPermissions.js deleted file mode 100644 index ad2384a..0000000 --- a/ModuleExportsFunctions/discordPermissions.js +++ /dev/null @@ -1,43 +0,0 @@ -module.exports = { - CREATE_INSTANT_INVITE: ["CREATE_INSTANT_INVITE", 0x1], - KICK_MEMBERS: ["KICK_MEMBERS", 0x2], - BAN_MEMBERS: ["BAN_MEMBERS", 0x4], - ADMINISTRATOR: ["ADMINISTRATOR", 0x8], - MANAGE_CHANNELS: ["MANAGE_CHANNELS", 0x10], - MANAGE_GUILD: ["MANAGE_GUILD", 0x20], - ADD_REACTIONS: ["ADD_REACTIONS", 0x40], - VIEW_AUDIT_LOG: ["VIEW_AUDIT_LOG", 0x80], - PRIORITY_SPEAKER: ["PRIORITY_SPEAKER", 0x100], - STREAM: ["STREAM", 0x200], - VIEW_CHANNEL: ["VIEW_CHANNEL", 0x400], - SEND_MESSAGES: ["SEND_MESSAGES", 0x800], - SEND_TTS_MESSAGES: ["SEND_TTS_MESSAGES", 0x1000], - MANAGE_MESSAGES: ["MANAGE_MESSAGES", 0x2000], - EMBED_LINKS: ["EMBED_LINKS", 0x4000], - ATTACH_FILES: ["ATTACH_FILES", 0x8000], - READ_MESSAGE_HISTORY: ["READ_MESSAGE_HISTORY", 0x10000], - MENTION_EVERYONE: ["MENTION_EVERYONE", 0x20000], - USE_EXTERNAL_EMOJIS: ["USE_EXTERNAL_EMOJIS", 0x40000], - VIEW_GUILD_INSIGHTS: ["VIEW_GUILD_INSIGHTS", 0x80000], - CONNECT: ["CONNECT", 0x100000], - SPEAK: ["SPEAK", 0x200000], - MUTE_MEMBERS: ["MUTE_MEMBERS", 0x400000], - DEAFEN_MEMBERS: ["DEAFEN_MEMBERS", 0x800000], - MOVE_MEMBERS: ["MOVE_MEMBERS", 0x1000000], - USE_VAD: ["USE_VAD", 0x2000000], - CHANGE_NICKNAME: ["CHANGE_NICKNAME", 0x4000000], - MANAGE_NICKNAMES: ["MANAGE_NICKNAMES", 0x8000000], - MANAGE_ROLES: ["MANAGE_ROLES", 0x10000000], - MANAGE_WEBHOOKS: ["MANAGE_WEBHOOKS", 0x20000000], - MANAGE_EMOJIS_AND_STICKERS: ["MANAGE_EMOJIS_AND_STICKERS", 0x40000000], - USE_APPLICATION_COMMANDS: ["USE_APPLICATION_COMMANDS", 0x80000000], - REQUEST_TO_SPEAK: ["REQUEST_TO_SPEAK", 0x100000000], - MANAGE_EVENTS: ["MANAGE_EVENTS", 0x200000000], - MANAGE_THREADS: ["MANAGE_THREADS", 0x400000000], - CREATE_PUBLIC_THREADS: ["CREATE_PUBLIC_THREADS", 0x800000000], - CREATE_PRIVATE_THREADS: ["CREATE_PRIVATE_THREADS", 0x1000000000], - USE_EXTERNAL_STICKERS: ["USE_EXTERNAL_STICKERS", 0x2000000000], - SEND_MESSAGES_IN_THREADS: ["SEND_MESSAGES_IN_THREADS", 0x4000000000], - START_EMBEDDED_ACTIVITIES: ["START_EMBEDDED_ACTIVITIES", 0x8000000000], - MODERATE_MEMBERS: ["MODERATE_MEMBERS", 0x10000000000], -} diff --git a/ModuleExportsFunctions/formTypes.js b/ModuleExportsFunctions/formTypes.js index ad07573..519a56d 100644 --- a/ModuleExportsFunctions/formTypes.js +++ b/ModuleExportsFunctions/formTypes.js @@ -1,346 +1,294 @@ -const discordPermissions = require("./discordPermissions") +const { Permissions } = require("discord.js"); module.exports = { - select: (list, disabled, themeOptions = {}) => { - if (!list) - throw new Error( - err("List in the 'select' form type cannot be empty.") - ) - if (typeof list != "object") - throw new Error( - err("List in the 'select' form type should be an JSON object.") - ) - let keys = Object.keys(list) - let values = Object.values(list) - return { - type: "select", - data: { - keys, - values, - }, - disabled: disabled || false, - themeOptions, - } - }, - multiSelect: (list, disabled, required, themeOptions = {}) => { - if (!list) - throw new Error( - err("List in the 'select' form type cannot be empty.") - ) - if (typeof list != "object") - throw new Error( - err("List in the 'select' form type should be an JSON object.") - ) - let keys = Object.keys(list) - let values = Object.values(list) - return { - type: "multiSelect", - data: { - keys, - values, - }, - disabled: disabled || false, - required: required || false, - themeOptions, - } - }, - input: (placeholder, min, max, disabled, required, themeOptions = {}) => { - if (min) { - if (isNaN(min)) - throw new Error( - err("'min' in the 'input' form type should be an number.") - ) - } - if (max) { - if (isNaN(max)) - throw new Error( - err("'max' in the 'input' form type should be an number.") - ) - } - if (min && max) { - if (min > max) - throw new Error( - err( - "'min' in the 'input' form type cannot be higher than 'max'." - ) - ) - } - return { - type: "input", - data: placeholder, - min: min || null, - max: max || null, - disabled: disabled || false, - required: required || false, - themeOptions, - } - }, - textarea: ( - placeholder, - min, - max, - disabled, - required, - themeOptions = {} - ) => { - if (min) { - if (isNaN(min)) - throw new Error( - err("'min' in the 'input' form type should be an number.") - ) - } - if (max) { - if (isNaN(max)) - throw new Error( - err("'max' in the 'input' form type should be an number.") - ) - } - if (min && max) { - if (min > max) - throw new Error( - err( - "'min' in the 'input' form type cannot be higher than 'max'." - ) - ) - } - return { - type: "textarea", - data: placeholder, - min: min || null, - max: max || null, - disabled: disabled || false, - required: required || false, - themeOptions, - } - }, - switch: (disabled, themeOptions = {}) => { - return { - type: "switch", - disabled: disabled, - themeOptions, - } - }, - checkbox: (disabled, themeOptions = {}) => { - return { - type: "checkbox", - disabled: disabled, - themeOptions, - } - }, - channelsSelect: ( - disabled, - channelTypes = ["GUILD_TEXT"], - hideNSFW, - onlyNSFW, - hideNoAccess, - themeOptions = {} - ) => { - return { - type: "channelsSelect", - function: (client, guildid, userid) => { - let listCount = {} - let list = { - "-": "", - } - const guild = client.guilds.cache.get(guildid) - const user = guild.members.cache.get(userid) - const bot = guild.members.cache.get(client.user.id) - client.guilds.cache - .get(guildid) - .channels.cache.forEach((channel) => { - if (!channelTypes.includes(channel.type)) return - if (hideNSFW && channel.nsfw) return - if (onlyNSFW && !channel.nsfw) return - if (hideNoAccess) { - if (!user.permissionsIn(channel).has('0x800') || !user.permissionsIn(channel).has('0x400')) return - if (!bot.permissionsIn(channel).has('0x800') || !bot.permissionsIn(channel).has('0x800')) return - } - listCount[channel.name] - ? (listCount[channel.name] = - listCount[channel.name] + 1) - : (listCount[channel.name] = 1) - if (list[channel.name]) - list[ - `${channel.name} (${listCount[channel.name]})` - ] = channel.id - else list[channel.name] = channel.id - }) + select: (list, disabled, themeOptions = {}) => { + if (!list) throw new Error(console.log("List in the 'select' form type cannot be empty.")); + if (typeof list != "object") throw new Error(console.log("List in the 'select' form type should be an JSON object.")); - let myObj = list - let keys = Object.keys(myObj), - i = null, - len = keys.length + const keys = Object.keys(list); + const values = Object.values(list); - keys.sort() - list = {} + return { + type: "select", + data: { + keys, + values, + }, + disabled: disabled || false, + themeOptions, + }; + }, + multiSelect: (list, disabled, required, themeOptions = {}) => { + if (!list) throw new Error(console.log("List in the 'select' form type cannot be empty.")); + if (typeof list != "object") throw new Error(console.log("List in the 'select' form type should be an JSON object.")); - for (i = 0; i < len; i++) { - k = keys[i] - list[k] = myObj[k] - } + const keys = Object.keys(list); + const values = Object.values(list); - return { - values: Object.values(list), - keys: Object.keys(list), - } - }, - disabled, - themeOptions, - } - }, - channelsMultiSelect: ( - disabled, - required, - channelTypes = ["GUILD_TEXT"], - hideNSFW, - onlyNSFW, - hideNoAccess, - themeOptions = {} - ) => { - return { - type: "channelsMultiSelect", - function: (client, guildid, userid) => { - let listCount = {} - let list = {} - const guild = client.guilds.cache.get(guildid) - const user = guild.members.cache.get(userid) - const bot = guild.members.cache.get(client.user.id) - client.guilds.cache - .get(guildid) - .channels.cache.forEach((channel) => { - if (!channelTypes.includes(channel.type)) return - if (hideNSFW && channel.nsfw) return - if (onlyNSFW && !channel.nsfw) return - if (hideNoAccess) { - if (!user.permissionsIn(channel).has('0x800') || !user.permissionsIn(channel).has('0x400')) return - if (!bot.permissionsIn(channel).has('0x800') || !bot.permissionsIn(channel).has('0x800')) return - } - listCount[channel.name] - ? (listCount[channel.name] = - listCount[channel.name] + 1) - : (listCount[channel.name] = 1) - if (list[channel.name]) - list[ - `${channel.name} (${listCount[channel.name]})` - ] = channel.id - else list[channel.name] = channel.id - }) + return { + type: "multiSelect", + data: { + keys, + values, + }, + disabled: disabled || false, + required: required || false, + themeOptions, + }; + }, + input: (placeholder, min, max, disabled, required, themeOptions = {}) => { + if (min && isNaN(min)) throw new Error(console.log("'min' in the 'input' form type should be an number.")); + if (max && isNaN(max)) throw new Error(console.log("'max' in the 'input' form type should be an number.")); + if ((min && max) && (min > max)) throw new Error(console.log("'min' in the 'input' form type cannot be higher than 'max'.")); - let myObj = list - let keys = Object.keys(myObj), - i = null, - len = keys.length + return { + type: "input", + data: placeholder, + min: min || null, + max: max || null, + disabled: disabled || false, + required: required || false, + themeOptions, + }; + }, + textarea: (placeholder, min, max, disabled, required, themeOptions = {}) => { + if (min && isNaN(min)) throw new Error(console.log("'min' in the 'input' form type should be an number.")); + if (max && isNaN(max)) throw new Error(console.log("'max' in the 'input' form type should be an number.")); + if ((min && max) && (min > max)) throw new Error(console.log("'min' in the 'input' form type cannot be higher than 'max'.")); - keys.sort() - list = {} + return { + type: "textarea", + data: placeholder, + min: min || null, + max: max || null, + disabled: disabled || false, + required: required || false, + themeOptions, + }; + }, + switch: (disabled, themeOptions = {}) => { + return { + type: "switch", + disabled: disabled, + themeOptions, + }; + }, + checkbox: (disabled, themeOptions = {}) => { + return { + type: "checkbox", + disabled: disabled, + themeOptions, + }; + }, + channelsSelect: (disabled, channelTypes = ["GUILD_TEXT"], hideNSFW, onlyNSFW, hideNoAccess, themeOptions = {}) => { + return { + type: "channelsSelect", + function: (client, guildid, userid) => { + const listCount = {}; + let list = { + "-": "", + }; - for (i = 0; i < len; i++) { - k = keys[i] - list[k] = myObj[k] - } + const guild = client.guilds.cache.get(guildid), + user = guild.members.cache.get(userid), + bot = guild.members.cache.get(client.user.id); - return { - values: Object.values(list), - keys: Object.keys(list), - } - }, - disabled, - required, - themeOptions, - } - }, - rolesMultiSelect: (disabled, required, includeBots, hideHigherRoles, themeOptions = {}) => { - return { - type: "rolesMultiSelect", - function: (client, guildid, userid) => { - let listCount = {} - const list = [] - const guild = client.guilds.cache.get(guildid) - const user = guild.members.cache.get(userid) - const bot = guild.members.cache.get(client.user.id) + client.guilds.cache.get(guildid).channels.cache.forEach((channel) => { + if (!channelTypes.includes(channel.type)) return; + if (hideNSFW && channel.nsfw) return; + if (onlyNSFW && !channel.nsfw) return; + if (hideNoAccess) { + if (!user.permissionsIn(channel).has(Permissions.FLAGS.SEND_MESSAGES) || !user.permissionsIn(channel).has(Permissions.FLAGS.VIEW_CHANNEL)) return; + if (!bot.permissionsIn(channel).has(Permissions.FLAGS.SEND_MESSAGES) || !bot.permissionsIn(channel).has(Permissions.FLAGS.SEND_MESSAGES)) return; + } - client.guilds.cache.get(guildid).roles.cache.forEach((role) => { - if (role.managed && !includeBots) return - if (role.id === guildid) return // @everyone role - if (hideHigherRoles) { - if (role.position >= user.roles.highest.position) return - if (role.position >= bot.roles.highest.position) return - } - listCount[role.name] - ? (listCount[role.name] = listCount[role.name] + 1) - : (listCount[role.name] = 1) - if (listCount[role.name] > 1) - list.push({ key: `${role.name} (${listCount[role.name]})`, value: role.id, position: role.position }) - else list.push({ key: role.name, value: role.id, position: role.position }) - }) + listCount[channel.name] ? (listCount[channel.name] = listCount[channel.name] + 1) : (listCount[channel.name] = 1); - list.sort((a, b) => b.position - a.position) + if (list[channel.name]) list[`${channel.name} (${listCount[channel.name]})`] = channel.id; + else list[channel.name] = channel.id; + }); - const sortedList = {} - list.forEach(({ key, value }) => (sortedList[key] = value)) + const myObj = list; + let i = null; + const keys = Object.keys(myObj), + len = keys.length; - return { - values: Object.values(sortedList), - keys: Object.keys(sortedList), - } - }, - disabled, - required, - themeOptions, - } - }, - rolesSelect: (disabled, includeBots, hideHigherRoles, themeOptions = {}) => { - return { - type: "rolesSelect", - function: (client, guildid, userid) => { - let listCount = {} - const list = [{ key: '-', value: '' }] - const guild = client.guilds.cache.get(guildid) - const user = guild.members.cache.get(userid) - const bot = guild.members.cache.get(client.user.id) - client.guilds.cache.get(guildid).roles.cache.forEach((role) => { - if (role.managed && !includeBots) return - if (role.id === guildid) return // @everyone role - if (hideHigherRoles) { - if (role.position >= user.roles.highest.position) return - if (role.position >= bot.roles.highest.position) return - } - listCount[role.name] - ? (listCount[role.name] = listCount[role.name] + 1) - : (listCount[role.name] = 1) - if (listCount[role.name] > 1) - list.push({ key: `${role.name} (${listCount[role.name]})`, value: role.id, position: role.position }) - else list.push({ key: role.name, value: role.id, position: role.position }) - }) + keys.sort(); + list = {}; - list.sort((a, b) => b.position - a.position) + for (i = 0; i < len; i++) { + const k = keys[i]; + list[k] = myObj[k]; + } - const sortedList = {} - list.forEach(({ key, value }) => (sortedList[key] = value)) + return { + values: Object.values(list), + keys: Object.keys(list), + }; + }, + disabled, + themeOptions, + }; + }, + channelsMultiSelect: (disabled, required, channelTypes = ["GUILD_TEXT"], hideNSFW, onlyNSFW, hideNoAccess, themeOptions = {}) => { + return { + type: "channelsMultiSelect", + function: (client, guildid, userid) => { + const listCount = {}; + let list = {}; + const guild = client.guilds.cache.get(guildid); + const user = guild.members.cache.get(userid); + const bot = guild.members.cache.get(client.user.id); - return { - values: Object.values(sortedList), - keys: Object.keys(sortedList), - } - }, - disabled, - themeOptions, - } - }, - colorSelect: (defaultState, disabled, themeOptions = {}) => { - return { - type: "colorSelect", - data: defaultState, - disabled, - themeOptions, - } - }, - embedBuilder: (defaultSettings, disabled, themeOptions = {}) => { - return { - type: "embedBuilder", - data: defaultSettings, - disabled, - themeOptions, - } - }, -} + client.guilds.cache.get(guildid).channels.cache.forEach(channel => { + if (!channelTypes.includes(channel.type)) return; + if (hideNSFW && channel.nsfw) return; + if (onlyNSFW && !channel.nsfw) return; + if (hideNoAccess) { + if (!user.permissionsIn(channel).has(Permissions.FLAGS.SEND_MESSAGES) || !user.permissionsIn(channel).has(Permissions.FLAGS.VIEW_CHANNEL)) return; + if (!bot.permissionsIn(channel).has(Permissions.FLAGS.SEND_MESSAGES) || !bot.permissionsIn(channel).has(Permissions.FLAGS.SEND_MESSAGES)) return; + } + listCount[channel.name] ? (listCount[channel.name] = listCount[channel.name] + 1) : (listCount[channel.name] = 1); + + if (list[channel.name]) list[`${channel.name} (${listCount[channel.name]})`] = channel.id; + else list[channel.name] = channel.id; + }); + + const myObj = list; + let i = null; + const keys = Object.keys(myObj), + len = keys.length; + + keys.sort(); + list = {}; + + for (i = 0; i < len; i++) { + const k = keys[i]; + list[k] = myObj[k]; + } + + return { + values: Object.values(list), + keys: Object.keys(list), + }; + }, + disabled, + required, + themeOptions, + }; + }, + rolesMultiSelect: (disabled, required, includeBots, hideHigherRoles, themeOptions = {}) => { + return { + type: "rolesMultiSelect", + function: (client, guildid, userid) => { + const listCount = {}; + const list = []; + const guild = client.guilds.cache.get(guildid); + const user = guild.members.cache.get(userid); + const bot = guild.members.cache.get(client.user.id); + + client.guilds.cache.get(guildid).roles.cache.forEach((role) => { + if (role.managed && !includeBots) return; + if (role.id === guildid) return; // @everyone role + if (hideHigherRoles) { + if (role.position >= user.roles.highest.position) return; + if (role.position >= bot.roles.highest.position) return; + } + + listCount[role.name] ? (listCount[role.name] = listCount[role.name] + 1) : (listCount[role.name] = 1); + + if (listCount[role.name] > 1) + list.push({ + key: `${role.name} (${listCount[role.name]})`, + value: role.id, + position: role.position, + }); + else list.push({ + key: role.name, + value: role.id, + position: role.position, + }); + }); + + list.sort((a, b) => b.position - a.position); + + const sortedList = {}; + + list.forEach(({ key, value }) => (sortedList[key] = value)); + + return { + values: Object.values(sortedList), + keys: Object.keys(sortedList), + }; + }, + disabled, + required, + themeOptions, + }; + }, + rolesSelect: (disabled, includeBots, hideHigherRoles, themeOptions = {}) => { + return { + type: "rolesSelect", + function: (client, guildid, userid) => { + const listCount = {}; + const list = [{ + key: "-", + value: "", + }]; + const guild = client.guilds.cache.get(guildid); + const user = guild.members.cache.get(userid); + const bot = guild.members.cache.get(client.user.id); + client.guilds.cache.get(guildid).roles.cache.forEach((role) => { + if (role.managed && !includeBots) return; + if (role.id === guildid) return; // @everyone role + if (hideHigherRoles) { + if (role.position >= user.roles.highest.position) return; + if (role.position >= bot.roles.highest.position) return; + } + + listCount[role.name] ? (listCount[role.name] = listCount[role.name] + 1) : (listCount[role.name] = 1); + + if (listCount[role.name] > 1) + list.push({ + key: `${role.name} (${listCount[role.name]})`, + value: role.id, + position: role.position, + }); + else list.push({ + key: role.name, + value: role.id, + position: role.position, + }); + }); + + list.sort((a, b) => b.position - a.position); + + const sortedList = {}; + list.forEach(({ key, value }) => (sortedList[key] = value)); + + return { + values: Object.values(sortedList), + keys: Object.keys(sortedList), + }; + }, + disabled, + themeOptions, + }; + }, + colorSelect: (defaultState, disabled, themeOptions = {}) => { + return { + type: "colorSelect", + data: defaultState, + disabled, + themeOptions, + }; + }, + embedBuilder: (defaultSettings, disabled, themeOptions = {}) => { + return { + type: "embedBuilder", + data: defaultSettings, + disabled, + themeOptions, + }; + }, +}; \ No newline at end of file diff --git a/Routes/dashboard.js b/Routes/dashboard.js index 6074d71..525725e 100644 --- a/Routes/dashboard.js +++ b/Routes/dashboard.js @@ -1,888 +1,566 @@ -const { PermissionFlagsBits } = require("discord.js") -const Discord = require("discord.js") -const router = require("express").Router() +const router = require("express").Router(), + RL = require("express-rate-limit"); module.exports = (app, config, themeConfig) => { - const RL = require("express-rate-limit") - const RateLimits = config.rateLimits || {} - let RateFunctions = {} + const RateLimits = config.rateLimits || {}; + const RateFunctions = {}; - const NoRL = (req, res, next) => next() + const NoRL = (req, res, next) => next(); - if (RateLimits.manage) { - RateFunctions.manage = RL.rateLimit({ - windowMs: RateLimits.manage.windowMs, - max: RateLimits.manage.max, - message: RateLimits.manage.message, - store: RateLimits.manage.store || new RL.MemoryStore(), - }) - } + if (RateLimits.manage) { + RateFunctions.manage = RL.rateLimit({ + windowMs: RateLimits.manage.windowMs, + max: RateLimits.manage.max, + message: RateLimits.manage.message, + store: RateLimits.manage.store || new RL.MemoryStore(), + }); + } - if (RateLimits.guildPage) { - RateFunctions.guildPage = RL.rateLimit({ - windowMs: RateLimits.guildPage.windowMs, - max: RateLimits.guildPage.max, - message: RateLimits.guildPage.message, - store: RateLimits.guildPage.store || new RL.MemoryStore(), - }) - } + if (RateLimits.guildPage) { + RateFunctions.guildPage = RL.rateLimit({ + windowMs: RateLimits.guildPage.windowMs, + max: RateLimits.guildPage.max, + message: RateLimits.guildPage.message, + store: RateLimits.guildPage.store || new RL.MemoryStore(), + }); + } - if (RateLimits.settingsUpdatePostAPI) { - RateFunctions.settingsUpdatePostAPI = RL.rateLimit({ - windowMs: RateLimits.settingsUpdatePostAPI.windowMs, - max: RateLimits.settingsUpdatePostAPI.max, - message: RateLimits.settingsUpdatePostAPI.message, - store: - RateLimits.settingsUpdatePostAPI.store || new RL.MemoryStore(), - }) - } + if (RateLimits.settingsUpdatePostAPI) { + RateFunctions.settingsUpdatePostAPI = RL.rateLimit({ + windowMs: RateLimits.settingsUpdatePostAPI.windowMs, + max: RateLimits.settingsUpdatePostAPI.max, + message: RateLimits.settingsUpdatePostAPI.message, + store: RateLimits.settingsUpdatePostAPI.store || new RL.MemoryStore(), + }); + } - router.get( - "/manage", - RateFunctions.manage ? RateFunctions.manage : NoRL, - async (req, res) => { - if (!req.session.user) return res.redirect("/discord?r=/manage") - let customThemeOptions - if (themeConfig?.customThemeOptions?.manage) { - customThemeOptions = - await themeConfig.customThemeOptions.manage({ - req: req, - res: res, - config: config, - }) - } - res.render("guilds", { - req: req, - bot: config.bot, - themeConfig: req.themeConfig, - customThemeOptions: customThemeOptions || {}, - config, - }) - } - ) + router.get("/manage", RateFunctions.manage ? RateFunctions.manage : NoRL, async (req, res) => { + if (!req.session.user) return res.redirect("/discord?r=/manage"); - router.get( - "/guild/:id", - RateFunctions.guildPage ? RateFunctions.guildPage : NoRL, - async (req, res) => { - res.redirect("/settings/" + req.params.id) + let customThemeOptions; + if (themeConfig?.customThemeOptions?.manage) { + customThemeOptions = await themeConfig.customThemeOptions.manage({ + req: req, + res: res, + config: config, + }); + } - if (!req.session.user) - return res.redirect("/discord?r=/guild/" + req.params.id) - let customThemeOptions - if (themeConfig?.customThemeOptions?.getGuild) { - customThemeOptions = - await themeConfig.customThemeOptions.getGuild({ - req: req, - res: res, - config: config, - guildId: req.params.id, - }) - } - let bot = config.bot - if (!bot.guilds.cache.get(req.params.id)) { - try { - await bot.guilds.fetch(req.params.id) - } catch (err) { } - } + res.render("guilds", { + req: req, + bot: config.bot, + themeConfig: req.themeConfig, + customThemeOptions: customThemeOptions || {}, + config, + }); + }); - if (!bot.guilds.cache.get(req.params.id)) - return res.redirect("/manage?error=noPermsToManageGuild") - if ( - !bot.guilds.cache - .get(req.params.id) - .members.cache.get(req.session.user.id) - ) { - try { - await bot.guilds.cache - .get(req.params.id) - .members.fetch(req.session.user.id) - } catch (err) { } - } - for (let PermissionRequired of req.requiredPermissions) { - let converted = PermissionRequired[0] - const DiscordJsVersion = Discord.version.split(".")[0] + router.get("/guild/:id", RateFunctions.guildPage ? RateFunctions.guildPage : NoRL, async (req, res) => { + res.redirect("/settings/" + req.params.id); - if (DiscordJsVersion === "14") - converted = convert14(PermissionRequired[0]) + if (!req.session.user) return res.redirect("/discord?r=/guild/" + req.params.id); - if ( - !bot.guilds.cache - .get(req.params.id) - .members.cache.get(req.session.user.id) - .permissions.has(converted) - ) - return res.redirect("/manage?error=noPermsToManageGuild") - } + let customThemeOptions; + if (themeConfig?.customThemeOptions?.getGuild) { + customThemeOptions = + await themeConfig.customThemeOptions.getGuild({ + req: req, + res: res, + config: config, + guildId: req.params.id, + }); + } - if (bot.guilds.cache.get(req.params.id).channels.cache.size < 1) { - try { - await bot.guilds.cache.get(req.params.id).channels.fetch() - } catch (err) { } - } + const bot = config.bot; + if (!bot.guilds.cache.get(req.params.id)) { + try { + await bot.guilds.fetch(req.params.id); + } catch (e) { /* ... */ } + } - if (bot.guilds.cache.get(req.params.id).roles.cache.size < 2) { - try { - await bot.guilds.cache.get(req.params.id).roles.fetch() - } catch (err) { } - } + if (!bot.guilds.cache.get(req.params.id)) return res.redirect("/manage?error=noPermsToManageGuild"); + if (!bot.guilds.cache.get(req.params.id).members.cache.get(req.session.user.id)) { + try { + await bot.guilds.cache.get(req.params.id).members.fetch(req.session.user.id); + } catch (e) { /* ... */ } + } - let actual = {} + // for (const PermissionRequired of req.requiredPermissions) { + // const permissionsReq = PermissionRequired[0]; - let canUseList = {} - if (!config.useCategorySet) - for (const s of config.settings) { - if (!canUseList[s.categoryId]) canUseList[s.categoryId] = {} - for (const c of s.categoryOptionsList) { - if (c.allowedCheck) { - const canUse = await c.allowedCheck({ - guild: { id: req.params.id }, - user: { id: req.session.user.id }, - }) - if (typeof canUse != "object") - throw new TypeError( - `${s.categoryId} category option with id ${c.optionId} allowedCheck function need to return {allowed: Boolean, errorMessage: String | null}` - ) - canUseList[s.categoryId][c.optionId] = canUse - } else { - canUseList[s.categoryId][c.optionId] = { - allowed: true, - errorMessage: null, - } - } + // if (!bot.guilds.cache.get(req.params.id).members.cache.get(req.session.user.id).permissions.has(permissionsReq)) return res.redirect("/manage?error=noPermsToManageGuild"); + // } - if (c.optionType == "spacer") { - } else { - if (!actual[s.categoryId]) { - actual[s.categoryId] = {} - } - if (!actual[s.categoryId][c.optionId]) { - actual[s.categoryId][c.optionId] = - await c.getActualSet({ - guild: { - id: req.params.id, - object: bot.guilds.cache.get( - req.params.id - ), - }, - user: { - id: req.session.user.id, - object: bot.guilds.cache - .get(req.params.id) - .members.cache.get( - req.session.user.id - ), - }, - }) - } - } - } - } - else - for (const category of config.settings) { - if (!canUseList[category.categoryId]) - canUseList[category.categoryId] = {} - const catGAS = await category.getActualSet({ - guild: { - id: req.params.id, - object: bot.guilds.cache.get(req.params.id), - }, - user: { - id: req.session.user.id, - object: bot.guilds.cache - .get(req.params.id) - .members.cache.get(req.session.user.id), - }, - }) + if (bot.guilds.cache.get(req.params.id).channels.cache.size < 1) { + try { + await bot.guilds.cache.get(req.params.id).channels.fetch(); + } catch (e) { /* ... */ } + } - for (const o of catGAS) { - if (!o || !o?.optionId) - console.log( - "WARNING: You haven't set the optionId for a category option in your config. This is required for the category option to work." - ) - else { - const option = category.categoryOptionsList.find( - (c) => c.optionId == o.optionId - ) - if (option) { - if (option.allowedCheck) { - const canUse = await option.allowedCheck({ - guild: { - id: req.params.id, - }, - user: { - id: req.session.user.id, - }, - }) - if (typeof canUse != "object") - throw new TypeError( - `${category.categoryId} category option with id ${option.optionId} allowedCheck function need to return {allowed: Boolean, errorMessage: String | null}` - ) - canUseList[category.categoryId][ - option.optionId - ] = canUse - } else { - canUseList[category.categoryId][ - option.optionId - ] = { - allowed: true, - errorMessage: null, - } - } + if (bot.guilds.cache.get(req.params.id).roles.cache.size < 2) { + try { + await bot.guilds.cache.get(req.params.id).roles.fetch(); + } catch (e) { /* ... */ } + } - if (option.optionType !== "spacer") { - if (!actual[category.categoryId]) { - actual[category.categoryId] = {} - } - if ( - !actual[category.categoryId][ - option.optionId - ] - ) { - actual[category.categoryId][ - option.optionId - ] = o.data - } - } - } else - console.log( - `WARNING: Option ${o.optionId} in category ${category.categoryId} doesn't exist in your config.` - ) - } - } - } + const actual = {}; + const canUseList = {}; - let errors - let success + if (!config.useCategorySet) + for (const s of config.settings) { + if (!canUseList[s.categoryId]) canUseList[s.categoryId] = {}; + for (const c of s.categoryOptionsList) { + if (c.allowedCheck) { + const canUse = await c.allowedCheck({ + guild: { id: req.params.id }, + user: { id: req.session.user.id }, + }); - if (req.session.errors) { - if (String(req.session.errors).includes("%is%")) { - errors = req.session.errors.split("%and%") - } - } + if (typeof canUse != "object") throw new TypeError(`${s.categoryId} category option with id ${c.optionId} allowedCheck function need to return {allowed: Boolean, errorMessage: String | null}`); - if (req.session.success) { - if (typeof req.session.success == "boolean") { - success = true - } else { - if (String(req.session.success).includes("%is%")) { - success = req.session.success.split("%and%") - } - } - } + canUseList[s.categoryId][c.optionId] = canUse; + } else { + canUseList[s.categoryId][c.optionId] = { + allowed: true, + errorMessage: null, + }; + } - req.session.errors = null - req.session.success = null + if (c.optionType == "spacer") { /* ... */ } else { + if (!actual[s.categoryId]) actual[s.categoryId] = {}; - res.render("guild", { - successes: success, - errors: errors, - settings: config.settings, - actual: actual, - canUseList, - bot: config.bot, - req: req, - guildid: req.params.id, - themeConfig: req.themeConfig, - customThemeOptions: customThemeOptions || {}, - config, - }) - } - ) + if (!actual[s.categoryId][c.optionId]) { + actual[s.categoryId][c.optionId] = + await c.getActualSet({ + guild: { + id: req.params.id, + object: bot.guilds.cache.get(req.params.id), + }, + user: { + id: req.session.user.id, + object: bot.guilds.cache.get(req.params.id).members.cache.get(req.session.user.id), + }, + }); + } + } + } + } + else + for (const category of config.settings) { + if (!canUseList[category.categoryId]) canUseList[category.categoryId] = {}; - router.post( - "/settings/update/:guildId/:categoryId", - RateFunctions.settingsUpdatePostAPI - ? RateFunctions.settingsUpdatePostAPI - : NoRL, - async (req, res) => { - if (!req.session.user) - return res.redirect("/discord?r=/guild/" + req.params.guildId) + const catGAS = await category.getActualSet({ + guild: { + id: req.params.id, + object: bot.guilds.cache.get(req.params.id), + }, + user: { + id: req.session.user.id, + object: bot.guilds.cache.get(req.params.id).members.cache.get(req.session.user.id), + }, + }); - let customThemeOptions - if (themeConfig?.customThemeOptions?.settingsUpdate) { - customThemeOptions = - await themeConfig.customThemeOptions.settingsUpdate({ - req: req, - config: config, - guildId: req.params.id, - categoryId: req.params.categoryId, - }) - } - let bot = config.bot + for (const o of catGAS) { + if (!o || !o?.optionId) console.log("WARNING: You haven't set the optionId for a category option in your config. This is required for the category option to work."); + else { + const option = category.categoryOptionsList.find((c) => c.optionId == o.optionId); - if (!bot.guilds.cache.get(req.params.guildId)) - return res.redirect("/manage?error=noPermsToManageGuild") - await bot.guilds.cache - .get(req.params.guildId) - .members.fetch(req.session.user.id) - for (let PermissionRequired of req.requiredPermissions) { - let converted2 = PermissionRequired[0] - const DiscordJsVersion2 = Discord.version.split(".")[0] + if (option) { + if (option.allowedCheck) { + const canUse = await option.allowedCheck({ + guild: { id: req.params.id }, + user: { id: req.session.user.id }, + }); - if (DiscordJsVersion2 === "14") - converted2 = await convert14(PermissionRequired[0]) + if (typeof canUse != "object") throw new TypeError(`${category.categoryId} category option with id ${option.optionId} allowedCheck function need to return {allowed: Boolean, errorMessage: String | null}`); - if ( - !bot.guilds.cache - .get(req.params.guildId) - .members.cache.get(req.session.user.id) - .permissions.has(converted2) - ) - return res.redirect("/manage?error=noPermsToManageGuild") - } + canUseList[category.categoryId][option.optionId] = canUse; + } else { + canUseList[category.categoryId][option.optionId] = { + allowed: true, + errorMessage: null, + }; + } - let cid = req.params.categoryId - let settings = config.settings + if (option.optionType !== "spacer") { + if (!actual[category.categoryId]) actual[category.categoryId] = {}; - let category = settings.find((c) => c.categoryId == cid) + if (!actual[category.categoryId][option.optionId]) + actual[category.categoryId][option.optionId] = o.data; + } + } else + console.log(`WARNING: Option ${o.optionId} in category ${category.categoryId} doesn't exist in your config.`); + } + } + } - if (!category) - return res.send({ - error: true, - message: "No category found", - }) + let errors; + let success; - let setNewRes - let errors = [] - let successes = [] - let catO = [] + if (req.session.errors) + if (String(req.session.errors).includes("%is%")) { + errors = req.session.errors.split("%and%"); + } - const userGuildMemberObject = bot.guilds.cache - .get(req.params.guildId) - .members.cache.get(req.session.user.id) - const guildObject = bot.guilds.cache.get(req.params.guildId) + if (req.session.success) { + if (typeof req.session.success == "boolean") { + success = true; + } else { + if (String(req.session.success).includes("%is%")) + success = req.session.success.split("%and%"); + } + } - for (let option of category.categoryOptionsList) { - let canUse = {} + req.session.errors = null; + req.session.success = null; - if (option.allowedCheck) { - canUse = await option.allowedCheck({ - guild: { id: req.params.guildId }, - user: { id: req.session.user.id }, - }) - } else { - canUse = { allowed: true, errorMessage: null } - } + res.render("guild", { + successes: success, + errors: errors, + settings: config.settings, + actual: actual, + canUseList, + bot: config.bot, + req: req, + guildid: req.params.id, + themeConfig: req.themeConfig, + customThemeOptions: customThemeOptions || {}, + config, + }); + }); - if (canUse.allowed == false) { - setNewRes = { error: canUse.errorMessage } - errors.push( - option.optionName + - "%is%" + - setNewRes.error + - "%is%" + - option.optionId - ) - } else if (option.optionType != "spacer") { - if (config.useCategorySet) { - if ( - option.optionType.type == "rolesMultiSelect" || - option.optionType.type == "channelsMultiSelect" || - option.optionType.type == "multiSelect" - ) { - if ( - !req.body[option.optionId] || - req.body[option.optionId] == null || - req.body[option.optionId] == undefined - ) - catO.push({ - optionId: option.optionId, - data: [], - }) - else if ( - typeof req.body[option.optionId] != "object" - ) - catO.push({ - optionId: option.optionId, - data: [req.body[option.optionId]], - }) - else - catO.push({ - optionId: option.optionId, - data: req.body[option.optionId], - }) - } else if (option.optionType.type == "switch") { - if ( - req.body[option.optionId] || - req.body[option.optionId] == null || - req.body[option.optionId] == undefined - ) { - if ( - req.body[option.optionId] == null || - req.body[option.optionId] == undefined - ) - catO.push({ - optionId: option.optionId, - data: false, - }) - else - catO.push({ - optionId: option.optionId, - data: true, - }) - } - } else if (option.optionType.type == "embedBuilder") { - if ( - req.body[option.optionId] == null || - req.body[option.optionId] == undefined - ) - catO.push({ - optionId: option.optionId, - data: option.optionType.data, - }) - else { - try { - const parsedResponse = JSON.parse( - req.body[option.optionId] - ) - catO.push({ - optionId: option.optionId, - data: parsedResponse, - }) - } catch (err) { - catO.push({ - optionId: option.optionId, - data: option.optionType.data, - }) - } - } - } else { - if ( - req.body[option.optionId] == undefined || - req.body[option.optionId] == null - ) - catO.push({ - optionId: option.optionId, - data: null, - }) - else - catO.push({ - optionId: option.optionId, - data: req.body[option.optionId], - }) - } - } else { - if ( - option.optionType.type == "rolesMultiSelect" || - option.optionType.type == "channelsMultiSelect" || - option.optionType.type == "multiSelect" - ) { - if ( - !req.body[option.optionId] || - req.body[option.optionId] == null || - req.body[option.optionId] == undefined - ) { - setNewRes = await option.setNew({ - guild: { - id: req.params.guildId, - object: guildObject, - }, - user: { - id: req.session.user.id, - object: userGuildMemberObject, - }, - newData: [], - }) - setNewRes ? null : (setNewRes = {}) - if (setNewRes.error) { - errors.push( - option.optionName + - "%is%" + - setNewRes.error + - "%is%" + - option.optionId - ) - } else { - successes.push(option.optionName) - } - } else if ( - typeof req.body[option.optionId] != "object" - ) { - setNewRes = await option.setNew({ - guild: { - id: req.params.guildId, - object: guildObject, - }, - user: { - id: req.session.user.id, - object: userGuildMemberObject, - }, - newData: [req.body[option.optionId]], - }) - setNewRes ? null : (setNewRes = {}) - if (setNewRes.error) { - errors.push( - option.optionName + - "%is%" + - setNewRes.error + - "%is%" + - option.optionId - ) - } else { - successes.push(option.optionName) - } - } else { - setNewRes = await option.setNew({ - guild: { - id: req.params.guildId, - object: guildObject, - }, - user: { - id: req.session.user.id, - object: userGuildMemberObject, - }, - newData: req.body[option.optionId], - }) - setNewRes ? null : (setNewRes = {}) - if (setNewRes.error) { - errors.push( - option.optionName + - "%is%" + - setNewRes.error + - "%is%" + - option.optionId - ) - } else { - successes.push(option.optionName) - } - } - } else if (option.optionType.type == "switch") { - if ( - req.body[option.optionId] || - req.body[option.optionId] == null || - req.body[option.optionId] == undefined - ) { - if ( - req.body[option.optionId] == null || - req.body[option.optionId] == undefined - ) { - setNewRes = - (await option.setNew({ - guild: { - id: req.params.guildId, - object: guildObject, - }, - user: { - id: req.session.user.id, - object: userGuildMemberObject, - }, - newData: false, - })) || {} - setNewRes ? null : (setNewRes = {}) - if (setNewRes.error) { - errors.push( - option.optionName + - "%is%" + - setNewRes.error + - "%is%" + - option.optionId - ) - } else { - successes.push(option.optionName) - } - } else { - setNewRes = - (await option.setNew({ - guild: { - id: req.params.guildId, - object: guildObject, - }, - user: { - id: req.session.user.id, - object: userGuildMemberObject, - }, - newData: true, - })) || {} - setNewRes ? null : (setNewRes = {}) - if (setNewRes.error) { - errors.push( - option.optionName + - "%is%" + - setNewRes.error + - "%is%" + - option.optionId - ) - } else { - successes.push(option.optionName) - } - } - } - } else if (option.optionType.type == "embedBuilder") { - if ( - req.body[option.optionId] == null || - req.body[option.optionId] == undefined - ) { - setNewRes = - (await option.setNew({ - guild: { - id: req.params.guildId, - object: guildObject, - }, - user: { - id: req.session.user.id, - object: userGuildMemberObject, - }, - newData: option.optionType.data, - })) || {} - setNewRes ? null : (setNewRes = {}) - if (setNewRes.error) { - errors.push( - option.optionName + - "%is%" + - setNewRes.error + - "%is%" + - option.optionId - ) - } else { - successes.push(option.optionName) - } - } else { - try { - const parsedResponse = JSON.parse( - req.body[option.optionId] - ) - setNewRes = - (await option.setNew({ - guild: { - id: req.params.guildId, - object: guildObject, - }, - user: { - id: req.session.user.id, - object: userGuildMemberObject, - }, - newData: parsedResponse, - })) || {} - setNewRes ? null : (setNewRes = {}) - if (setNewRes.error) { - errors.push( - option.optionName + - "%is%" + - setNewRes.error + - "%is%" + - option.optionId - ) - } else { - successes.push(option.optionName) - } - } catch (err) { - setNewRes = - (await option.setNew({ - guild: { - id: req.params.guildId, - object: guildObject, - }, - user: { - id: req.session.user.id, - object: userGuildMemberObject, - }, - newData: option.optionType.data, - })) || {} - setNewRes = { - error: "JSON parse for embed builder went wrong, your settings have been reset.", - } - if (setNewRes.error) { - errors.push( - option.optionName + - "%is%" + - setNewRes.error + - "%is%" + - option.optionId - ) - } else { - successes.push(option.optionName) - } - } - } - } else { - if ( - req.body[option.optionId] == undefined || - req.body[option.optionId] == null - ) { - setNewRes = - (await option.setNew({ - guild: { - id: req.params.guildId, - object: guildObject, - }, - user: { - id: req.session.user.id, - object: userGuildMemberObject, - }, - newData: null, - })) || {} - setNewRes ? null : (setNewRes = {}) - if (setNewRes.error) { - errors.push( - option.optionName + - "%is%" + - setNewRes.error + - "%is%" + - option.optionId - ) - } else { - successes.push(option.optionName) - } - } else { - setNewRes = - (await option.setNew({ - guild: { - id: req.params.guildId, - object: guildObject, - }, - user: { - id: req.session.user.id, - object: userGuildMemberObject, - }, - newData: req.body[option.optionId], - })) || {} - setNewRes ? null : (setNewRes = {}) - if (setNewRes.error) { - errors.push( - option.optionName + - "%is%" + - setNewRes.error + - "%is%" + - option.optionId - ) - } else { - successes.push(option.optionName) - } - } - } - } - } - } + router.post("/settings/update/:guildId/:categoryId", RateFunctions.settingsUpdatePostAPI ? RateFunctions.settingsUpdatePostAPI : NoRL, async (req, res) => { + if (!req.session.user) + return res.redirect("/discord?r=/guild/" + req.params.guildId); - if (config.useCategorySet && catO.length) { - let sNR = await category.setNew({ - guild: { - id: req.params.guildId, - object: guildObject, - }, - user: { - id: req.session.user.id, - object: userGuildMemberObject, - }, - data: catO, - }) - sNR ? null : (sNR = {}) - if (sNR.error) { - errors.push(category.categoryId + "%is%" + sNR.error) - } else { - successes.push(category.categoryId) - } - } + // let customThemeOptions; + // if (themeConfig?.customThemeOptions?.settingsUpdate) { + // customThemeOptions = + // await themeConfig.customThemeOptions.settingsUpdate({ + // req: req, + // config: config, + // guildId: req.params.id, + // categoryId: req.params.categoryId, + // }); + // } - let successesForDBDEvent = [] - let errorsForDBDEvent = [] + const bot = config.bot; - successes.forEach((item) => { - if (typeof item == "string") { - successesForDBDEvent.push(item.split("%is%")) - } - }) + if (!bot.guilds.cache.get(req.params.guildId)) return res.redirect("/manage?error=noPermsToManageGuild"); - errors.forEach((item) => { - if (typeof item == "string") { - errorsForDBDEvent.push(item.split("%is%")) - } - }) + await bot.guilds.cache.get(req.params.guildId).members.fetch(req.session.user.id); - req.DBDEvents.emit("guildSettingsUpdated", { - user: req.session.user, - changes: { successesForDBDEvent, errorsForDBDEvent }, - guildId: req.params.guildId, - }) + // for (const PermissionRequired of req.requiredPermissions) { + // const permissionsReq = PermissionRequired[0]; - if (errors[0]) { - if (!successes) successes = [] - req.session.success = successes.join("%and%") - req.session.errors = errors.join("%and%") - return res.redirect("/guild/" + req.params.guildId) - } else { - req.session.success = true - req.session.errors = false - return res.redirect("/guild/" + req.params.guildId) - } - } - ) + // if (!bot.guilds.cache.get(req.params.guildId).members.cache.get(req.session.user.id).permissions.has(permissionsReq)) + // return res.redirect("/manage?error=noPermsToManageGuild"); + // } - return router -} + const cid = req.params.categoryId; + const settings = config.settings; -function convert14(perm) { - let final = "NULL" + const category = settings.find((c) => c.categoryId == cid); - switch (perm) { - case "CREATE_INSTANT_INVITE": - final = "CreateInstantInvite" - break - case "KICK_MEMBERS": - final = "KickMembers" - break - case "BAN_MEMBERS": - final = "BanMembers" - break - case "ADMINISTRATOR": - final = "Administrator" - break - case "MANAGE_CHANNELS": - final = "ManageChannels" - break - case "MANAGE_GUILD": - final = "ManageGuild" - break - case "ADD_REACTIONS": - final = "AddReactions" - break - case "VIEW_AUDIT_LOG": - final = "ViewAuditLog" - break - case "PRIORITY_SPEAKER": - final = "PrioritySpeaker" - break - case "STREAM": - final = "Stream" - break - case "VIEW_CHANNEL": - final = "ViewChannel" - break - case "SEND_MESSAGES": - final = "SendMessages" - break - case "SEND_TTS_MESSAGES": - final = "SendTTSMessages" - break - case "MANAGE_MESSAGES": - final = "ManageMessages" - break - case "EMBED_LINKS": - final = "ManageMessages" - break - case "ATTACH_FILES": - final = "AttachFiles" - break - case "READ_MESSAGE_HISTORY": - final = "ReadMessageHistory" - break - case "MENTION_EVERYONE": - final = "MentionEveryone" - break - case "USE_EXTERNAL_EMOJIS": - final = "UseExternalEmojis" - break - case "VIEW_GUILD_INSIGHTS": - final = "ViewGuildInsughts" - break - case "CONNECT": - final = "Connect" - break - case "SPEAK": - final = "Speak" - break - } + if (!category) + return res.send({ + error: true, + message: "No category found", + }); - return final -} + let setNewRes; + const errors = []; + let successes = []; + const catO = []; + + const userGuildMemberObject = bot.guilds.cache.get(req.params.guildId).members.cache.get(req.session.user.id); + const guildObject = bot.guilds.cache.get(req.params.guildId); + + for (const option of category.categoryOptionsList) { + let canUse = {}; + + if (option.allowedCheck) { + canUse = await option.allowedCheck({ + guild: { id: req.params.guildId }, + user: { id: req.session.user.id }, + }); + } else { + canUse = { + allowed: true, + errorMessage: null, + }; + } + + if (canUse.allowed == false) { + setNewRes = { + error: canUse.errorMessage, + }; + + errors.push( + option.optionName + "%is%" + setNewRes.error + "%is%" + option.optionId, + ); + } else if (option.optionType != "spacer") { + if (config.useCategorySet) { + if (option.optionType.type == "rolesMultiSelect" || option.optionType.type == "channelsMultiSelect" || option.optionType.type == "multiSelect") { + if (!req.body[option.optionId] || req.body[option.optionId] == null || req.body[option.optionId] == undefined) + catO.push({ + optionId: option.optionId, + data: [], + }); + else if (typeof req.body[option.optionId] != "object") + catO.push({ + optionId: option.optionId, + data: [req.body[option.optionId]], + }); + else + catO.push({ + optionId: option.optionId, + data: req.body[option.optionId], + }); + } else if (option.optionType.type == "switch") { + if (req.body[option.optionId] || req.body[option.optionId] == null || req.body[option.optionId] == undefined) { + if (req.body[option.optionId] == null || req.body[option.optionId] == undefined) + catO.push({ + optionId: option.optionId, + data: false, + }); + else + catO.push({ + optionId: option.optionId, + data: true, + }); + } + } else if (option.optionType.type == "embedBuilder") { + if (req.body[option.optionId] == null || req.body[option.optionId] == undefined) + catO.push({ + optionId: option.optionId, + data: option.optionType.data, + }); + else { + try { + const parsedResponse = JSON.parse(req.body[option.optionId]); + + catO.push({ + optionId: option.optionId, + data: parsedResponse, + }); + } catch (err) { + catO.push({ + optionId: option.optionId, + data: option.optionType.data, + }); + } + } + } else { + if (req.body[option.optionId] == undefined || req.body[option.optionId] == null) + catO.push({ + optionId: option.optionId, + data: null, + }); + else + catO.push({ + optionId: option.optionId, + data: req.body[option.optionId], + }); + } + } else { + if (option.optionType.type == "rolesMultiSelect" || option.optionType.type == "channelsMultiSelect" || option.optionType.type == "multiSelect") { + if (!req.body[option.optionId] || req.body[option.optionId] == null || req.body[option.optionId] == undefined) { + setNewRes = await option.setNew({ + guild: { id: req.params.guildId, object: guildObject }, + user: { id: req.session.user.id, object: userGuildMemberObject }, + newData: [], + }); + + setNewRes ? null : (setNewRes = {}); + + if (setNewRes.error) { + errors.push(option.optionName + "%is%" + setNewRes.error + "%is%" + option.optionId); + } else + successes.push(option.optionName); + } else if (typeof req.body[option.optionId] != "object") { + setNewRes = await option.setNew({ + guild: { id: req.params.guildId, object: guildObject }, + user: { id: req.session.user.id, object: userGuildMemberObject }, + newData: [req.body[option.optionId]], + }); + + setNewRes ? null : (setNewRes = {}); + + if (setNewRes.error) + errors.push(option.optionName + "%is%" + setNewRes.error + "%is%" + option.optionId); + else + successes.push(option.optionName); + } else { + setNewRes = await option.setNew({ + guild: { id: req.params.guildId, object: guildObject }, + user: { id: req.session.user.id, object: userGuildMemberObject }, + newData: req.body[option.optionId], + }); + + setNewRes ? null : (setNewRes = {}); + + if (setNewRes.error) + errors.push(option.optionName + "%is%" + setNewRes.error + "%is%" + option.optionId); + else + successes.push(option.optionName); + } + } else if (option.optionType.type == "switch") { + if (req.body[option.optionId] || req.body[option.optionId] == null || req.body[option.optionId] == undefined) { + if (req.body[option.optionId] == null || req.body[option.optionId] == undefined) { + setNewRes = (await option.setNew({ + guild: { id: req.params.guildId, object: guildObject }, + user: { id: req.session.user.id, object: userGuildMemberObject }, + newData: false, + })) || {}; + + setNewRes ? null : (setNewRes = {}); + + if (setNewRes.error) + errors.push(option.optionName + "%is%" + setNewRes.error + "%is%" + option.optionId); + else + successes.push(option.optionName); + } else { + setNewRes = (await option.setNew({ + guild: { id: req.params.guildId, object: guildObject }, + user: { id: req.session.user.id, object: userGuildMemberObject }, + newData: true, + })) || {}; + + setNewRes ? null : (setNewRes = {}); + + if (setNewRes.error) + errors.push(option.optionName + "%is%" + setNewRes.error + "%is%" + option.optionId); + else + successes.push(option.optionName); + } + } + } else if (option.optionType.type == "embedBuilder") { + if (req.body[option.optionId] == null || req.body[option.optionId] == undefined) { + setNewRes = (await option.setNew({ + guild: { id: req.params.guildId, object: guildObject }, + user: { id: req.session.user.id, object: userGuildMemberObject }, + newData: option.optionType.data, + })) || {}; + + setNewRes ? null : (setNewRes = {}); + + if (setNewRes.error) + errors.push(option.optionName + "%is%" + setNewRes.error + "%is%" + option.optionId); + else + successes.push(option.optionName); + } else { + try { + const parsedResponse = JSON.parse(req.body[option.optionId]); + + setNewRes = (await option.setNew({ + guild: { id: req.params.guildId, object: guildObject }, + user: { id: req.session.user.id, object: userGuildMemberObject }, + newData: parsedResponse, + })) || {}; + + setNewRes ? null : (setNewRes = {}); + + if (setNewRes.error) + errors.push(option.optionName + "%is%" + setNewRes.error + "%is%" + option.optionId); + else + successes.push(option.optionName); + } catch (err) { + setNewRes = (await option.setNew({ + guild: { id: req.params.guildId, object: guildObject }, + user: { id: req.session.user.id, object: userGuildMemberObject }, + newData: option.optionType.data, + })) || {}; + + setNewRes = { + error: "JSON parse for embed builder went wrong, your settings have been reset.", + }; + + if (setNewRes.error) + errors.push(option.optionName + "%is%" + setNewRes.error + "%is%" + option.optionId); + else + successes.push(option.optionName); + } + } + } else { + if (req.body[option.optionId] == undefined || req.body[option.optionId] == null) { + setNewRes = (await option.setNew({ + guild: { id: req.params.guildId, object: guildObject }, + user: { id: req.session.user.id, object: userGuildMemberObject }, + newData: null, + })) || {}; + + setNewRes ? null : (setNewRes = {}); + + if (setNewRes.error) + errors.push(option.optionName + "%is%" + setNewRes.error + "%is%" + option.optionId); + else + successes.push(option.optionName); + } else { + setNewRes = (await option.setNew({ + guild: { id: req.params.guildId, object: guildObject }, + user: { id: req.session.user.id, object: userGuildMemberObject }, + newData: req.body[option.optionId], + })) || {}; + + setNewRes ? null : (setNewRes = {}); + + if (setNewRes.error) + errors.push(option.optionName + "%is%" + setNewRes.error + "%is%" + option.optionId); + else + successes.push(option.optionName); + } + } + } + } + } + + if (config.useCategorySet && catO.length) { + let sNR = await category.setNew({ + guild: { id: req.params.guildId, object: guildObject }, + user: { id: req.session.user.id, object: userGuildMemberObject }, + data: catO, + }); + + sNR ? null : (sNR = {}); + + if (sNR.error) errors.push(category.categoryId + "%is%" + sNR.error); + else successes.push(category.categoryId); + } + + const successesForDBDEvent = []; + const errorsForDBDEvent = []; + + successes.forEach(item => { + if (typeof item == "string") successesForDBDEvent.push(item.split("%is%")); + }); + + errors.forEach(item => { + if (typeof item == "string") errorsForDBDEvent.push(item.split("%is%")); + }); + + req.DBDEvents.emit("guildSettingsUpdated", { + user: req.session.user, + changes: { + successesForDBDEvent, + errorsForDBDEvent, + }, + guildId: req.params.guildId, + }); + + if (errors[0]) { + if (!successes) successes = []; + req.session.success = successes.join("%and%"); + req.session.errors = errors.join("%and%"); + + return res.redirect("/guild/" + req.params.guildId); + } else { + req.session.success = true; + req.session.errors = false; + + return res.redirect("/guild/" + req.params.guildId); + } + }); + + return router; +}; \ No newline at end of file diff --git a/Routes/discord.js b/Routes/discord.js index f9b4289..be59a82 100644 --- a/Routes/discord.js +++ b/Routes/discord.js @@ -1,416 +1,397 @@ -const router = require("express").Router() -const fetch = require("node-fetch") +const router = require("express").Router(); +const RL = require("express-rate-limit"); +const safeStorage = require("assistants-safe-storage"); -const DiscordOauth2 = require("discord-oauth2") -const oauth = new DiscordOauth2() +const DiscordOauth2 = require("discord-oauth2"); +const oauth = new DiscordOauth2(); module.exports = (app, config, themeConfig) => { - const scopes = config.guildAfterAuthorization?.use - ? ["identify", "guilds", "guilds.join"] - : ["identify", "guilds"] - const RL = require("express-rate-limit") - const RateLimits = config.rateLimits || {} - let RateFunctions = {} + const storage = new safeStorage(config.bot.config.token); + const scopes = config.guildAfterAuthorization?.use ? ["identify", "guilds", "guilds.join"] : ["identify", "guilds"]; - const NoRL = (req, res, next) => next() + const RateLimits = config.rateLimits || {}; + const RateFunctions = {}; - if (RateLimits.discordOAuth2) { - RateFunctions.discordOAuth2 = RL.rateLimit({ - windowMs: RateLimits.discordOAuth2.windowMs, - max: RateLimits.discordOAuth2.max, - message: RateLimits.discordOAuth2.message, - store: RateLimits.discordOAuth2.store || new RL.MemoryStore(), - }) - } + const NoRL = (req, res, next) => next(); - router.get("/", (req, res) => { - const clientId = req.client.id - const redirectUri = req.redirectUri + if (RateLimits.discordOAuth2) { + RateFunctions.discordOAuth2 = RL.rateLimit({ + windowMs: RateLimits.discordOAuth2.windowMs, + max: RateLimits.discordOAuth2.max, + message: RateLimits.discordOAuth2.message, + store: RateLimits.discordOAuth2.store || new RL.MemoryStore(), + }); + } - let newPage = "/" - if (themeConfig.landingPage?.enabled) newPage = "/dash" - req.session.r = req.query.r || newPage + router.get("/", (req, res) => { + const clientId = req.client.id; + const redirectUri = req.redirectUri; - const authorizeUrl = `https://discord.com/api/oauth2/authorize?client_id=${clientId}&redirect_uri=${encodeURIComponent( - redirectUri - )}&response_type=code&scope=${scopes.join("%20")}` - res.redirect(authorizeUrl) - }) + let newPage = "/"; + if (themeConfig.landingPage?.enabled) newPage = "/dash"; - router.get("/status", async (req, res) => { - res.send(req.session?.discordAuthStatus) - }) + req.session.r = req.query.r || newPage; - router.get( - "/callback", - RateFunctions.discordOAuth2 ? RateFunctions.discordOAuth2 : NoRL, - async (req, res) => { - req.session.discordAuthStatus = { - loading: true, - success: null, - state: { - error: null, - data: null, - }, - } - const clientId = req.client.id - const clientSecret = req.client.secret - const redirectUri = req.redirectUri + const authorizeUrl = `https://discord.com/api/oauth2/authorize?client_id=${clientId}&redirect_uri=${encodeURIComponent(redirectUri)}&response_type=code&scope=${scopes.join("%20")}`; - const accessCode = req.query.code - if (!accessCode) - return res.redirect("/?error=NoAccessCodeReturnedFromDiscord") + res.redirect(authorizeUrl); + }); - res.redirect("/loading") + router.get("/status", async (req, res) => { + res.send(req.session?.discordAuthStatus); + }); - let OAuth2Response - let OAuth2UserResponse - let OAuth2GuildsResponse + router.get("/callback", RateFunctions.discordOAuth2 ? RateFunctions.discordOAuth2 : NoRL, async (req, res) => { + req.session.discordAuthStatus = { + loading: true, + success: null, + state: { + error: null, + data: null, + }, + }; - /* - Get Discord OAuth2 API Response with Access Code gained - */ - try { - req.session.discordAuthStatus = { - loading: true, - success: null, - state: { - error: null, - data: "Requesting token...", - }, - } - req.session.save(function (err) {}) - OAuth2Response = await oauth.tokenRequest({ - clientId, - clientSecret, + const clientId = req.client.id; + const clientSecret = req.client.secret; + const redirectUri = req.redirectUri; - code: accessCode, - scope: scopes.join(" "), - grantType: "authorization_code", + const accessCode = req.query.code; + if (!accessCode) return res.redirect("/?error=NoAccessCodeReturnedFromDiscord"); - redirectUri, - }) - } catch (err) { - req.config.reportError( - "Discord.js Route - OAuth2Response (line 86)", - err - ) - req.session.discordAuthStatus = { - loading: false, - success: false, - state: { - error: err, - data: null, - }, - } - req.session.save(function (err) {}) - return - } + res.redirect("/loading"); - /* - Get User from Discord OAuth2 API using gained access_token and update its values with tag and avatarURL - */ + let OAuth2Response; + let OAuth2UserResponse; + let OAuth2GuildsResponse; - try { - req.session.discordAuthStatus = { - loading: true, - success: null, - state: { - error: null, - data: "Getting User...", - }, - } - req.session.save(function (err) {}) - OAuth2UserResponse = await oauth.getUser( - OAuth2Response.access_token - ) - } catch (err) { - req.config.reportError( - "Discord.js Route - OAuth2UserResponse (line 118)", - err - ) - req.session.discordAuthStatus = { - loading: false, - success: false, - state: { - error: err, - data: null, - }, - } - req.session.save(function (err) {}) - return - } - OAuth2UserResponse.tag = `${OAuth2UserResponse.username}#${OAuth2UserResponse.discriminator}` - OAuth2UserResponse.avatarURL = OAuth2UserResponse.avatar - ? `https://cdn.discordapp.com/avatars/${OAuth2UserResponse.id}/${OAuth2UserResponse.avatar}.png?size=1024` - : null + try { + req.session.discordAuthStatus = { + loading: true, + success: null, + state: { + error: null, + data: "Requesting token...", + }, + }; - /* - Save user token in Assistants Secure Storage - */ + req.session.save(function () {}); - try { - req.AssistantsSecureStorage.SaveUser( - OAuth2UserResponse.id, - OAuth2Response.access_token - ) - } catch (err) { - req.config.reportError( - "Discord.js Route - Assistants Secure Storage (line 141)", - err - ) - req.session.discordAuthStatus = { - loading: false, - success: false, - state: { - error: err, - data: null, - }, - } - req.session.save(function (err) {}) - return - } + OAuth2Response = await oauth.tokenRequest({ + clientId, + clientSecret, - /* - Save user in session - */ + code: accessCode, + scope: scopes.join(" "), + grantType: "authorization_code", - req.session.user = OAuth2UserResponse - req.session.loggedInLastTime = true + redirectUri, + }); + } catch (err) { + console.log("Discord.js Route - OAuth2Response (line 88)\n" + err); - /* - Register user to DBD Stats and emit userLoggedIn event - */ + req.session.discordAuthStatus = { + loading: false, + success: false, + state: { + error: err, + data: null, + }, + }; - try { - req.DBDEvents.emit("userLoggedIn", OAuth2UserResponse) - } catch (err) { - req.config.reportError("Discord.js Route - Register and DBDEvents emit userLoggedIn (line 170)", err) - req.session.discordAuthStatus = { - loading: false, - success: false, - state: { - error: err, - data: null, - }, - } - req.session.save(function (err) {}) - return - } + req.session.save(function () {}); - /* - Gain and update session with user guilds - */ + return; + } - try { - req.session.discordAuthStatus = { - loading: true, - success: null, - state: { - error: null, - data: "Getting List of User Guilds...", - }, - } - req.session.save(function (err) {}) - OAuth2GuildsResponse = await oauth.getUserGuilds( - OAuth2Response.access_token - ) - } catch (err) { - req.config.reportError( - "Discord.js Route - OAuth2GuildsResponse (line 201)", - err - ) - req.session.discordAuthStatus = { - loading: false, - success: false, - state: { - error: err, - data: null, - }, - } - req.session.save(function (err) {}) - return - } - req.session.guilds = OAuth2GuildsResponse || [] + /* + Get User from Discord OAuth2 API using gained access_token and update its values with tag and avatarURL + */ + try { + req.session.discordAuthStatus = { + loading: true, + success: null, + state: { + error: null, + data: "Getting User...", + }, + }; - /* - Loop and fetch each guild into bots cache - */ + req.session.save(function () {}); - if (!req.config.disableResolvingGuildCache) { - try { - req.session.discordAuthStatus = { - loading: true, - success: null, - state: { - error: null, - data: "Resolving guilds cache...", - }, - } - req.session.save(function (err) {}) - for (let g of OAuth2GuildsResponse) { - try { - await req.bot.guilds.fetch(g.id) - } catch (err) {} - } - } catch (err) { - req.config.reportError( - "Discord.js Route - OAuth2GuildsResponse Whole Loop (line 239)", - err - ) - req.session.discordAuthStatus = { - loading: false, - success: false, - state: { - error: err, - data: null, - }, - } - req.session.save(function (err) {}) - return - } - } + OAuth2UserResponse = await oauth.getUser(OAuth2Response.access_token); + } catch (err) { + console.log("Discord.js Route - OAuth2UserResponse (line 122)\n" + err); - /* - If joining specific guild after authorization is enabled, do it - */ + req.session.discordAuthStatus = { + loading: false, + success: false, + state: { + error: err, + data: null, + }, + }; - if (req.guildAfterAuthorization.use == true) { - req.session.discordAuthStatus = { - loading: true, - success: null, - state: { - error: null, - data: "Authorizing user with guild...", - }, - } - req.session.save(function (err) {}) - try { - await oauth.addMember({ - accessToken: OAuth2Response.access_token, - botToken: req.botToken, - guildId: req.guildAfterAuthorization.guildId, - userId: OAuth2UserResponse.id, + req.session.save(function () {}); - ...(req.guildAfterAuthorization.options || {}), - /* - options?: { - nickname?: string, - roles?: [string], - mute?: boolean, - deaf?: boolean, - } - */ - }) - } catch (err) { - req.config.reportError( - "Discord.js Route - guildAfterAuthorization (line 287)", - err - ) - } - } + return; + } + OAuth2UserResponse.tag = `${OAuth2UserResponse.username}#${OAuth2UserResponse.discriminator}`; + OAuth2UserResponse.avatarURL = OAuth2UserResponse.avatar ? `https://cdn.discordapp.com/avatars/${OAuth2UserResponse.id}/${OAuth2UserResponse.avatar}.png?size=1024` : null; - req.session.discordAuthStatus = { - loading: false, - success: true, - state: { - error: null, - data: null, - }, - } - req.session.save(function (err) {}) + /* + Save user token in Assistants Secure Storage + */ + try { + storage.SaveUser(OAuth2UserResponse.id, OAuth2Response.access_token); + } catch (err) { + console.log("Discord.js Route - Assistants Secure Storage (line 147)\n" + err); - return - } - ) + req.session.discordAuthStatus = { + loading: false, + success: false, + state: { + error: err, + data: null, + }, + }; - router.get("/logout", (req, res) => { - let r = req.query.r || "/" - req.session.destroy() - res.redirect(r) - }) + req.session.save(function () {}); - router.get("/guilds/reload", async (req, res) => { - if (!req.session.user) return res.redirect("/discord") + return; + } - /* - Fetch user token - */ + /* + Save user in session + */ + req.session.user = OAuth2UserResponse; + req.session.loggedInLastTime = true; - const access_token = req.AssistantsSecureStorage.GetUser( - req.session.user.id - ) - if (!access_token) - return res.send({ - error: true, - message: "You don't have any access_token saved.", - login_again_text: true, - }) + /* + Register user to DBD Stats and emit userLoggedIn event + */ + try { + req.DBDEvents.emit("userLoggedIn", OAuth2UserResponse); + } catch (err) { + console.log("Discord.js Route - DBDStats register and DBDEvent emit userLoggedIn (line 173)\n" + err); - /* - Gain and update session with user guilds - */ + req.session.discordAuthStatus = { + loading: false, + success: false, + state: { + error: err, + data: null, + }, + }; + req.session.save(function () {}); - let OAuth2GuildsResponse + return; + } - try { - OAuth2GuildsResponse = await oauth.getUserGuilds(access_token) - } catch (err) { - req.config.reportError( - "Discord.js Route - OAuth2GuildsResponse for ReloadGuilds (line 335)", - err - ) - return res.send({ - error: true, - message: - "An error occured. Access_token is wrong or you're being rate limited.", - login_again_text: true, - }) - } - req.session.guilds = OAuth2GuildsResponse || [] + /* + Gain and update session with user guilds + */ + try { + req.session.discordAuthStatus = { + loading: true, + success: null, + state: { + error: null, + data: "Getting List of User Guilds...", + }, + }; - /* - Loop and fetch each guild into bots cache - */ + req.session.save(function () {}); - try { - const Promises = [] - for (let g of OAuth2GuildsResponse) { - Promises.push( - new Promise(async (resolve, reject) => { - try { - await req.bot.guilds.fetch(g.id) - } catch (err) {} - resolve(1) - }) - ) - try { - await Promises.all(Promises) - } catch (err) {} - } - } catch (err) { - req.config.reportError( - "Discord.js Route - OAuth2GuildsResponse Whole Loop for ReloadGuilds (line 363)", - err - ) - return res.send({ - error: true, - message: - "An error occured. Access_token is wrong or you're being rate limited.", - login_again_text: true, - }) - } + OAuth2GuildsResponse = await oauth.getUserGuilds(OAuth2Response.access_token); + } catch (err) { + req.config.reportError("Discord.js Route - OAuth2GuildsResponse (line 205)\n" + err); - /* - Success - */ + req.session.discordAuthStatus = { + loading: false, + success: false, + state: { + error: err, + data: null, + }, + }; - return res.send({ - error: false, - message: null, - login_again_text: false, - }) - }) + req.session.save(function () {}); - return router -} + return; + } + req.session.guilds = OAuth2GuildsResponse || []; + + /* + Loop and fetch each guild into bots cache + */ + if (!req.config.disableResolvingGuildCache) { + try { + req.session.discordAuthStatus = { + loading: true, + success: null, + state: { + error: null, + data: "Resolving guilds cache...", + }, + }; + + req.session.save(function () {}); + + for (const g of OAuth2GuildsResponse) { + try { + await req.bot.guilds.fetch(g.id); + } catch (e) { /* ... */ } + } + } catch (err) { + console.log("Discord.js Route - OAuth2GuildsResponse Whole Loop (line 244)" + err); + + req.session.discordAuthStatus = { + loading: false, + success: false, + state: { + error: err, + data: null, + }, + }; + + req.session.save(function () {}); + + return; + } + } + + /* + If joining specific guild after authorization is enabled, do it + */ + + if (req.guildAfterAuthorization.use == true) { + req.session.discordAuthStatus = { + loading: true, + success: null, + state: { + error: null, + data: "Authorizing user with guild...", + }, + }; + + req.session.save(function () {}); + + try { + await oauth.addMember({ + accessToken: OAuth2Response.access_token, + botToken: req.botToken, + guildId: req.guildAfterAuthorization.guildId, + userId: OAuth2UserResponse.id, + + ...(req.guildAfterAuthorization.options || {}), + /* + options?: { + nickname?: string, + roles?: [string], + mute?: boolean, + deaf?: boolean, + } + */ + }); + } catch (err) { + req.config.reportError("Discord.js Route - guildAfterAuthorization (line 295)" + err); + } + } + + req.session.discordAuthStatus = { + loading: false, + success: true, + state: { + error: null, + data: null, + }, + }; + + req.session.save(function () {}); + + return; + }); + + router.get("/logout", (req, res) => { + const r = req.query.r || "/"; + req.session.destroy(); + res.redirect(r); + }); + + router.get("/guilds/reload", async (req, res) => { + if (!req.session.user) return res.redirect("/discord"); + + /* + Fetch user token + */ + const access_token = storage.GetUser(req.session.user.id); + + if (!access_token) + return res.send({ + error: true, + message: "You don't have any access_token saved.", + login_again_text: true, + }); + + /* + Gain and update session with user guilds + */ + let OAuth2GuildsResponse; + + try { + OAuth2GuildsResponse = await oauth.getUserGuilds(access_token); + } catch (err) { + req.config.reportError("Discord.js Route - OAuth2GuildsResponse for ReloadGuilds (line 342)" + err); + + return res.send({ + error: true, + message: "An error occured. Access_token is wrong or you're being rate limited.", + login_again_text: true, + }); + } + + req.session.guilds = OAuth2GuildsResponse || []; + + /* + Loop and fetch each guild into bots cache + */ + try { + const Promises = []; + + for (const g of OAuth2GuildsResponse) { + Promises.push( + // eslint-disable-next-line no-unused-vars, no-async-promise-executor + new Promise(async (resolve, reject) => { + try { + await req.bot.guilds.fetch(g.id); + } catch (e) { /* ... */ } + + resolve(1); + }), + ); + try { + await Promises.all(Promises); + } catch (e) { /* ... */ } + } + } catch (err) { + console.log("Discord.js Route - OAuth2GuildsResponse Whole Loop for ReloadGuilds (line 375)" + err); + + return res.send({ + error: true, + message: "An error occured. Access_token is wrong or you're being rate limited.", + login_again_text: true, + }); + } + + /* + Success + */ + return res.send({ + error: false, + message: null, + login_again_text: false, + }); + }); + + return router; +}; \ No newline at end of file diff --git a/Routes/main.js b/Routes/main.js index 73c2368..7e5cda3 100644 --- a/Routes/main.js +++ b/Routes/main.js @@ -1,122 +1,91 @@ -const Discord = require("discord.js") -const router = require("express").Router() +const router = require("express").Router(); +// eslint-disable-next-line no-unused-vars module.exports = (app, config, themeConfig, modules) => { - router.get( - themeConfig.landingPage?.enabled ? "/dash" : "/", - async (req, res) => { - let customThemeOptions - if (themeConfig?.customThemeOptions?.index) { - customThemeOptions = await themeConfig.customThemeOptions.index( - { req: req, res: res, config: config } - ) - } - res.render("index", { - req: req, - themeConfig: req.themeConfig, - bot: config.bot, - customThemeOptions: customThemeOptions || {}, - config, - require, - }) - } - ) + router.get(themeConfig.landingPage?.enabled ? "/dash" : "/", async (req, res) => { + let customThemeOptions; - if (themeConfig.landingPage?.enabled) - router.get("/", async (req, res) => { - res.setHeader("Content-Type", "text/html") - res.send(await themeConfig.landingPage.getLandingPage(req, res)) - }) + if (themeConfig?.customThemeOptions?.index) { + customThemeOptions = await themeConfig.customThemeOptions.index({ + req: req, + res: res, + config: config, + }); + } - router.get("/loading", async (req, res) => { - if (!req.session?.discordAuthStatus?.loading) - return res.redirect("/manage") + res.render("index", { + req: req, + themeConfig: req.themeConfig, + bot: config.bot, + customThemeOptions: customThemeOptions || {}, + config, + require, + }); + }); - res.render("loading", { req, themeConfig, bot: config.bot }) - }) + if (themeConfig.landingPage?.enabled) + router.get("/", async (req, res) => { + res.setHeader("Content-Type", "text/html"); + res.send(await themeConfig.landingPage.getLandingPage(req, res)); + }); - router.get("/invite", (req, res) => { - let config = req.config - config.invite ? null : (config.invite = {}) - const scopes = config.invite.scopes || ["bot"] + router.get("/loading", async (req, res) => { + if (!req.session?.discordAuthStatus?.loading) + return res.redirect("/manage"); - if (req.query.redirect && !req.query.g) - return res.redirect( - `https://discord.com/oauth2/authorize?client_id=${ - config.invite.clientId || config.bot.user.id - }&scope=${scopes.join("%20")}&permissions=${ - config.invite.permissions || "0" - }&response_type=code&redirect_uri=${req.query.redirect}${ - config.invite.otherParams || "" - }` - ) - if (req.query.redirect && req.query.g) - return res.redirect( - `https://discord.com/oauth2/authorize?client_id=${ - config.invite.clientId || config.bot.user.id - }&scope=${scopes.join("%20")}&permissions=${ - config.invite.permissions || "0" - }&response_type=code&redirect_uri=${ - req.query.redirect - }&guild_id=${req.query.g}${config.invite.otherParams || ""}` - ) + res.render("loading", { + req, + themeConfig, + bot: config.bot, + }); + }); - if (req.query.g) { - let thingymabob = config.invite.redirectUri - ? `&response_type=code&redirect_uri=${config.invite.redirectUri}` - : null; - if(!thingymabob) thingymabob = config.invite.specialredirectUri - ? `&response_type=code&redirect_uri=${config.invite.specialRedirectUri.replace("{SERVER}", req.query.g)}` - : ""; - - return res.redirect( - `https://discord.com/oauth2/authorize?client_id=${ - config.invite.clientId || config.bot.user.id - }&scope=${scopes.join("%20")}&permissions=${ - config.invite.permissions || "0" - }${thingymabob}&guild_id=${req.query.g}${config.invite.otherParams || ""}` - ) - } + router.get("/invite", (req, res) => { + const config = req.config; + config.invite ? null : (config.invite = {}); - res.redirect( - `https://discord.com/oauth2/authorize?client_id=${ - config.invite.clientId || config.bot.user.id - }&scope=${scopes.join("%20")}&permissions=${ - config.invite.permissions || "0" - }${ - config.invite.redirectUri - ? `&response_type=code&redirect_uri=${config.invite.redirectUri}` - : "" - }${config.invite.otherParams || ""}` - ) - }) + const scopes = config.invite.scopes || ["bot"]; - if (!config.supportServer) config.supportServer = {} + if (req.query.redirect && !req.query.g) + return res.redirect(`https://discord.com/oauth2/authorize?client_id=${config.invite.clientId || config.bot.user.id}&scope=${scopes.join("%20")}&permissions=${config.invite.permissions || "0"}&response_type=code&redirect_uri=${req.query.redirect}${config.invite.otherParams || ""}`); + if (req.query.redirect && req.query.g) + return res.redirect(`https://discord.com/oauth2/authorize?client_id=${config.invite.clientId || config.bot.user.id}&scope=${scopes.join("%20")}&permissions=${config.invite.permissions || "0"}&response_type=code&redirect_uri=${req.query.redirect}&guild_id=${req.query.g}${config.invite.otherParams || ""}`); - router.get(config.supportServer.slash || "/support-server", (req, res) => { - let config = req.config - config.supportServer ? null : (config.supportServer = {}) - if (!config.supportServer.inviteUrl) - return res.send({ - error: true, - message: - "No inviteUrl defined (discord-dashboard config.supportServer).", - }) - if ( - !config.supportServer.inviteUrl - .toLowerCase() - .startsWith("https://discord.gg/") && - !config.supportServer.inviteUrl - .toLowerCase() - .startsWith("https://discord.com/") - ) - return res.send({ - error: true, - message: - "Invite url should start with 'https://discord.gg/' or 'https://discord.com/'.", - }) - res.redirect(config.supportServer.inviteUrl) - }) + if (req.query.g) { + let thingymabob = config.invite.redirectUri ? `&response_type=code&redirect_uri=${config.invite.redirectUri}` : null; + if (!thingymabob) thingymabob = config.invite.specialredirectUri ? `&response_type=code&redirect_uri=${config.invite.specialRedirectUri.replace("{SERVER}", req.query.g)}` : ""; - return router -} + return res.redirect(`https://discord.com/oauth2/authorize?client_id=${config.invite.clientId || config.bot.user.id}&scope=${scopes.join("%20")}&permissions=${config.invite.permissions || "0"}${thingymabob}&guild_id=${req.query.g}${config.invite.otherParams || ""}`); + } + + res.redirect(`https://discord.com/oauth2/authorize?client_id=${config.invite.clientId || config.bot.user.id}&scope=${scopes.join("%20")}&permissions=${config.invite.permissions || "0"}${config.invite.redirectUri ? `&response_type=code&redirect_uri=${config.invite.redirectUri}` : ""}${config.invite.otherParams || ""}`); + }); + + if (!config.supportServer) config.supportServer = {}; + + router.get(config.supportServer.slash || "/support-server", (req, res) => { + const config = req.config; + config.supportServer ? null : (config.supportServer = {}); + + if (!config.supportServer.inviteUrl) + return res.send({ + error: true, + message: "No inviteUrl defined (discord-dashboard config.supportServer).", + }); + + if (!config.supportServer.inviteUrl + .toLowerCase() + .startsWith("https://discord.gg/") && + !config.supportServer.inviteUrl + .toLowerCase() + .startsWith("https://discord.com/") + ) return res.send({ + error: true, + message: "Invite url should start with 'https://discord.gg/' or 'https://discord.com/'.", + }); + + res.redirect(config.supportServer.inviteUrl); + }); + + return router; +}; \ No newline at end of file diff --git a/index.js b/index.js index d02aa08..c6b9efd 100644 --- a/index.js +++ b/index.js @@ -1,47 +1,52 @@ -const EventEmitter = require('events'); -const DBDEvents = new EventEmitter(); -const version = require("./package.json").version; +const EventEmitter = require("events"), + express = require("express"), + app = express(), + session = require("express-session"), + bodyParser = require("body-parser"), + partials = require("express-partials"), + router = require("./router"), + initServer = require("./InitFunctions/initServer"); -const err = (text) => { - return text + ` Do you need help? Join our Discord server: ${'https://discord.gg/CzfMGtrdaA'.blue}`; -} +const version = require("./package.json").version; +const DBDEvents = new EventEmitter(); class Dashboard { constructor(config) { - let notSetYetAndRequired = []; - if (!config.port) notSetYetAndRequired.push('port'); - if (!config.theme) notSetYetAndRequired.push('theme'); - if (!config.client) notSetYetAndRequired.push('client'); - if (!config.redirectUri) notSetYetAndRequired.push('redirectUri'); - if (!config.bot) notSetYetAndRequired.push('bot'); - if (!config.settings) notSetYetAndRequired.push('settings'); - if (!config.domain) notSetYetAndRequired.push('domain'); - if (notSetYetAndRequired[0]) throw new Error(err(`You need to define some more things: ${notSetYetAndRequired.join(', ')}.`)); + const notSetYetAndRequired = []; + + if (!config.port) notSetYetAndRequired.push("port"); + if (!config.theme) notSetYetAndRequired.push("theme"); + if (!config.client) notSetYetAndRequired.push("client"); + if (!config.redirectUri) notSetYetAndRequired.push("redirectUri"); + if (!config.bot) notSetYetAndRequired.push("bot"); + if (!config.settings) notSetYetAndRequired.push("settings"); + if (!config.domain) notSetYetAndRequired.push("domain"); + if (notSetYetAndRequired[0]) throw new Error(`You need to define some more things: ${notSetYetAndRequired.join(", ")}.`); + this.config = config; this.modules = []; } async init() { - const modules = this.modules; - const config = this.config; - const express = require('express'); - const app = express(); - const session = require('express-session'); - const bodyParser = require('body-parser'); - const partials = require('express-partials'); - const v13support = require('discord.js').version.slice(0, 2) == "13"; + const config = this.config, + modules = this.modules; - app.use(bodyParser.urlencoded({ - extended: true - })); + app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.json()); app.use(partials()); - app.set('views', config.theme.viewsPath); - app.use(express.static(config.theme.staticPath));app.use('/', express.static(config.theme.staticPath));app.use('/:a/', express.static(config.theme.staticPath));app.use('/:a/:b/', express.static(config.theme.staticPath));app.use('/:a/:b/:c/', express.static(config.theme.staticPath));app.use('/:a/:b/:c/:d/', express.static(config.theme.staticPath)); - app.set('view engine', 'ejs'); - let sessionData = { - secret: config.cookiesSecret || 'total_secret_cookie_secret', + app.use(express.static(config.theme.staticPath)); + app.use("/", express.static(config.theme.staticPath)); + app.use("/:a/", express.static(config.theme.staticPath)); + app.use("/:a/:b/", express.static(config.theme.staticPath)); + app.use("/:a/:b/:c/", express.static(config.theme.staticPath)); + app.use("/:a/:b/:c/:d/", express.static(config.theme.staticPath)); + + app.set("views", config.theme.viewsPath); + app.set("view engine", "ejs"); + + const sessionData = { + secret: config.cookiesSecret || "total_secret_cookie_secret", resave: true, saveUninitialized: true, cookie: { @@ -49,13 +54,14 @@ class Dashboard { maxAge: 253402300799999, }, }; + config.sessionSaveSession ? sessionData.store = config.sessionSaveSession : null; app.use(session(sessionData)); - let themeConfig = config.theme.themeConfig; + const themeConfig = config.theme.themeConfig; - app.get('*', (req,res,next) => { - DBDEvents.emit('websiteView', req.session.user ? req.session.user : {loggedIn: false}); + app.get("*", (req, res, next) => { + DBDEvents.emit("websiteView", req.session.user ? req.session.user : { loggedIn: false }); next(); }); @@ -63,7 +69,7 @@ class Dashboard { app.use((req, res, next) => { req.DBDEvents = DBDEvents; - if(req.session.loggedInLastTime == true){ + if (req.session.loggedInLastTime == true) { req.displayLoggedInInfo = true; req.session.loggedInLastTime = false; } @@ -77,18 +83,20 @@ class Dashboard { req.botToken = config.bot.token; req.guildAfterAuthorization = config.guildAfterAuthorization || {}; - req.websiteTitle = config.websiteTitle || "Discord Web Dashboard"; - req.iconUrl = config.iconUrl || 'https://www.nomadfoods.com/wp-content/uploads/2018/08/placeholder-1-e1533569576673.png'; + req.websiteTitle = config.websiteTitle || "Discord Bot Dashboard"; + req.iconUrl = config.iconUrl || "https://www.nomadfoods.com/wp-content/uploads/2018/08/placeholder-1-e1533569576673.png"; req.app = app; req.config = config; next(); }); - require('./router')(app, config, themeConfig, modules); + router(app, config, themeConfig, modules); this.app = app; - let sio = require('./InitFunctions/initServer')(app, config, themeConfig, modules); + + const sio = initServer(app, config, themeConfig, modules); + this.server = sio.server; this.io = sio.io; } @@ -104,8 +112,8 @@ class Dashboard { module.exports = { Dashboard, - formTypes: require('./ModuleExportsFunctions/formTypes'), - customPagesTypes: require('./ModuleExportsFunctions/customPagesTypes'), + formTypes: require("./ModuleExportsFunctions/formTypes"), + customPagesTypes: require("./ModuleExportsFunctions/customPagesTypes"), DBDEvents, - version -} \ No newline at end of file + version, +}; \ No newline at end of file diff --git a/package.json b/package.json index 272cdde..6e3da0a 100644 --- a/package.json +++ b/package.json @@ -1,19 +1,14 @@ { "name": "discord-dashboard", - "version": "2.3.61", - "description": "Create an Dashboard for your bot in 10 minutes without APIs knowledge and slapping code from scratch!", + "version": "1.0", + "description": "dashboard", "main": "index.js", - "directories": { - "test": "test" - }, "typings": ".d.ts", "dependencies": { "assistants-safe-storage": "^1.0.0", "body-parser": "^1.20.0", "colors": "^1.4.0", "cookie-parser": "^1.4.6", - "discord-dashboard": "^2.3.39", - "discord-dashboard-pp-system": "^1.0.2", "discord-oauth2": "^2.10.0", "discord.js": "*", "ejs": "^3.1.8", @@ -24,32 +19,103 @@ "https": "^1.0.0", "keyv": "^4.5.2", "node-fetch": "^2.6.7", - "readline-sync": "^1.4.10", - "socket.io": "^4.5.1", - "uuid": "^8.3.2" + "quick.db": "^7.1.3", + "socket.io": "^4.5.1" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, - "author": "breftejk", - "license": "CC BY-NC-SA 4.0", - "homepage": "https://dbd-docs.assistantscenter.com/", - "keywords": [ - "discord", - "discord.js", - "discordjs", - "discord dashboard", - "discord web dashboard", - "web dashboard", - "dashboard" - ], - "repository": { - "type": "git", - "url": "https://github.com/Assistants-Center/Discord.js-Web-Dashboard.git" - }, "devDependencies": { "dbd-dark-dashboard": "^1.6.58", + "eslint": "^8.23.0", "javascript-obfuscator": "^4.0.0", "prettier": "2.7.1" + }, + "eslintConfig": { + "env": { + "commonjs": true, + "es6": true, + "es2020": true, + "node": true + }, + "extends": "eslint:recommended", + "globals": { + "Atomics": "readonly", + "SharedArrayBuffer": "readonly" + }, + "parserOptions": { + "ecmaVersion": 2020 + }, + "rules": { + "arrow-spacing": [ + "warn", + { + "before": true, + "after": true + } + ], + "comma-dangle": [ + "error", + "always-multiline" + ], + "comma-spacing": "error", + "comma-style": "error", + "dot-location": [ + "error", + "property" + ], + "handle-callback-err": "off", + "indent": [ + "error", + "tab", + { + "SwitchCase": 1 + } + ], + "keyword-spacing": "error", + "max-nested-callbacks": [ + "error", + { + "max": 4 + } + ], + "max-statements-per-line": [ + "error", + { + "max": 2 + } + ], + "no-console": "off", + "no-multi-spaces": "error", + "no-multiple-empty-lines": [ + "error", + { + "max": 2, + "maxEOF": 1, + "maxBOF": 0 + } + ], + "no-trailing-spaces": [ + "error" + ], + "no-var": "error", + "object-curly-spacing": [ + "error", + "always" + ], + "prefer-const": "error", + "quotes": [ + "error", + "double" + ], + "semi": [ + "error", + "always" + ], + "space-in-parens": "error", + "space-infix-ops": "error", + "space-unary-ops": "error", + "yoda": "error" + } } } diff --git a/router.js b/router.js index 948f391..bef5ed2 100644 --- a/router.js +++ b/router.js @@ -1,173 +1,137 @@ +const cookieParser = require("cookie-parser"), + underMaintenancePageDefault = require("./underMaintenancePageDefault"), + error404pageDefault = require("./404pagedefault"); + +const mainRouter = require("./Routes/main"), + dashboardRouter = require("./Routes/dashboard"), + discordRouter = require("./Routes/discord"); + module.exports = (app, config, themeConfig, modules) => { - app.use(require("cookie-parser")()) + app.use(cookieParser()); - app.use((req, res, next) => { - req.bot = config.bot - next() - }) + app.use((req, res, next) => { + req.bot = config.bot; + next(); + }); - if (themeConfig.defaultLocales) { - app.use((req, res, next) => { - if (req.cookies?.lang) req.lang = req.cookies.lang - else req.lang = req.acceptsLanguages()[0].replace("-", "") + if (themeConfig.defaultLocales) { + app.use((req, res, next) => { + if (req.cookies?.lang) req.lang = req.cookies.lang; + else req.lang = req.acceptsLanguages()[0].replace("-", ""); - if (themeConfig.locales) { - if (Object.keys(themeConfig.locales).includes(req.lang)) { - req.locales = themeConfig.locales[req.lang] - } else { - req.locales = - themeConfig.locales[Object.keys(themeConfig.locales)[0]] - } - } else { - req.locales = - themeConfig.defaultLocales[ - Object.keys(themeConfig.defaultLocales).includes( - req.lang - ) - ? req.lang - : "enUS" - ] - } + if (themeConfig.locales) { + if (Object.keys(themeConfig.locales).includes(req.lang)) req.locales = themeConfig.locales[req.lang]; + else req.locales = themeConfig.locales[Object.keys(themeConfig.locales)[0]]; + } else + req.locales = themeConfig.defaultLocales[Object.keys(themeConfig.defaultLocales).includes(req.lang) ? req.lang : "enUS"]; - next() - }) - } + next(); + }); + } - app.use( - "/discord", - require("./Routes/discord")(app, config, themeConfig, modules) - ) + app.use("/discord", discordRouter(app, config, themeConfig, modules)); - if (config.useUnderMaintenance) { - app.get( - config.underMaintenanceAccessPage || "/total-secret-get-access", - (req, res) => { - res.send(` -
- - -
- `) - } - ) + if (config.useUnderMaintenance) { + app.get(config.underMaintenanceAccessPage || "/total-secret-get-access", (req, res) => { + res.send(` +
+ + +
+ `); + }); - app.post( - config.underMaintenanceAccessPage || "/total-secret-get-access", - (req, res) => { - if (!req.body) req.body = {} - const accessKey = req.body.accessKey - if (accessKey != config.underMaintenanceAccessKey) - return res.send("Wrong key.") - req.session.umaccess = true - res.redirect("/") - } - ) + app.post(config.underMaintenanceAccessPage || "/total-secret-get-access", (req, res) => { + if (!req.body) req.body = {}; - app.use((req, res, next) => { - if (req.originalUrl.startsWith("/loading")) return next() - if (!req.session.umaccess && !req.session.user) { - if (!config.useThemeMaintenance) - return res.send( - config.underMaintenanceCustomHtml || - require("./underMaintenancePageDefault")( - config.underMaintenance, - false - ) - ) - else - res.render("maintenance", { - req: req, - bot: config.bot, - themeConfig: req.themeConfig, - loggedIn: false, - defaultMaintenanceConfig: config.underMaintenance || {}, - }) - } else if ( - !req.session.umaccess && - config.ownerIDs && - !config.ownerIDs.includes(req.session.user.id) - ) { - if (!config.useThemeMaintenance) - return res.send( - config.underMaintenanceCustomHtml || - require("./underMaintenancePageDefault")( - config.underMaintenance, - true - ) - ) - else - res.render("maintenance", { - req: req, - bot: config.bot, - themeConfig: req.themeConfig, - loggedIn: true, - defaultMaintenanceConfig: config.underMaintenance || {}, - }) - } else next() - }) - } + const accessKey = req.body.accessKey; - app.use("/", require("./Routes/main")(app, config, themeConfig, modules)) - app.use( - "/", - require("./Routes/dashboard")(app, config, themeConfig, modules) - ) + if (accessKey != config.underMaintenanceAccessKey) return res.send("Wrong key."); - config.theme.init(app, config) + req.session.umaccess = true; + res.redirect("/"); + }); - let customPages = config.customPages || [] - customPages.forEach((p) => { - if (p.type == "redirect") { - app.get(p.endpoint, async (req, res) => { - let endpoint = await p.getEndpoint({ - user: req.session.user || {}, - req, - }) - res.redirect(endpoint) - }) - } else if (p.type == "html") { - app.get(p.endpoint, async (req, res) => { - let html = await p.getHtml({ - user: req.session.user || {}, - req, - }) - res.send(html) - }) - } else if (p.type == "json") { - app.get(p.endpoint, async (req, res) => { - let json = await p.getJson({ - user: req.session.user || {}, - req, - }) - res.send(json) - }) - } - }) + app.use((req, res, next) => { + if (req.originalUrl.startsWith("/loading")) return next(); - modules.forEach((module) => { - module.app({ - app: app, - config: this.config, - themeConfig: themeConfig, - }) - }) + if (!req.session.umaccess && !req.session.user) { + if (!config.useThemeMaintenance) + return res.send(config.underMaintenanceCustomHtml || underMaintenancePageDefault(config.underMaintenance, false)); + else + res.render("maintenance", { + req: req, + bot: config.bot, + themeConfig: req.themeConfig, + loggedIn: false, + defaultMaintenanceConfig: config.underMaintenance || {}, + }); + } else if (!req.session.umaccess && config.ownerIDs && !config.ownerIDs.includes(req.session.user.id)) { + if (!config.useThemeMaintenance) + return res.send(config.underMaintenanceCustomHtml || underMaintenancePageDefault(config.underMaintenance, true)); + else + res.render("maintenance", { + req: req, + bot: config.bot, + themeConfig: req.themeConfig, + loggedIn: true, + defaultMaintenanceConfig: config.underMaintenance || {}, + }); + } else next(); + }); + } - if (!config.useTheme404) { - app.get("*", (req, res) => { - let text = - config.html404 || - require("./404pagedefault")( - config.websiteTitle || themeConfig.websiteName - ) - res.send( - text.replace( - "{{websiteTitle}}", - config.websiteTitle || themeConfig.websiteName - ) - ) - }) - } -} + app.use("/", mainRouter(app, config, themeConfig, modules)); + app.use("/", dashboardRouter(app, config, themeConfig, modules)); + + config.theme.init(app, config); + + const customPages = config.customPages || []; + + customPages.forEach(p => { + if (p.type == "redirect") { + app.get(p.endpoint, async (req, res) => { + const endpoint = await p.getEndpoint({ + user: req.session.user || {}, + req, + }); + + res.redirect(endpoint); + }); + } else if (p.type == "html") { + app.get(p.endpoint, async (req, res) => { + const html = await p.getHtml({ + user: req.session.user || {}, + req, + }); + + res.send(html); + }); + } else if (p.type == "json") { + app.get(p.endpoint, async (req, res) => { + const json = await p.getJson({ + user: req.session.user || {}, + req, + }); + + res.send(json); + }); + } + }); + + modules.forEach(module => { + module.app({ + app: app, + config: this.config, + themeConfig: themeConfig, + }); + }); + + if (!config.useTheme404) { + app.get("*", (req, res) => { + const text = config.html404 || error404pageDefault(config.websiteTitle || themeConfig.websiteName); + + res.send(text.replace("{{websiteTitle}}", config.websiteTitle || themeConfig.websiteName)); + }); + } +}; \ No newline at end of file diff --git a/theme/dbd-soft-ui/dbd-soft-ui.d.ts b/theme/dbd-soft-ui/dbd-soft-ui.d.ts index f3bb2f2..71805a8 100644 --- a/theme/dbd-soft-ui/dbd-soft-ui.d.ts +++ b/theme/dbd-soft-ui/dbd-soft-ui.d.ts @@ -1,538 +1,538 @@ declare module "dbd-soft-ui" { - import { Express, Request, Response } from "express"; + import { Express, Request, Response } from "express"; - type themeConfig = { - customThemeOptions: { - index: ({ req, res, config }: { - req: Request, - res: Response, - config: any - }) => { - cards: { - title: string, - icon: string, - getValue: string, - progressBar: { - enabled: boolean, - getProgress: number - } - }[], - graph: { - values: number[], - labels: string[] - } - } - }, - addons: string[], - websiteName: string, - colorScheme: "dark" | "pink" | "blue" | "red" | "green" | "yellow" | "custom", - themeColors?: { - primaryColor: string, - secondaryColor: string - } - supporteMail: string, - locales: Record, - footer: { - replaceDefault: boolean, - text: string, - } - admin: { - pterodactyl: { - enabled: boolean, - apiKey: string, - panelLink: string, - serverUUIDs: string[] - }, - logs?: { - enabled?: boolean, - key?: string, - } - }, - icons: { - favicon: string, - noGuildIcon: string, - sidebar: { - darkUrl: string, - lightUrl: string, - hideName: boolean, - borderRadius: boolean, - alignCenter: boolean - } - }, - index: { - graph: { - enabled: boolean, - lineGraph: boolean, - tag: string, - max: number - } - }, - premium: { - enabled: boolean, - card: { - title: string, - description: string, - bgImage: string, - button: { - text: string, - url: string - } - } - }, - preloader: { - image: string, - spinner: boolean, - text: string - }, - sidebar?: { - gestures: { - disabled: boolean, - gestureTimer: number, - gestureSensitivity: number - } - }, - shardspage?: { - enabled: boolean, - key: string, - }, - meta: { - author: string, - owner: string, - description: string, - ogLocale: string, - ogTitle: string, - ogImage: string, - ogType: string, - ogUrl: string, - ogSiteName: string, - ogDescription: string, - twitterTitle: string, - twitterDescription: string, - twitterDomain: string, - twitterUrl: string, - twitterCard: string, - twitterSite: string, - twitterSiteId: string, - twitterCreator: string, - twitterCreatorId: string, - twitterImage: string - }, - error: { - error404: { - title: string, - subtitle: string, - description: string - }, - dbdError: { - disableSecretMenu: boolean, - secretMenuCombination: string[] - } - }, - sweetalert: { - errors: { - requirePremium: string - }, - success: { - login: string - } - }, - blacklisted: { - title: string, - subtitle: string, - description: string, - button: { - enabled: boolean, - text: string, - link: string - } - }, - commands?: [ - { - category: string, - subTitle: string, - categoryId: string, - image: string, - hideAlias: boolean, - hideDescription: boolean, - hideSidebarItem: boolean, - list: [ - { - commandName: string, - commandUsage: string, - commandDescription: string, - commandAlias: string - } - ] - } - ] + type themeConfig = { + customThemeOptions: { + index: ({ req, res, config }: { + req: Request, + res: Response, + config: any + }) => { + cards: { + title: string, + icon: string, + getValue: string, + progressBar: { + enabled: boolean, + getProgress: number + } + }[], + graph: { + values: number[], + labels: string[] + } + } + }, + addons: string[], + websiteName: string, + colorScheme: "dark" | "pink" | "blue" | "red" | "green" | "yellow" | "custom", + themeColors?: { + primaryColor: string, + secondaryColor: string + } + supporteMail: string, + locales: Record, + footer: { + replaceDefault: boolean, + text: string, + } + admin: { + pterodactyl: { + enabled: boolean, + apiKey: string, + panelLink: string, + serverUUIDs: string[] + }, + logs?: { + enabled?: boolean, + key?: string, + } + }, + icons: { + favicon: string, + noGuildIcon: string, + sidebar: { + darkUrl: string, + lightUrl: string, + hideName: boolean, + borderRadius: boolean, + alignCenter: boolean + } + }, + index: { + graph: { + enabled: boolean, + lineGraph: boolean, + tag: string, + max: number + } + }, + premium: { + enabled: boolean, + card: { + title: string, + description: string, + bgImage: string, + button: { + text: string, + url: string + } + } + }, + preloader: { + image: string, + spinner: boolean, + text: string + }, + sidebar?: { + gestures: { + disabled: boolean, + gestureTimer: number, + gestureSensitivity: number + } + }, + shardspage?: { + enabled: boolean, + key: string, + }, + meta: { + author: string, + owner: string, + description: string, + ogLocale: string, + ogTitle: string, + ogImage: string, + ogType: string, + ogUrl: string, + ogSiteName: string, + ogDescription: string, + twitterTitle: string, + twitterDescription: string, + twitterDomain: string, + twitterUrl: string, + twitterCard: string, + twitterSite: string, + twitterSiteId: string, + twitterCreator: string, + twitterCreatorId: string, + twitterImage: string + }, + error: { + error404: { + title: string, + subtitle: string, + description: string + }, + dbdError: { + disableSecretMenu: boolean, + secretMenuCombination: string[] + } + }, + sweetalert: { + errors: { + requirePremium: string + }, + success: { + login: string + } + }, + blacklisted: { + title: string, + subtitle: string, + description: string, + button: { + enabled: boolean, + text: string, + link: string + } + }, + commands?: [ + { + category: string, + subTitle: string, + categoryId: string, + image: string, + hideAlias: boolean, + hideDescription: boolean, + hideSidebarItem: boolean, + list: [ + { + commandName: string, + commandUsage: string, + commandDescription: string, + commandAlias: string + } + ] + } + ] - } + } - export default function (options: themeConfig): { - themeCodename: string, - viewsPath: string, - staticPath: string, - embedBuilderComponent: string, - themeConfig: themeConfig, - init: (app: Express, config: Record) => void; - }; + export default function (options: themeConfig): { + themeCodename: string, + viewsPath: string, + staticPath: string, + embedBuilderComponent: string, + themeConfig: themeConfig, + init: (app: Express, config: Record) => void; + }; - export const partials: any; - export const formTypes: FormTypes; - export const cmdHandler: (commands: Record[], prefix: string) => Record[]; + export const partials: any; + export const formTypes: FormTypes; + export const cmdHandler: (commands: Record[], prefix: string) => Record[]; - /** - * @see [utils/feedHandler](./utils/feedHandler.js). - */ - export class Feed { - color: FeedColor; - description: string; - icon: FeedIcon; - id: string | number; + /** + * @see [utils/feedHandler](./utils/feedHandler.js). + */ + export class Feed { + color: FeedColor; + description: string; + icon: FeedIcon; + id: string | number; - setColor: (color: FeedColor) => Feed; - setDescription: (description: string) => Feed; - setIcon: (icon: FeedIcon) => Feed; - getFeed: (id: string | number) => Feed; - delete: () => Feed; - send: () => Promise; - constructor(); - } + setColor: (color: FeedColor) => Feed; + setDescription: (description: string) => Feed; + setIcon: (icon: FeedIcon) => Feed; + getFeed: (id: string | number) => Feed; + delete: () => Feed; + send: () => Promise; + constructor(); + } - /** - * All possible colors that can be used against the - * `Feed#setColor()` method. They can be accessed with - * dot notation, eg `FeedColor.Red`. - */ - export enum FeedColor { - Red = "red", - Orange = "orange", - Pink = "pink", - Gray = "gray", - Green = "green", - Blue = "blue", - Dark = "dark" - } + /** + * All possible colors that can be used against the + * `Feed#setColor()` method. They can be accessed with + * dot notation, eg `FeedColor.Red`. + */ + export enum FeedColor { + Red = "red", + Orange = "orange", + Pink = "pink", + Gray = "gray", + Green = "green", + Blue = "blue", + Dark = "dark" + } - /** - * All possible icons that can be used against the - * `Feed#setIcon()` method. They can be accessed with - * bracket notation, eg `FeedIcon["address-book"]`. - */ - export enum FeedIcon { - "address-book", - "address-card", - "adjust", - "air-freshener", - "align-center", - "align-left", - "align-right", - "ambulance", - "angle-double-down", - "angle-double-left", - "angle-double-right", - "angle-double-up", - "angle-down", - "angle-left", - "angle-right", - "angle-up", - "archive", - "arrow-alt-circle-down", - "arrow-alt-circle-left", - "arrow-alt-circle-right", - "arrow-alt-circle-up", - "arrow-down", - "arrow-left", - "arrow-right", - "arrow-up", - "arrows-alt", - "arrows-alt-h", - "arrows-alt-v", - "assistive-listening-systems", - "asterisk", - "at", - "atlas", - "award", - "backspace", - "backward", - "bahai", - "ban", - "band-aid", - "bars", - "battery-empty", - "battery-full", - "battery-half", - "battery-quarter", - "battery-three-quarters", - "bed", - "beer", - "bell", - "bell-slash", - "birthday-cake", - "bolt", - "bomb", - "bone", - "book", - "book-dead", - "book-medical", - "book-open", - "bookmark", - "border-all", - "border-none", - "border-style", - "bowling-ball", - "box", - "box-open", - "briefcase", - "broadcast-tower", - "bug", - "building", - "bullhorn", - "calculator", - "calendar", - "calendar-alt", - "calendar-check", - "calendar-day", - "calendar-minus", - "calendar-plus", - "calendar-times", - "calendar-week", - "camera", - "caret-down", - "caret-left", - "caret-right", - "caret-up", - "certificate", - "chair", - "chalkboard", - "charging-station", - "chart-bar", - "chart-line", - "chart-pie", - "check", - "check-circle", - "check-square", - "circle", - "circle-notch", - "clipboard", - "clock", - "clone", - "cloud", - "cloud-download-alt", - "cloud-meatball", - "cloud-moon", - "cloud-moon-rain", - "cloud-rain", - "cloud-showers-heavy", - "cloud-sun", - "cloud-sun-rain", - "cloud-upload-alt", - "code", - "code-branch", - "cog", - "cogs", - "columns", - "comment", - "comment-alt", - "comment-dollar", - "comment-dots", - "comment-medical", - "comment-slash", - "comments", - "comments-dollar", - "compact-disc", - "compass", - "compress-alt", - "cookie", - "cookie-bite", - "copy", - "credit-card", - "crop", - "crop-alt", - "cut", - "database", - "desktop", - "edit", - "envelope", - "envelope-open", - "eraser", - "ethernet", - "exchange-alt", - "exclamation", - "exclamation-circle", - "exclamation-triangle", - "expand", - "expand-alt", - "external-link-alt", - "eye", - "eye-dropper", - "eye-slash", - "fan", - "file", - "file-alt", - "file-archive", - "file-audio", - "file-code", - "file-download", - "fill", - "fill-drip", - "filter", - "fingerprint", - "fire", - "fire-alt", - "folder", - "folder-open", - "forward", - "gamepad", - "ghost", - "gift", - "gifts", - "globe", - "globe-africa", - "globe-asia", - "globe-europe", - "headphones", - "headphones-alt", - "headset", - "heart", - "heart-broken", - "heartbeat", - "history", - "home", - "info", - "keyboard", - "layer-group", - "list", - "lock", - "lock-open", - "map-marker", - "map-marker-alt", - "microphone", - "microphone-alt", - "microphone-alt-slash", - "minus", - "mobile", - "mobile-alt", - "moon", - "mouse", - "mouse-pointer", - "music", - "network-wired", - "neuter", - "paperclip", - "paste", - "pause", - "paw", - "pen", - "pencil-alt", - "percent", - "percentage", - "phone", - "phone-alt", - "phone-slash", - "phone-volume", - "photo-video", - "power-off", - "question", - "question-circle", - "redo", - "redo-alt", - "reply", - "robot", - "rocket", - "rss", - "satellite-dish", - "save", - "search", - "server", - "shapes", - "share", - "share-alt", - "shield-alt", - "signal", - "skull", - "skull-crossbones", - "sliders-h", - "sort", - "spinner", - "times", - "times-circle", - "toggle-off", - "toggle-on", - "toolbox", - "tools", - "trash", - "trash-alt", - "tv", - "undo", - "undo-alt", - "unlink", - "unlock", - "unlock-alt", - "upload", - "user", - "user-alt", - "volume-down", - "volume-mute", - "volume-off", - "volume-up", - "wifi", - "wrench", + /** + * All possible icons that can be used against the + * `Feed#setIcon()` method. They can be accessed with + * bracket notation, eg `FeedIcon["address-book"]`. + */ + export enum FeedIcon { + "address-book", + "address-card", + "adjust", + "air-freshener", + "align-center", + "align-left", + "align-right", + "ambulance", + "angle-double-down", + "angle-double-left", + "angle-double-right", + "angle-double-up", + "angle-down", + "angle-left", + "angle-right", + "angle-up", + "archive", + "arrow-alt-circle-down", + "arrow-alt-circle-left", + "arrow-alt-circle-right", + "arrow-alt-circle-up", + "arrow-down", + "arrow-left", + "arrow-right", + "arrow-up", + "arrows-alt", + "arrows-alt-h", + "arrows-alt-v", + "assistive-listening-systems", + "asterisk", + "at", + "atlas", + "award", + "backspace", + "backward", + "bahai", + "ban", + "band-aid", + "bars", + "battery-empty", + "battery-full", + "battery-half", + "battery-quarter", + "battery-three-quarters", + "bed", + "beer", + "bell", + "bell-slash", + "birthday-cake", + "bolt", + "bomb", + "bone", + "book", + "book-dead", + "book-medical", + "book-open", + "bookmark", + "border-all", + "border-none", + "border-style", + "bowling-ball", + "box", + "box-open", + "briefcase", + "broadcast-tower", + "bug", + "building", + "bullhorn", + "calculator", + "calendar", + "calendar-alt", + "calendar-check", + "calendar-day", + "calendar-minus", + "calendar-plus", + "calendar-times", + "calendar-week", + "camera", + "caret-down", + "caret-left", + "caret-right", + "caret-up", + "certificate", + "chair", + "chalkboard", + "charging-station", + "chart-bar", + "chart-line", + "chart-pie", + "check", + "check-circle", + "check-square", + "circle", + "circle-notch", + "clipboard", + "clock", + "clone", + "cloud", + "cloud-download-alt", + "cloud-meatball", + "cloud-moon", + "cloud-moon-rain", + "cloud-rain", + "cloud-showers-heavy", + "cloud-sun", + "cloud-sun-rain", + "cloud-upload-alt", + "code", + "code-branch", + "cog", + "cogs", + "columns", + "comment", + "comment-alt", + "comment-dollar", + "comment-dots", + "comment-medical", + "comment-slash", + "comments", + "comments-dollar", + "compact-disc", + "compass", + "compress-alt", + "cookie", + "cookie-bite", + "copy", + "credit-card", + "crop", + "crop-alt", + "cut", + "database", + "desktop", + "edit", + "envelope", + "envelope-open", + "eraser", + "ethernet", + "exchange-alt", + "exclamation", + "exclamation-circle", + "exclamation-triangle", + "expand", + "expand-alt", + "external-link-alt", + "eye", + "eye-dropper", + "eye-slash", + "fan", + "file", + "file-alt", + "file-archive", + "file-audio", + "file-code", + "file-download", + "fill", + "fill-drip", + "filter", + "fingerprint", + "fire", + "fire-alt", + "folder", + "folder-open", + "forward", + "gamepad", + "ghost", + "gift", + "gifts", + "globe", + "globe-africa", + "globe-asia", + "globe-europe", + "headphones", + "headphones-alt", + "headset", + "heart", + "heart-broken", + "heartbeat", + "history", + "home", + "info", + "keyboard", + "layer-group", + "list", + "lock", + "lock-open", + "map-marker", + "map-marker-alt", + "microphone", + "microphone-alt", + "microphone-alt-slash", + "minus", + "mobile", + "mobile-alt", + "moon", + "mouse", + "mouse-pointer", + "music", + "network-wired", + "neuter", + "paperclip", + "paste", + "pause", + "paw", + "pen", + "pencil-alt", + "percent", + "percentage", + "phone", + "phone-alt", + "phone-slash", + "phone-volume", + "photo-video", + "power-off", + "question", + "question-circle", + "redo", + "redo-alt", + "reply", + "robot", + "rocket", + "rss", + "satellite-dish", + "save", + "search", + "server", + "shapes", + "share", + "share-alt", + "shield-alt", + "signal", + "skull", + "skull-crossbones", + "sliders-h", + "sort", + "spinner", + "times", + "times-circle", + "toggle-off", + "toggle-on", + "toolbox", + "tools", + "trash", + "trash-alt", + "tv", + "undo", + "undo-alt", + "unlink", + "unlock", + "unlock-alt", + "upload", + "user", + "user-alt", + "volume-down", + "volume-mute", + "volume-off", + "volume-up", + "wifi", + "wrench", - "youtube", - "discord", - "node", - "apple", - "sellsy", - "app-store", - "cloudflare", - "dev", - "github-alt", - "gitlab", - "google", - "itunes-note", - "node-js", - "npm", - "spotify", - "usb", - "windows" - } + "youtube", + "discord", + "node", + "apple", + "sellsy", + "app-store", + "cloudflare", + "dev", + "github-alt", + "gitlab", + "google", + "itunes-note", + "node-js", + "npm", + "spotify", + "usb", + "windows" + } - /** - * @see [utils/formtypes](./utils/formtypes.js). - */ - export interface FormTypes { - spacer: (themeOptions: Record) => { - type: string, - themeOptions: Record - } - emojiPicker: (disabled: boolean, themeOptions: Record) => { - type: string, - disabled: boolean, - themeOptions: Record - } - slider: (min: number, max: number, step: number, disabled: boolean, themeOptions: Record) => { - type: string, - min: number, - max: number, - step: number, - disabled: boolean, - themeOptions: Record - }, - date: (disabled: boolean, themeOptions: Record) => { - type: string, - disabled: boolean, - themeOptions: Record - }, - numberPicker: (min: number, max: number, disabled: boolean, themeOptions: Record) => { - type: string, - disabled: boolean, - themeOptions: Record - }, - tagInput: (disabled: boolean, themeOptions: Record) => { - type: string, - disabled: boolean, - themeOptions: Record - } - } -} + /** + * @see [utils/formtypes](./utils/formtypes.js). + */ + export interface FormTypes { + spacer: (themeOptions: Record) => { + type: string, + themeOptions: Record + } + emojiPicker: (disabled: boolean, themeOptions: Record) => { + type: string, + disabled: boolean, + themeOptions: Record + } + slider: (min: number, max: number, step: number, disabled: boolean, themeOptions: Record) => { + type: string, + min: number, + max: number, + step: number, + disabled: boolean, + themeOptions: Record + }, + date: (disabled: boolean, themeOptions: Record) => { + type: string, + disabled: boolean, + themeOptions: Record + }, + numberPicker: (min: number, max: number, disabled: boolean, themeOptions: Record) => { + type: string, + disabled: boolean, + themeOptions: Record + }, + tagInput: (disabled: boolean, themeOptions: Record) => { + type: string, + disabled: boolean, + themeOptions: Record + } + } +} \ No newline at end of file diff --git a/theme/dbd-soft-ui/icons.js b/theme/dbd-soft-ui/icons.js index 9a94b29..5d9ce93 100644 --- a/theme/dbd-soft-ui/icons.js +++ b/theme/dbd-soft-ui/icons.js @@ -1,288 +1,289 @@ const icons = [ - 'address-book', - 'address-card', - 'adjust', - 'air-freshener', - 'align-center', - 'align-left', - 'align-right', - 'ambulance', - 'angle-double-down', - 'angle-double-left', - 'angle-double-right', - 'angle-double-up', - 'angle-down', - 'angle-left', - 'angle-right', - 'angle-up', - 'archive', - 'arrow-alt-circle-down', - 'arrow-alt-circle-left', - 'arrow-alt-circle-right', - 'arrow-alt-circle-up', - 'arrow-down', - 'arrow-left', - 'arrow-right', - 'arrow-up', - 'arrows-alt', - 'arrows-alt-h', - 'arrows-alt-v', - 'assistive-listening-systems', - 'asterisk', - 'at', - 'atlas', - 'award', - 'backspace', - 'backward', - 'bahai', - 'ban', - 'band-aid', - 'bars', - 'battery-empty', - 'battery-full', - 'battery-half', - 'battery-quarter', - 'battery-three-quarters', - 'bed', - 'beer', - 'bell', - 'bell-slash', - 'birthday-cake', - 'bolt', - 'bomb', - 'bone', - 'book', - 'book-dead', - 'book-medical', - 'book-open', - 'bookmark', - 'border-all', - 'border-none', - 'border-style', - 'bowling-ball', - 'box', - 'box-open', - 'briefcase', - 'broadcast-tower', - 'bug', - 'building', - 'bullhorn', - 'calculator', - 'calendar', - 'calendar-alt', - 'calendar-check', - 'calendar-day', - 'calendar-minus', - 'calendar-plus', - 'calendar-times', - 'calendar-week', - 'camera', - 'caret-down', - 'caret-left', - 'caret-right', - 'caret-up', - 'certificate', - 'chair', - 'chalkboard', - 'charging-station', - 'chart-bar', - 'chart-line', - 'chart-pie', - 'check', - 'check-circle', - 'check-square', - 'circle', - 'circle-notch', - 'clipboard', - 'clock', - 'clone', - 'cloud', - 'cloud-download-alt', - 'cloud-meatball', - 'cloud-moon', - 'cloud-moon-rain', - 'cloud-rain', - 'cloud-showers-heavy', - 'cloud-sun', - 'cloud-sun-rain', - 'cloud-upload-alt', - 'code', - 'code-branch', - 'cog', - 'cogs', - 'columns', - 'comment', - 'comment-alt', - 'comment-dollar', - 'comment-dots', - 'comment-medical', - 'comment-slash', - 'comments', - 'comments-dollar', - 'compact-disc', - 'compass', - 'compress-alt', - 'cookie', - 'cookie-bite', - 'copy', - 'credit-card', - 'crop', - 'crop-alt', - 'cut', - 'database', - 'desktop', - 'edit', - 'envelope', - 'envelope-open', - 'eraser', - 'ethernet', - 'exchange-alt', - 'exclamation', - 'exclamation-circle', - 'exclamation-triangle', - 'expand', - 'expand-alt', - 'external-link-alt', - 'eye', - 'eye-dropper', - 'eye-slash', - 'fan', - 'file', - 'file-alt', - 'file-archive', - 'file-audio', - 'file-code', - 'file-download', - 'fill', - 'fill-drip', - 'filter', - 'fingerprint', - 'fire', - 'fire-alt', - 'folder', - 'folder-open', - 'forward', - 'gamepad', - 'ghost', - 'gift', - 'gifts', - 'globe', - 'globe-africa', - 'globe-asia', - 'globe-europe', - 'headphones', - 'headphones-alt', - 'headset', - 'heart', - 'heart-broken', - 'heartbeat', - 'history', - 'home', - 'info', - 'keyboard', - 'layer-group', - 'list', - 'lock', - 'lock-open', - 'map-marker', - 'map-marker-alt', - 'microphone', - 'microphone-alt', - 'microphone-alt-slash', - 'minus', - 'mobile', - 'mobile-alt', - 'moon', - 'mouse', - 'mouse-pointer', - 'music', - 'network-wired', - 'neuter', - 'paperclip', - 'paste', - 'pause', - 'paw', - 'pen', - 'pencil-alt', - 'percent', - 'percentage', - 'phone', - 'phone-alt', - 'phone-slash', - 'phone-volume', - 'photo-video', - 'power-off', - 'question', - 'question-circle', - 'redo', - 'redo-alt', - 'reply', - 'robot', - 'rocket', - 'rss', - 'satellite-dish', - 'save', - 'search', - 'server', - 'shapes', - 'share', - 'share-alt', - 'shield-alt', - 'signal', - 'skull', - 'skull-crossbones', - 'sliders-h', - 'sort', - 'spinner', - 'times', - 'times-circle', - 'toggle-off', - 'toggle-on', - 'toolbox', - 'tools', - 'trash', - 'trash-alt', - 'tv', - 'undo', - 'undo-alt', - 'unlink', - 'unlock', - 'unlock-alt', - 'upload', - 'user', - 'user-alt', - 'volume-down', - 'volume-mute', - 'volume-off', - 'volume-up', - 'wifi', - 'wrench' -] + "address-book", + "address-card", + "adjust", + "air-freshener", + "align-center", + "align-left", + "align-right", + "ambulance", + "angle-double-down", + "angle-double-left", + "angle-double-right", + "angle-double-up", + "angle-down", + "angle-left", + "angle-right", + "angle-up", + "archive", + "arrow-alt-circle-down", + "arrow-alt-circle-left", + "arrow-alt-circle-right", + "arrow-alt-circle-up", + "arrow-down", + "arrow-left", + "arrow-right", + "arrow-up", + "arrows-alt", + "arrows-alt-h", + "arrows-alt-v", + "assistive-listening-systems", + "asterisk", + "at", + "atlas", + "award", + "backspace", + "backward", + "bahai", + "ban", + "band-aid", + "bars", + "battery-empty", + "battery-full", + "battery-half", + "battery-quarter", + "battery-three-quarters", + "bed", + "beer", + "bell", + "bell-slash", + "birthday-cake", + "bolt", + "bomb", + "bone", + "book", + "book-dead", + "book-medical", + "book-open", + "bookmark", + "border-all", + "border-none", + "border-style", + "bowling-ball", + "box", + "box-open", + "briefcase", + "broadcast-tower", + "bug", + "building", + "bullhorn", + "calculator", + "calendar", + "calendar-alt", + "calendar-check", + "calendar-day", + "calendar-minus", + "calendar-plus", + "calendar-times", + "calendar-week", + "camera", + "caret-down", + "caret-left", + "caret-right", + "caret-up", + "certificate", + "chair", + "chalkboard", + "charging-station", + "chart-bar", + "chart-line", + "chart-pie", + "check", + "check-circle", + "check-square", + "circle", + "circle-notch", + "clipboard", + "clock", + "clone", + "cloud", + "cloud-download-alt", + "cloud-meatball", + "cloud-moon", + "cloud-moon-rain", + "cloud-rain", + "cloud-showers-heavy", + "cloud-sun", + "cloud-sun-rain", + "cloud-upload-alt", + "code", + "code-branch", + "cog", + "cogs", + "columns", + "comment", + "comment-alt", + "comment-dollar", + "comment-dots", + "comment-medical", + "comment-slash", + "comments", + "comments-dollar", + "compact-disc", + "compass", + "compress-alt", + "cookie", + "cookie-bite", + "copy", + "credit-card", + "crop", + "crop-alt", + "cut", + "database", + "desktop", + "edit", + "envelope", + "envelope-open", + "eraser", + "ethernet", + "exchange-alt", + "exclamation", + "exclamation-circle", + "exclamation-triangle", + "expand", + "expand-alt", + "external-link-alt", + "eye", + "eye-dropper", + "eye-slash", + "fan", + "file", + "file-alt", + "file-archive", + "file-audio", + "file-code", + "file-download", + "fill", + "fill-drip", + "filter", + "fingerprint", + "fire", + "fire-alt", + "folder", + "folder-open", + "forward", + "gamepad", + "ghost", + "gift", + "gifts", + "globe", + "globe-africa", + "globe-asia", + "globe-europe", + "headphones", + "headphones-alt", + "headset", + "heart", + "heart-broken", + "heartbeat", + "history", + "home", + "info", + "keyboard", + "layer-group", + "list", + "lock", + "lock-open", + "map-marker", + "map-marker-alt", + "microphone", + "microphone-alt", + "microphone-alt-slash", + "minus", + "mobile", + "mobile-alt", + "moon", + "mouse", + "mouse-pointer", + "music", + "network-wired", + "neuter", + "paperclip", + "paste", + "pause", + "paw", + "pen", + "pencil-alt", + "percent", + "percentage", + "phone", + "phone-alt", + "phone-slash", + "phone-volume", + "photo-video", + "power-off", + "question", + "question-circle", + "redo", + "redo-alt", + "reply", + "robot", + "rocket", + "rss", + "satellite-dish", + "save", + "search", + "server", + "shapes", + "share", + "share-alt", + "shield-alt", + "signal", + "skull", + "skull-crossbones", + "sliders-h", + "sort", + "spinner", + "times", + "times-circle", + "toggle-off", + "toggle-on", + "toolbox", + "tools", + "trash", + "trash-alt", + "tv", + "undo", + "undo-alt", + "unlink", + "unlock", + "unlock-alt", + "upload", + "user", + "user-alt", + "volume-down", + "volume-mute", + "volume-off", + "volume-up", + "wifi", + "wrench", +]; + const otherIcons = [ - 'youtube', - 'discord', - 'node', - 'apple', - 'sellsy', - 'app-store', - 'cloudflare', - 'dev', - 'github-alt', - 'gitlab', - 'google', - 'itunes-note', - 'node-js', - 'npm', - 'spotify', - 'usb', - 'windows' -] + "youtube", + "discord", + "node", + "apple", + "sellsy", + "app-store", + "cloudflare", + "dev", + "github-alt", + "gitlab", + "google", + "itunes-note", + "node-js", + "npm", + "spotify", + "usb", + "windows", +]; function run() { - return { - icons, - otherIcons - } + return { + icons, + otherIcons, + }; } -module.exports = run() +module.exports = run(); \ No newline at end of file diff --git a/theme/dbd-soft-ui/index.js b/theme/dbd-soft-ui/index.js index 8cc7bea..ae49749 100644 --- a/theme/dbd-soft-ui/index.js +++ b/theme/dbd-soft-ui/index.js @@ -1,69 +1,48 @@ -const colors = require('colors') -const npmUpdater = require('./utils/updater/npm') -const fileUpdater = require('./utils/updater/files') -const consolePrefix = `${'['.blue}${'dbd-soft-ui'.yellow}${']'.blue} ` -const Keyv = require('keyv') -const path = require('path') +const consolePrefix = `${"[".blue}${"dbd-soft-ui".yellow}${"]".blue} `; +const Keyv = require("keyv"); +const path = require("path"); +const { readFileSync } = require("fs"); module.exports = (themeConfig = {}) => { - return { - themeCodename: 'softui', - viewsPath: path.join(__dirname, '/views'), - staticPath: path.join(__dirname, '/views/src'), - themeConfig: { - ...themeConfig, - defaultLocales: require('./locales.js') - }, - messages: { - error: { - addonLicense: `${consolePrefix}${'Failed to initialise {{ADDON}}.\nThe license this addon was installed with does not match your current discord-dashboard license.' - .cyan - }` - }, - success: { - addonLoaded: `${consolePrefix}${'Successfully loaded {{ADDON}}.'.cyan - }` - } - }, - embedBuilderComponent: require('fs').readFileSync( - path.join(__dirname, '/embedBuilderComponent.txt'), - 'utf8' - ), - init: async (app, config) => { - if(!config?.useTheme404) return console.log(`${consolePrefix}${'You need to set useTheme404 to true in your DBD config otherwise Soft-UI will not work correctly!\n\nDashboard has not fully initialised due to this. Pages will 404!'.red}`); + return { + themeCodename: "softui", + viewsPath: path.join(__dirname, "/views"), + staticPath: path.join(__dirname, "/views/src"), + themeConfig: { + ...themeConfig, + defaultLocales: require("./locales.js"), + }, + messages: { + error: { + addonLicense: `${consolePrefix}${"Failed to initialise {{ADDON}}.\nThe license this addon was installed with does not match your current discord-dashboard license.".cyan}`, + }, + success: { + addonLoaded: `${consolePrefix}${"Successfully loaded {{ADDON}}.".cyan}`, + }, + }, + embedBuilderComponent: readFileSync(path.join(__dirname, "/embedBuilderComponent.txt"), "utf8"), + init: async (app, config) => { + if (!config?.useTheme404) return console.log(`${consolePrefix}${"You need to set useTheme404 to true in your DBD config otherwise Soft-UI will not work correctly!\n\nDashboard has not fully initialised due to this. Pages will 404!".red}`); - let outdated = false - ; (async () => { - let check = await npmUpdater.update() - await fileUpdater.update() - if (!check) outdated = true - })() + const db = new Keyv(themeConfig.dbdriver || "sqlite://" + path.join(__dirname, "/database.sqlite")); - const db = new Keyv( - themeConfig.dbdriver || - 'sqlite://' + path.join(__dirname, '/database.sqlite') - ) + db.on("error", (err) => { + console.log("Connection Error", err); + process.exit(); + }); - db.on('error', (err) => { - console.log('Connection Error', err) - process.exit() - }) + themeConfig = { ...themeConfig, defaultLocales: require("./locales.js") }; - themeConfig = { - ...themeConfig, - defaultLocales: require('./locales.js') - } + require("./utils/functions/errorHandler")(config, themeConfig, db); + require("./utils/functions/settingsPage")(config, themeConfig, db); + // await require('./utils/addonManager').execute(themeConfig, config, app, module.exports.messages); + require("./utils/initPages").init(config, themeConfig, app, db); + }, + }; +}; - require('./utils/functions/errorHandler')(config, themeConfig, db) - require('./utils/functions/settingsPage')(config, themeConfig, db) - // await require('./utils/addonManager').execute(themeConfig, config, app, module.exports.messages); - require('./utils/initPages').init(config, themeConfig, app, db) - } - } -} - -module.exports.partials = __dirname + '/views/partials' -module.exports.formTypes = require('./utils/formtypes') -module.exports.Feed = require('./utils/feedHandler') -module.exports.cmdHandler = require('./utils/cmdHandler') -module.exports.version = require('./package.json').version +module.exports.partials = __dirname + "/views/partials"; +module.exports.formTypes = require("./utils/formtypes"); +module.exports.Feed = require("./utils/feedHandler"); +module.exports.cmdHandler = require("./utils/cmdHandler"); +module.exports.version = require("./package.json").version; \ No newline at end of file diff --git a/theme/dbd-soft-ui/locales.js b/theme/dbd-soft-ui/locales.js index 5234e86..6b45be7 100644 --- a/theme/dbd-soft-ui/locales.js +++ b/theme/dbd-soft-ui/locales.js @@ -1,95 +1,94 @@ module.exports = { - enUS: { - name: 'English', - index: { - feeds: ['Current Users', 'CPU', 'System Platform', 'Server Count'], - card: { - category: 'Soft UI', - title: 'Assistants - The center of everything', - description: - "Assistants Discord Bot management panel. Assistants Bot was created to give others the ability to do what they want. Just.
That's an example text.

Feel free to use HTML", - footer: 'Learn More', - image: '/img/soft-ui.webp', - linkText: 'Learn more' - }, - feedsTitle: 'Feeds', - graphTitle: 'Graphs' - }, - manage: { - settings: { - memberCount: 'Members', - info: { - info: 'Info', - server: 'Server Information' - } - } - }, - privacyPolicy: { - title: 'Privacy Policy', - description: 'Privacy Policy and Terms of Service' - }, - partials: { - sidebar: { - dash: 'Dashboard', - manage: 'Manage Guilds', - commands: 'Commands', - pp: 'Privacy Policy', - admin: 'Admin', - account: 'Account Pages', - login: 'Sign In', - logout: 'Sign Out' - }, - navbar: { - home: 'Home', - pages: { - manage: 'Manage Guilds', - settings: 'Manage Guilds', - commands: 'Commands', - pp: 'Privacy Policy', - admin: 'Admin Panel', - error: 'Error', - credits: 'Credits', - debug: 'Debug', - leaderboard: 'Leaderboard', - profile: 'Profile', - maintenance: 'Under Maintenance' - } - }, - title: { - pages: { - manage: 'Manage Guilds', - settings: 'Manage Guilds', - commands: 'Commands', - pp: 'Privacy Policy', - admin: 'Admin Panel', - error: 'Error', - credits: 'Credits', - debug: 'Debug', - leaderboard: 'Leaderboard', - profile: 'Profile', - maintenance: 'Under Maintenance' - } - }, - preloader: { - text: 'Page is loading...' - }, - premium: { - title: 'Want more from Assistants?', - description: 'Check out premium features below!', - buttonText: 'Become Premium' - }, - settings: { - title: 'Site Configuration', - description: 'Configurable Viewing Options', - theme: { - title: 'Site Theme', - description: 'Make the site more appealing for your eyes!' - }, - language: { - title: 'Site Language', - description: 'Select your preferred language!' - } - } - } - } -} + enUS: { + name: "English", + index: { + feeds: ["Current Users", "CPU", "System Platform", "Server Count"], + card: { + category: "Soft UI", + title: "Assistants - The center of everything", + description: "Assistants Discord Bot management panel. Assistants Bot was created to give others the ability to do what they want. Just.
That's an example text.

Feel free to use HTML", + footer: "Learn More", + image: "/img/soft-ui.webp", + linkText: "Learn more", + }, + feedsTitle: "Feeds", + graphTitle: "Graphs", + }, + manage: { + settings: { + memberCount: "Members", + info: { + info: "Info", + server: "Server Information", + }, + }, + }, + privacyPolicy: { + title: "Privacy Policy", + description: "Privacy Policy and Terms of Service", + }, + partials: { + sidebar: { + dash: "Dashboard", + manage: "Manage Guilds", + commands: "Commands", + pp: "Privacy Policy", + admin: "Admin", + account: "Account Pages", + login: "Sign In", + logout: "Sign Out", + }, + navbar: { + home: "Home", + pages: { + manage: "Manage Guilds", + settings: "Manage Guilds", + commands: "Commands", + pp: "Privacy Policy", + admin: "Admin Panel", + error: "Error", + credits: "Credits", + debug: "Debug", + leaderboard: "Leaderboard", + profile: "Profile", + maintenance: "Under Maintenance", + }, + }, + title: { + pages: { + manage: "Manage Guilds", + settings: "Manage Guilds", + commands: "Commands", + pp: "Privacy Policy", + admin: "Admin Panel", + error: "Error", + credits: "Credits", + debug: "Debug", + leaderboard: "Leaderboard", + profile: "Profile", + maintenance: "Under Maintenance", + }, + }, + preloader: { + text: "Page is loading...", + }, + premium: { + title: "Want more from Assistants?", + description: "Check out premium features below!", + buttonText: "Become Premium", + }, + settings: { + title: "Site Configuration", + description: "Configurable Viewing Options", + theme: { + title: "Site Theme", + description: "Make the site more appealing for your eyes!", + }, + language: { + title: "Site Language", + description: "Select your preferred language!", + }, + }, + }, + }, +}; \ No newline at end of file diff --git a/theme/dbd-soft-ui/package.json b/theme/dbd-soft-ui/package.json index 2951963..159cb81 100644 --- a/theme/dbd-soft-ui/package.json +++ b/theme/dbd-soft-ui/package.json @@ -1,18 +1,8 @@ { "name": "dbd-soft-ui", - "version": "1.6.48-beta.1", + "description": "dashboard theme", + "version": "1.0", "typings": "dbd-soft-ui.d.ts", - "author": { - "name": "iMidnight" - }, - "contributors": [ - "PlainDevelopment", - "Breftejk" - ], - "bugs": { - "url": "https://github.com/Assistants-Center/dbd-soft-ui/issues" - }, - "bundleDependencies": [], "dependencies": { "@keyv/sqlite": "^3.6.1", "colors": "1.4.0", @@ -21,29 +11,100 @@ "nodeactyl": "^3.2.2", "quick.db": "^7.1.3" }, - "deprecated": false, - "description": "Soft UI DBD Theme: An awesome - feature packed theme to use with discord-dashboard!", - "homepage": "https://softui.assistantscenter.com/", - "keywords": [ - "discord", - "discord.js", - "discordjs", - "discord dashboard", - "discord web dashboard", - "web dashboard", - "dashboard" - ], - "license": "MIT", "main": "index.js", - "repository": { - "type": "git", - "url": "git+https://github.com/Assistants-Center/DBD-Soft-UI.git" - }, "scripts": { "test": "echo \"Error: no test specified\"" }, "devDependencies": { "express": "^4.18.2", + "eslint": "^8.23.0", "prettier": "2.7.1" + }, + "eslintConfig": { + "env": { + "commonjs": true, + "es6": true, + "es2020": true, + "node": true + }, + "extends": "eslint:recommended", + "globals": { + "Atomics": "readonly", + "SharedArrayBuffer": "readonly" + }, + "parserOptions": { + "ecmaVersion": 2020 + }, + "rules": { + "arrow-spacing": [ + "warn", + { + "before": true, + "after": true + } + ], + "comma-dangle": [ + "error", + "always-multiline" + ], + "comma-spacing": "error", + "comma-style": "error", + "dot-location": [ + "error", + "property" + ], + "handle-callback-err": "off", + "indent": [ + "error", + "tab", + { + "SwitchCase": 1 + } + ], + "keyword-spacing": "error", + "max-nested-callbacks": [ + "error", + { + "max": 4 + } + ], + "max-statements-per-line": [ + "error", + { + "max": 2 + } + ], + "no-console": "off", + "no-multi-spaces": "error", + "no-multiple-empty-lines": [ + "error", + { + "max": 2, + "maxEOF": 1, + "maxBOF": 0 + } + ], + "no-trailing-spaces": [ + "error" + ], + "no-var": "error", + "object-curly-spacing": [ + "error", + "always" + ], + "prefer-const": "error", + "quotes": [ + "error", + "double" + ], + "semi": [ + "error", + "always" + ], + "space-in-parens": "error", + "space-infix-ops": "error", + "space-unary-ops": "error", + "yoda": "error" + } } } diff --git a/theme/dbd-soft-ui/pages/admin/control.js b/theme/dbd-soft-ui/pages/admin/control.js index 2acdb17..04fe30d 100644 --- a/theme/dbd-soft-ui/pages/admin/control.js +++ b/theme/dbd-soft-ui/pages/admin/control.js @@ -1,27 +1,24 @@ -const npmUpdater = require('../../utils/updater/npm') -const fileUpdater = require('../../utils/updater/files') - module.exports = { - page: '/control', - execute: async (req, res, app, config, themeConfig, info) => { - - const { uuid, action } = req.query - if (!uuid && action && req.query.type) { - if (req.query.type === 'npm') await npmUpdater.update() - if (req.query.type === 'live') await fileUpdater.update() - return res.redirect('/admin?result=true') - } - if (!uuid || !action) return res.sendStatus(412) + page: "/control", + // eslint-disable-next-line no-unused-vars + execute: async (req, res, app, config, themeConfig, info) => { + const { uuid, action } = req.query; - try { - if (action === 'start') await themeConfig.nodeactyl.startServer(uuid) - if (action === 'restart') await themeConfig.nodeactyl.restartServer(uuid) - if (action === 'stop') await themeConfig.nodeactyl.stopServer(uuid) - if (action === 'kill') await themeConfig.nodeactyl.killServer(uuid) - } catch (error) { - console.error(error) - return res.redirect('/admin?result=false') - } - return res.redirect('/admin?result=true') - } -} + if (!uuid && action && req.query.type) { + return res.redirect("/admin?result=true"); + } + + if (!uuid || !action) return res.sendStatus(412); + + try { + if (action === "start") await themeConfig.nodeactyl.startServer(uuid); + if (action === "restart") await themeConfig.nodeactyl.restartServer(uuid); + if (action === "stop") await themeConfig.nodeactyl.stopServer(uuid); + if (action === "kill") await themeConfig.nodeactyl.killServer(uuid); + } catch (error) { + console.error(error); + return res.redirect("/admin?result=false"); + } + return res.redirect("/admin?result=true"); + } +}; \ No newline at end of file diff --git a/theme/dbd-soft-ui/pages/admin/feed.js b/theme/dbd-soft-ui/pages/admin/feed.js index fcea454..816543c 100644 --- a/theme/dbd-soft-ui/pages/admin/feed.js +++ b/theme/dbd-soft-ui/pages/admin/feed.js @@ -1,193 +1,197 @@ -const db = require('quick.db') -const { icons, otherIcons } = require('../../icons') +const db = require("quick.db"); +const { icons, otherIcons } = require("../../icons"); module.exports = { - page: '/feed', - execute: async (req, res, app, config, themeConfig, info) => { - if (req.query.action === 'delete') { - const deleteFeed = req.query.feed - if (!deleteFeed) return res.redirect('/admin?error=invalidFeed') - if (!/^\d+$/.test(deleteFeed)) - return res.redirect('/admin?error=invalidFeed') - if (deleteFeed !== '1' && deleteFeed !== '2' && deleteFeed !== '3') - return res.redirect('/admin?error=invalidFeed') - if (deleteFeed === '1') { - if (!db.get('feeds.one')) - return res.redirect('/admin?error=invalidFeed') - if (db.get('feeds.two')) { - const f = await db.get('feeds.two') - await db.set('feeds.one', { - color: f.color, - description: f.description, - published: f.published, - icon: f.icon, - diff: f.diff - }) - } else { - await db.delete('feeds.one') - } - if (db.get('feeds.three')) { - const f = await db.get('feeds.three') - await db.set('feeds.two', { - color: f.color, - description: f.description, - published: f.published, - icon: f.icon, - diff: f.diff - }) - await db.delete('feeds.three') - } - } else if (deleteFeed === '2') { - if (!db.get('feeds.two')) - return res.redirect('/admin?error=invalidFeed') - if (db.get('feeds.one')) { - const f = await db.get('feeds.one') - await db.set('feeds.two', { - color: f.color, - description: f.description, - published: f.published, - icon: f.icon, - diff: f.diff - }) - await db.delete('feeds.one') - } else { - await db.delete('feeds.two') - } - } else if (deleteFeed === '3') { - if (!db.get('feeds.three')) - return res.redirect('/admin?error=invalidFeed') - await db.delete('feeds.three') - if (db.get('feeds.two')) { - const f = await db.get('feeds.two') - await db.set('feeds.three', { - color: f.color, - description: f.description, - published: f.published, - icon: f.icon, - diff: f.diff - }) - } - if (db.get('feeds.one')) { - const f = await db.get('feeds.one') - await db.set('feeds.two', { - color: f.color, - description: f.description, - published: f.published, - icon: f.icon, - diff: f.diff - }) - } - } - return res.redirect('/admin') - } else if (req.query.action === 'create') { - const { color, description, icon } = req.query - if (!color || !description || !icon) - return res.redirect('/admin?error=missingData') - if ( - color !== 'red' && - color !== 'orange' && - color !== 'pink' && - color !== 'gray' && - color !== 'green' && - color !== 'blue' && - color !== 'dark' - ) - return res.redirect('/admin?error=invalidData') - if (description.length < 3 || description.length > 128) - return res.redirect('/admin?error=invalidData') - if (!icons.includes(icon) && !otherIcons.includes(icon)) - return res.redirect('/admin?error=invalidData') - let diff - let col - if (otherIcons.includes(icon)) diff = true - if (color === 'red') col = 'danger' - if (color === 'orange') col = 'warning' - if (color === 'pink') col = 'primary' - if (color === 'gray') col = 'secondary' - if (color === 'green') col = 'success' - if (color === 'blue') col = 'info' - if (color === 'dark') col = 'dark' - if ( - db.get('feeds.three') && - db.get('feeds.two') && - db.get('feeds.one') - ) { - await db.delete('feeds.one') - const f3 = db.get('feeds.three') - const f2 = db.get('feeds.two') - await db.set('feeds.two', { - color: f3.color, - description: f3.description, - published: f3.published, - icon: f3.icon, - diff: f3.diff - }) - await db.set('feeds.one', { - color: f2.color, - description: f2.description, - published: f2.published, - icon: f2.icon, - diff: f2.diff - }) - await db.set('feeds.three', { - color: col, - description: description, - published: Date.now(), - icon: icon, - diff: diff - }) - } else { - if (!db.get('feeds.three')) - await db.set('feeds.three', { - color: col, - description: description, - published: Date.now(), - icon: icon, - diff: diff - }) - else if (!db.get('feeds.two')) { - const f3 = db.get('feeds.three') - await db.set('feeds.two', { - color: f3.color, - description: f3.description, - published: f3.published, - icon: f3.icon, - diff: f3.diff - }) - await db.set('feeds.three', { - color: col, - description: description, - published: Date.now(), - icon: icon, - diff: diff - }) - } else { - const f3 = db.get('feeds.three') - const f2 = db.get('feeds.two') - await db.set('feeds.one', { - color: f2.color, - description: f2.description, - published: f2.published, - icon: f2.icon, - diff: f2.diff - }) - await db.set('feeds.two', { - color: f3.color, - description: f3.description, - published: f3.published, - icon: f3.icon, - diff: f3.diff - }) - await db.set('feeds.three', { - color: col, - description: description, - published: Date.now(), - icon: icon, - diff: diff - }) - } - } - return res.redirect('/admin') - } - } -} + page: "/feed", + // eslint-disable-next-line no-unused-vars + execute: async (req, res, app, config, themeConfig, info) => { + if (req.query.action === "delete") { + const deleteFeed = req.query.feed; + + if (!deleteFeed) return res.redirect("/admin?error=invalidFeed"); + if (!/^\d+$/.test(deleteFeed)) return res.redirect("/admin?error=invalidFeed"); + if (deleteFeed !== "1" && deleteFeed !== "2" && deleteFeed !== "3") return res.redirect("/admin?error=invalidFeed"); + + if (deleteFeed === "1") { + if (!db.get("feeds.one")) return res.redirect("/admin?error=invalidFeed"); + + if (db.get("feeds.two")) { + const f = await db.get("feeds.two"); + + await db.set("feeds.one", { + color: f.color, + description: f.description, + published: f.published, + icon: f.icon, + diff: f.diff, + }); + } else await db.delete("feeds.one"); + + if (db.get("feeds.three")) { + const f = await db.get("feeds.three"); + + await db.set("feeds.two", { + color: f.color, + description: f.description, + published: f.published, + icon: f.icon, + diff: f.diff, + }); + + await db.delete("feeds.three"); + } + } else if (deleteFeed === "2") { + if (!db.get("feeds.two")) return res.redirect("/admin?error=invalidFeed"); + + if (db.get("feeds.one")) { + const f = await db.get("feeds.one"); + await db.set("feeds.two", { + color: f.color, + description: f.description, + published: f.published, + icon: f.icon, + diff: f.diff, + }); + await db.delete("feeds.one"); + } else { + await db.delete("feeds.two"); + } + } else if (deleteFeed === "3") { + if (!db.get("feeds.three")) return res.redirect("/admin?error=invalidFeed"); + + await db.delete("feeds.three"); + + if (db.get("feeds.two")) { + const f = await db.get("feeds.two"); + + await db.set("feeds.three", { + color: f.color, + description: f.description, + published: f.published, + icon: f.icon, + diff: f.diff, + }); + } + + if (db.get("feeds.one")) { + const f = await db.get("feeds.one"); + + await db.set("feeds.two", { + color: f.color, + description: f.description, + published: f.published, + icon: f.icon, + diff: f.diff, + }); + } + } + return res.redirect("/admin"); + } else if (req.query.action === "create") { + const { color, description, icon } = req.query; + if (!color || !description || !icon) return res.redirect("/admin?error=missingData"); + + if (color !== "red" && color !== "orange" && color !== "pink" && color !== "gray" && color !== "green" && color !== "blue" && color !== "dark") return res.redirect("/admin?error=invalidData"); + if (description.length < 3 || description.length > 128) return res.redirect("/admin?error=invalidData"); + if (!icons.includes(icon) && !otherIcons.includes(icon)) return res.redirect("/admin?error=invalidData"); + + let diff; + let col; + + if (otherIcons.includes(icon)) diff = true; + if (color === "red") col = "danger"; + if (color === "orange") col = "warning"; + if (color === "pink") col = "primary"; + if (color === "gray") col = "secondary"; + if (color === "green") col = "success"; + if (color === "blue") col = "info"; + if (color === "dark") col = "dark"; + + if (db.get("feeds.three") && db.get("feeds.two") && db.get("feeds.one")) { + await db.delete("feeds.one"); + + const f3 = db.get("feeds.three"); + const f2 = db.get("feeds.two"); + + await db.set("feeds.two", { + color: f3.color, + description: f3.description, + published: f3.published, + icon: f3.icon, + diff: f3.diff, + }); + + await db.set("feeds.one", { + color: f2.color, + description: f2.description, + published: f2.published, + icon: f2.icon, + diff: f2.diff, + }); + + await db.set("feeds.three", { + color: col, + description: description, + published: Date.now(), + icon: icon, + diff: diff, + }); + } else { + if (!db.get("feeds.three")) { + await db.set("feeds.three", { + color: col, + description: description, + published: Date.now(), + icon: icon, + diff: diff, + }); + } else if (!db.get("feeds.two")) { + const f3 = db.get("feeds.three"); + + await db.set("feeds.two", { + color: f3.color, + description: f3.description, + published: f3.published, + icon: f3.icon, + diff: f3.diff, + }); + + await db.set("feeds.three", { + color: col, + description: description, + published: Date.now(), + icon: icon, + diff: diff, + }); + } else { + const f3 = db.get("feeds.three"); + const f2 = db.get("feeds.two"); + + await db.set("feeds.one", { + color: f2.color, + description: f2.description, + published: f2.published, + icon: f2.icon, + diff: f2.diff, + }); + + await db.set("feeds.two", { + color: f3.color, + description: f3.description, + published: f3.published, + icon: f3.icon, + diff: f3.diff, + }); + + await db.set("feeds.three", { + color: col, + description: description, + published: Date.now(), + icon: icon, + diff: diff, + }); + } + } + return res.redirect("/admin"); + } + }, +}; \ No newline at end of file diff --git a/theme/dbd-soft-ui/pages/get/admin.js b/theme/dbd-soft-ui/pages/get/admin.js index e2f27a3..d06479e 100644 --- a/theme/dbd-soft-ui/pages/get/admin.js +++ b/theme/dbd-soft-ui/pages/get/admin.js @@ -1,48 +1,45 @@ -const db = require('quick.db') +const db = require("quick.db"); module.exports = { - page: '/admin', - execute: async (req, res, app, config, themeConfig, info, database) => { - if (!req.session.user) return res.redirect('/discord?r=/admin/') - if (!config.ownerIDs?.includes(req.session.user.id)) - return res.redirect('/') - if (!themeConfig.nodeactyl && themeConfig.admin?.pterodactyl?.enabled) - return res.send( - 'Unable to contact Pterodactyl, are your details correct?' - ) + page: "/admin", + execute: async (req, res, app, config, themeConfig, info, database) => { + if (!req.session.user) return res.redirect("/discord?r=/admin/"); + if (!config.ownerIDs?.includes(req.session.user.id)) return res.redirect("/"); + if (!themeConfig.nodeactyl && themeConfig.admin?.pterodactyl?.enabled) return res.send("Unable to contact Pterodactyl, are your details correct?"); - async function getServers() { - if (!themeConfig?.admin?.pterodactyl?.enabled) return [] - const serverData = [] - for (const uuid of themeConfig?.admin?.pterodactyl?.serverUUIDs) { - let dataStatus = await themeConfig?.nodeactyl?.getServerStatus(uuid) - let data = await themeConfig?.nodeactyl?.getServerDetails(uuid) - - serverData.push({ - name: data.name.toString(), - uuid: data.uuid.toString(), - desc: data.description.toString(), - node: data.node.toString(), - status: dataStatus.toString() - }) - } - return serverData - } + async function getServers() { + if (!themeConfig?.admin?.pterodactyl?.enabled) return []; - let allFeedsUsed = false - if (db.get('feeds.one') && db.get('feeds.two') && db.get('feeds.three')) - allFeedsUsed = true - const d = await getServers() - res.render('admin', { - req, - sData: d, - ldata: await database.get('logs'), - themeConfig: req.themeConfig, - node: themeConfig.nodeactyl, - bot: config.bot, - allFeedsUsed, - config, - require - }) - } -} \ No newline at end of file + const serverData = []; + const serverUUIDS = themeConfig?.admin?.pterodactyl?.serverUUIDs; + for (const uuid of serverUUIDS) { + const dataStatus = await themeConfig?.nodeactyl?.getServerStatus(uuid); + const data = await themeConfig?.nodeactyl?.getServerDetails(uuid); + + serverData.push({ + name: data.name.toString(), + uuid: data.uuid.toString(), + desc: data.description.toString(), + node: data.node.toString(), + status: dataStatus.toString(), + }); + } + + return serverData; + } + + const d = await getServers(); + + res.render("admin", { + req, + sData: d, + ldata: await database.get("logs"), + themeConfig: req.themeConfig, + node: themeConfig.nodeactyl, + bot: config.bot, + allFeedsUsed: (db.get("feeds.one") && db.get("feeds.two") && db.get("feeds.three")) ? true : false, + config, + require, + }); + }, +}; \ No newline at end of file diff --git a/theme/dbd-soft-ui/pages/get/blacklisted.js b/theme/dbd-soft-ui/pages/get/blacklisted.js index ab67475..ee447bf 100644 --- a/theme/dbd-soft-ui/pages/get/blacklisted.js +++ b/theme/dbd-soft-ui/pages/get/blacklisted.js @@ -1,11 +1,11 @@ module.exports = { - page: '/blacklisted', - execute: async (req, res, app, config, themeConfig, info) => { - res.render('blacklisted', { - req, - config, - themeConfig, - info - }) - } -} + page: "/blacklisted", + execute: async (req, res, app, config, themeConfig, info) => { + res.render("blacklisted", { + req, + config, + themeConfig, + info, + }); + }, +}; \ No newline at end of file diff --git a/theme/dbd-soft-ui/pages/get/commands.js b/theme/dbd-soft-ui/pages/get/commands.js index 4ab6636..ecd1945 100644 --- a/theme/dbd-soft-ui/pages/get/commands.js +++ b/theme/dbd-soft-ui/pages/get/commands.js @@ -1,12 +1,12 @@ module.exports = { - page: '/commands', - execute: async (req, res, app, config, themeConfig, info) => { - if (themeConfig.commands) - res.render('commands.ejs', { - req, - config, - themeConfig, - info - }) - } -} + page: "/commands", + execute: async (req, res, app, config, themeConfig, info) => { + if (themeConfig.commands) + res.render("commands", { + req, + config, + themeConfig, + info, + }); + }, +}; \ No newline at end of file diff --git a/theme/dbd-soft-ui/pages/get/credits.js b/theme/dbd-soft-ui/pages/get/credits.js index 0ff79ca..b3641c1 100644 --- a/theme/dbd-soft-ui/pages/get/credits.js +++ b/theme/dbd-soft-ui/pages/get/credits.js @@ -1,11 +1,11 @@ module.exports = { - page: '/credits', - execute: async (req, res, app, config, themeConfig, info) => { - res.render('credits', { - req: req, - config, - themeConfig, - info - }) - } -} + page: "/credits", + execute: async (req, res, app, config, themeConfig, info) => { + res.render("credits", { + req: req, + config, + themeConfig, + info, + }); + }, +}; \ No newline at end of file diff --git a/theme/dbd-soft-ui/pages/get/debug.js b/theme/dbd-soft-ui/pages/get/debug.js index 09c68f4..49daff8 100644 --- a/theme/dbd-soft-ui/pages/get/debug.js +++ b/theme/dbd-soft-ui/pages/get/debug.js @@ -1,70 +1,45 @@ -const fetch = require('node-fetch') -const fs = require('fs') -let DBD = require('discord-dashboard') +const fetch = require("node-fetch"); +const fs = require("fs"); +const DBD = require("../../../../index"); module.exports = { - page: '/debug', - execute: async (req, res, app, config, themeConfig, info) => { - /* - Do not remove this page. - It will be used with support in the discord server. - */ - if (!req.session.user) return res.redirect('/discord?r=/debug/') - if (!config.ownerIDs?.includes(req.session.user.id)) - return res.redirect('/') + page: "/debug", + execute: async (req, res, app, config, themeConfig, info) => { + /* + Do not remove this page. + It will be used with support in the discord server. + */ + if (!req.session.user) return res.redirect("/discord?r=/debug/"); + if (!config.ownerIDs?.includes(req.session.user.id)) return res.redirect("/"); - let onlineFiles = { - index: await fetch( - `https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/index.ejs` - ), - guild: await fetch( - `https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/guild.ejs` - ), - guilds: await fetch( - `https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/guilds.ejs` - ) - } + const onlineFiles = { + index: await fetch("https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/index.ejs"), + guild: await fetch("https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/guild.ejs"), + guilds: await fetch("https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/guilds.ejs"), + }; - onlineFiles.index = await onlineFiles.index.text() - onlineFiles.guild = await onlineFiles.guild.text() - onlineFiles.guilds = await onlineFiles.guilds.text() - let localFiles = { - index: await fs.readFileSync( - `${__dirname}/../..//views/index.ejs`, - 'utf-8' - ), - guild: await fs.readFileSync( - `${__dirname}/../../views/settings.ejs`, - 'utf-8' - ), - guilds: await fs.readFileSync( - `${__dirname}/../../views/guilds.ejs`, - 'utf-8' - ) - } + onlineFiles.index = await onlineFiles.index.text(); + onlineFiles.guild = await onlineFiles.guild.text(); + onlineFiles.guilds = await onlineFiles.guilds.text(); - let onlineV = await fetch( - `https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/utils/updater/versionsOnline.json` - ) - const localV = require(`${__dirname}/../../utils/updater/versions.json`) - onlineV = await onlineV.json() + const localFiles = { + index: await fs.readFileSync(`${__dirname}/../../views/index.ejs`, "utf-8"), + guild: await fs.readFileSync(`${__dirname}/../../views/settings.ejs`, "utf-8"), + guilds: await fs.readFileSync(`${__dirname}/../../views/guilds.ejs`, "utf-8"), + }; - res.render('debug', { - license: require(`discord-dashboard`).licenseInfo().type, // replace with discord-dashboard - onlineV, - localV, - onlineFiles, - localFiles, - rawUptime: process.uptime(), - nodeVersion: process.version, - themeConfig, - discordVersion: require('discord.js').version, - dbdVersion: DBD.version, - themeVersion: require(`dbd-soft-ui`).version, - themePartials: require(`${__dirname}/../../utils/updater/versions.json`), - req, - config, - info - }) - } -} + res.render("debug", { + onlineFiles, + localFiles, + rawUptime: process.uptime(), + nodeVersion: process.version, + themeConfig, + discordVersion: require("discord.js").version, + dbdVersion: DBD.version, + themeVersion: require("dbd-soft-ui").version, + req, + config, + info, + }); + }, +}; \ No newline at end of file diff --git a/theme/dbd-soft-ui/pages/get/getshards.js b/theme/dbd-soft-ui/pages/get/getshards.js index 6228903..9f0de18 100644 --- a/theme/dbd-soft-ui/pages/get/getshards.js +++ b/theme/dbd-soft-ui/pages/get/getshards.js @@ -1,8 +1,8 @@ module.exports = { - page: '/shards/get', - execute: async (req, res, app, config, themeConfig, info, db) => { - let returned = await db.get('stats') + page: "/shards/get", + execute: async (req, res, app, config, themeConfig, info, db) => { + const returned = await db.get("stats"); - res.json(returned) - } -} + res.json(returned); + }, +}; diff --git a/theme/dbd-soft-ui/pages/get/privacyPolicy.js b/theme/dbd-soft-ui/pages/get/privacyPolicy.js index c85a564..c350c42 100644 --- a/theme/dbd-soft-ui/pages/get/privacyPolicy.js +++ b/theme/dbd-soft-ui/pages/get/privacyPolicy.js @@ -1,11 +1,11 @@ module.exports = { - page: '/privacy-policy', - execute: async (req, res, app, config, themeConfig, info) => { - res.render('pp', { - req, - config, - themeConfig, - info - }) - } -} + page: "/privacy-policy", + execute: async (req, res, app, config, themeConfig, info) => { + res.render("pp", { + req, + config, + themeConfig, + info, + }); + }, +}; \ No newline at end of file diff --git a/theme/dbd-soft-ui/pages/get/settings.js b/theme/dbd-soft-ui/pages/get/settings.js index 373df8f..4d03b95 100644 --- a/theme/dbd-soft-ui/pages/get/settings.js +++ b/theme/dbd-soft-ui/pages/get/settings.js @@ -1,11 +1,11 @@ module.exports = { - page: '/settings/:id/:category', - execute: async (req, res, app, config, themeConfig, info) => { - const categoryExists = config.settings?.find( - (s) => s.categoryId === req.params.category - ) - if (!categoryExists) return config.errorPage(req, res, null, 404) + page: "/settings/:id/:category", + // eslint-disable-next-line no-unused-vars + execute: async (req, res, app, config, themeConfig, info) => { + const categoryExists = config.settings?.find(s => s.categoryId === req.params.category); - await config.guildSettings(req, res, false, req.params.category) - } -} + if (!categoryExists) return config.errorPage(req, res, null, 404); + + await config.guildSettings(req, res, false, req.params.category); + }, +}; \ No newline at end of file diff --git a/theme/dbd-soft-ui/pages/get/settingsHome.js b/theme/dbd-soft-ui/pages/get/settingsHome.js index ef3c558..b5868b9 100644 --- a/theme/dbd-soft-ui/pages/get/settingsHome.js +++ b/theme/dbd-soft-ui/pages/get/settingsHome.js @@ -1,6 +1,7 @@ module.exports = { - page: '/settings/:id/', - execute: async (req, res, app, config, themeConfig, info) => { - await config.guildSettings(req, res, true) - } -} + page: "/settings/:id/", + // eslint-disable-next-line no-unused-vars + execute: async (req, res, app, config, themeConfig, info) => { + await config.guildSettings(req, res, true); + }, +}; \ No newline at end of file diff --git a/theme/dbd-soft-ui/pages/get/shards.js b/theme/dbd-soft-ui/pages/get/shards.js index 0ed1b7a..5ea9985 100644 --- a/theme/dbd-soft-ui/pages/get/shards.js +++ b/theme/dbd-soft-ui/pages/get/shards.js @@ -1,11 +1,12 @@ module.exports = { - page: '/shards', - execute: async (req, res, app, config, themeConfig, info, db) => { - res.render('shards', { - req: req, - config, - themeConfig, - info - }) - } -} + page: "/shards", + // eslint-disable-next-line no-unused-vars + execute: async (req, res, app, config, themeConfig, info, db) => { + res.render("shards", { + req: req, + config, + themeConfig, + info, + }); + }, +}; \ No newline at end of file diff --git a/theme/dbd-soft-ui/pages/post/guildSettings.js b/theme/dbd-soft-ui/pages/post/guildSettings.js index 05f2005..ec55ab1 100644 --- a/theme/dbd-soft-ui/pages/post/guildSettings.js +++ b/theme/dbd-soft-ui/pages/post/guildSettings.js @@ -1,476 +1,392 @@ module.exports = { - page: '/guild/update/:guildId/', - execute: async (req, res, app, config, themeConfig, info) => { - const data = req.body + page: "/guild/update/:guildId/", + // eslint-disable-next-line no-unused-vars + execute: async (req, res, app, config, themeConfig, info) => { + const data = req.body; - let setNewRes - let errors = [] - let successes = [] + let setNewRes; + const errors = []; + const successes = []; - if (!req.session?.user) - return res.send({ - success: false, - message: 'User is not logged in' - }) + if (!req.session?.user) return res.send({ + success: false, + message: "User is not logged in", + }); - const userGuildMemberObject = config.bot.guilds.cache - .get(req.params.guildId) - .members.cache.get(req.session.user.id) - const guildObject = config.bot.guilds.cache.get(req.params.guildId) + const userGuildMemberObject = config.bot.guilds.cache.get(req.params.guildId).members.cache.get(req.session.user.id); + const guildObject = config.bot.guilds.cache.get(req.params.guildId); - let category = config.settings?.find((c) => c.categoryId == req.query.categoryId) + const category = config.settings?.find(c => c.categoryId == req.query.categoryId); + const catO = []; + const catToggle = []; - let catO = []; - let catToggle = []; + if (data.categoryToggle) { + for (const s of data.categoryToggle) { + if (!config.useCategorySet) try { + const category = config.settings?.find(c => c?.categoryId == s.id); - if (data.categoryToggle) { - for (const s of data.categoryToggle) { - if (!config.useCategorySet) try { - let category = config.settings?.find( - (c) => c?.categoryId == s.id - ) - await category.setNew({ - guild: { id: req.params.guildId }, - newData: s.value - }) - } catch (err) { - errors.push(`Category ${s.id} %is%Failed to save%is%categoryToggle`); - } - else { - if (category?.categoryId == s.id) catO.push({ - optionId: category.categoryId == s.id ? "categoryToggle" : s.id, - data: s.value - }); - else catToggle.push({ - optionId: s.id, - data: s.value - }); - } - } - if ("categoryToggle" in data && !category) { - return res.send({ - success: true, - message: "Saved toggle", - errors: [], - successes: [], - }) - } - } + await category.setNew({ + guild: { id: req.params.guildId }, + newData: s.value, + }); + } catch (err) { + errors.push(`Category ${s.id} %is%Failed to save%is%categoryToggle`); + } + else { + if (category?.categoryId == s.id) catO.push({ + optionId: category.categoryId == s.id ? "categoryToggle" : s.id, + data: s.value, + }); + else catToggle.push({ + optionId: s.id, + data: s.value, + }); + } + } + if ("categoryToggle" in data && !category) { + return res.send({ + success: true, + message: "Saved toggle", + errors: [], + successes: [], + }); + } + } - if (!category) - return res.send({ - error: true, - message: "No category found", - }) + if (!category) return res.send({ + error: true, + message: "No category found", + }); - const subOptions = category.categoryOptionsList.filter((o) => o.optionType.type == "multiRow") - .map((o) => o.optionType.options) - .flat() + const subOptions = category.categoryOptionsList.filter(o => o.optionType.type == "multiRow").map(o => o.optionType.options).flat(); - const newOptionsList = [ - ...category.categoryOptionsList.filter((o) => o.optionType.type != "multiRow"), - ...subOptions - ] + const newOptionsList = [ + ...category.categoryOptionsList.filter((o) => o.optionType.type != "multiRow"), + ...subOptions, + ]; - if (data.options) for (let option of newOptionsList) { - let d = data.options.find((o) => o.id === option.optionId); - let canUse = {} + if (data.options) + for (const option of newOptionsList) { + const d = data.options.find(o => o.id === option.optionId); + let canUse = {}; - if (!d && !d?.id) continue; + if (!d && !d?.id) continue; - if (option.allowedCheck) canUse = await option.allowedCheck({ - guild: { id: req.params.guildId }, - user: { id: req.session.user.id }, - }) - else canUse = { allowed: true, errorMessage: null } + if (option.allowedCheck) canUse = await option.allowedCheck({ + guild: { id: req.params.guildId }, + user: { id: req.session.user.id }, + }); + + else canUse = { + allowed: true, + errorMessage: null, + }; - if (canUse.allowed == false) { - setNewRes = { error: canUse.errorMessage } - errors.push( - option.optionName + - "%is%" + - setNewRes.error + - "%is%" + - option.optionId - ) - } else if (option.optionType != "spacer") { - if (config.useCategorySet) { - if (option.optionType.type == "rolesMultiSelect" || option.optionType.type == "channelsMultiSelect" || option.optionType.type == "multiSelect" || option.optionType.type == 'tagInput') { - if (!d.value || d.value == null || d.value == undefined) catO.push({ - optionId: option.optionId, - data: [], - }) - else if (typeof d.value != "object") catO.push({ - optionId: option.optionId, - data: [d.value], - }) - else catO.push({ - optionId: option.optionId, - data: d.value, - }) - } else if (option.optionType.type == "switch") { - if ( - d.value || - d.value == null || - d.value == undefined || - d.value == false - ) { - if (d.value || d.value == null || d.value == undefined || d.value == false) { - if (d.value == null || d.value == undefined || d.value == false) - catO.push({ - optionId: option.optionId, - data: false - }); - else - catO.push({ - optionId: option.optionId, - data: true - }); - } - } - } else if (option.optionType.type == "embedBuilder") { - if ( - d.value == null || - d.value == undefined - ) - catO.push({ - optionId: option.optionId, - data: option.optionType.data, - }) - else { - try { - const parsedResponse = JSON.parse( - d.value - ) - catO.push({ - optionId: option.optionId, - data: parsedResponse, - }) - } catch (err) { - catO.push({ - optionId: option.optionId, - data: option.optionType.data, - }) - } - } - } else { - if ( - d.value == undefined || - d.value == null - ) - catO.push({ - optionId: option.optionId, - data: null, - }) - else - catO.push({ - optionId: option.optionId, - data: d.value, - }) - } - } else { - if ( - option.optionType.type == - 'rolesMultiSelect' || - option.optionType.type == - 'channelsMultiSelect' || - option.optionType.type == 'multiSelect' || - option.optionType.type == 'tagInput' - ) { - if ( - !d.value || - d.value == null || - d.value == undefined - ) { - setNewRes = await option.setNew({ - guild: { - id: req.params.guildId, - object: guildObject - }, - user: { - id: req.session.user.id, - object: userGuildMemberObject - }, - newData: [] - }) - setNewRes ? null : (setNewRes = {}) - if (setNewRes.error) { - errors.push( - option.optionName + - '%is%' + - setNewRes.error + - '%is%' + - option.optionId - ) - } else { - successes.push(option.optionName) - } - } else if ( - typeof d.value != 'object' - ) { - setNewRes = await option.setNew({ - guild: { - id: req.params.guildId, - object: guildObject - }, - user: { - id: req.session.user.id, - object: userGuildMemberObject - }, - newData: [d.value] - }) - setNewRes ? null : (setNewRes = {}) - if (setNewRes.error) { - errors.push( - option.optionName + - '%is%' + - setNewRes.error + - '%is%' + - option.optionId - ) - } else { - successes.push(option.optionName) - } - } else { - setNewRes = await option.setNew({ - guild: { - id: req.params.guildId, - object: guildObject - }, - user: { - id: req.session.user.id, - object: userGuildMemberObject - }, - newData: d.value - }) - setNewRes ? null : (setNewRes = {}) - if (setNewRes.error) { - errors.push( - option.optionName + - '%is%' + - setNewRes.error + - '%is%' + - option.optionId - ) - } else { - successes.push(option.optionName) - } - } - } else if ( - option.optionType.type == 'embedBuilder' - ) { - if ( - d.value !== null || - d.value !== undefined - ) { - setNewRes = - (await option.setNew({ - guild: { - id: req.params.guildId, - object: guildObject - }, - user: { - id: req.session.user.id, - object: userGuildMemberObject - }, - newData: JSON.parse( - d.value - ) - })) || {} - setNewRes ? null : (setNewRes = {}) - if (setNewRes.error) { - errors.push( - option.optionName + - '%is%' + - setNewRes.error + - '%is%' + - option.optionId - ) - } else { - successes.push(option.optionName) - } - } else { - try { - const parsedResponse = JSON.parse( - d.value - ) - setNewRes = - (await option.setNew({ - guild: { - id: req.params.guildId, - object: guildObject - }, - user: { - id: req.session.user.id, - object: userGuildMemberObject - }, - newData: parsedResponse - })) || {} - setNewRes ? null : (setNewRes = {}) - if (setNewRes.error) { - errors.push( - option.optionName + - '%is%' + - setNewRes.error + - '%is%' + - option.optionId - ) - } else { - successes.push( - option.optionName - ) - } - } catch (err) { - setNewRes = - (await option.setNew({ - guild: { - id: req.params.guildId, - object: guildObject - }, - user: { - id: req.session.user.id, - object: userGuildMemberObject - }, - newData: - option.optionType.data - })) || {} - setNewRes = { - error: 'JSON parse for embed builder went wrong, your settings have been reset.' - } - if (setNewRes.error) { - errors.push( - option.optionName + - '%is%' + - setNewRes.error + - '%is%' + - option.optionId - ) - } else { - successes.push( - option.optionName - ) - } - } - } - } else { - if ( - d.value == undefined || - d.value == null - ) { - setNewRes = - (await option.setNew({ - guild: { - id: req.params.guildId, - object: guildObject - }, - user: { - id: req.session.user.id, - object: userGuildMemberObject - }, - newData: null - })) || {} - setNewRes ? null : (setNewRes = {}) - if (setNewRes.error) { - errors.push( - option.optionName + - '%is%' + - setNewRes.error + - '%is%' + - option.optionId - ) - } else { - successes.push(option.optionName) - } - } else { - setNewRes = - (await option.setNew({ - guild: { - id: req.params.guildId, - object: guildObject - }, - user: { - id: req.session.user.id, - object: userGuildMemberObject - }, - newData: d.value - })) || {} - setNewRes ? null : (setNewRes = {}) - if (setNewRes.error) { - errors.push( - option.optionName + - '%is%' + - setNewRes.error + - '%is%' + - option.optionId - ) - } else { - successes.push(option.optionName) - } - } - } - } - } - } + if (canUse.allowed == false) { + setNewRes = { + error: canUse.errorMessage, + }; - if (config.useCategorySet && catO.length) { - let sNR = await category.setNew({ - guild: { - id: req.params.guildId, - object: guildObject, - }, - user: { - id: req.session.user.id, - object: userGuildMemberObject, - }, - data: catO, - }) - sNR ? null : (sNR = {}) - if (sNR.error) { - errors.push(category.categoryId + "%is%" + sNR.error) - } else { - successes.push(category.categoryId) - } - } + errors.push(option.optionName + "%is%" + setNewRes.error + "%is%" + option.optionId); + } else if (option.optionType != "spacer") { + if (config.useCategorySet) { + if (option.optionType.type == "rolesMultiSelect" || option.optionType.type == "channelsMultiSelect" || option.optionType.type == "multiSelect" || option.optionType.type == "tagInput") { + if (!d.value || d.value == null || d.value == undefined) catO.push({ + optionId: option.optionId, + data: [], + }); + else if (typeof d.value != "object") catO.push({ + optionId: option.optionId, + data: [d.value], + }); + else catO.push({ + optionId: option.optionId, + data: d.value, + }); + } else if (option.optionType.type == "switch") { + if (d.value || d.value == null || d.value == undefined || d.value == false) { + if (d.value || d.value == null || d.value == undefined || d.value == false) { + if (d.value == null || d.value == undefined || d.value == false) + catO.push({ + optionId: option.optionId, + data: false, + }); + else + catO.push({ + optionId: option.optionId, + data: true, + }); + } + } + } else if (option.optionType.type == "embedBuilder") { + if (d.value == null || d.value == undefined) + catO.push({ + optionId: option.optionId, + data: option.optionType.data, + }); + else { + try { + const parsedResponse = JSON.parse(d.value); - if (config.useCategorySet && catToggle.length) for (const opt of catToggle) { - let cat = config.settings?.find((c) => c.categoryId == opt.optionId); + catO.push({ + optionId: option.optionId, + data: parsedResponse, + }); + } catch (err) { + catO.push({ + optionId: option.optionId, + data: option.optionType.data, + }); + } + } + } else { + if (d.value == undefined || d.value == null) + catO.push({ + optionId: option.optionId, + data: null, + }); + else + catO.push({ + optionId: option.optionId, + data: d.value, + }); + } + } else { + if (option.optionType.type == "rolesMultiSelect" || option.optionType.type == "channelsMultiSelect" || option.optionType.type == "multiSelect" || option.optionType.type == "tagInput") { + if (!d.value || d.value == null || d.value == undefined) { + setNewRes = await option.setNew({ + guild: { + id: req.params.guildId, + object: guildObject, + }, + user: { + id: req.session.user.id, + object: userGuildMemberObject, + }, + newData: [], + }); - if (!cat) { - errors.push(`Category ${opt.optionId} %is%Doesn't exist%is%categoryToggle`); - continue; - } + setNewRes ? null : (setNewRes = {}); - try { - await cat.setNew({ - guild: { - id: req.params.guildId, - object: guildObject, - }, - user: { - id: req.session.user.id, - object: userGuildMemberObject, - }, - data: [{ - optionId: "categoryToggle", - data: opt.data - }], - }); - } catch (err) { - errors.push(`Category ${opt.optionId} %is%${err}%is%categoryToggle`); - } - } + if (setNewRes.error) + errors.push(option.optionName + "%is%" + setNewRes.error + "%is%" + option.optionId); + else + successes.push(option.optionName); + } else if (typeof d.value != "object") { + setNewRes = await option.setNew({ + guild: { + id: req.params.guildId, + object: guildObject, + }, + user: { + id: req.session.user.id, + object: userGuildMemberObject, + }, + newData: [d.value], + }); - req.DBDEvents.emit('guildSettingsUpdated', { - user: req.session.user, - changes: { successes, errors } - }) + setNewRes ? null : (setNewRes = {}); - res.send({ - success: true, - message: 'saved changed', - errors, - successes - }) - } -} + if (setNewRes.error) + errors.push(option.optionName + "%is%" + setNewRes.error + "%is%" + option.optionId); + else + successes.push(option.optionName); + } else { + setNewRes = await option.setNew({ + guild: { + id: req.params.guildId, + object: guildObject, + }, + user: { + id: req.session.user.id, + object: userGuildMemberObject, + }, + newData: d.value, + }); + + setNewRes ? null : (setNewRes = {}); + + if (setNewRes.error) + errors.push(option.optionName + "%is%" + setNewRes.error + "%is%" + option.optionId); + else + successes.push(option.optionName); + } + } else if (option.optionType.type == "embedBuilder") { + if (d.value !== null || d.value !== undefined) { + setNewRes = (await option.setNew({ + guild: { + id: req.params.guildId, + object: guildObject, + }, + user: { + id: req.session.user.id, + object: userGuildMemberObject, + }, + newData: JSON.parse( + d.value, + ), + })) || {}; + + setNewRes ? null : (setNewRes = {}); + + if (setNewRes.error) + errors.push(option.optionName + "%is%" + setNewRes.error + "%is%" + option.optionId); + else + successes.push(option.optionName); + } else { + try { + const parsedResponse = JSON.parse(d.value); + + setNewRes = (await option.setNew({ + guild: { + id: req.params.guildId, + object: guildObject, + }, + user: { + id: req.session.user.id, + object: userGuildMemberObject, + }, + newData: parsedResponse, + })) || {}; + + setNewRes ? null : (setNewRes = {}); + + if (setNewRes.error) + errors.push(option.optionName + "%is%" + setNewRes.error + "%is%" + option.optionId); + else + successes.push(option.optionName); + } catch (err) { + setNewRes = (await option.setNew({ + guild: { + id: req.params.guildId, + object: guildObject, + }, + user: { + id: req.session.user.id, + object: userGuildMemberObject, + }, + newData: option.optionType.data, + })) || {}; + + setNewRes = { + error: "JSON parse for embed builder went wrong, your settings have been reset.", + }; + + if (setNewRes.error) + errors.push(option.optionName + "%is%" + setNewRes.error + "%is%" + option.optionId); + else + successes.push(option.optionName); + } + } + } else { + if (d.value == undefined || d.value == null) { + setNewRes = (await option.setNew({ + guild: { + id: req.params.guildId, + object: guildObject, + }, + user: { + id: req.session.user.id, + object: userGuildMemberObject, + }, + newData: null, + })) || {}; + + setNewRes ? null : (setNewRes = {}); + + if (setNewRes.error) + errors.push(option.optionName + "%is%" + setNewRes.error + "%is%" + option.optionId); + else + successes.push(option.optionName); + } else { + setNewRes = (await option.setNew({ + guild: { + id: req.params.guildId, + object: guildObject, + }, + user: { + id: req.session.user.id, + object: userGuildMemberObject, + }, + newData: d.value, + })) || {}; + + setNewRes ? null : (setNewRes = {}); + + if (setNewRes.error) + errors.push(option.optionName + "%is%" + setNewRes.error + "%is%" + option.optionId); + else + successes.push(option.optionName); + } + } + } + } + } + + if (config.useCategorySet && catO.length) { + let sNR = await category.setNew({ + guild: { + id: req.params.guildId, + object: guildObject, + }, + user: { + id: req.session.user.id, + object: userGuildMemberObject, + }, + data: catO, + }); + + sNR ? null : (sNR = {}); + + if (sNR.error) + errors.push(category.categoryId + "%is%" + sNR.error); + else + successes.push(category.categoryId); + } + + if (config.useCategorySet && catToggle.length) + for (const opt of catToggle) { + const cat = config.settings?.find(c => c.categoryId == opt.optionId); + + if (!cat) { + errors.push(`Category ${opt.optionId} %is%Doesn't exist%is%categoryToggle`); + continue; + } + + try { + await cat.setNew({ + guild: { + id: req.params.guildId, + object: guildObject, + }, + user: { + id: req.session.user.id, + object: userGuildMemberObject, + }, + data: [{ + optionId: "categoryToggle", + data: opt.data, + }], + }); + } catch (err) { + errors.push(`Category ${opt.optionId} %is%${err}%is%categoryToggle`); + } + } + + req.DBDEvents.emit("guildSettingsUpdated", { + user: req.session.user, + changes: { + successes, + errors, + }, + }); + + res.send({ + success: true, + message: "saved changed", + errors, + successes, + }); + }, +}; \ No newline at end of file diff --git a/theme/dbd-soft-ui/pages/post/logs.js b/theme/dbd-soft-ui/pages/post/logs.js index 5e4543d..3212992 100644 --- a/theme/dbd-soft-ui/pages/post/logs.js +++ b/theme/dbd-soft-ui/pages/post/logs.js @@ -1,23 +1,21 @@ module.exports = { - page: '/stats/logs/update', - execute: async (req, res, app, config, themeConfig, info, db) => { - if ( - 'Bearer ' + themeConfig.admin?.logs?.key !== - req.headers.authorization - ) - return res.json({ status: 'Invalid sharding key' }) + page: "/stats/logs/update", + execute: async (req, res, app, config, themeConfig, info, db) => { + if ("Bearer " + themeConfig.admin?.logs?.key !== req.headers.authorization) return res.json({ status: "Invalid sharding key" }); - const logs = await db.get('logs') + const logs = await db.get("logs"); - let newLogs = [] + let newLogs = []; - if (!logs || !logs.length || !logs[0]) - newLogs = [req.body] - else - newLogs = [req.body, ...logs] + if (!logs || !logs.length || !logs[0]) + newLogs = [req.body]; + else + newLogs = [req.body, ...logs]; - await db.set('logs', newLogs) + await db.set("logs", newLogs); - res.json({ status: 'Completed' }) - } -} \ No newline at end of file + res.json({ + status: "Completed", + }); + }, +}; \ No newline at end of file diff --git a/theme/dbd-soft-ui/pages/post/shards.js b/theme/dbd-soft-ui/pages/post/shards.js index 526ac69..8afd24d 100644 --- a/theme/dbd-soft-ui/pages/post/shards.js +++ b/theme/dbd-soft-ui/pages/post/shards.js @@ -1,36 +1,34 @@ module.exports = { - page: '/stats/shards/update', - execute: async (req, res, app, config, themeConfig, info, db) => { - if ( - 'Bearer ' + themeConfig.shardspage?.key !== - req.headers.authorization - ) - return res.json({ status: 'Invalid sharding key' }) + page: "/stats/shards/update", + execute: async (req, res, app, config, themeConfig, info, db) => { + if ("Bearer " + themeConfig.shardspage?.key !== req.headers.authorization) return res.json({ status: "Invalid sharding key" }); - const stats = await db.get('stats') + const stats = await db.get("stats"); - const clean = req.body.map((s) => { - if (!stats) return { - ...s, - ping: [0, 0, 0, 0, 0, 0, 0, 0, 0, s.ping] - } + const clean = req.body.map((s) => { + if (!stats) return { + ...s, + ping: [0, 0, 0, 0, 0, 0, 0, 0, 0, s.ping], + }; - const currentSaved = stats?.find((x) => x.id === s.id) - if (!currentSaved) return { - ...s, - ping: [0, 0, 0, 0, 0, 0, 0, 0, 0, s.ping] - } + const currentSaved = stats?.find((x) => x.id === s.id); + if (!currentSaved) return { + ...s, + ping: [0, 0, 0, 0, 0, 0, 0, 0, 0, s.ping], + }; - const nextPing = currentSaved?.ping?.slice(1, 10) + const nextPing = currentSaved?.ping?.slice(1, 10); - return { - ...s, - ping: nextPing ? [...nextPing, s.ping] : [0, 0, 0, 0, 0, 0, 0, 0, 0, s.ping], - } - }) + return { + ...s, + ping: nextPing ? [...nextPing, s.ping] : [0, 0, 0, 0, 0, 0, 0, 0, 0, s.ping], + }; + }); - await db.set('stats', clean) + await db.set("stats", clean); - res.json({ status: 'Completed' }) - } -} + res.json({ + status: "Completed", + }); + }, +}; \ No newline at end of file diff --git a/theme/dbd-soft-ui/utils/cmdHandler.js b/theme/dbd-soft-ui/utils/cmdHandler.js index 712987b..475ab48 100644 --- a/theme/dbd-soft-ui/utils/cmdHandler.js +++ b/theme/dbd-soft-ui/utils/cmdHandler.js @@ -1,52 +1,42 @@ module.exports = (commands, prefix) => { - if (!commands) - throw new Error('No commands were provided to the Soft UI cmdHandler.') - if (!prefix) prefix = '!' + if (!commands) throw new Error("No commands were provided to the Soft UI cmdHandler."); + if (!prefix) prefix = "/"; - let finalCategories = [] - let categories = [] + const finalCategories = []; + const categories = []; - commands.map((cmd) => { - if (!categories.includes(cmd.category)) { - categories.push(cmd.category) - } - }) + commands.map(cmd => { + if (!categories.includes(cmd.category)) categories.push(cmd.category); + }); - for (const category of categories) { - if ( - category.toLowerCase().includes('admin') || - category.toLowerCase().includes('owner') || - category.toLowerCase().includes('development') - ) - continue - let commandsArr = [] + for (const category of categories) { + if (category.toLowerCase().includes("admin") || category.toLowerCase().includes("owner") || category.toLowerCase().includes("development") || category.toLowerCase().includes("suncountry") || category.toLowerCase().includes("iat")) continue; + const commandsArr = []; - commands - .filter((cmd) => cmd.category === category) - .map((cmd) => { - let obj = { - commandName: cmd.name, - commandUsage: `${cmd.usage ? cmd.usage : `${prefix}${cmd.name}`}`, - commandDescription: cmd.description, - commandAlias: cmd.aliases?.join(', ') || 'None' - } - commandsArr.push(obj) - }) + commands.filter(cmd => cmd.category === category).map(cmd => { + const obj = { + commandName: cmd.name, + commandUsage: `${cmd.usage ? cmd.usage : `${prefix}${cmd.name}`}`, + commandDescription: cmd.description, + commandAlias: cmd.aliases?.join(", ") || "None", + }; + commandsArr.push(obj); + }); - const categoryObj = { - categoryId: category, - category: `${capitalizeFirstLetter(category)}`, - subTitle: `${capitalizeFirstLetter(category)} commands`, - list: commandsArr - } + const categoryObj = { + categoryId: category, + category: `${capitalizeFirstLetter(category)}`, + subTitle: `${capitalizeFirstLetter(category)} commands`, + list: commandsArr, + }; - finalCategories.push(categoryObj) - } + finalCategories.push(categoryObj); + } - function capitalizeFirstLetter(string) { - return string.charAt(0).toUpperCase() + string.slice(1) - } + function capitalizeFirstLetter(string) { + return string.charAt(0).toUpperCase() + string.slice(1); + } - return finalCategories -} + return finalCategories; +}; \ No newline at end of file diff --git a/theme/dbd-soft-ui/utils/feedHandler.js b/theme/dbd-soft-ui/utils/feedHandler.js index 2607bb9..bd98ec0 100644 --- a/theme/dbd-soft-ui/utils/feedHandler.js +++ b/theme/dbd-soft-ui/utils/feedHandler.js @@ -1,165 +1,171 @@ -const db = require('quick.db') -const consolePrefix = `${'['.blue}${'dbd-soft-ui'.yellow}${']'.blue} ` -const colors = require('colors') -const { icons, otherIcons } = require('../icons') +const db = require("quick.db"); +const consolePrefix = `${"[".blue}${"dbd-soft-ui".yellow}${"]".blue} `; +const colors = require("colors"); +const { icons, otherIcons } = require("../icons"); module.exports = class Feed { - constructor() { - this.setColor = function (color) { - if (!color) throw new Error(`${consolePrefix}${`Failed to modify feed. ${colors.red('Invalid color.')}`.cyan}`); - if ( - color !== 'red' && - color !== 'orange' && - color !== 'pink' && - color !== 'gray' && - color !== 'green' && - color !== 'blue' && - color !== 'dark' - ) { - throw new Error(`${consolePrefix}${`Failed to modify feed. ${colors.red('Invalid color.')}`.cyan}`); - } + constructor() { + this.setColor = function (color) { + if (!color) throw new Error(`${consolePrefix}${`Failed to modify feed. ${colors.red("Invalid color.")}`.cyan}`); + if (color !== "red" && color !== "orange" && color !== "pink" && color !== "gray" && color !== "green" && color !== "blue" && color !== "dark") throw new Error(`${consolePrefix}${`Failed to modify feed. ${colors.red("Invalid color.")}`.cyan}`); - this.color = color; - return this; - } + this.color = color; + return this; + }; - this.setDescription = function (description) { - if (!description) throw new Error(`${consolePrefix}${`Failed to modify feed. ${colors.red('Invalid description.')}`.cyan}`); - if (description.length < 3 || description.length > 128) console.log(`${consolePrefix}${'Invalid description'.cyan}`); - this.description = description; - return this; - } + this.setDescription = function (description) { + if (!description) throw new Error(`${consolePrefix}${`Failed to modify feed. ${colors.red("Invalid description.")}`.cyan}`); + if (description.length < 3 || description.length > 128) console.log(`${consolePrefix}${"Invalid description".cyan}`); - this.setIcon = function (icon) { - if (!icon) throw new Error(`${consolePrefix}${`Failed to modify feed. ${colors.red('Invalid icon.')}`.cyan}`); - if (!icons.includes(icon) && !otherIcons.includes(icon)) throw new Error(`${consolePrefix}${`Failed to modify feed. ${colors.red('Invalid icon.')}`.cyan}`); - this.icon = icon; - return this; - } + this.description = description; + return this; + }; - this.getFeed = function (id) { - if (!id) throw new Error(`${consolePrefix}${`Failed to get feed. ${colors.red('Invalid id.')}`.cyan}`); - let feedName = ''; - switch (id) { - case 1: - feedName = 'one'; - break; - case 2: - feedName = 'two'; - break; - case 3: - feedName = 'three'; - break; - case "all": - feedName = 'all'; - break; - default: - throw new Error(`${consolePrefix}${`Failed to get feed. ${colors.red('Invalid id.')}`.cyan}`); - } + this.setIcon = function (icon) { + if (!icon) throw new Error(`${consolePrefix}${`Failed to modify feed. ${colors.red("Invalid icon.")}`.cyan}`); + if (!icons.includes(icon) && !otherIcons.includes(icon)) throw new Error(`${consolePrefix}${`Failed to modify feed. ${colors.red("Invalid icon.")}`.cyan}`); - let feed = db.get(`feeds${feedName === "all" ? "" : `.${feedName}`}`) - if (!feed) throw new Error(`${consolePrefix}${`Failed to get feed. ${colors.red('Feed not found.')}`.cyan}`); - this.feed = feed; - return this; - } + this.icon = icon; + return this; + }; - this.delete = function () { - if (!this.feed)throw new Error(`${consolePrefix}${`Failed to delete feed. ${colors.red('Feed not selected')}`.cyan}`); - db.delete(`feeds.${this.feed.id}`); - return this; - } + this.getFeed = function (id) { + if (!id) throw new Error(`${consolePrefix}${`Failed to get feed. ${colors.red("Invalid id.")}`.cyan}`); - this.send = async function () { - const { color, description, icon } = this; + let feedName = ""; + switch (id) { + case 1: + feedName = "one"; + break; + case 2: + feedName = "two"; + break; + case 3: + feedName = "three"; + break; + case "all": + feedName = "all"; + break; + default: + throw new Error(`${consolePrefix}${`Failed to get feed. ${colors.red("Invalid id.")}`.cyan}`); + } - let diff; - let col; - if (otherIcons.includes(icon)) diff = true; + const feed = db.get(`feeds${feedName === "all" ? "" : `.${feedName}`}`); - if (color === 'red') col = 'danger'; - if (color === 'orange') col = 'warning'; - if (color === 'pink') col = 'primary'; - if (color === 'gray') col = 'secondary'; - if (color === 'green') col = 'success'; - if (color === 'blue') col = 'info'; - if (color === 'dark') col = 'dark'; + if (!feed) throw new Error(`${consolePrefix}${`Failed to get feed. ${colors.red("Feed not found.")}`.cyan}`); - if (db.get('feeds.three') && db.get('feeds.two') && db.get('feeds.one')) { - await db.delete('feeds.one') - const f3 = db.get('feeds.three') - const f2 = db.get('feeds.two') - await db.set('feeds.two', { - color: f3.color, - description: f3.description, - published: f3.published, - icon: f3.icon, - diff: f3.diff - }) - await db.set('feeds.one', { - color: f2.color, - description: f2.description, - published: f2.published, - icon: f2.icon, - diff: f2.diff - }) - await db.set('feeds.three', { - color: col, - description: description, - published: Date.now(), - icon: icon, - diff: diff - }) - } else { - if (!db.get('feeds.three')) { - await db.set('feeds.three', { - color: col, - description: description, - published: Date.now(), - icon: icon, - diff: diff - }) - } else if (!db.get('feeds.two')) { - const f3 = db.get('feeds.three') - await db.set('feeds.two', { - color: f3.color, - description: f3.description, - published: f3.published, - icon: f3.icon, - diff: f3.diff - }) - await db.set('feeds.three', { - color: col, - description: description, - published: Date.now(), - icon: icon, - diff: diff - }) - } else { - const f3 = db.get('feeds.three') - const f2 = db.get('feeds.two') - await db.set('feeds.one', { - color: f2.color, - description: f2.description, - published: f2.published, - icon: f2.icon, - diff: f2.diff - }) - await db.set('feeds.two', { - color: f3.color, - description: f3.description, - published: f3.published, - icon: f3.icon, - diff: f3.diff - }) - await db.set('feeds.three', { - color: col, - description: description, - published: Date.now(), - icon: icon, - diff: diff - }) - } - } - } - } -} \ No newline at end of file + this.feed = feed; + return this; + }; + + this.delete = function () { + if (!this.feed) throw new Error(`${consolePrefix}${`Failed to delete feed. ${colors.red("Feed not selected")}`.cyan}`); + + db.delete(`feeds.${this.feed.id}`); + + return this; + }; + + this.send = async function () { + const { color, description, icon } = this; + + let diff; + let col; + if (otherIcons.includes(icon)) diff = true; + + if (color === "red") col = "danger"; + if (color === "orange") col = "warning"; + if (color === "pink") col = "primary"; + if (color === "gray") col = "secondary"; + if (color === "green") col = "success"; + if (color === "blue") col = "info"; + if (color === "dark") col = "dark"; + + if (db.get("feeds.three") && db.get("feeds.two") && db.get("feeds.one")) { + await db.delete("feeds.one"); + + const f3 = db.get("feeds.three"); + const f2 = db.get("feeds.two"); + + await db.set("feeds.two", { + color: f3.color, + description: f3.description, + published: f3.published, + icon: f3.icon, + diff: f3.diff, + }); + + await db.set("feeds.one", { + color: f2.color, + description: f2.description, + published: f2.published, + icon: f2.icon, + diff: f2.diff, + }); + + await db.set("feeds.three", { + color: col, + description: description, + published: Date.now(), + icon: icon, + diff: diff, + }); + } else { + if (!db.get("feeds.three")) { + await db.set("feeds.three", { + color: col, + description: description, + published: Date.now(), + icon: icon, + diff: diff, + }); + } else if (!db.get("feeds.two")) { + const f3 = db.get("feeds.three"); + + await db.set("feeds.two", { + color: f3.color, + description: f3.description, + published: f3.published, + icon: f3.icon, + diff: f3.diff, + }); + + await db.set("feeds.three", { + color: col, + description: description, + published: Date.now(), + icon: icon, + diff: diff, + }); + } else { + const f3 = db.get("feeds.three"); + const f2 = db.get("feeds.two"); + + await db.set("feeds.one", { + color: f2.color, + description: f2.description, + published: f2.published, + icon: f2.icon, + diff: f2.diff, + }); + + await db.set("feeds.two", { + color: f3.color, + description: f3.description, + published: f3.published, + icon: f3.icon, + diff: f3.diff, + }); + + await db.set("feeds.three", { + color: col, + description: description, + published: Date.now(), + icon: icon, + diff: diff, + }); + } + } + }; + } +}; \ No newline at end of file diff --git a/theme/dbd-soft-ui/utils/formtypes.js b/theme/dbd-soft-ui/utils/formtypes.js index b7fb6e9..f163843 100644 --- a/theme/dbd-soft-ui/utils/formtypes.js +++ b/theme/dbd-soft-ui/utils/formtypes.js @@ -1,63 +1,63 @@ module.exports = { - multiRow: (options) => { - // Validate Data - if (options && (!options.length || !options[0])) throw new Error("Options in the 'collapsable' form type should be an array."); + multiRow: (options) => { + // Validate Data + if (options && (!options.length || !options[0])) throw new Error("Options in the 'collapsable' form type should be an array."); - const hasType = (object) => object.hasOwnProperty('optionType') && object.optionType?.hasOwnProperty('type'); + const hasType = object => Object.prototype.hasOwnProperty.call(object, "optionType") && Object.prototype.hasOwnProperty.call(object.optionType, "type"); - if (options && !options.every(hasType)) throw new Error("Invalid form type provided in the 'multiRow' form type."); + if (options && !options.every(hasType)) throw new Error("Invalid form type provided in the 'multiRow' form type."); - if (options && options.find(obj => obj.optionType.type == "multiRow")) throw new Error("You cannot use the form type 'multiRow' in the 'multiRow' form type."); + if (options && options.find(obj => obj.optionType.type == "multiRow")) throw new Error("You cannot use the form type 'multiRow' in the 'multiRow' form type."); - return { - type: "multiRow", - options - } - }, - spacer: (themeOptions = {}) => { - return { - type: 'spacer', - themeOptions - } - }, - emojiPicker: (disabled, themeOptions = {}) => { - return { - type: 'emojiPicker', - disabled, - themeOptions - } - }, - slider: (min, max, step, disabled, themeOptions = {}) => { - return { - type: 'slider', - min, - max, - step, - disabled, - themeOptions - } - }, - date: (disabled, themeOptions = {}) => { - return { - type: 'date', - disabled, - themeOptions - } - }, - numberPicker: (min, max, disabled, themeOptions = {}) => { - return { - type: 'numberPicker', - min, - max, - disabled, - themeOptions - } - }, - tagInput: (disabled, themeOptions = {}) => { - return { - type: 'tagInput', - disabled, - themeOptions - } - } -} \ No newline at end of file + return { + type: "multiRow", + options, + }; + }, + spacer: (themeOptions = {}) => { + return { + type: "spacer", + themeOptions, + }; + }, + emojiPicker: (disabled, themeOptions = {}) => { + return { + type: "emojiPicker", + disabled, + themeOptions, + }; + }, + slider: (min, max, step, disabled, themeOptions = {}) => { + return { + type: "slider", + min, + max, + step, + disabled, + themeOptions, + }; + }, + date: (disabled, themeOptions = {}) => { + return { + type: "date", + disabled, + themeOptions, + }; + }, + numberPicker: (min, max, disabled, themeOptions = {}) => { + return { + type: "numberPicker", + min, + max, + disabled, + themeOptions, + }; + }, + tagInput: (disabled, themeOptions = {}) => { + return { + type: "tagInput", + disabled, + themeOptions, + }; + }, +}; \ No newline at end of file diff --git a/theme/dbd-soft-ui/utils/functions/errorHandler.js b/theme/dbd-soft-ui/utils/functions/errorHandler.js index bf2377a..121e067 100644 --- a/theme/dbd-soft-ui/utils/functions/errorHandler.js +++ b/theme/dbd-soft-ui/utils/functions/errorHandler.js @@ -1,47 +1,44 @@ module.exports = function (config, themeConfig) { - config.errorPage = function (req, res, error, type) { - if (type == 404) { - title = themeConfig?.error?.error404?.title || '404' - subtitle = - themeConfig?.error?.error404?.subtitle || 'Page not found' - description = - themeConfig?.error?.error404?.description || - 'The page you are looking for does not exist.' - } + config.errorPage = function (req, res, error, type) { + let title, subtitle, description = null; - title = themeConfig?.error?.dbdError?.title || type.toString() - subtitle = themeConfig?.error?.dbdError?.subtitle || 'An error occurred' - description = - themeConfig?.error?.dbdError?.description || - 'Please contact us if the issue persists or try again later.' + if (type == 404) { + title = themeConfig?.error?.error404?.title || "404"; + subtitle = themeConfig?.error?.error404?.subtitle || "Page not found"; + description = themeConfig?.error?.error404?.description || "The page you are looking for does not exist."; + } - if (error) { - console.error(error) - } + title = themeConfig?.error?.dbdError?.title || type.toString(); + subtitle = themeConfig?.error?.dbdError?.subtitle || "An error occurred"; + description = + themeConfig?.error?.dbdError?.description || + "Please contact us if the issue persists or try again later."; - if (themeConfig?.error?.errorHandler) - themeConfig.error.errorHandler({ - req, - res, - error: { - type, - path: error?.path || null, - error: error?.stack || `Page ${req.originalUrl} not found!` - }, - user: req?.session?.user || null - }) + if (error) console.error(error); - return res.render('error', { - strError: error?.stack?.split('\n'), - req, - bot: config.bot, - config, - type, - themeConfig, - title, - subtitle, - description, - error: error || undefined - }) - } -} + if (themeConfig?.error?.errorHandler) + themeConfig.error.errorHandler({ + req, + res, + error: { + type, + path: error?.path || null, + error: error?.stack || `Page ${req.originalUrl} not found!`, + }, + user: req?.session?.user || null, + }); + + return res.render("error", { + strError: error?.stack?.split("\n"), + req, + bot: config.bot, + config, + type, + themeConfig, + title, + subtitle, + description, + error: error || undefined, + }); + }; +}; \ No newline at end of file diff --git a/theme/dbd-soft-ui/utils/functions/settingsPage.js b/theme/dbd-soft-ui/utils/functions/settingsPage.js index ebcf7d9..89f40ff 100644 --- a/theme/dbd-soft-ui/utils/functions/settingsPage.js +++ b/theme/dbd-soft-ui/utils/functions/settingsPage.js @@ -1,399 +1,266 @@ -const Discord = require('discord.js') +const { Permissions } = require("discord.js"); + module.exports = function (config, themeConfig) { - config.guildSettings = async function (req, res, home, category) { - if (!req.session.user) return res.redirect('/discord?r=/guild/' + req.params.id) + // eslint-disable-next-line no-unused-vars + config.guildSettings = async function (req, res, home, category) { + if (!req.session.user) return res.redirect("/discord?r=/guild/" + req.params.id); - let bot = config.bot - if (!bot.guilds.cache.get(req.params.id)) { - try { - await bot.guilds.fetch(req.params.id) - } catch (err) { } - } + const bot = config.bot; + if (!bot.guilds.cache.get(req.params.id)) { + try { + await bot.guilds.fetch(req.params.id); + } catch (e) { /* ... */ } + } - if (!bot.guilds.cache.get(req.params.id)) return res.redirect('/manage?error=noPermsToManageGuild') - if ( - !bot.guilds.cache - .get(req.params.id) - .members.cache.get(req.session.user.id) - ) { - try { - await bot.guilds.cache - .get(req.params.id) - .members.fetch(req.session.user.id) - } catch (err) { } - } - for (let PermissionRequired of req.requiredPermissions) { - let converted = PermissionRequired[0] - const DiscordJsVersion = Discord.version.split('.')[0] - if (DiscordJsVersion === '14') converted = await convert14(PermissionRequired[0]) + if (!bot.guilds.cache.get(req.params.id)) return res.redirect("/manage?error=noPermsToManageGuild"); + if (!bot.guilds.cache.get(req.params.id).members.cache.get(req.session.user.id)) { + try { + await bot.guilds.cache.get(req.params.id).members.fetch(req.session.user.id); + } catch (e) { /* ... */ } + } - if ( - !bot.guilds.cache - .get(req.params.id) - .members.cache.get(req.session.user.id) - .permissions.has(converted) - ) { - return res.redirect('/manage?error=noPermsToManageGuild') - } - } + // for (const PermissionRequired of req.requiredPermissions) { + // const permissionsReq = Permissions.FLAGS[PermissionRequired[0]]; - if (bot.guilds.cache.get(req.params.id).channels.cache.size < 1) { - try { - await bot.guilds.cache.get(req.params.id).channels.fetch() - } catch (err) { } - } + // if (!bot.guilds.cache.get(req.params.id).members.cache.get(req.session.user.id).permissions.has(permissionsReq)) + // return res.redirect("/manage?error=noPermsToManageGuild"); + // } - if (bot.guilds.cache.get(req.params.id).roles.cache.size < 2) { - try { - await bot.guilds.cache.get(req.params.id).roles.fetch() - } catch (err) { } - } + if (bot.guilds.cache.get(req.params.id).channels.cache.size < 1) { + try { + await bot.guilds.cache.get(req.params.id).channels.fetch(); + } catch (e) { /* ... */ } + } - let actual = {} - let toggle = {} - let premium = {} + if (bot.guilds.cache.get(req.params.id).roles.cache.size < 2) { + try { + await bot.guilds.cache.get(req.params.id).roles.fetch(); + } catch (e) { /* ... */ } + } - let canUseList = {} + const actual = {}; + const toggle = {}; + const premium = {}; - if (config.settings?.length) for (const category of config.settings) { - if (!canUseList[category.categoryId]) canUseList[category.categoryId] = {}; - if (!actual[category.categoryId]) actual[category.categoryId] = {} + const canUseList = {}; - if (config.useCategorySet) { - let catGAS = await category.getActualSet({ - guild: { - id: req.params.id, - object: bot.guilds.cache.get(req.params.id), - }, - user: { - id: req.session.user.id, - object: bot.guilds.cache - .get(req.params.id) - .members.cache.get(req.session.user.id), - }, - }); + if (config.settings?.length) + for (const category of config.settings) { + if (!canUseList[category.categoryId]) canUseList[category.categoryId] = {}; + if (!actual[category.categoryId]) actual[category.categoryId] = {}; - if (category.toggleable) { - if (!toggle[category.categoryId]) { - toggle[category.categoryId] = {} - } - toggle[category.categoryId] = catGAS.find(o => o.optionId === "categoryToggle") || null; - catGAS = catGAS.filter((c) => c.optionId !== 'categoryToggle') - } - if (category.premium) { - if (!premium[category.categoryId]) { - premium[category.categoryId] = {} - } - premium[category.categoryId] = await s.premiumUser({ - guild: { - id: req.params.id - }, - user: { - id: req.session.user.id, - tag: req.session.user.tag - } - }) - } + if (config.useCategorySet) { + let catGAS = await category.getActualSet({ + guild: { + id: req.params.id, + object: bot.guilds.cache.get(req.params.id), + }, + user: { + id: req.session.user.id, + object: bot.guilds.cache.get(req.params.id).members.cache.get(req.session.user.id), + }, + }); - if (category.premium && premium[category.categoryId] == false) return res.redirect( - `/settings/${req.params.id}?error=premiumRequired` - ) + if (category.toggleable) { + if (!toggle[category.categoryId]) { + toggle[category.categoryId] = {}; + } + toggle[category.categoryId] = catGAS.find(o => o.optionId === "categoryToggle") || null; + catGAS = catGAS.filter(c => c.optionId !== "categoryToggle"); + } + if (category.premium) { + if (!premium[category.categoryId]) premium[category.categoryId] = {}; - for (const o of catGAS) { - if (!o || !o?.optionId) { - console.log( - "WARNING: You haven't set the optionId for a category option in your config. This is required for the category option to work." - ) - continue; - } - const option = category.categoryOptionsList.find( - (c) => c.optionId == o.optionId - ) - if (option) { - if (option.allowedCheck) { - const canUse = await option.allowedCheck({ - guild: { - id: req.params.id, - }, - user: { - id: req.session.user.id, - }, - }) + premium[category.categoryId] = await category.premiumUser({ + guild: { + id: req.params.id, + }, + user: { + id: req.session.user.id, + tag: req.session.user.tag, + }, + }); + } - if (typeof canUse != "object") - throw new TypeError( - `${category.categoryId} category option with id ${option.optionId} allowedCheck function need to return {allowed: Boolean, errorMessage: String | null}` - ) - canUseList[category.categoryId][ - option.optionId - ] = canUse - } else { - canUseList[category.categoryId][ - option.optionId - ] = { - allowed: true, - errorMessage: null, - } - } + if (category.premium && premium[category.categoryId] == false) + return res.redirect(`/settings/${req.params.id}?error=premiumRequired`); - if (option.optionType !== "spacer") { - if (!actual[category.categoryId]) { - actual[category.categoryId] = {} - } - if ( - !actual[category.categoryId][ - option.optionId - ] - ) { - actual[category.categoryId][ - option.optionId - ] = o.data - } - } else actual[category.categoryId][option.optionId] = { - type: 'spacer', - themeOptions: option.themeOptions - } - } else console.log(`WARNING: Option ${o.optionId} in category ${category.categoryId} doesn't exist in your config.`) + for (const o of catGAS) { + if (!o || !o?.optionId) { + console.log("WARNING: You haven't set the optionId for a category option in your config. This is required for the category option to work."); + continue; + } - } - } else for (const s of config.settings) { - if (!canUseList[s.categoryId]) canUseList[s.categoryId] = {} - if (s.toggleable) { - if (!toggle[s.categoryId]) { - toggle[s.categoryId] = {} - } - toggle[s.categoryId] = await s.getActualSet({ - guild: { - id: req.params.id - } - }) - } - if (s.premium) { - if (!premium[s.categoryId]) { - premium[s.categoryId] = {} - } - premium[s.categoryId] = await s.premiumUser({ - guild: { - id: req.params.id - }, - user: { - id: req.session.user.id, - tag: req.session.user.tag - } - }) - } + const option = category.categoryOptionsList.find(c => c.optionId == o.optionId); - if (category) { - if (s.premium && premium[category] == false) { - return res.redirect( - `/settings/${req.params.id}?error=premiumRequired` - ) - } - } + if (option) { + if (option.allowedCheck) { + const canUse = await option.allowedCheck({ + guild: { id: req.params.id }, + user: { id: req.session.user.id }, + }); - for (const c of s.categoryOptionsList) { - if (c.allowedCheck) { - const canUse = await c.allowedCheck({ - guild: { id: req.params.id }, - user: { id: req.session.user.id } - }) - if (typeof canUse != 'object') { - throw new TypeError( - `${s.categoryId} category option with id ${c.optionId} allowedCheck function need to return {allowed: Boolean, errorMessage: String | null}` - ) - } - canUseList[s.categoryId][c.optionId] = canUse - } else { - canUseList[s.categoryId][c.optionId] = { - allowed: true, - errorMessage: null - } - } + if (typeof canUse != "object") throw new TypeError(`${category.categoryId} category option with id ${option.optionId} allowedCheck function need to return {allowed: Boolean, errorMessage: String | null}`); - if (!actual[s.categoryId]) actual[s.categoryId] = {} + canUseList[category.categoryId][option.optionId] = canUse; + } else { + canUseList[category.categoryId][option.optionId] = { + allowed: true, + errorMessage: null, + }; + } - if (c.optionType.type == 'spacer') { - actual[s.categoryId][c.optionId] = { - type: 'spacer', - themeOptions: c.themeOptions - } - } else if ( - c.optionType.type == 'collapsable' || - c.optionType.type == 'modal' - ) { - for (const item of c.optionType.options) { - if ( - item.optionType.type == 'channelsMultiSelect' || - item.optionType.type == 'roleMultiSelect' || - item.optionType.type == 'tagInput' - ) { - actual[s.categoryId][item.optionId] = [] - } - } - } else { - if (!actual[s.categoryId]) { - actual[s.categoryId] = {} - } - if (!actual[s.categoryId][c.optionId]) { - if (c.optionType.type === "multiRow") { - for (const item of c.optionType.options) { - actual[s.categoryId][item.optionId] = await item.getActualSet( - { - guild: { - id: req.params.id, - object: bot.guilds.cache.get(req.params.id) - }, - user: { - id: req.session.user.id, - object: bot.guilds.cache - .get(req.params.id) - .members.cache.get(req.session.user.id) - } - } - ) - } - continue - } - actual[s.categoryId][c.optionId] = await c.getActualSet( - { - guild: { - id: req.params.id, - object: bot.guilds.cache.get(req.params.id) - }, - user: { - id: req.session.user.id, - object: bot.guilds.cache - .get(req.params.id) - .members.cache.get(req.session.user.id) - } - } - ) - } - } - } - } - } + if (option.optionType !== "spacer") { + if (!actual[category.categoryId]) actual[category.categoryId] = {}; - let errors - let success - // boo - if (req.session.errors) { - if (String(req.session.errors).includes('%is%')) { - errors = req.session.errors.split('%and%') - } - } + if (!actual[category.categoryId][option.optionId]) + actual[category.categoryId][option.optionId] = o.data; + } else actual[category.categoryId][option.optionId] = { + type: "spacer", + themeOptions: option.themeOptions, + }; + } else console.log(`WARNING: Option ${o.optionId} in category ${category.categoryId} doesn't exist in your config.`); + } + } else + for (const s of config.settings) { + if (!canUseList[s.categoryId]) canUseList[s.categoryId] = {}; - if (req.session.success) { - if (typeof req.session.success == 'boolean') { - success = true - } else { - if (String(req.session.success).includes('%is%')) { - success = req.session.success.split('%and%') - } - } - } + if (s.toggleable) { + if (!toggle[s.categoryId]) toggle[s.categoryId] = {}; - req.session.errors = null - req.session.success = null + toggle[s.categoryId] = await s.getActualSet({ + guild: { + id: req.params.id, + }, + }); + } + if (s.premium) { + if (!premium[s.categoryId]) premium[s.categoryId] = {}; - const guild = bot.guilds.cache.get(req.params.id) - let gIcon + premium[s.categoryId] = await s.premiumUser({ + guild: { + id: req.params.id, + }, + user: { + id: req.session.user.id, + tag: req.session.user.tag, + }, + }); + } - if (!guild.iconURL()) gIcon = themeConfig?.icons?.noGuildIcon - else gIcon = guild.iconURL() + if (category) + if (s.premium && premium[category] == false) + return res.redirect(`/settings/${req.params.id}?error=premiumRequired`); - res.render('settings', { - successes: success, - errors: errors, - settings: config.settings, - actual: actual, - toggle, - premium, - canUseList, - bot: config.bot, - guild, - userid: req.session.user.id, - gIcon, - req: req, - guildid: req.params.id, - themeConfig: req.themeConfig, - config - }) - } -} + for (const c of s.categoryOptionsList) { + if (c.allowedCheck) { + const canUse = await c.allowedCheck({ + guild: { id: req.params.id }, + user: { id: req.session.user.id }, + }); -async function convert14(perm) { - var final = 'NULL' + if (typeof canUse != "object") throw new TypeError(`${s.categoryId} category option with id ${c.optionId} allowedCheck function need to return {allowed: Boolean, errorMessage: String | null}`); - switch (perm) { - case 'CREATE_INSTANT_INVITE': - final = 'CreateInstantInvite' - break - case 'KICK_MEMBERS': - final = 'KickMembers' - break - case 'BAN_MEMBERS': - final = 'BanMembers' - break - case 'ADMINISTRATOR': - final = 'Administrator' - break - case 'MANAGE_CHANNELS': - final = 'ManageChannels' - break - case 'MANAGE_GUILD': - final = 'ManageGuild' - break - case 'ADD_REACTIONS': - final = 'AddReactions' - break - case 'VIEW_AUDIT_LOG': - final = 'ViewAuditLog' - break - case 'PRIORITY_SPEAKER': - final = 'PrioritySpeaker' - break - case 'STREAM': - final = 'Stream' - break - case 'VIEW_CHANNEL': - final = 'ViewChannel' - break - case 'SEND_MESSAGES': - final = 'SendMessages' - break - case 'SEND_TTS_MESSAGES': - final = 'SendTTSMessages' - break - case 'MANAGE_MESSAGES': - final = 'ManageMessages' - break - case 'EMBED_LINKS': - final = 'ManageMessages' - break - case 'ATTACH_FILES': - final = 'AttachFiles' - break - case 'READ_MESSAGE_HISTORY': - final = 'ReadMessageHistory' - break - case 'MENTION_EVERYONE': - final = 'MentionEveryone' - break - case 'USE_EXTERNAL_EMOJIS': - final = 'UseExternalEmojis' - break - case 'VIEW_GUILD_INSIGHTS': - final = 'ViewGuildInsughts' - break - case 'CONNECT': - final = 'Connect' - break - case 'SPEAK': - final = 'Speak' - break - } + canUseList[s.categoryId][c.optionId] = canUse; + } else { + canUseList[s.categoryId][c.optionId] = { + allowed: true, + errorMessage: null, + }; + } - return final -} + if (!actual[s.categoryId]) actual[s.categoryId] = {}; + + if (c.optionType.type == "spacer") { + actual[s.categoryId][c.optionId] = { + type: "spacer", + themeOptions: c.themeOptions, + }; + } else if (c.optionType.type == "collapsable" || c.optionType.type == "modal") { + for (const item of c.optionType.options) { + if (item.optionType.type == "channelsMultiSelect" || item.optionType.type == "roleMultiSelect" || item.optionType.type == "tagInput") + actual[s.categoryId][item.optionId] = []; + } + } else { + if (!actual[s.categoryId]) actual[s.categoryId] = {}; + + if (!actual[s.categoryId][c.optionId]) { + if (c.optionType.type === "multiRow") { + for (const item of c.optionType.options) { + actual[s.categoryId][item.optionId] = await item.getActualSet({ + guild: { + id: req.params.id, + object: bot.guilds.cache.get(req.params.id), + }, + user: { + id: req.session.user.id, + object: bot.guilds.cache.get(req.params.id).members.cache.get(req.session.user.id), + }, + }); + } + continue; + } + actual[s.categoryId][c.optionId] = await c.getActualSet({ + guild: { + id: req.params.id, + object: bot.guilds.cache.get(req.params.id), + }, + user: { + id: req.session.user.id, + object: bot.guilds.cache.get(req.params.id).members.cache.get(req.session.user.id), + }, + }); + } + } + } + } + } + + let errors; + let success; + + if (req.session.errors) { + if (String(req.session.errors).includes("%is%")) { + errors = req.session.errors.split("%and%"); + } + } + + if (req.session.success) { + if (typeof req.session.success == "boolean") + success = true; + else { + if (String(req.session.success).includes("%is%")) { + success = req.session.success.split("%and%"); + } + } + } + + req.session.errors = null; + req.session.success = null; + + const guild = bot.guilds.cache.get(req.params.id); + let gIcon; + + if (!guild.iconURL()) gIcon = themeConfig?.icons?.noGuildIcon; + else gIcon = guild.iconURL(); + + res.render("settings", { + successes: success, + errors: errors, + settings: config.settings, + actual: actual, + toggle, + premium, + canUseList, + bot: config.bot, + guild, + userid: req.session.user.id, + gIcon, + req: req, + guildid: req.params.id, + themeConfig: req.themeConfig, + config, + }); + }; +}; \ No newline at end of file diff --git a/theme/dbd-soft-ui/utils/initPages.js b/theme/dbd-soft-ui/utils/initPages.js index f4859fa..b06cd70 100644 --- a/theme/dbd-soft-ui/utils/initPages.js +++ b/theme/dbd-soft-ui/utils/initPages.js @@ -1,89 +1,66 @@ -const fs = require('fs') -const colors = require('colors') -const consolePrefix = `${'['.blue}${'dbd-soft-ui'.yellow}${']'.blue} ` -const Nodeactyl = require('nodeactyl') +const fs = require("fs"); +const colors = require("colors"); +const consolePrefix = `${"[".blue}${"dbd-soft-ui".yellow}${"]".blue} `; +const Nodeactyl = require("nodeactyl"); module.exports = { - init: async function (config, themeConfig, app, db) { - let info; - if (themeConfig?.customThemeOptions?.info) info = await themeConfig.customThemeOptions.info({ config: config }); - if(themeConfig?.admin?.pterodactyl?.enabled) { - themeConfig.nodeactyl = new Nodeactyl.NodeactylClient( - themeConfig.admin?.pterodactyl?.panelLink, - themeConfig.admin?.pterodactyl?.apiKey - ) + init: async function (config, themeConfig, app, db) { + let info; + if (themeConfig?.customThemeOptions?.info) info = await themeConfig.customThemeOptions.info({ config: config }); - try { - await themeConfig.nodeactyl.getAccountDetails(); - } catch (error) { - console.log(`${consolePrefix}${('Failed to connect to Pterodactyl panel!\nEnsure you\'ve used a CLIENT api key, (found at ' + themeConfig.admin.pterodactyl.panelLink + '/account/api)').red}`); - } - } - const eventFolders = fs.readdirSync(`${__dirname}/../pages`) + if (themeConfig?.admin?.pterodactyl?.enabled) { + themeConfig.nodeactyl = new Nodeactyl.NodeactylClient(themeConfig.admin?.pterodactyl?.panelLink, themeConfig.admin?.pterodactyl?.apiKey); - for (const folder of eventFolders) { - const eventFiles = fs - .readdirSync(`${__dirname}/../pages/${folder}`) - .filter((file) => file.endsWith('.js')); - for (const file of eventFiles) { - const e = require(`${__dirname}/../pages/${folder}/${file}`); - try { - if (folder === 'admin') { - await app.get(e.page, async function (req, res) { - if (!req.session.user) return res.sendStatus(401) - if (!config.ownerIDs?.includes(req.session.user.id)) return res.sendStatus(403); - e.execute( - req, - res, - app, - config, - themeConfig, - info, - db - ) - }) - } else if (folder === 'post') { - await app.post(e.page, function (req, res) { - e.execute( - req, - res, - app, - config, - themeConfig, - info, - db - ) - }) - } else if (folder === 'get') { - await app.use(e.page, async function (req, res) { - e.execute( - req, - res, - app, - config, - themeConfig, - info, - db - ) - }) - } - } catch (error) { - console.log(`${consolePrefix}${'Failed to load:'.cyan} ${colors.red(e.page)}`); - console.log(`Page handler ${file}: ${error}`); - } - } - } + try { + await themeConfig.nodeactyl.getAccountDetails(); + } catch (error) { + console.log(`${consolePrefix}${("Failed to connect to Pterodactyl panel!\nEnsure you've used a CLIENT api key, (found at " + themeConfig.admin.pterodactyl.panelLink + "/account/api)").red}`); + } + } - app.use('*', async function (req, res) { - res.status(404) - config.errorPage(req, res, undefined, 404) - }) + const eventFolders = fs.readdirSync(`${__dirname}/../pages`); - app.use((err, req, res, next) => { - res.status(500) - config.errorPage(req, res, err, 500) - }) + for (const folder of eventFolders) { + const eventFiles = fs.readdirSync(`${__dirname}/../pages/${folder}`).filter((file) => file.endsWith(".js")); - console.log(`${consolePrefix}${'Initialised all pages!'.cyan}`); - } -} \ No newline at end of file + for (const file of eventFiles) { + const e = require(`${__dirname}/../pages/${folder}/${file}`); + + try { + if (folder === "admin") { + await app.get(e.page, async function (req, res) { + if (!req.session.user) return res.sendStatus(401); + if (!config.ownerIDs?.includes(req.session.user.id)) return res.sendStatus(403); + + e.execute(req, res, app, config, themeConfig, info, db); + }); + } else if (folder === "post") { + await app.post(e.page, function (req, res) { + e.execute(req, res, app, config, themeConfig, info, db); + }); + } else if (folder === "get") { + await app.use(e.page, async function (req, res) { + e.execute(req, res, app, config, themeConfig, info, db); + }); + } + } catch (error) { + console.log(`${consolePrefix}${"Failed to load:".cyan} ${colors.red(e.page)}`); + console.log(`Page handler ${file}: ${error}`); + } + } + } + + app.use("*", async function (req, res) { + res.status(404); + config.errorPage(req, res, undefined, 404); + }); + + // eslint-disable-next-line no-unused-vars + app.use((err, req, res, next) => { + res.status(500); + config.errorPage(req, res, err, 500); + }); + + console.log(`${consolePrefix}${"Initialised all pages!".cyan}`); + }, +}; \ No newline at end of file diff --git a/theme/dbd-soft-ui/utils/updater/files.js b/theme/dbd-soft-ui/utils/updater/files.js deleted file mode 100644 index f8dc411..0000000 --- a/theme/dbd-soft-ui/utils/updater/files.js +++ /dev/null @@ -1,80 +0,0 @@ -const fetch = require('node-fetch') -const fs = require('fs') -const consolePrefix = `\x1b[34m[\x1b[33mdbd-soft-ui\x1b[34m]\x1b[36m ` -const colors = require('colors') - -async function update() { - let failed3 = 0 - let failed4 = 0 - - try { - await fetch(`https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/utils/updater/versionsOnline.json`); - } catch (error) { - failed3++ - console.log(`${consolePrefix}Failed to check live for updates.`) - } - - if (failed3 === 0) { - let checkArray = await fetch(`https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/utils/updater/versionsOnline.json`); - - try { - checkArray = await checkArray.json() - } catch (error) { - failed4++ - console.log(`${consolePrefix}Failed to check live for updates.`) - } - - if (failed4 === 0) { - let latestVersions = []; - let currentVersions = fs.readFileSync(__dirname + '/versions.json'); - currentVersions = JSON.parse(currentVersions); - let needsUpdating = []; - - for (const latestFile of checkArray) { - if (latestFile.version > currentVersions[latestFile.name]) { - needsUpdating.push({ - name: latestFile.name, - type: latestFile.type - }) - const { name, type } = latestFile - if (type === 'partial') { - let failedFile = 0 - let fileRaw = await fetch(`https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/partials/${name}.ejs`); - - try { - fileRaw = await fileRaw.text() - } catch (error) { - failedFile++ - console.log( - `${consolePrefix}Failed to update ${colors.red( - name - )}.` - ) - } - - if (failedFile === 0) { - await fs.writeFileSync( - `${__dirname}/../../views/partials/${name}.ejs`, - fileRaw - ) - currentVersions[name] = latestFile.version - await fs.writeFileSync( - `${__dirname}/versions.json`, - JSON.stringify(currentVersions) - ) - console.log( - `${consolePrefix}Successfully updated ${colors.green( - name - )}` - ) - } - } - } - } - } - } -} - -exports.update = async () => { - await update() -} \ No newline at end of file diff --git a/theme/dbd-soft-ui/utils/updater/npm.js b/theme/dbd-soft-ui/utils/updater/npm.js deleted file mode 100644 index d7417c5..0000000 --- a/theme/dbd-soft-ui/utils/updater/npm.js +++ /dev/null @@ -1,3 +0,0 @@ -exports.update = () => { - return; -} \ No newline at end of file diff --git a/theme/dbd-soft-ui/utils/updater/versions.json b/theme/dbd-soft-ui/utils/updater/versions.json deleted file mode 100644 index 091e443..0000000 --- a/theme/dbd-soft-ui/utils/updater/versions.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "colorscheme": "1.0.64", - "feeds": "1.0.62", - "footer": "1.0.1", - "graph": "1.0.2", - "iconsList": "1.0.0", - "meta": "0.0.0", - "navbar": "1.0.11", - "popup": "1.1.5", - "preload": "0.0.0", - "preloader": "1.1.14", - "premium": "1.0.0", - "scripts": "0.0.0", - "secret": "1.0.0", - "sidebar": "0.0.0", - "theme": "1.1.0" -} diff --git a/theme/dbd-soft-ui/utils/updater/versionsOnline.json b/theme/dbd-soft-ui/utils/updater/versionsOnline.json deleted file mode 100644 index b97ca09..0000000 --- a/theme/dbd-soft-ui/utils/updater/versionsOnline.json +++ /dev/null @@ -1,57 +0,0 @@ -[ - { - "name": "colorscheme", - "version": "1.0.64", - "type": "partial" - }, - { - "name": "footer", - "version": "1.0.1", - "type": "partial" - }, - { - "name": "graph", - "version": "1.0.2", - "type": "partial" - }, - { - "name": "iconsList", - "version": "1.0.0", - "type": "partial" - }, - { - "name": "navbar", - "version": "1.0.11", - "type": "partial" - }, - { - "name": "popup", - "version": "1.1.5", - "type": "partial" - }, - { - "name": "preloader", - "version": "1.1.14", - "type": "partial" - }, - { - "name": "premium", - "version": "1.0.0", - "type": "partial" - }, - { - "name": "secret", - "version": "1.0.0", - "type": "partial" - }, - { - "name": "theme", - "version": "1.1.0", - "type": "partial" - }, - { - "name": "preload", - "version": "0.0.0", - "type": "partial" - } -] diff --git a/theme/dbd-soft-ui/views/admin.ejs b/theme/dbd-soft-ui/views/admin.ejs index 5cac1ce..9aa24e3 100644 --- a/theme/dbd-soft-ui/views/admin.ejs +++ b/theme/dbd-soft-ui/views/admin.ejs @@ -1,684 +1,669 @@ - - <%- include('partials/preloader.ejs', {now: 'admin'}) %> - - <% - const icons = [ - "address-book", - "address-card", - "adjust", - "air-freshener", - "align-center", - "align-left", - "align-right", - "ambulance", - "angle-double-down", - "angle-double-left", - "angle-double-right", - "angle-double-up", - "angle-down", - "angle-left", - "angle-right", - "angle-up", - "archive", - "arrow-alt-circle-down", - "arrow-alt-circle-left", - "arrow-alt-circle-right", - "arrow-alt-circle-up", - "arrow-down", - "arrow-left", - "arrow-right", - "arrow-up", - "arrows-alt", - "arrows-alt-h", - "arrows-alt-v", - "assistive-listening-systems", - "asterisk", - "at", - "atlas", - "award", - "backspace", - "backward", - "bahai", - "ban", - "band-aid", - "bars", - "battery-empty", - "battery-full", - "battery-half", - "battery-quarter", - "battery-three-quarters", - "bed", - "beer", - "bell", - "bell-slash", - "birthday-cake", - "bolt", - "bomb", - "bone", - "book", - "book-dead", - "book-medical", - "book-open", - "bookmark", - "border-all", - "border-none", - "border-style", - "bowling-ball", - "box", - "box-open", - "briefcase", - "broadcast-tower", - "bug", - "building", - "bullhorn", - "calculator", - "calendar", - "calendar-alt", - "calendar-check", - "calendar-day", - "calendar-minus", - "calendar-plus", - "calendar-times", - "calendar-week", - "camera", - "caret-down", - "caret-left", - "caret-right", - "caret-up", - "certificate", - "chair", - "chalkboard", - "charging-station", - "chart-bar", - "chart-line", - "chart-pie", - "check", - "check-circle", - "check-square", - "circle", - "circle-notch", - "clipboard", - "clock", - "clone", - "cloud", - "cloud-download-alt", - "cloud-meatball", - "cloud-moon", - "cloud-moon-rain", - "cloud-rain", - "cloud-showers-heavy", - "cloud-sun", - "cloud-sun-rain", - "cloud-upload-alt", - "code", - "code-branch", - "cog", - "cogs", - "columns", - "comment", - "comment-alt", - "comment-dollar", - "comment-dots", - "comment-medical", - "comment-slash", - "comments", - "comments-dollar", - "compact-disc", - "compass", - "compress-alt", - "cookie", - "cookie-bite", - "copy", - "credit-card", - "crop", - "crop-alt", - "cut", - "database", - "desktop", - "edit", - "envelope", - "envelope-open", - "eraser", - "ethernet", - "exchange-alt", - "exclamation", - "exclamation-circle", - "exclamation-triangle", - "expand", - "expand-alt", - "external-link-alt", - "eye", - "eye-dropper", - "eye-slash", - "fan", - "file", - "file-alt", - "file-archive", - "file-audio", - "file-code", - "file-download", - "fill", - "fill-drip", - "filter", - "fingerprint", - "fire", - "fire-alt", - "folder", - "folder-open", - "forward", - "gamepad", - "ghost", - "gift", - "gifts", - "globe", - "globe-africa", - "globe-asia", - "globe-europe", - "headphones", - "headphones-alt", - "headset", - "heart", - "heart-broken", - "heartbeat", - "history", - "home", - "info", - "keyboard", - "layer-group", - "list", - "lock", - "lock-open", - "map-marker", - "map-marker-alt", - "microphone", - "microphone-alt", - "microphone-alt-slash", - "minus", - "mobile", - "mobile-alt", - "moon", - "mouse", - "mouse-pointer", - "music", - "network-wired", - "neuter", - "paperclip", - "paste", - "pause", - "paw", - "pen", - "pencil-alt", - "percent", - "percentage", - "phone", - "phone-alt", - "phone-slash", - "phone-volume", - "photo-video", - "power-off", - "question", - "question-circle", - "redo", - "redo-alt", - "reply", - "robot", - "rocket", - "rss", - "satellite-dish", - "save", - "search", - "server", - "shapes", - "share", - "share-alt", - "shield-alt", - "signal", - "skull", - "skull-crossbones", - "sliders-h", - "sort", - "spinner", - "times", - "times-circle", - "toggle-off", - "toggle-on", - "toolbox", - "tools", - "trash", - "trash-alt", - "tv", - "undo", - "undo-alt", - "unlink", - "unlock", - "unlock-alt", - "upload", - "user", - "user-alt", - "volume-down", - "volume-mute", - "volume-off", - "volume-up", - "wifi", - "wrench" - ] - const otherIcons = [ - "youtube", - "discord", - "node", - "apple", - "sellsy", - "app-store", - "cloudflare", - "dev", - "github-alt", - "gitlab", - "google", - "itunes-note", - "node-js", - "npm", - "spotify", - "usb", - "windows" - ] - %> - - <%- themeConfig?.customHtml %> + #backButton:active { + background-color: #555; + } + + <% + const icons = [ + "address-book", + "address-card", + "adjust", + "air-freshener", + "align-center", + "align-left", + "align-right", + "ambulance", + "angle-double-down", + "angle-double-left", + "angle-double-right", + "angle-double-up", + "angle-down", + "angle-left", + "angle-right", + "angle-up", + "archive", + "arrow-alt-circle-down", + "arrow-alt-circle-left", + "arrow-alt-circle-right", + "arrow-alt-circle-up", + "arrow-down", + "arrow-left", + "arrow-right", + "arrow-up", + "arrows-alt", + "arrows-alt-h", + "arrows-alt-v", + "assistive-listening-systems", + "asterisk", + "at", + "atlas", + "award", + "backspace", + "backward", + "bahai", + "ban", + "band-aid", + "bars", + "battery-empty", + "battery-full", + "battery-half", + "battery-quarter", + "battery-three-quarters", + "bed", + "beer", + "bell", + "bell-slash", + "birthday-cake", + "bolt", + "bomb", + "bone", + "book", + "book-dead", + "book-medical", + "book-open", + "bookmark", + "border-all", + "border-none", + "border-style", + "bowling-ball", + "box", + "box-open", + "briefcase", + "broadcast-tower", + "bug", + "building", + "bullhorn", + "calculator", + "calendar", + "calendar-alt", + "calendar-check", + "calendar-day", + "calendar-minus", + "calendar-plus", + "calendar-times", + "calendar-week", + "camera", + "caret-down", + "caret-left", + "caret-right", + "caret-up", + "certificate", + "chair", + "chalkboard", + "charging-station", + "chart-bar", + "chart-line", + "chart-pie", + "check", + "check-circle", + "check-square", + "circle", + "circle-notch", + "clipboard", + "clock", + "clone", + "cloud", + "cloud-download-alt", + "cloud-meatball", + "cloud-moon", + "cloud-moon-rain", + "cloud-rain", + "cloud-showers-heavy", + "cloud-sun", + "cloud-sun-rain", + "cloud-upload-alt", + "code", + "code-branch", + "cog", + "cogs", + "columns", + "comment", + "comment-alt", + "comment-dollar", + "comment-dots", + "comment-medical", + "comment-slash", + "comments", + "comments-dollar", + "compact-disc", + "compass", + "compress-alt", + "cookie", + "cookie-bite", + "copy", + "credit-card", + "crop", + "crop-alt", + "cut", + "database", + "desktop", + "edit", + "envelope", + "envelope-open", + "eraser", + "ethernet", + "exchange-alt", + "exclamation", + "exclamation-circle", + "exclamation-triangle", + "expand", + "expand-alt", + "external-link-alt", + "eye", + "eye-dropper", + "eye-slash", + "fan", + "file", + "file-alt", + "file-archive", + "file-audio", + "file-code", + "file-download", + "fill", + "fill-drip", + "filter", + "fingerprint", + "fire", + "fire-alt", + "folder", + "folder-open", + "forward", + "gamepad", + "ghost", + "gift", + "gifts", + "globe", + "globe-africa", + "globe-asia", + "globe-europe", + "headphones", + "headphones-alt", + "headset", + "heart", + "heart-broken", + "heartbeat", + "history", + "home", + "info", + "keyboard", + "layer-group", + "list", + "lock", + "lock-open", + "map-marker", + "map-marker-alt", + "microphone", + "microphone-alt", + "microphone-alt-slash", + "minus", + "mobile", + "mobile-alt", + "moon", + "mouse", + "mouse-pointer", + "music", + "network-wired", + "neuter", + "paperclip", + "paste", + "pause", + "paw", + "pen", + "pencil-alt", + "percent", + "percentage", + "phone", + "phone-alt", + "phone-slash", + "phone-volume", + "photo-video", + "power-off", + "question", + "question-circle", + "redo", + "redo-alt", + "reply", + "robot", + "rocket", + "rss", + "satellite-dish", + "save", + "search", + "server", + "shapes", + "share", + "share-alt", + "shield-alt", + "signal", + "skull", + "skull-crossbones", + "sliders-h", + "sort", + "spinner", + "times", + "times-circle", + "toggle-off", + "toggle-on", + "toolbox", + "tools", + "trash", + "trash-alt", + "tv", + "undo", + "undo-alt", + "unlink", + "unlock", + "unlock-alt", + "upload", + "user", + "user-alt", + "volume-down", + "volume-mute", + "volume-off", + "volume-up", + "wifi", + "wrench" + ] + const otherIcons = [ + "youtube", + "discord", + "node", + "apple", + "sellsy", + "app-store", + "cloudflare", + "dev", + "github-alt", + "gitlab", + "google", + "itunes-note", + "node-js", + "npm", + "spotify", + "usb", + "windows" + ] + %> + + <%- themeConfig?.customHtml %> <%- include('partials/preload.ejs') %> <%- include('partials/sidebar.ejs', {config: config, now:'admin'}) %>
- - <%- include('partials/navbar.ejs', {now:'admin'}) %> - -
- <% - if(themeConfig?.admin?.pterodactyl?.enabled) { %> -
- -
-
-
-
Pterodactyl List
-
-
-
- - - - - - - - - - - <% - sData.forEach(data => { - %> - - - - + + + <% + }); + %> + + +
- Server - - Info - - Status - - Controls -
-
-
- user1 -
-
-
<%- data.name %>
-

<%- data.uuid %>

-
-
-
-

<%- data.description %>

-

<%- data.node %>

-
- <% - if(data.status === "running") { %> - Online - <% } else if(data.status === "starting") { %> - Starting - <% } else if(data.status === "stopping") { %> - Stopping - <% } else { %> - Offline - <% } %> + + <%- include('partials/navbar.ejs', {now:'admin'}) %> + +
+ <% + if(themeConfig?.admin?.pterodactyl?.enabled) { %> +
+ +
+
+
+
Pterodactyl List
+
+
+
+ + + + + + + + + + + <% + sData.forEach(data => { + %> + + + + - - - <% - }); - %> - - -
+ Server + + Info + + Status + + Controls +
+
+
+ user1 +
+
+
<%- data.name %>
+

<%- data.uuid %>

+
+
+
+

<%- data.description %>

+

<%- data.node %>

+
+ <% + if(data.status === "running") { %> + Online + <% } else if(data.status === "starting") { %> + Starting + <% } else if(data.status === "stopping") { %> + Stopping + <% } else { %> + Offline + <% } %> - - <% - if(data.status === "running" || data.status === "starting") { %> - Stop - Restart - Kill - <% } else if(data.status === "restarting") { %> - Stop - Kill - <% } else if(data.status === "stopping") { %> - Kill - <% } else { %> - Start - - <% } %> -
-
-
-
-
-
-
- <% } %> - <% if (themeConfig.admin?.logs?.enabled) { %> -
-
-
Bot Logs
-
-
-
Current Logs
-
-
- <% if (ldata !== undefined) { %> - - <% } else { %> - - <% } %> -
-
-
-
-
- <% } %> -
-
-
-
-
Feed Builder
-
-
-
Feed Icon
-
    -
  • -
    -
    - - - - - -
    -
    -
  • -
-
Feed Description
-
    -
  • -
    -
    - - - - - -
    -
    -
  • -
-
Feed Colour
-
    -
  • -
    - -
    -
  • -
-
- -
-
-
-
-
-
-
Feed Preview
-
-
-
- -
-
-
-
-
-
Admin Controls
- CHECK FOR UPDATES -
-
-
- - -
-
-
-
-
-
-
-
-
Current Feeds
- <%- include('partials/feeds.ejs', {require, admin:true}) %> -
- - <% - icons.forEach(async(icon) => { %> -
+ <% + if(data.status === "running" || data.status === "starting") { %> + Stop + Restart + Kill + <% } else if(data.status === "restarting") { %> + Stop + Kill + <% } else if(data.status === "stopping") { %> + Kill + <% } else { %> + Start + + <% } %> +
+
+
+
+
+
+
+ <% } %> + <% if (themeConfig.admin?.logs?.enabled) { %> +
+
+
Bot Logs
+
+
+
Current Logs
+
+
+ <% if (ldata !== undefined) { %> + + <% } else { %> + + <% } %> +
+
+
+
+
+ <% } %> +
+
+
+
+
Feed Builder
+
+
+
Feed Icon
+
    +
  • +
    +
    + + + + + +
    +
    +
  • +
+
Feed Description
+
    +
  • +
    +
    + + + + + +
    +
    +
  • +
+
Feed Colour
+
    +
  • +
    + +
    +
  • +
+
+ +
+
+
+
+
+
+
Feed Preview
+
+
+
+ +
+
+
+
+
+
Admin Controls
+ CHECK FOR UPDATES +
+
+
+ + +
+
+
+
+
+
+
+
+
Current Feeds
+ <%- include('partials/feeds.ejs', {require, admin:true}) %> +
+ + <% + icons.forEach(async(icon) => { %> + - - - <%- include('partials/iconsList.ejs', {icons,otherIcons}) %> - -
-
-
-
-
- <%- include('partials/footer.ejs') %> -
-
+ + + + <%- include('partials/iconsList.ejs', {icons,otherIcons}) %> + +
+ + + +
+ <%- include('partials/footer.ejs') %> +
+ <%- include('partials/scripts.ejs', {now: "admin"}) %> diff --git a/theme/dbd-soft-ui/views/commands.ejs b/theme/dbd-soft-ui/views/commands.ejs index 1702edb..6076fcb 100644 --- a/theme/dbd-soft-ui/views/commands.ejs +++ b/theme/dbd-soft-ui/views/commands.ejs @@ -1,167 +1,155 @@ - - <%- include('partials/preloader.ejs', {now: 'commands'}) %> - - <%- themeConfig?.customHtml %> + <%- include("partials/preloader.ejs", {now: "commands"}) %> + + <%- themeConfig?.customHtml %> -<%- include('partials/preload.ejs') %> -<%- include('partials/sidebar.ejs', {config: config, now:'commands'}) %> +<%- include("partials/preload.ejs") %> +<%- include("partials/sidebar.ejs", {config: config, now:"commands"}) %>
- - <%- include('partials/navbar.ejs', {now:'commands'}) %> - -
-
-
- <% themeConfig.commands?.forEach(category => { %> -
-
-
-
-

<%= category.category %>

- <%= category.subTitle %> -
-
-
- - - - - - <% if(!category.hideDescription) { %> - - <% } %> - <% if(!category.hideAlias) { %> - - <% } %> - - - - - <% category.list.forEach((item)=>{ %> - - - - <% if(!category.hideDescription) { %> - - <% } %> - <% if(!category.hideAlias) { %> - - <% } %> -
- Name - - Command Usage - - Description - - Aliases -
-
-
- <% if(category.image){ %> - <%- category.image %> - <% } %> -
-
-
<%= item.commandName %>
-
-
-
-

<%= item.commandUsage %>

-
-

<%= item.commandDescription %>

-
- <%= item.commandAlias %> - - + + <%- include("partials/navbar.ejs", {now:"commands"}) %> + +
+
+
+ <% themeConfig.commands?.forEach(category => { %> + <% if (!category.hideSidebarItem) { %> +
+
+
+ +
+
+ + + + + + <% if(!category.hideDescription) { %> + + <% } %> + <% if(!category.hideAlias) { %> + + <% } %> + + + + + <% category.list.forEach((item)=>{ %> + + + + <% if(!category.hideDescription) { %> + + <% } %> + <% if(!category.hideAlias) { %> + + <% } %> + - - <% }) %> - -
+ Name + + Command Usage + + Description + + Aliases +
+
+
+ <% if(category.image){ %> + <%- category.image %> + <% } %> +
+
+
<%= item.commandName %>
+
+
+
+

<%= item.commandUsage %>

+
+

<%= item.commandDescription %>

+
+ <%= item.commandAlias %> + + - -
-
-
-
-
-
- <% }) %> -
-
- - <%- include('partials/footer.ejs') %> - - <%- include('partials/scripts.ejs', {now: "commands"}) %> + } catch (error) { + console.log(error) + } + } + }); + + <%- include("partials/scripts.ejs", {now: "commands"}) %> \ No newline at end of file diff --git a/theme/dbd-soft-ui/views/components/formTypes/channelsMultiSelect.ejs b/theme/dbd-soft-ui/views/components/formTypes/channelsMultiSelect.ejs index de089e5..c321afe 100644 --- a/theme/dbd-soft-ui/views/components/formTypes/channelsMultiSelect.ejs +++ b/theme/dbd-soft-ui/views/components/formTypes/channelsMultiSelect.ejs @@ -1,32 +1,32 @@ <% if(!Allowed.allowed){ %><%- Allowed.errorMessage %>
<% } %>
\ No newline at end of file diff --git a/theme/dbd-soft-ui/views/components/formTypes/channelsSelect.ejs b/theme/dbd-soft-ui/views/components/formTypes/channelsSelect.ejs index 4a84f35..0441af9 100644 --- a/theme/dbd-soft-ui/views/components/formTypes/channelsSelect.ejs +++ b/theme/dbd-soft-ui/views/components/formTypes/channelsSelect.ejs @@ -1,19 +1,19 @@ <% if(!Allowed.allowed){ %><%- Allowed.errorMessage %>
<% } %> -disabled<% } %> + formType="channelSelect" + defaultValue="" + class="form-select" + id="<%= option.optionId %>" class="col-md-12" + style="<% if(!Allowed.allowed){ %>border-color: red;<% } %> "> + <% + let ioooooo = 0; + let functiona = option.optionType.function(bot, guildid, userid); + functiona.values.forEach(value=>{ %> + + <% ioooooo++; }); %> diff --git a/theme/dbd-soft-ui/views/components/formTypes/checkbox.ejs b/theme/dbd-soft-ui/views/components/formTypes/checkbox.ejs index 132f25b..f7976a5 100644 --- a/theme/dbd-soft-ui/views/components/formTypes/checkbox.ejs +++ b/theme/dbd-soft-ui/views/components/formTypes/checkbox.ejs @@ -1,14 +1,14 @@ <% if(!Allowed.allowed){ %><%- Allowed.errorMessage %>
<% } %>
\ No newline at end of file diff --git a/theme/dbd-soft-ui/views/components/formTypes/colorSelect.ejs b/theme/dbd-soft-ui/views/components/formTypes/colorSelect.ejs index 12e6e80..9323638 100644 --- a/theme/dbd-soft-ui/views/components/formTypes/colorSelect.ejs +++ b/theme/dbd-soft-ui/views/components/formTypes/colorSelect.ejs @@ -1,9 +1,9 @@ <% if(!Allowed.allowed){ %><%- Allowed.errorMessage %>
<% } %> " - <% if(option.optionType.disabled){ %>disabled<% } %> - <% if(!Allowed.allowed){ %>style="border-color: red;" disabled<% } %> + id="<%= option.optionId %>" + formType="colorSelect" + class="form-control form-control-color" + value="<%= actual[s.categoryId][option.optionId] || option.optionType.data || "#ffffff" %>" + <% if(option.optionType.disabled){ %>disabled<% } %> + <% if(!Allowed.allowed){ %>style="border-color: red;" disabled<% } %> > diff --git a/theme/dbd-soft-ui/views/components/formTypes/date.ejs b/theme/dbd-soft-ui/views/components/formTypes/date.ejs index 72c5d69..f41729a 100644 --- a/theme/dbd-soft-ui/views/components/formTypes/date.ejs +++ b/theme/dbd-soft-ui/views/components/formTypes/date.ejs @@ -1,26 +1,26 @@ <% if(!Allowed.allowed){ %><%- Allowed.errorMessage %>
<% } %> - - value="<%= actual[s.categoryId][option.optionId] %>" - <% } else { %> - value="<%- new Date().toISOString().slice(0, 10) %>" - <% } %> - <% if(option?.themeOptions?.min) { %> - min="<%= option.themeOptions.min%>" - <% } %> - <% if(option?.themeOptions?.max) { %> - max="<%= option.themeOptions.max%>" - <% } %> - <% if(!Allowed.allowed){ %> - style="border-color: red;" - <% } %> - <% if (!Allowed.allowed || option.optionType.disabled) { %> - disabled - <% } %> + + value="<%= actual[s.categoryId][option.optionId] %>" + <% } else { %> + value="<%- new Date().toISOString().slice(0, 10) %>" + <% } %> + <% if(option?.themeOptions?.min) { %> + min="<%= option.themeOptions.min%>" + <% } %> + <% if(option?.themeOptions?.max) { %> + max="<%= option.themeOptions.max%>" + <% } %> + <% if(!Allowed.allowed){ %> + style="border-color: red;" + <% } %> + <% if (!Allowed.allowed || option.optionType.disabled) { %> + disabled + <% } %> > diff --git a/theme/dbd-soft-ui/views/components/formTypes/embedBuilder.ejs b/theme/dbd-soft-ui/views/components/formTypes/embedBuilder.ejs index a66c328..a6cf429 100644 --- a/theme/dbd-soft-ui/views/components/formTypes/embedBuilder.ejs +++ b/theme/dbd-soft-ui/views/components/formTypes/embedBuilder.ejs @@ -1,106 +1,106 @@ <% if(!Allowed.allowed){ %><%- Allowed.errorMessage %>
<% } %> + style="visibility: hidden;width: .1px;height: .1px"><%- JSON.stringify(actual[s.categoryId][option.optionId]) || "" %>
- <% - let embedContent; - if (actual[s.categoryId][option.optionId] == null) { - if (option.optionType.data.defaultJson) { - embedContent = JSON.stringify(option.optionType.data.defaultJson, null, 3); - } else { - embedContent = `{ - content: "Did you know that if you don't know something, you don't know it? This riddle was solved by me. Don't thank me.", - embed: { - timestamp: new Date().toISOString(), - url: "https://discord.com", - description: "There was a boar, everyone liked a boar. One day the boar ate my dinner and escaped through the chimney. I haven't seen a boar since then.", - author: { - name: "Assistants Center", - url: "https://assistants.ga", - icon_url: "https://media.discordapp.net/attachments/911644960590270484/934513385402413076/ac_fixed.png" - }, - image: { - url: "https://unsplash.it/380/200" - }, - footer: { - text: "Crated with Discord-Dashboard", - icon_url: "https://cdn.discordapp.com/emojis/870635912437047336.png" - }, - fields: [ - { - name: "Hello", - value: "Hi, Assistants Center loves you <:ac_love:806492057996230676>" - }, - { - name: "Do you know that", - value: "You can use custom emojis there, even from server where bot isn't <:Kekwlaugh:722088222766923847>", - inline: false - }, - ] - } - }`; - } - } else { - if (typeof actual[s.categoryId][option.optionId] === "string") embedContent = actual[s.categoryId][option.optionId]; - else embedContent = JSON.stringify(actual[s.categoryId][option.optionId], null, 3); - } + <% + let embedContent; + if (actual[s.categoryId][option.optionId] == null) { + if (option.optionType.data.defaultJson) { + embedContent = JSON.stringify(option.optionType.data.defaultJson, null, 3); + } else { + embedContent = `{ + content: "Did you know that if you don't know something, you don't know it? This riddle was solved by me. Don't thank me.", + embed: { + timestamp: new Date().toISOString(), + url: "https://discord.com", + description: "There was a boar, everyone liked a boar. One day the boar ate my dinner and escaped through the chimney. I haven't seen a boar since then.", + author: { + name: "Assistants Center", + url: "https://assistants.ga", + icon_url: "https://media.discordapp.net/attachments/911644960590270484/934513385402413076/ac_fixed.png" + }, + image: { + url: "https://unsplash.it/380/200" + }, + footer: { + text: "Crated with Discord-Dashboard", + icon_url: "https://cdn.discordapp.com/emojis/870635912437047336.png" + }, + fields: [ + { + name: "Hello", + value: "Hi, Assistants Center loves you <:ac_love:806492057996230676>" + }, + { + name: "Do you know that", + value: "You can use custom emojis there, even from server where bot isn't <:Kekwlaugh:722088222766923847>", + inline: false + }, + ] + } + }`; + } + } else { + if (typeof actual[s.categoryId][option.optionId] === "string") embedContent = actual[s.categoryId][option.optionId]; + else embedContent = JSON.stringify(actual[s.categoryId][option.optionId], null, 3); + } - %> - + %> +
\ No newline at end of file diff --git a/theme/dbd-soft-ui/views/components/formTypes/emojiPicker.ejs b/theme/dbd-soft-ui/views/components/formTypes/emojiPicker.ejs index 6c5c94e..7755ed5 100644 --- a/theme/dbd-soft-ui/views/components/formTypes/emojiPicker.ejs +++ b/theme/dbd-soft-ui/views/components/formTypes/emojiPicker.ejs @@ -1,176 +1,176 @@ <% if(!Allowed.allowed){ %> - - <%- Allowed.errorMessage %> - -
+ + <%- Allowed.errorMessage %> + +
<% } %> " class="d-none" type="text" id="<%= option.optionId %>" formType="emojiPicker" type="text" onchange="optionEdited(this)"> <% if(!option.optionType.disabled && Allowed.allowed){ %> - + if (emojis.find(x => x.name === emoji)) { + custom = emojis.find(x => x.name === emoji) + } + + $("#<%= option.optionId %>").val(custom ? custom.id : emoji) + $("#<%= option.optionId %>").trigger("change") + + if (custom?.id) + return $("#navbarDropdownMenuLink2").html( + `${custom.name}` + ) + else $("#navbarDropdownMenuLink2").html(` + + ${twemoji.parse(emoji)} + + `) + }); + twemoji.parse(document.body, "<%= bot.guilds.cache.get(req.params.id).emojis.cache.map(e => e.id) %>"); + <% } %> \ No newline at end of file diff --git a/theme/dbd-soft-ui/views/components/formTypes/input.ejs b/theme/dbd-soft-ui/views/components/formTypes/input.ejs index a81194f..4efc73d 100644 --- a/theme/dbd-soft-ui/views/components/formTypes/input.ejs +++ b/theme/dbd-soft-ui/views/components/formTypes/input.ejs @@ -1,33 +1,33 @@ <% if(!Allowed.allowed){ %><%- Allowed.errorMessage %>
<% } %> style="border-color: red;" disabled - <% } %> - type="text" id="<%= option.optionId %>" class="col-md-12 form-control" - id="<%= option.optionId %>" - formType="input" - defaultValue="<% if(actual[s.categoryId][option.optionId]){ %><%= actual[s.categoryId][option.optionId] %><% } %>" - <% if(option.optionType.required){ %>required - <% } %> - <% if(option.optionType.disabled){ %>disabled - <% } %> - placeholder="<%= option.optionType.data %>" - <% if(actual[s.categoryId][option.optionId]){ %>value="<%= actual[s.categoryId][option.optionId] %>" - <% } %> - <% if(option.optionType.min){ %>minlength="<%= option.optionType.min %>" - <% } %> - <% if(option.optionType.max){ %>maxlength="<%= option.optionType.max %>" - <% } %> + <% } %> + type="text" id="<%= option.optionId %>" class="col-md-12 form-control" + id="<%= option.optionId %>" + formType="input" + defaultValue="<% if(actual[s.categoryId][option.optionId]){ %><%= actual[s.categoryId][option.optionId] %><% } %>" + <% if(option.optionType.required){ %>required + <% } %> + <% if(option.optionType.disabled){ %>disabled + <% } %> + placeholder="<%= option.optionType.data %>" + <% if(actual[s.categoryId][option.optionId]){ %>value="<%= actual[s.categoryId][option.optionId] %>" + <% } %> + <% if(option.optionType.min){ %>minlength="<%= option.optionType.min %>" + <% } %> + <% if(option.optionType.max){ %>maxlength="<%= option.optionType.max %>" + <% } %> /> <% if (option?.themeOptions?.optionPlaceholder) { %> -
- <% option?.themeOptions?.optionPlaceholder?.values.forEach(array => { %> - - onclick="$('#<%= option.optionId %>').val(this.innerHTML);" - <% } %> - ><%- array %> - <% }) %> -
+
+ <% option?.themeOptions?.optionPlaceholder?.values.forEach(array => { %> + + onclick="$('#<%= option.optionId %>').val(this.innerHTML);" + <% } %> + ><%- array %> + <% }) %> +
<% } %> diff --git a/theme/dbd-soft-ui/views/components/formTypes/multiRow.ejs b/theme/dbd-soft-ui/views/components/formTypes/multiRow.ejs index 9a8b7d6..1e28178 100644 --- a/theme/dbd-soft-ui/views/components/formTypes/multiRow.ejs +++ b/theme/dbd-soft-ui/views/components/formTypes/multiRow.ejs @@ -1,10 +1,9 @@ -
- <% option.optionType.options.forEach(opt => { %> -
-

<%- opt?.optionName || ""%>

-

<%- opt?.optionDescription || ""%>

- <%- include(`./${opt.optionType.type}.ejs`, {option: opt, s, Allowed}) %> -
- <% }) %> + <% option.optionType.options.forEach(opt => { %> +
+

<%- opt?.optionName || ""%>

+

<%- opt?.optionDescription || ""%>

+ <%- include(`./${opt.optionType.type}.ejs`, {option: opt, s, Allowed}) %> +
+ <% }) %>
\ No newline at end of file diff --git a/theme/dbd-soft-ui/views/components/formTypes/multiSelect.ejs b/theme/dbd-soft-ui/views/components/formTypes/multiSelect.ejs index 425e9d2..8d4661c 100644 --- a/theme/dbd-soft-ui/views/components/formTypes/multiSelect.ejs +++ b/theme/dbd-soft-ui/views/components/formTypes/multiSelect.ejs @@ -1,29 +1,29 @@ <% if(!Allowed.allowed){ %><%- Allowed.errorMessage %>
<% } %> diff --git a/theme/dbd-soft-ui/views/components/formTypes/numberPicker.ejs b/theme/dbd-soft-ui/views/components/formTypes/numberPicker.ejs index d5e5d36..334322f 100644 --- a/theme/dbd-soft-ui/views/components/formTypes/numberPicker.ejs +++ b/theme/dbd-soft-ui/views/components/formTypes/numberPicker.ejs @@ -1,27 +1,27 @@ <% if(!Allowed.allowed){ %><%- Allowed.errorMessage %>
<% } %> - - defaultValue="<%= actual[s.categoryId][option.optionId] %>" - value="<%= actual[s.categoryId][option.optionId] %>" - <% } %> - class="form-control" - type="number" - id="<%= option.optionId %>" - formType="numberPicker" - <% if (option.optionType.min) { %> - min="<%= option.optionType.min %>" - onkeyup="if(this.value < <%= option.optionType.min %>) this.value = <%= option.optionType.min %>" - <% } %> - <% if (option.optionType.max) { %> - max="<%= option.optionType.max %>" - onkeyup="if(this.value > <%= option.optionType.max %>) this.value = <%= option.optionType.max %>" - <% } %> - <% if(!Allowed.allowed ){ %> - style="border-color: red !important" - disabled - <% } %> - <% if (Allowed.allowed && option.optionType.disabled) { %> - disabled - <% } %> + + defaultValue="<%= actual[s.categoryId][option.optionId] %>" + value="<%= actual[s.categoryId][option.optionId] %>" + <% } %> + class="form-control" + type="number" + id="<%= option.optionId %>" + formType="numberPicker" + <% if (option.optionType.min) { %> + min="<%= option.optionType.min %>" + onkeyup="if(this.value < <%= option.optionType.min %>) this.value = <%= option.optionType.min %>" + <% } %> + <% if (option.optionType.max) { %> + max="<%= option.optionType.max %>" + onkeyup="if(this.value > <%= option.optionType.max %>) this.value = <%= option.optionType.max %>" + <% } %> + <% if(!Allowed.allowed ){ %> + style="border-color: red !important" + disabled + <% } %> + <% if (Allowed.allowed && option.optionType.disabled) { %> + disabled + <% } %> > diff --git a/theme/dbd-soft-ui/views/components/formTypes/rolesMultiSelect.ejs b/theme/dbd-soft-ui/views/components/formTypes/rolesMultiSelect.ejs index 664822d..490a1cd 100644 --- a/theme/dbd-soft-ui/views/components/formTypes/rolesMultiSelect.ejs +++ b/theme/dbd-soft-ui/views/components/formTypes/rolesMultiSelect.ejs @@ -1,26 +1,26 @@ <% if(!Allowed.allowed){ %><%- Allowed.errorMessage %>
<% } %>
\ No newline at end of file diff --git a/theme/dbd-soft-ui/views/components/formTypes/rolesSelect.ejs b/theme/dbd-soft-ui/views/components/formTypes/rolesSelect.ejs index 6bcd66a..e966b7c 100644 --- a/theme/dbd-soft-ui/views/components/formTypes/rolesSelect.ejs +++ b/theme/dbd-soft-ui/views/components/formTypes/rolesSelect.ejs @@ -1,21 +1,21 @@ <% if(!Allowed.allowed){ %><%- Allowed.errorMessage %>
<% } %> diff --git a/theme/dbd-soft-ui/views/components/formTypes/select.ejs b/theme/dbd-soft-ui/views/components/formTypes/select.ejs index b2c110b..3517861 100644 --- a/theme/dbd-soft-ui/views/components/formTypes/select.ejs +++ b/theme/dbd-soft-ui/views/components/formTypes/select.ejs @@ -1,22 +1,22 @@ <% if(!Allowed.allowed){ %><%- Allowed.errorMessage %>
<% } %> diff --git a/theme/dbd-soft-ui/views/components/formTypes/slider.ejs b/theme/dbd-soft-ui/views/components/formTypes/slider.ejs index dbfc5dc..6fb79be 100644 --- a/theme/dbd-soft-ui/views/components/formTypes/slider.ejs +++ b/theme/dbd-soft-ui/views/components/formTypes/slider.ejs @@ -1,99 +1,99 @@ <% if(!Allowed.allowed){ %><%- Allowed.errorMessage %>
<% } %> <% if(option?.themeOptions?.dataList) { %> - - <% option.themeOptions.dataList.forEach(data => { %> - - <% }) %> - + + <% option.themeOptions.dataList.forEach(data => { %> + + <% }) %> + <% } %> - - defaultValue="<%= actual[s.categoryId][option.optionId] %>" - value="<%= actual[s.categoryId][option.optionId] %>" + defaultValue="<%= actual[s.categoryId][option.optionId] %>" + value="<%= actual[s.categoryId][option.optionId] %>" <% } %> - class="form-control slider" - formType="slider" - id="<%= option.optionId %>" - type="range" - list="steplist" - step="<%= option.optionType.step %>" - min="<%= option.optionType.min %>" - max="<%= option.optionType.max %>" + class="form-control slider" + formType="slider" + id="<%= option.optionId %>" + type="range" + list="steplist" + step="<%= option.optionType.step %>" + min="<%= option.optionType.min %>" + max="<%= option.optionType.max %>" <% if (option.themeOptions?.showValue) { %> - oninput="updateSlider(this.value, this.id)" -<% } %> - style="border: none !important; <% if(!Allowed.allowed){ %> border-color: red; <% } %>" -<% if(!Allowed.allowed){ %> - disabled + oninput="updateSlider(this.value, this.id)" +<% } %> + style="border: none !important; <% if(!Allowed.allowed){ %> border-color: red; <% } %>" +<% if(!Allowed.allowed){ %> + disabled <% } %> <% if (Allowed.allowed && option.optionType.disabled) { %> - disabled + disabled <% } %> > <% if (option.themeOptions?.showValue) { %> -

Slider is set to <% if(actual[s.categoryId][option.optionId]){ %><%= actual[s.categoryId][option.optionId] %><% } %>

+

Slider is set to <% if(actual[s.categoryId][option.optionId]){ %><%= actual[s.categoryId][option.optionId] %><% } %>

<% } %> diff --git a/theme/dbd-soft-ui/views/components/formTypes/switch.ejs b/theme/dbd-soft-ui/views/components/formTypes/switch.ejs index 0e85817..e25cde3 100644 --- a/theme/dbd-soft-ui/views/components/formTypes/switch.ejs +++ b/theme/dbd-soft-ui/views/components/formTypes/switch.ejs @@ -2,77 +2,77 @@ if (actual[s.categoryId][option.optionId]) val = "checked"; %> <% if(!Allowed.allowed){ %><%- Allowed.errorMessage %>
<% } %>
+
+
+
+
+
+
Partial Information
+
+
+
+
+
+ + +
+
+ <%- include("partials/footer.ejs") %> + + + + <%- include("partials/scripts.ejs", {now: "debug"}) %> \ No newline at end of file diff --git a/theme/dbd-soft-ui/views/error.ejs b/theme/dbd-soft-ui/views/error.ejs index f78d584..7bf7e1b 100644 --- a/theme/dbd-soft-ui/views/error.ejs +++ b/theme/dbd-soft-ui/views/error.ejs @@ -1,151 +1,136 @@ - - <%- include('partials/preloader.ejs', {now: 'error'}) %> - <% - let data + <%- include('partials/preloader.ejs', {now: 'error'}) %> + <% + let data - if (error !== undefined && error && config.ownerIDs?.includes(req.session?.user?.id) && !themeConfig?.error?.dbdError?.disableSecretMenu) { - data = "text/json;charset=utf-8," + encodeURIComponent(error) + "\n" - data += `${error.path}` - } - %> - <% if (error !== undefined && error && config.ownerIDs?.includes(req.session?.user?.id) && !themeConfig?.error?.dbdError?.disableSecretMenu) { %> - - <% } %> - <%- themeConfig?.customHtml %> + if (error !== undefined && error && config.ownerIDs?.includes(req.session?.user?.id) && !themeConfig?.error?.dbdError?.disableSecretMenu) { + data = "text/json;charset=utf-8," + encodeURIComponent(error) + "\n" + data += `${error.path}` + } + %> + <% if (error !== undefined && error && config.ownerIDs?.includes(req.session?.user?.id) && !themeConfig?.error?.dbdError?.disableSecretMenu) { %> + + <% } %> + <%- themeConfig?.customHtml %> <%- include('partials/preload.ejs') %>
- +
<%- include('partials/scripts.ejs', {now: "index"}) %> <% if(error !== undefined && error && config.ownerIDs?.includes(req.session?.user?.id) && !themeConfig?.error?.dbdError?.disableSecretMenu) { %> - - <% if (error !== undefined && error && config.ownerIDs?.includes(req.session?.user?.id) && !themeConfig?.error?.dbdError?.disableSecretMenu) { %> - - <% } %> + let entered = []; + window.addEventListener("keydown", function (e) { + if (e.keyCode.toString() === konami[currentCount]) { + if (currentCount !== 0 && entered[currentCount - 1] !== konami[currentCount - 1]) { + // User has messed with variables in console to try show it smh + entered = []; + return currentCount = 0; + } + if (!konami[currentCount + 1]) { + // Correct code + $('#exampleModalSignUp').modal('show'); + currentCount = 0; + return entered = []; + } + entered.push(e.keyCode.toString()); + currentCount++; + } else { + currentCount = 0; + return entered = []; + } + }, true); + } + + <% } %> <% } %> diff --git a/theme/dbd-soft-ui/views/guild.ejs b/theme/dbd-soft-ui/views/guild.ejs index 50df21b..9b54531 100644 --- a/theme/dbd-soft-ui/views/guild.ejs +++ b/theme/dbd-soft-ui/views/guild.ejs @@ -1,32 +1,16 @@ - - - + - + \ No newline at end of file diff --git a/theme/dbd-soft-ui/views/guilds.ejs b/theme/dbd-soft-ui/views/guilds.ejs index a0997cd..285bfd5 100644 --- a/theme/dbd-soft-ui/views/guilds.ejs +++ b/theme/dbd-soft-ui/views/guilds.ejs @@ -1,115 +1,100 @@ - - <%- include('partials/preloader.ejs', {now:'manage'}) %> + <%- include('partials/preloader.ejs', {now:'manage'}) %> - - <%- themeConfig?.customHtml %> + + <%- themeConfig?.customHtml %> <%- include('partials/preload.ejs') %> <%- include('partials/sidebar.ejs', {config: config, now:'manage'}) %>
- <%- include('partials/navbar.ejs', {now:'manage'}) %> -
-
-
-
-
-

- Your servers -

-

- Select the server you want to configure -

-
-
-
- <% - for(var i in req.session.guilds){ %> - <% if((req.session.guilds[i].permissions & 0x00000020) == 0x00000020){ %> - <% if(bot.guilds.cache.get(req.session.guilds[i].id)){ - const guild = bot.guilds.cache.get(req.session.guilds[i].id); - let icon; + <%- include('partials/navbar.ejs', {now:'manage'}) %> +
+
+
+
+
+

+ Your servers +

+

+ Select the server you want to configure +

+
+
+
+ <% + for(var i in req.session.guilds){ %> + <% if((req.session.guilds[i].permissions & 0x00000020) == 0x00000020){ %> + <% if(bot.guilds.cache.get(req.session.guilds[i].id)){ + const guild = bot.guilds.cache.get(req.session.guilds[i].id); + let icon; - if (!guild.iconURL()) icon = themeConfig?.icons?.noGuildIcon; - else icon = guild.iconURL() + "?size=256"; - %> - -
-
- <% } } } %> -
-
- <% for (var i in req.session.guilds){ %> - <% if((req.session.guilds[i].permissions & 0x00000020) == 0x00000020){ %> - <% - if(!bot.guilds.cache.get(req.session.guilds[i].id)){ - let icon = `https://cdn.discordapp.com/icons/${req.session.guilds[i].id}/${req.session.guilds[i].icon}.png`; - const friendlyName = req.session.guilds[i].name.replace('`', ''); - if (!req.session.guilds[i].icon) icon = themeConfig.icons.noGuildIcon; - else icon = icon + "?size=256" - %> - - -
-
+ if (!guild.iconURL()) icon = themeConfig?.icons?.noGuildIcon; + else icon = guild.iconURL() + "?size=256"; + %> + +
+
+ <% } } } %> +
+
+ <% for (var i in req.session.guilds){ %> + <% if((req.session.guilds[i].permissions & 0x00000020) == 0x00000020){ %> + <% + if(!bot.guilds.cache.get(req.session.guilds[i].id)){ + let icon = `https://cdn.discordapp.com/icons/${req.session.guilds[i].id}/${req.session.guilds[i].icon}.png`; + const friendlyName = req.session.guilds[i].name.replace('`', ''); + if (!req.session.guilds[i].icon) icon = themeConfig.icons.noGuildIcon; + else icon = icon + "?size=256" + %> + + +
+
- <% } } } %> - -
-
-
-
- <%- include('partials/footer.ejs') %> -
-
- - - - - - - - - - <%- include('partials/scripts.ejs', {now: "guilds"}) %> + <% } } } %> + +
+
+
+
+ <%- include('partials/footer.ejs') %> +
+
+ + + + + + + + + + <%- include('partials/scripts.ejs', {now: "guilds"}) %> diff --git a/theme/dbd-soft-ui/views/index.ejs b/theme/dbd-soft-ui/views/index.ejs index c79e426..5ed189b 100644 --- a/theme/dbd-soft-ui/views/index.ejs +++ b/theme/dbd-soft-ui/views/index.ejs @@ -1,36 +1,21 @@ - <%- include('partials/preloader.ejs', {now:'index', req: req}) %> <% if (req.query?.guild_id) { %> - - <%- themeConfig?.customHtml %> + function refreshParent() { + window.opener.location = `/settings/<%= req.query?.guild_id %>`; + window.close(); + return + }; + window.opener.location = `/settings/<%= req.query?.guild_id %>`; + window.close(); + } + + <%- themeConfig?.customHtml %> <% } %> @@ -38,115 +23,115 @@ <%- include('partials/preload.ejs') %> <%- include('partials/sidebar.ejs', {config: config, now:'index'}) %>
- - <%- include('partials/navbar.ejs', {now:'index'}) %> - -
-
- <% - let i = 0; - customThemeOptions.cards.forEach((stats) => { - %> -
-
-
-
-
-
-

- <%- req?.locales?.index?.feeds[i] || stats.title %>

-
- <%- stats.getValue %> -
-
- <% if(stats.progressBar && stats.progressBar.enabled){ %> -
-
-
- <% } %> -
-
-
- -
-
-
-
-
-
- <% i++ }); %> -
-
-
-
-
-
-
-
-

<%- req?.locales?.index?.card?.category %>

-
<%- req?.locales?.index?.card?.title %>
-

<%- req?.locales?.index?.card?.description %>

-

<%= req?.locales?.index?.card?.footer %>

- <% if(themeConfig.index?.card?.link?.enabled) { %> - - <%- req?.locales?.index?.card?.link?.text %> - - - <% } %> -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<%- req?.locales?.index?.feeds.title || "Feeds" %>
- <%- include('partials/feeds.ejs', {require, admin:false}) %> -
-
-
-
- <% if(themeConfig.index?.graph?.enabled) { %> -
-
-
<%- req?.locales?.index?.graph?.title %>
- <% if(themeConfig.index.graph.lineGraph) { %> -
- <% } %> -
- <% if(!themeConfig.index.graph.lineGraph) { %> - - <% } else { %> - - <% } %> -
- <% if(themeConfig.index.graph.lineGraph) { %> -
- <% } %> -
-
-
-
- <% } %> -
- <%- include('partials/footer.ejs') %> + + <%- include('partials/navbar.ejs', {now:'index'}) %> + +
+
+ <% + let i = 0; + customThemeOptions.cards.forEach((stats) => { + %> +
+
+
+
+
+
+

+ <%- req?.locales?.index?.feeds[i] || stats.title %>

+
+ <%- stats.getValue %> +
+
+ <% if(stats.progressBar && stats.progressBar.enabled){ %> +
+
+
+ <% } %> +
+
+
+ +
+
+
+
+
+
+ <% i++ }); %> +
+
+
+
+
+
+
+
+

<%- req?.locales?.index?.card?.category %>

+
<%- req?.locales?.index?.card?.title %>
+

<%- req?.locales?.index?.card?.description %>

+

<%= req?.locales?.index?.card?.footer %>

+ <% if(themeConfig.index?.card?.link?.enabled) { %> + + <%- req?.locales?.index?.card?.link?.text %> + + + <% } %> +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<%- req?.locales?.index?.feeds.title || "Feeds" %>
+ <%- include('partials/feeds.ejs', {require, admin:false}) %> +
+
+
+
+ <% if(themeConfig.index?.graph?.enabled) { %> +
+
+
<%- req?.locales?.index?.graph?.title %>
+ <% if(themeConfig.index.graph.lineGraph) { %> +
+ <% } %> +
+ <% if(!themeConfig.index.graph.lineGraph) { %> + + <% } else { %> + + <% } %> +
+ <% if(themeConfig.index.graph.lineGraph) { %> +
+ <% } %> +
+
+
+
+ <% } %> +
+ <%- include('partials/footer.ejs') %>
diff --git a/theme/dbd-soft-ui/views/loading.ejs b/theme/dbd-soft-ui/views/loading.ejs index 82bad19..55b4cd6 100644 --- a/theme/dbd-soft-ui/views/loading.ejs +++ b/theme/dbd-soft-ui/views/loading.ejs @@ -1,140 +1,140 @@ - - - - - - - - - - - - <%- include('partials/colorscheme.ejs') %> - <%= themeConfig.websiteName %> - Loading - <% if(req.cookies?.selectedTheme == "dark" || req.cookies?.selectedTheme == "auto" || !req.cookies?.selectedTheme) { %> - - media="(prefers-color-scheme: dark)" - <% } %> - > - <% } %> - <%- themeConfig?.customHtml %> + + + + + + + + + + + + <%- include('partials/colorscheme.ejs') %> + <%= themeConfig.websiteName %> - Loading + <% if(req.cookies?.selectedTheme == "dark" || req.cookies?.selectedTheme == "auto" || !req.cookies?.selectedTheme) { %> + + media="(prefers-color-scheme: dark)" + <% } %> + > + <% } %> + <%- themeConfig?.customHtml %>
-
-
-
-
-
- <% if(themeConfig.preloader){ %> - <% if(themeConfig.preloader.image) { %> - <% if(!themeConfig.preloader.spinner) { %> -
- -
- <% } %> - <% } %> - <% if(themeConfig.preloader.text){ %> -
-
-

Loading...

- <% if(themeConfig.preloader.spinner) { %> +
+
+
+
+
+ <% if(themeConfig.preloader){ %> + <% if(themeConfig.preloader.image) { %> + <% if(!themeConfig.preloader.spinner) { %> +
+ +
+ <% } %> + <% } %> + <% if(themeConfig.preloader.text){ %> +
+
+

Loading...

+ <% if(themeConfig.preloader.spinner) { %> -
-
- Loading... -
- -
- <% } %> -
- <% } %> - <% } %> +
+
+ Loading... +
+ +
+ <% } %> +
+ <% } %> + <% } %>
\ No newline at end of file diff --git a/theme/dbd-soft-ui/views/maintenance.ejs b/theme/dbd-soft-ui/views/maintenance.ejs index 7b74074..50d41aa 100644 --- a/theme/dbd-soft-ui/views/maintenance.ejs +++ b/theme/dbd-soft-ui/views/maintenance.ejs @@ -1,167 +1,154 @@ - <% let logged = `Login`; if (loggedIn) logged = 'Logout'; let title, - contentTitle, - texts; + contentTitle, + texts; if (defaultMaintenanceConfig !== {}) { - title = defaultMaintenanceConfig.title; - contentTitle = defaultMaintenanceConfig.contentTitle; - texts = defaultMaintenanceConfig.texts; - if (!texts) texts = []; + title = defaultMaintenanceConfig.title; + contentTitle = defaultMaintenanceConfig.contentTitle; + texts = defaultMaintenanceConfig.texts; + if (!texts) texts = []; } %> - <%- include('partials/preloader.ejs', {now: 'maintenance'}) %> - <%- include('partials/colorscheme.ejs') %> - - - <%- themeConfig?.customHtml %> + setInterval(() => { + if (newWindow.closed) window.location.href = `<%= req.originalUrl%>?swal=logged` + }, 500); + <% } else { %> + window.location.href = `<%= req.originalUrl%>?swal=logged` + <% } %> + } + + <%- themeConfig?.customHtml %> <%- include('partials/preload.ejs') %>
-
-
- - -
-
+
+
+ + +
+
- <% - const images = ["curved-1", "curved-2", "curved-3", "curved-4", "curved-5", "curved-6", "curved-7", "curved-8", "curved-9", "curved-10", "curved-11", "curved-12", "curved-13", "curved-14", "curved-15", "curved-16", "curved-17", "curved-18"]; + <% + const images = ["curved-1", "curved-2", "curved-3", "curved-4", "curved-5", "curved-6", "curved-7", "curved-8", "curved-9", "curved-10", "curved-11", "curved-12", "curved-13", "curved-14", "curved-15", "curved-16", "curved-17", "curved-18"]; - const image = images[Math.floor(Math.random() * images.length)]; - %> - + const image = images[Math.floor(Math.random() * images.length)]; + %> +
<% if(defaultMaintenanceConfig.infoCards){ %> -
-
-
-
-
- <% let c = 1; defaultMaintenanceConfig.infoCards.forEach(card => { %> -
-
- <% if(card.title){ %>

- <%- card.title %>

- <% } %> - <% if(card.subtitle){ %>
<%- card.subtitle %>
- <% } %> - <% if(card.description){ %>

<%- card.description %>

- <% } %> -
- <% c++; if(c != 4) { %> -
- <% } %> -
- <% }) %> +
+
+
+
+
+ <% let c = 1; defaultMaintenanceConfig.infoCards.forEach(card => { %> +
+
+ <% if(card.title){ %>

+ <%- card.title %>

+ <% } %> + <% if(card.subtitle){ %>
<%- card.subtitle %>
+ <% } %> + <% if(card.description){ %>

<%- card.description %>

+ <% } %> +
+ <% c++; if(c != 4) { %> +
+ <% } %> +
+ <% }) %> - -
-
-
-
-
+ +
+
+
+
+
<% } %> diff --git a/theme/dbd-soft-ui/views/newFormTypes.ejs b/theme/dbd-soft-ui/views/newFormTypes.ejs index b341680..359d148 100644 --- a/theme/dbd-soft-ui/views/newFormTypes.ejs +++ b/theme/dbd-soft-ui/views/newFormTypes.ejs @@ -1,202 +1,202 @@ - - - - - - - + + + + + + +
- +

Slider is set to





-

Message content

-
-
-
- -
-
-
-
-
- -
-
-
-
- -
-
-
-
- -
-
-
-
- -
-
-
-
-
-
-
-
+

Message content

+
+
+
+ +
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+
+

-

Items

-

Manage your shop. Add, edit or remove items.

-
-
- -
Item
-
-
+
-
+

Items

+

Manage your shop. Add, edit or remove items.

+
+
+ +
Item
+
+
+
+
- -
-
-

Currency

-

Set a custom currency symbol.

-
-
-
-
-

Basic Settings

-
- - - -
-
- -
-
-

Author settings

-
- - - -
-
- -
-
-
-
-
-
-
Server's store
-
You have 10$ in your bank.
-
-
-
-
-
-
-
-
-

Fields

-
- - - -
-
- -
-
-
-
-
+ function setHref(item) { + var a = document.getElementById(item); //or grab it by tagname etc + var x = document.getElementById("authorurlinput").value; + a.href = x + } + +
+
+

Currency

+

Set a custom currency symbol.

+
+
+
+
+

Basic Settings

+
+ + + +
+
+ +
+
+

Author settings

+
+ + + +
+
+ +
+
+
+
+
+
+
Server's store
+
You have 10$ in your bank.
+
+
+
+
+
+
+
+
+

Fields

+
+ + + +
+
+ +
+
+
+
+
<%- include('partials/scripts.ejs') %> diff --git a/theme/dbd-soft-ui/views/partials/colorscheme.ejs b/theme/dbd-soft-ui/views/partials/colorscheme.ejs index 41c1ff0..04d29e3 100644 --- a/theme/dbd-soft-ui/views/partials/colorscheme.ejs +++ b/theme/dbd-soft-ui/views/partials/colorscheme.ejs @@ -1,187 +1,194 @@ <% let currentScheme = themeConfig.colorScheme, - currentCode = "310deg, #7928CA 0%, #FF0080 100%", - colone, - coltwo; + currentCode = "310deg, #7928CA 0%, #FF0080 100%", + colone, + coltwo; if (currentScheme == "pink") { - currentCode = "310deg, #7928CA 0%, #FF0080 100%"; - colone = "#FF0080"; - coltwo = "#7928CA"; + currentCode = "310deg, #7928CA 0%, #FF0080 100%"; + colone = "#FF0080"; + coltwo = "#7928CA"; } if (currentScheme == "red") { - currentCode = "310deg, #ea0606 0%, #ff667c 100%"; - colone = "#ea0606"; - coltwo = "#ff667c"; + currentCode = "310deg, #ea0606 0%, #ff667c 100%"; + colone = "#ea0606"; + coltwo = "#ff667c"; } if (currentScheme == "green") { - currentCode = "310deg, #17ad37 0%, #98ec2d 100%"; - colone = "#17ad37"; - coltwo = "#98ec2d"; + currentCode = "310deg, #17ad37 0%, #98ec2d 100%"; + colone = "#17ad37"; + coltwo = "#98ec2d"; } if (currentScheme == "yellow") { - currentCode = "310deg, #f53939 0%, #fbcf33 100%"; - colone = "#f53939"; - coltwo = "#fbcf33"; + currentCode = "310deg, #f53939 0%, #fbcf33 100%"; + colone = "#f53939"; + coltwo = "#fbcf33"; } if (currentScheme == "dark") { - currentCode = "310deg, #141727 0%, #3A416F 100%"; - colone = "#141727"; - coltwo = "#3A416F"; + currentCode = "310deg, #141727 0%, #3A416F 100%"; + colone = "#141727"; + coltwo = "#3A416F"; } if (currentScheme == "blue") { - currentCode = "310deg, #2152ff 0%, #21d4fd 100%"; - colone = "#2152ff"; - coltwo = "#21d4fd"; + currentCode = "310deg, #2152ff 0%, #21d4fd 100%"; + colone = "#2152ff"; + coltwo = "#21d4fd"; } if (currentScheme == "custom") { - if (!themeConfig.themeColors || !themeConfig.themeColors.primaryColor || !themeConfig.themeColors.secondaryColor) { - currentCode = "310deg, #7928CA 0%, #FF0080 100%"; - colone = "#FF0080"; - coltwo = "#7928CA"; - } else { - currentCode = "310deg, " + themeConfig.themeColors.primaryColor + " 0%, " + themeConfig.themeColors.secondaryColor + " 100%"; - colone = themeConfig.themeColors.primaryColor; - coltwo = themeConfig.themeColors.secondaryColor; - } + if (!themeConfig.themeColors || !themeConfig.themeColors.primaryColor || !themeConfig.themeColors.secondaryColor) { + currentCode = "310deg, #7928CA 0%, #FF0080 100%"; + colone = "#FF0080"; + coltwo = "#7928CA"; + } else { + currentCode = "310deg, " + themeConfig.themeColors.primaryColor + " 0%, " + themeConfig.themeColors.secondaryColor + " 100%"; + colone = themeConfig.themeColors.primaryColor; + coltwo = themeConfig.themeColors.secondaryColor; + } } %> diff --git a/theme/dbd-soft-ui/views/partials/feeds.ejs b/theme/dbd-soft-ui/views/partials/feeds.ejs index 3872278..2695efe 100644 --- a/theme/dbd-soft-ui/views/partials/feeds.ejs +++ b/theme/dbd-soft-ui/views/partials/feeds.ejs @@ -1,118 +1,118 @@
-
- <% - let feeds = []; +
+ <% + let feeds = []; - const db = require('quick.db'); + const db = require('quick.db'); - if (db.get('feeds.three')) { - const fd = db.get('feeds.three'); - const fdata = { - color: fd.color, - description: fd.description, - icon: fd.icon, - published: fd.published, - diff: fd.diff, - feedNum: 3 - } - feeds.push(fdata); - } - if (db.get('feeds.two')) { - const fd = db.get('feeds.two'); - const fdata = { - color: fd.color, - description: fd.description, - icon: fd.icon, - published: fd.published, - diff: fd.diff, - feedNum: 2 - } - feeds.push(fdata); - } - if (db.get('feeds.one')) { - const fd = db.get('feeds.one'); - const fdata = { - color: fd.color, - description: fd.description, - published: fd.published, - icon: fd.icon, - diff: fd.diff, - feedNum: 1 - } - feeds.push(fdata); - } - feeds.forEach(feed => { + if (db.get('feeds.three')) { + const fd = db.get('feeds.three'); + const fdata = { + color: fd.color, + description: fd.description, + icon: fd.icon, + published: fd.published, + diff: fd.diff, + feedNum: 3 + } + feeds.push(fdata); + } + if (db.get('feeds.two')) { + const fd = db.get('feeds.two'); + const fdata = { + color: fd.color, + description: fd.description, + icon: fd.icon, + published: fd.published, + diff: fd.diff, + feedNum: 2 + } + feeds.push(fdata); + } + if (db.get('feeds.one')) { + const fd = db.get('feeds.one'); + const fdata = { + color: fd.color, + description: fd.description, + published: fd.published, + icon: fd.icon, + diff: fd.diff, + feedNum: 1 + } + feeds.push(fdata); + } + feeds.forEach(feed => { - var delta = Math.abs(Date.now() - feed.published) / 1000; + var delta = Math.abs(Date.now() - feed.published) / 1000; - // calculate (and subtract) whole days - var days = Math.floor(delta / 86400); - delta -= days * 86400; + // calculate (and subtract) whole days + var days = Math.floor(delta / 86400); + delta -= days * 86400; - // calculate (and subtract) whole hours - var hours = Math.floor(delta / 3600) % 24; - delta -= hours * 3600; + // calculate (and subtract) whole hours + var hours = Math.floor(delta / 3600) % 24; + delta -= hours * 3600; - // calculate (and subtract) whole minutes - var minutes = Math.floor(delta / 60) % 60; - delta -= minutes * 60; + // calculate (and subtract) whole minutes + var minutes = Math.floor(delta / 60) % 60; + delta -= minutes * 60; - // what's left is seconds - var seconds = delta % 60; // in theory the modulus is not required + // what's left is seconds + var seconds = delta % 60; // in theory the modulus is not required - let dateString = `loading`; + let dateString = `loading`; - //stupid variable names but yeah :sweat_smile: - if (seconds < 2) secsingle = "second"; - else secsingle = "seconds"; + //stupid variable names but yeah :sweat_smile: + if (seconds < 2) secsingle = "second"; + else secsingle = "seconds"; - if (minutes < 2) minsingle = "minute"; - else minsingle = "minutes"; + if (minutes < 2) minsingle = "minute"; + else minsingle = "minutes"; - if (hours < 2) hrsingle = "hour"; - else hrsingle = "hours"; + if (hours < 2) hrsingle = "hour"; + else hrsingle = "hours"; - if (days < 2) daysingle = "day"; - else daysingle = "days"; + if (days < 2) daysingle = "day"; + else daysingle = "days"; - if (minutes < 1) dateString = `${Math.round(seconds)} ${secsingle} ago`; - else if (hours < 1) dateString = `${minutes} ${minsingle} ago`; - else if (days < 1) dateString = `${hours} ${hrsingle} ago`; - else dateString = `${days} ${daysingle} ago`; - let faString = "fas fa-"; - if (feed.diff) faString = "fab fa-"; - %> -
- -
- <% - }) - if(!feeds[0]) { - %> -
- - There are no feeds. - -
- <% - } - %> -
+ if (minutes < 1) dateString = `${Math.round(seconds)} ${secsingle} ago`; + else if (hours < 1) dateString = `${minutes} ${minsingle} ago`; + else if (days < 1) dateString = `${hours} ${hrsingle} ago`; + else dateString = `${days} ${daysingle} ago`; + let faString = "fas fa-"; + if (feed.diff) faString = "fab fa-"; + %> +
+ +
+ <% + }) + if(!feeds[0]) { + %> +
+ + There are no feeds. + +
+ <% + } + %> +
\ No newline at end of file diff --git a/theme/dbd-soft-ui/views/partials/footer.ejs b/theme/dbd-soft-ui/views/partials/footer.ejs index 6a11a5a..021d52b 100644 --- a/theme/dbd-soft-ui/views/partials/footer.ejs +++ b/theme/dbd-soft-ui/views/partials/footer.ejs @@ -1,16 +1,20 @@
-
-
-
- -
-
-
+
+
+
+ +
+
+
\ No newline at end of file diff --git a/theme/dbd-soft-ui/views/partials/graph.ejs b/theme/dbd-soft-ui/views/partials/graph.ejs index 30950cb..f8a59b3 100644 --- a/theme/dbd-soft-ui/views/partials/graph.ejs +++ b/theme/dbd-soft-ui/views/partials/graph.ejs @@ -7,220 +7,220 @@ let gradone; let gradtwo; function hexToRgba(hex, alpha) { - var r = parseInt(hex.substring(1,3), 16); - var g = parseInt(hex.substring(3,5), 16); - var b = parseInt(hex.substring(5,7), 16); + var r = parseInt(hex.substring(1,3), 16); + var g = parseInt(hex.substring(3,5), 16); + var b = parseInt(hex.substring(5,7), 16); - return 'rgba(' + r + ', ' + g + ', ' + b + ', ' + alpha + ')'; + return 'rgba(' + r + ', ' + g + ', ' + b + ', ' + alpha + ')'; } if (currentScheme == "blue") { - colone = "#21d4fd"; - coltwo = "#2152ff"; - gradone = "rgba(33,212,253,0.1)"; - gradtwo = "rgba(33,82,255,0.1)"; + colone = "#21d4fd"; + coltwo = "#2152ff"; + gradone = "rgba(33,212,253,0.1)"; + gradtwo = "rgba(33,82,255,0.1)"; } if (currentScheme == "pink") { - colone = "#FF0080"; - coltwo = "#7928CA"; - gradone = "rgba(255,0,128,0.1)"; - gradtwo = "rgba(121,40,202,0.1)"; + colone = "#FF0080"; + coltwo = "#7928CA"; + gradone = "rgba(255,0,128,0.1)"; + gradtwo = "rgba(121,40,202,0.1)"; } if (currentScheme == "red") { - colone = "#ea0606"; - coltwo = "#ff667c"; - gradone = "rgba(255,102,124,0.1)"; - gradtwo = "rgba(234,6,6,0.1)"; + colone = "#ea0606"; + coltwo = "#ff667c"; + gradone = "rgba(255,102,124,0.1)"; + gradtwo = "rgba(234,6,6,0.1)"; } if (currentScheme == "green") { - colone = "#17ad37"; - coltwo = "#98ec2d"; - gradone = "rgba(23,173,55,0.1)"; - gradtwo = "rgba(152,236,45,0.1)"; + colone = "#17ad37"; + coltwo = "#98ec2d"; + gradone = "rgba(23,173,55,0.1)"; + gradtwo = "rgba(152,236,45,0.1)"; } if (currentScheme == "yellow") { - colone = "#f53939"; - coltwo = "#fbcf33"; - gradone = "rgba(245,57,57,0.1)"; - gradtwo = "rgba(251,207,51,0.1)"; + colone = "#f53939"; + coltwo = "#fbcf33"; + gradone = "rgba(245,57,57,0.1)"; + gradtwo = "rgba(251,207,51,0.1)"; } if (currentScheme == "dark") { - colone = "#141727"; - coltwo = "#3A416F"; - gradone = "rgba(20,23,39,0.1)"; - gradtwo = "rgba(58,65,111,0.1)"; + colone = "#141727"; + coltwo = "#3A416F"; + gradone = "rgba(20,23,39,0.1)"; + gradtwo = "rgba(58,65,111,0.1)"; } if (currentScheme == "custom") { - if (!themeConfig.themeColors || !themeConfig.themeColors.primaryColor || !themeConfig.themeColors.secondaryColor) { - currentCode = "310deg, #7928CA 0%, #FF0080 100%"; - colone = "#FF0080"; - coltwo = "#7928CA"; - gradone = "rgba(255,0,128,0.1)"; - gradtwo = "rgba(121,40,202,0.1)"; - } else { - currentCode = "310deg, " + themeConfig.themeColors.primaryColor + " 0%, " + themeConfig.themeColors.secondaryColor + " 100%"; - colone = themeConfig.themeColors.primaryColor; - coltwo = themeConfig.themeColors.secondaryColor; - gradone = hexToRgba(themeConfig.themeColors.primaryColor, 0.1); - gradtwo = hexToRgba(themeConfig.themeColors.secondaryColor, 0.1); - } + if (!themeConfig.themeColors || !themeConfig.themeColors.primaryColor || !themeConfig.themeColors.secondaryColor) { + currentCode = "310deg, #7928CA 0%, #FF0080 100%"; + colone = "#FF0080"; + coltwo = "#7928CA"; + gradone = "rgba(255,0,128,0.1)"; + gradtwo = "rgba(121,40,202,0.1)"; + } else { + currentCode = "310deg, " + themeConfig.themeColors.primaryColor + " 0%, " + themeConfig.themeColors.secondaryColor + " 100%"; + colone = themeConfig.themeColors.primaryColor; + coltwo = themeConfig.themeColors.secondaryColor; + gradone = hexToRgba(themeConfig.themeColors.primaryColor, 0.1); + gradtwo = hexToRgba(themeConfig.themeColors.secondaryColor, 0.1); + } } %> \ No newline at end of file diff --git a/theme/dbd-soft-ui/views/partials/iconsList.ejs b/theme/dbd-soft-ui/views/partials/iconsList.ejs index 21ce6c1..c02ca4d 100644 --- a/theme/dbd-soft-ui/views/partials/iconsList.ejs +++ b/theme/dbd-soft-ui/views/partials/iconsList.ejs @@ -1,22 +1,22 @@ \ No newline at end of file diff --git a/theme/dbd-soft-ui/views/partials/meta.ejs b/theme/dbd-soft-ui/views/partials/meta.ejs index e15055e..a56456f 100644 --- a/theme/dbd-soft-ui/views/partials/meta.ejs +++ b/theme/dbd-soft-ui/views/partials/meta.ejs @@ -1,25 +1,45 @@ - + -<% if(themeConfig?.meta?.author){ %><% } %> -<% if(themeConfig?.meta?.owner){ %><% } %> -<% if(themeConfig?.meta?.ogLocale){ %><% } %> -<% if(themeConfig?.meta?.ogTitle){ %><% } %> -<% if(themeConfig?.meta?.twitterTitle){ %><% } %> -<% if(themeConfig?.meta?.description){ %><% } %> -<% if(themeConfig?.meta?.ogDescription){ %><% } %> -<% if(themeConfig?.meta?.twitterDescription){ %><% } %> -<% if(themeConfig?.meta?.twitterDomain){ %><% } %> -<% if(themeConfig?.meta?.twitterUrl){ %><% } %> -<% if(themeConfig?.meta?.twitterCard){ %><% } %> -<% if(themeConfig?.meta?.twitterSite){ %><% } %> -<% if(themeConfig?.meta?.twitterSiteId){ %><% } %> -<% if(themeConfig?.meta?.twitterCreator){ %><% } %> -<% if(themeConfig?.meta?.twitterCreatorId){ %><% } %> -<% if(themeConfig?.meta?.twitterImage){ %><% } %> -<% if(themeConfig?.meta?.ogImage){ %><% } %> -<% if(themeConfig?.meta?.ogType){ %><% } %> -<% if(themeConfig?.meta?.ogUrl){ %><% } %> -<% if(themeConfig?.meta?.ogSiteName){ %><% } %> +<% if(themeConfig?.meta?.author){ %> +<% } %> +<% if(themeConfig?.meta?.owner){ %> +<% } %> +<% if(themeConfig?.meta?.ogLocale){ %> +<% } %> +<% if(themeConfig?.meta?.ogTitle){ %> +<% } %> +<% if(themeConfig?.meta?.twitterTitle){ %> +<% } %> +<% if(themeConfig?.meta?.description){ %> +<% } %> +<% if(themeConfig?.meta?.ogDescription){ %> +<% } %> +<% if(themeConfig?.meta?.twitterDescription){ %> +<% } %> +<% if(themeConfig?.meta?.twitterDomain){ %> +<% } %> +<% if(themeConfig?.meta?.twitterUrl){ %> +<% } %> +<% if(themeConfig?.meta?.twitterCard){ %> +<% } %> +<% if(themeConfig?.meta?.twitterSite){ %> +<% } %> +<% if(themeConfig?.meta?.twitterSiteId){ %> +<% } %> +<% if(themeConfig?.meta?.twitterCreator){ %> +<% } %> +<% if(themeConfig?.meta?.twitterCreatorId){ %> +<% } %> +<% if(themeConfig?.meta?.twitterImage){ %> +<% } %> +<% if(themeConfig?.meta?.ogImage){ %> +<% } %> +<% if(themeConfig?.meta?.ogType){ %> +<% } %> +<% if(themeConfig?.meta?.ogUrl){ %> +<% } %> +<% if(themeConfig?.meta?.ogSiteName){ %> +<% } %> \ No newline at end of file diff --git a/theme/dbd-soft-ui/views/partials/navbar.ejs b/theme/dbd-soft-ui/views/partials/navbar.ejs index 8253f1d..eb9895c 100644 --- a/theme/dbd-soft-ui/views/partials/navbar.ejs +++ b/theme/dbd-soft-ui/views/partials/navbar.ejs @@ -1,64 +1,64 @@ <% let currentPage = "Dashboard"; if (now) { - const pages = req?.locales?.partials?.navbar?.pages; - if (now === 'manage') currentPage = pages?.manage || "Manage Guilds"; - if (now === 'settings') currentPage = pages?.settings || "Manage Guilds"; - if (now === 'commands') currentPage = pages?.commands || "Commands"; - if (now === 'pp') currentPage = pages?.pp || "Privacy Policy"; - if (now === 'admin') currentPage = pages?.admin || "Admin Panel"; - if (now === 'error') currentPage = pages?.error || "Error"; - if (now === 'credits') currentPage = pages?.credits || "Credits"; - if (now === 'debug') currentPage = pages?.debug || "Debug"; - if (now === 'leaderboard') currentPage = pages?.leaderboard || "Leaderboard"; - if (now === 'profile') currentPage = pages?.profile || "Profile"; - if (now === 'maintenance') currentPage = pages?.maintenance || "Under Maintenance"; - if (now === 'shards') currentPage = pages?.shards || "Shards"; + const pages = req?.locales?.partials?.navbar?.pages; + if (now === 'manage') currentPage = pages?.manage || "Manage Guilds"; + if (now === 'settings') currentPage = pages?.settings || "Manage Guilds"; + if (now === 'commands') currentPage = pages?.commands || "Commands"; + if (now === 'pp') currentPage = pages?.pp || "Privacy Policy"; + if (now === 'admin') currentPage = pages?.admin || "Admin Panel"; + if (now === 'error') currentPage = pages?.error || "Error"; + if (now === 'credits') currentPage = pages?.credits || "Credits"; + if (now === 'debug') currentPage = pages?.debug || "Debug"; + if (now === 'leaderboard') currentPage = pages?.leaderboard || "Leaderboard"; + if (now === 'profile') currentPage = pages?.profile || "Profile"; + if (now === 'maintenance') currentPage = pages?.maintenance || "Under Maintenance"; + if (now === 'shards') currentPage = pages?.shards || "Shards"; } %> \ No newline at end of file diff --git a/theme/dbd-soft-ui/views/partials/popup.ejs b/theme/dbd-soft-ui/views/partials/popup.ejs index f49441f..cd66a83 100644 --- a/theme/dbd-soft-ui/views/partials/popup.ejs +++ b/theme/dbd-soft-ui/views/partials/popup.ejs @@ -1,29 +1,29 @@
-
- -
\ No newline at end of file + +
+ + + + + + \ No newline at end of file diff --git a/theme/dbd-soft-ui/views/partials/preload.ejs b/theme/dbd-soft-ui/views/partials/preload.ejs index 6b45129..a48bcbf 100644 --- a/theme/dbd-soft-ui/views/partials/preload.ejs +++ b/theme/dbd-soft-ui/views/partials/preload.ejs @@ -1,67 +1,67 @@
-
-
-
-
-
- <% if(themeConfig.preloader){ %> - <% if(themeConfig.preloader.image) { %> - <% if(!themeConfig.preloader.spinner) { %> -
- -
- <% } %> - <% } %> - <% if(themeConfig.preloader.text){ %> -
-
-

<%- req?.locales?.partials?.preloader?.text %>

- <% if(themeConfig.preloader.spinner) { %> +
+
+
+
+
+ <% if(themeConfig.preloader){ %> + <% if(themeConfig.preloader.image) { %> + <% if(!themeConfig.preloader.spinner) { %> +
+ +
+ <% } %> + <% } %> + <% if(themeConfig.preloader.text){ %> +
+
+

<%- req?.locales?.partials?.preloader?.text %>

+ <% if(themeConfig.preloader.spinner) { %> -
-
- Loading... -
-
- <% } %> -
- <% } %> - <% } %> +
+
+ Loading... +
+
+ <% } %> +
+ <% } %> + <% } %>
\ No newline at end of file diff --git a/theme/dbd-soft-ui/views/partials/preloader.ejs b/theme/dbd-soft-ui/views/partials/preloader.ejs index ef5b564..9291e1d 100644 --- a/theme/dbd-soft-ui/views/partials/preloader.ejs +++ b/theme/dbd-soft-ui/views/partials/preloader.ejs @@ -1,18 +1,18 @@ <% let currentPage = "Dashboard"; if (now) { - const pages = req?.locales?.partials?.navbar?.pages; - if (now === 'manage') currentPage = pages?.manage || "Manage Guilds"; - if (now === 'settings') currentPage = pages?.settings || "Manage Guilds"; - if (now === 'commands') currentPage = pages?.commands || "Commands"; - if (now === 'pp') currentPage = pages?.pp || "Privacy Policy"; - if (now === 'admin') currentPage = pages?.admin || "Admin Panel"; - if (now === 'error') currentPage = pages?.error || "Error"; - if (now === 'credits') currentPage = pages?.credits || "Credits"; - if (now === 'debug') currentPage = pages?.debug || "Debug"; - if (now === 'leaderboard') currentPage = pages?.leaderboard || "Leaderboard"; - if (now === 'profile') currentPage = pages?.profile || "Profile"; - if (now === 'maintenance') currentPage = pages?.maintenance || "Under Maintenance"; + const pages = req?.locales?.partials?.navbar?.pages; + if (now === 'manage') currentPage = pages?.manage || "Manage Guilds"; + if (now === 'settings') currentPage = pages?.settings || "Manage Guilds"; + if (now === 'commands') currentPage = pages?.commands || "Commands"; + if (now === 'pp') currentPage = pages?.pp || "Privacy Policy"; + if (now === 'admin') currentPage = pages?.admin || "Admin Panel"; + if (now === 'error') currentPage = pages?.error || "Error"; + if (now === 'credits') currentPage = pages?.credits || "Credits"; + if (now === 'debug') currentPage = pages?.debug || "Debug"; + if (now === 'leaderboard') currentPage = pages?.leaderboard || "Leaderboard"; + if (now === 'profile') currentPage = pages?.profile || "Profile"; + if (now === 'maintenance') currentPage = pages?.maintenance || "Under Maintenance"; } %> @@ -21,13 +21,13 @@ if (now) { - <%= themeConfig.websiteName %> - <%- currentPage %> + <%= themeConfig.websiteName %> - <%- currentPage %> <% if(themeConfig.preloader.image) { %> - <% } %> + <% } %> @@ -38,25 +38,25 @@ if (now) { <% // By default system theme is loaded, unless a user has changed it. Probably could be optimised further but :shrug: if(req.cookies?.selectedTheme == "dark" || req.cookies?.selectedTheme == "auto" || !req.cookies?.selectedTheme) { %> - media="(prefers-color-scheme: dark)"<% } %>> - <% if (themeConfig?.icons?.sidebar?.darkUrl) { %> - - <% } %> + media="(prefers-color-scheme: dark)"<% } %>> + <% if (themeConfig?.icons?.sidebar?.darkUrl) { %> + + <% } %> <% } %> @@ -68,127 +68,127 @@ if(req.cookies?.selectedTheme == "dark" || req.cookies?.selectedTheme == "auto" <%- include('colorscheme.ejs') %> <% if(now !== "maintenance" && now !== "error") { %> - <%- include('theme.ejs') %> + <%- include('theme.ejs') %> <% } %> diff --git a/theme/dbd-soft-ui/views/partials/premium.ejs b/theme/dbd-soft-ui/views/partials/premium.ejs index a1217f2..a2fec9c 100644 --- a/theme/dbd-soft-ui/views/partials/premium.ejs +++ b/theme/dbd-soft-ui/views/partials/premium.ejs @@ -1,72 +1,72 @@ <% if (req.cookies?.premiumCard == "false" || !req.cookies?.premiumCard) { %> -
-
-
-
- -
-
<%- req?.locales?.partials?.premium?.title %>
-

<%- req?.locales?.partials?.premium?.description %>

- - <%- req?.locales?.partials?.premium?.buttonText %> -
-
-
+
+
+
+
+ +
+
<%- req?.locales?.partials?.premium?.title %>
+

<%- req?.locales?.partials?.premium?.description %>

+ + <%- req?.locales?.partials?.premium?.buttonText %> +
+
+
<% } %> \ No newline at end of file diff --git a/theme/dbd-soft-ui/views/partials/scripts.ejs b/theme/dbd-soft-ui/views/partials/scripts.ejs index 4b51586..cb63bec 100644 --- a/theme/dbd-soft-ui/views/partials/scripts.ejs +++ b/theme/dbd-soft-ui/views/partials/scripts.ejs @@ -1,158 +1,158 @@ + integrity="sha256-eTyxS0rkjpLEo16uXTS0uVCS4815lc40K2iVpWDvdSY=" crossorigin="anonymous"> diff --git a/theme/dbd-soft-ui/views/partials/secret.ejs b/theme/dbd-soft-ui/views/partials/secret.ejs deleted file mode 100644 index 89d192a..0000000 --- a/theme/dbd-soft-ui/views/partials/secret.ejs +++ /dev/null @@ -1,96 +0,0 @@ - \ No newline at end of file diff --git a/theme/dbd-soft-ui/views/partials/serverSelect.ejs b/theme/dbd-soft-ui/views/partials/serverSelect.ejs index 7e01785..8b5fbd5 100644 --- a/theme/dbd-soft-ui/views/partials/serverSelect.ejs +++ b/theme/dbd-soft-ui/views/partials/serverSelect.ejs @@ -1,45 +1,45 @@ <% for(var i in req.session.guilds){ %> - <% if((req.session.guilds[i].permissions & 0x00000020) == 0x00000020){ %> - <% if(!bot.guilds.cache.get(req.session.guilds[i].id)){ - let icon = `https://cdn.discordapp.com/icons/${req.session.guilds[i].id}/${req.session.guilds[i].icon}.png`; - const friendlyName = req.session.guilds[i].name.replace('`', ''); - if (!req.session.guilds[i].icon) icon = themeConfig.iconURL; - %> - - - - - <% }else{ - const guild = bot.guilds.cache.get(req.session.guilds[i].id); - let icon; + <% if((req.session.guilds[i].permissions & 0x00000020) == 0x00000020){ %> + <% if(!bot.guilds.cache.get(req.session.guilds[i].id)){ + let icon = `https://cdn.discordapp.com/icons/${req.session.guilds[i].id}/${req.session.guilds[i].icon}.png`; + const friendlyName = req.session.guilds[i].name.replace('`', ''); + if (!req.session.guilds[i].icon) icon = themeConfig.iconURL; + %> + + + + + <% }else{ + const guild = bot.guilds.cache.get(req.session.guilds[i].id); + let icon; - if (!guild.iconURL()) icon = themeConfig.iconURL; - else icon = guild.iconURL(); - const friendlyName = guild.name.replace('`', ''); - %> - - - - - + if (!guild.iconURL()) icon = themeConfig.iconURL; + else icon = guild.iconURL(); + const friendlyName = guild.name.replace('`', ''); + %> + + + + + <% } } diff --git a/theme/dbd-soft-ui/views/partials/sidebar.ejs b/theme/dbd-soft-ui/views/partials/sidebar.ejs index b4ae862..06dabc7 100644 --- a/theme/dbd-soft-ui/views/partials/sidebar.ejs +++ b/theme/dbd-soft-ui/views/partials/sidebar.ejs @@ -1,342 +1,342 @@ \ No newline at end of file diff --git a/theme/dbd-soft-ui/views/partials/theme.ejs b/theme/dbd-soft-ui/views/partials/theme.ejs index 19a1da9..12e8dc3 100644 --- a/theme/dbd-soft-ui/views/partials/theme.ejs +++ b/theme/dbd-soft-ui/views/partials/theme.ejs @@ -1,71 +1,71 @@
- - - -
-
-
-
<%- req?.locales?.partials?.settings?.title || "Site Configuration" %>
-

<%- req?.locales?.partials?.settings?.description || "Configurable Viewing Options" %>

-
-
- -
- -
-
-
- - -
-
<%- req?.locales?.partials?.settings?.theme?.title || "Site Theme" %>
-

<%- req?.locales?.partials?.settings?.theme?.description || "Make the site more appealing for your eyes!" %>

-
-
- - - + + + +
+
+
+
<%- req?.locales?.partials?.settings?.title || "Site Configuration" %>
+

<%- req?.locales?.partials?.settings?.description || "Configurable Viewing Options" %>

+
+
+ +
+ +
+
+
+ + +
+
<%- req?.locales?.partials?.settings?.theme?.title || "Site Theme" %>
+

<%- req?.locales?.partials?.settings?.theme?.description || "Make the site more appealing for your eyes!" %>

+
+
+ + + -
-
-
<%- req?.locales?.partials?.settings?.language?.title || "Site Language" %>
-

<%- req?.locales?.partials?.settings?.language?.description || "Select your preferred language!" %>

-
-
- -
-

You can change the sidenav type just on desktop view.

-
-
+
+
+
<%- req?.locales?.partials?.settings?.language?.title || "Site Language" %>
+

<%- req?.locales?.partials?.settings?.language?.description || "Select your preferred language!" %>

+
+
+ +
+

You can change the sidenav type just on desktop view.

+
+
diff --git a/theme/dbd-soft-ui/views/pp.ejs b/theme/dbd-soft-ui/views/pp.ejs index a8aaff8..a848dab 100644 --- a/theme/dbd-soft-ui/views/pp.ejs +++ b/theme/dbd-soft-ui/views/pp.ejs @@ -1,478 +1,462 @@ - - <%- include('partials/preloader.ejs', {now: 'pp'}) %> - <%- themeConfig?.customHtml %> + <%- include('partials/preloader.ejs', {now: 'pp'}) %> + <%- themeConfig?.customHtml %> <%- include('partials/preload.ejs') %> <%- include('partials/sidebar.ejs', {config: config, now: 'pp'}) %>
- - <%- include('partials/navbar.ejs', {now: 'pp'}) %> - -
-
-
-
-
-
-

<%- req?.locales?.privacyPolicy?.title || "Privacy Policy" %>

-

<%- req?.locales?.privacyPolicy?.description || "Privacy Policy and Terms of Service" %>

-
-
- <% if (req?.locales?.privacyPolicy?.pp){ %> - <%- req.locales.privacyPolicy.pp %> - <% } else { %> -

Last updated: October 10, 2021

-

This Privacy Policy describes Our policies and procedures on the collection, use and - disclosure of Your information when You use the Service and tells You about Your - privacy - rights and how the law protects You.

-

We use Your Personal data to provide and improve the Service. By using the Service, - You - agree to the collection and use of information in accordance with this Privacy - Policy. - This Privacy Policy has been created with the help of the Privacy - Policy Generator.

-

Interpretation and Definitions

-

Interpretation

-

The words of which the initial letter is capitalized have meanings defined under the - following conditions. The following definitions shall have the same meaning - regardless - of whether they appear in singular or in plural.

-

Definitions

-

For the purposes of this Privacy Policy:

-
    -
  • -

    Account means a unique account created for You to access our - Service or parts of our Service.

    -
  • -
  • -

    Company (referred to as either "the Company", "We", "Us" or - "Our" in this Agreement) refers to <%= themeConfig.websiteName %>.

    -
  • -
  • -

    Cookies are small files that are placed on Your computer, - mobile - device or any other device by a website, containing the details of Your - browsing - history on that website among its many uses.

    -
  • -
  • -

    Country refers to: United Kingdom

    -
  • -
  • -

    Device means any device that can access the Service such as - a - computer, a cellphone or a digital tablet.

    -
  • -
  • -

    Personal Data is any information that relates to an - identified - or identifiable individual.

    -
  • -
  • -

    Service refers to the Website.

    -
  • -
  • -

    Service Provider means any natural or legal person who - processes - the data on behalf of the Company. It refers to third-party companies or - individuals employed by the Company to facilitate the Service, to provide - the - Service on behalf of the Company, to perform services related to the Service - or - to assist the Company in analyzing how the Service is used.

    -
  • -
  • -

    Third-party Social Media Service refers to any website or - any - social network website through which a User can log in or create an account - to - use the Service.

    -
  • -
  • -

    Usage Data refers to data collected automatically, either - generated by the use of the Service or from the Service infrastructure - itself - (for example, the duration of a page visit).

    -
  • -
  • -

    Website refers to <%= themeConfig.websiteName %>, accessible - from <%= config.domain %>

    -
  • -
  • -

    You means the individual accessing or using the Service, or - the - company, or other legal entity on behalf of which such individual is - accessing - or using the Service, as applicable.

    -
  • -
-

Collecting and Using Your Personal Data

-

Types of Data Collected

-

Personal Data

-

While using Our Service, We may ask You to provide Us with certain personally - identifiable information that can be used to contact or identify You. Personally - identifiable information may include, but is not limited to:

-
    -
  • Usage Data
  • -
-

Usage Data

-

Usage Data is collected automatically when using the Service.

-

Usage Data may include information such as Your Device's Internet Protocol address - (e.g. - IP address), browser type, browser version, the pages of our Service that You visit, - the - time and date of Your visit, the time spent on those pages, unique device - identifiers - and other diagnostic data.

-

When You access the Service by or through a mobile device, We may collect certain - information automatically, including, but not limited to, the type of mobile device - You - use, Your mobile device unique ID, the IP address of Your mobile device, Your mobile - operating system, the type of mobile Internet browser You use, unique device - identifiers - and other diagnostic data.

-

We may also collect information that Your browser sends whenever You visit our - Service or - when You access the Service by or through a mobile device.

-

Information from Third-Party Social Media Services

-

The Company allows You to create an account and log in to use the Service through the - following Third-party Social Media Services:

-
    -
  • Google
  • -
  • Facebook
  • -
  • Twitter
  • -
-

If You decide to register through or otherwise grant us access to a Third-Party - Social - Media Service, We may collect Personal data that is already associated with Your - Third-Party Social Media Service's account, such as Your name, Your email address, - Your - activities or Your contact list associated with that account.

-

You may also have the option of sharing additional information with the Company - through - Your Third-Party Social Media Service's account. If You choose to provide such - information and Personal Data, during registration or otherwise, You are giving the - Company permission to use, share, and store it in a manner consistent with this - Privacy - Policy.

-

Tracking Technologies and Cookies

-

We use Cookies and similar tracking technologies to track the activity on Our Service - and - store certain information. Tracking technologies used are beacons, tags, and scripts - to - collect and track information and to improve and analyze Our Service. The - technologies - We use may include:

-
    -
  • Cookies or Browser Cookies. A cookie is a small file placed on - Your - Device. You can instruct Your browser to refuse all Cookies or to indicate when - a - Cookie is being sent. However, if You do not accept Cookies, You may not be able - to - use some parts of our Service. Unless you have adjusted Your browser setting so - that - it will refuse Cookies, our Service may use Cookies. -
  • -
  • Flash Cookies. Certain features of our Service may use local - stored - objects (or Flash Cookies) to collect and store information about Your - preferences - or Your activity on our Service. Flash Cookies are not managed by the same - browser - settings as those used for Browser Cookies. For more information on how You can - delete Flash Cookies, please read "Where can I change the settings for - disabling, or - deleting local shared objects?" available at https://helpx.adobe.com/flash-player/kb/disable-local-shared-objects-flash.html#main_Where_can_I_change_the_settings_for_disabling__or_deleting_local_shared_objects_ -
  • -
  • Web Beacons. Certain sections of our Service and our emails may - contain small electronic files known as web beacons (also referred to as clear - gifs, - pixel tags, and single-pixel gifs) that permit the Company, for example, to - count - users who have visited those pages or opened an email and for other related - website - statistics (for example, recording the popularity of a certain section and - verifying - system and server integrity). -
  • -
-

Cookies can be "Persistent" or "Session" Cookies. Persistent Cookies remain on Your - personal computer or mobile device when You go offline, while Session Cookies are - deleted as soon as You close Your web browser. You can learn more about cookies - here: Cookies by TermsFeed Generator.

-

We use both Session and Persistent Cookies for the purposes set out below:

-
    -
  • -

    Necessary / Essential Cookies

    -

    Type: Session Cookies

    -

    Administered by: Us

    -

    Purpose: These Cookies are essential to provide You with services available - through the Website and to enable You to use some of its features. They help - to - authenticate users and prevent fraudulent use of user accounts. Without - these - Cookies, the services that You have asked for cannot be provided, and We - only - use these Cookies to provide You with those services.

    -
  • -
  • -

    Cookies Policy / Notice Acceptance Cookies

    -

    Type: Persistent Cookies

    -

    Administered by: Us

    -

    Purpose: These Cookies identify if users have accepted the use of cookies on - the - Website.

    -
  • -
  • -

    Functionality Cookies

    -

    Type: Persistent Cookies

    -

    Administered by: Us

    -

    Purpose: These Cookies allow us to remember choices You make when You use the - Website, such as remembering your login details or language preference. The - purpose of these Cookies is to provide You with a more personal experience - and - to avoid You having to re-enter your preferences every time You use the - Website.

    -
  • -
-

For more information about the cookies we use and your choices regarding cookies, - please - visit our Cookies Policy or the Cookies section of our Privacy Policy.

-

Use of Your Personal Data

-

The Company may use Personal Data for the following purposes:

-
    -
  • -

    To provide and maintain our Service, including to monitor - the - usage of our Service.

    -
  • -
  • -

    To manage Your Account: to manage Your registration as a - user of - the Service. The Personal Data You provide can give You access to different - functionalities of the Service that are available to You as a registered - user. -

    -
  • -
  • -

    For the performance of a contract: the development, - compliance - and undertaking of the purchase contract for the products, items or services - You - have purchased or of any other contract with Us through the Service.

    -
  • -
  • -

    To contact You: To contact You by email, telephone calls, - SMS, - or other equivalent forms of electronic communication, such as a mobile - application's push notifications regarding updates or informative - communications - related to the functionalities, products or contracted services, including - the - security updates, when necessary or reasonable for their implementation.

    -
  • -
  • -

    To provide You with news, special offers and general - information - about other goods, services and events which we offer that are similar to - those - that you have already purchased or enquired about unless You have opted not - to - receive such information.

    -
  • -
  • -

    To manage Your requests: To attend and manage Your requests - to - Us.

    -
  • -
  • -

    For business transfers: We may use Your information to - evaluate - or conduct a merger, divestiture, restructuring, reorganization, - dissolution, or - other sale or transfer of some or all of Our assets, whether as a going - concern - or as part of bankruptcy, liquidation, or similar proceeding, in which - Personal - Data held by Us about our Service users is among the assets transferred.

    -
  • -
  • -

    For other purposes: We may use Your information for other - purposes, such as data analysis, identifying usage trends, determining the - effectiveness of our promotional campaigns and to evaluate and improve our - Service, products, services, marketing and your experience.

    -
  • -
-

We may share Your personal information in the following situations:

-
    -
  • With Service Providers: We may share Your personal information - with - Service Providers to monitor and analyze the use of our Service, to contact You. -
  • -
  • For business transfers: We may share or transfer Your personal - information in connection with, or during negotiations of, any merger, sale of - Company assets, financing, or acquisition of all or a portion of Our business to - another company. -
  • -
  • With Affiliates: We may share Your information with Our - affiliates, - in which case we will require those affiliates to honor this Privacy Policy. - Affiliates include Our parent company and any other subsidiaries, joint venture - partners or other companies that We control or that are under common control - with - Us. -
  • -
  • With business partners: We may share Your information with Our - business partners to offer You certain products, services or promotions. -
  • -
  • With other users: when You share personal information or - otherwise - interact in the public areas with other users, such information may be viewed by - all - users and may be publicly distributed outside. If You interact with other users - or - register through a Third-Party Social Media Service, Your contacts on the - Third-Party Social Media Service may see Your name, profile, pictures and - description of Your activity. Similarly, other users will be able to view - descriptions of Your activity, communicate with You and view Your profile. -
  • -
  • With Your consent: We may disclose Your personal information - for - any other purpose with Your consent. -
  • -
-

Retention of Your Personal Data

-

The Company will retain Your Personal Data only for as long as is necessary for the - purposes set out in this Privacy Policy. We will retain and use Your Personal Data - to - the extent necessary to comply with our legal obligations (for example, if we are - required to retain your data to comply with applicable laws), resolve disputes, and - enforce our legal agreements and policies.

-

The Company will also retain Usage Data for internal analysis purposes. Usage Data is - generally retained for a shorter period of time, except when this data is used to - strengthen the security or to improve the functionality of Our Service, or We are - legally obligated to retain this data for longer time periods.

-

Transfer of Your Personal Data

-

Your information, including Personal Data, is processed at the Company's operating - offices and in any other places where the parties involved in the processing are - located. It means that this information may be transferred to — and maintained on — - computers located outside of Your state, province, country or other governmental - jurisdiction where the data protection laws may differ than those from Your - jurisdiction.

-

Your consent to this Privacy Policy followed by Your submission of such information - represents Your agreement to that transfer.

-

The Company will take all steps reasonably necessary to ensure that Your data is - treated - securely and in accordance with this Privacy Policy and no transfer of Your Personal - Data will take place to an organization or a country unless there are adequate - controls - in place including the security of Your data and other personal information.

-

Disclosure of Your Personal Data

-

Business Transactions

-

If the Company is involved in a merger, acquisition or asset sale, Your Personal Data - may - be transferred. We will provide notice before Your Personal Data is transferred and - becomes subject to a different Privacy Policy.

-

Law enforcement

-

Under certain circumstances, the Company may be required to disclose Your Personal - Data - if required to do so by law or in response to valid requests by public authorities - (e.g. - a court or a government agency).

-

Other legal requirements

-

The Company may disclose Your Personal Data in the good faith belief that such action - is - necessary to:

-
    -
  • Comply with a legal obligation
  • -
  • Protect and defend the rights or property of the Company
  • -
  • Prevent or investigate possible wrongdoing in connection with the Service
  • -
  • Protect the personal safety of Users of the Service or the public
  • -
  • Protect against legal liability
  • -
-

Security of Your Personal Data

-

The security of Your Personal Data is important to Us, but remember that no method of - transmission over the Internet, or method of electronic storage is 100% secure. - While We - strive to use commercially acceptable means to protect Your Personal Data, We cannot - guarantee its absolute security.

-

Children's Privacy

-

Our Service does not address anyone under the age of 13. We do not knowingly collect - personally identifiable information from anyone under the age of 13. If You are a - parent - or guardian and You are aware that Your child has provided Us with Personal Data, - please - contact Us. If We become aware that We have collected Personal Data from anyone - under - the age of 13 without verification of parental consent, We take steps to remove that - information from Our servers.

-

If We need to rely on consent as a legal basis for processing Your information and - Your - country requires consent from a parent, We may require Your parent's consent before - We - collect and use that information.

-

Links to Other Websites

-

Our Service may contain links to other websites that are not operated by Us. If You - click - on a third party link, You will be directed to that third party's site. We strongly - advise You to review the Privacy Policy of every site You visit.

-

We have no control over and assume no responsibility for the content, privacy - policies or - practices of any third party sites or services.

-

Changes to this Privacy Policy

-

We may update Our Privacy Policy from time to time. We will notify You of any changes - by - posting the new Privacy Policy on this page.

-

We will let You know via email and/or a prominent notice on Our Service, prior to the - change becoming effective and update the "Last updated" date at the top of this - Privacy - Policy.

-

You are advised to review this Privacy Policy periodically for any changes. Changes - to - this Privacy Policy are effective when they are posted on this page.

-

Contact Us

-

If you have any questions about this Privacy Policy, You can contact us:

-
-
-
-
-
- <%- include('partials/footer.ejs', {now: 'pp'}) %> -
+ + <%- include('partials/navbar.ejs', {now: 'pp'}) %> + +
+
+
+
+
+
+

<%- req?.locales?.privacyPolicy?.title || "Privacy Policy" %>

+

<%- req?.locales?.privacyPolicy?.description || "Privacy Policy and Terms of Service" %>

+
+
+ <% if (req?.locales?.privacyPolicy?.pp){ %> + <%- req.locales.privacyPolicy.pp %> + <% } else { %> +

Last updated: October 10, 2021

+

This Privacy Policy describes Our policies and procedures on the collection, use and + disclosure of Your information when You use the Service and tells You about Your + privacy + rights and how the law protects You.

+

We use Your Personal data to provide and improve the Service. By using the Service, + You + agree to the collection and use of information in accordance with this Privacy + Policy. + This Privacy Policy has been created with the help of the Privacy + Policy Generator.

+

Interpretation and Definitions

+

Interpretation

+

The words of which the initial letter is capitalized have meanings defined under the + following conditions. The following definitions shall have the same meaning + regardless + of whether they appear in singular or in plural.

+

Definitions

+

For the purposes of this Privacy Policy:

+
    +
  • +

    Account means a unique account created for You to access our + Service or parts of our Service.

    +
  • +
  • +

    Company (referred to as either "the Company", "We", "Us" or + "Our" in this Agreement) refers to <%= themeConfig.websiteName %>.

    +
  • +
  • +

    Cookies are small files that are placed on Your computer, + mobile + device or any other device by a website, containing the details of Your + browsing + history on that website among its many uses.

    +
  • +
  • +

    Country refers to: United Kingdom

    +
  • +
  • +

    Device means any device that can access the Service such as + a + computer, a cellphone or a digital tablet.

    +
  • +
  • +

    Personal Data is any information that relates to an + identified + or identifiable individual.

    +
  • +
  • +

    Service refers to the Website.

    +
  • +
  • +

    Service Provider means any natural or legal person who + processes + the data on behalf of the Company. It refers to third-party companies or + individuals employed by the Company to facilitate the Service, to provide + the + Service on behalf of the Company, to perform services related to the Service + or + to assist the Company in analyzing how the Service is used.

    +
  • +
  • +

    Third-party Social Media Service refers to any website or + any + social network website through which a User can log in or create an account + to + use the Service.

    +
  • +
  • +

    Usage Data refers to data collected automatically, either + generated by the use of the Service or from the Service infrastructure + itself + (for example, the duration of a page visit).

    +
  • +
  • +

    Website refers to <%= themeConfig.websiteName %>, accessible + from <%= config.domain %>

    +
  • +
  • +

    You means the individual accessing or using the Service, or + the + company, or other legal entity on behalf of which such individual is + accessing + or using the Service, as applicable.

    +
  • +
+

Collecting and Using Your Personal Data

+

Types of Data Collected

+

Personal Data

+

While using Our Service, We may ask You to provide Us with certain personally + identifiable information that can be used to contact or identify You. Personally + identifiable information may include, but is not limited to:

+
    +
  • Usage Data
  • +
+

Usage Data

+

Usage Data is collected automatically when using the Service.

+

Usage Data may include information such as Your Device's Internet Protocol address + (e.g. + IP address), browser type, browser version, the pages of our Service that You visit, + the + time and date of Your visit, the time spent on those pages, unique device + identifiers + and other diagnostic data.

+

When You access the Service by or through a mobile device, We may collect certain + information automatically, including, but not limited to, the type of mobile device + You + use, Your mobile device unique ID, the IP address of Your mobile device, Your mobile + operating system, the type of mobile Internet browser You use, unique device + identifiers + and other diagnostic data.

+

We may also collect information that Your browser sends whenever You visit our + Service or + when You access the Service by or through a mobile device.

+

Information from Third-Party Social Media Services

+

The Company allows You to create an account and log in to use the Service through the + following Third-party Social Media Services:

+
    +
  • Google
  • +
  • Facebook
  • +
  • Twitter
  • +
+

If You decide to register through or otherwise grant us access to a Third-Party + Social + Media Service, We may collect Personal data that is already associated with Your + Third-Party Social Media Service's account, such as Your name, Your email address, + Your + activities or Your contact list associated with that account.

+

You may also have the option of sharing additional information with the Company + through + Your Third-Party Social Media Service's account. If You choose to provide such + information and Personal Data, during registration or otherwise, You are giving the + Company permission to use, share, and store it in a manner consistent with this + Privacy + Policy.

+

Tracking Technologies and Cookies

+

We use Cookies and similar tracking technologies to track the activity on Our Service + and + store certain information. Tracking technologies used are beacons, tags, and scripts + to + collect and track information and to improve and analyze Our Service. The + technologies + We use may include:

+
    +
  • Cookies or Browser Cookies. A cookie is a small file placed on + Your + Device. You can instruct Your browser to refuse all Cookies or to indicate when + a + Cookie is being sent. However, if You do not accept Cookies, You may not be able + to + use some parts of our Service. Unless you have adjusted Your browser setting so + that + it will refuse Cookies, our Service may use Cookies. +
  • +
  • Flash Cookies. Certain features of our Service may use local + stored + objects (or Flash Cookies) to collect and store information about Your + preferences + or Your activity on our Service. Flash Cookies are not managed by the same + browser + settings as those used for Browser Cookies. For more information on how You can + delete Flash Cookies, please read "Where can I change the settings for + disabling, or + deleting local shared objects?" available at https://helpx.adobe.com/flash-player/kb/disable-local-shared-objects-flash.html#main_Where_can_I_change_the_settings_for_disabling__or_deleting_local_shared_objects_ +
  • +
  • Web Beacons. Certain sections of our Service and our emails may + contain small electronic files known as web beacons (also referred to as clear + gifs, + pixel tags, and single-pixel gifs) that permit the Company, for example, to + count + users who have visited those pages or opened an email and for other related + website + statistics (for example, recording the popularity of a certain section and + verifying + system and server integrity). +
  • +
+

Cookies can be "Persistent" or "Session" Cookies. Persistent Cookies remain on Your + personal computer or mobile device when You go offline, while Session Cookies are + deleted as soon as You close Your web browser. You can learn more about cookies + here: Cookies by TermsFeed Generator.

+

We use both Session and Persistent Cookies for the purposes set out below:

+
    +
  • +

    Necessary / Essential Cookies

    +

    Type: Session Cookies

    +

    Administered by: Us

    +

    Purpose: These Cookies are essential to provide You with services available + through the Website and to enable You to use some of its features. They help + to + authenticate users and prevent fraudulent use of user accounts. Without + these + Cookies, the services that You have asked for cannot be provided, and We + only + use these Cookies to provide You with those services.

    +
  • +
  • +

    Cookies Policy / Notice Acceptance Cookies

    +

    Type: Persistent Cookies

    +

    Administered by: Us

    +

    Purpose: These Cookies identify if users have accepted the use of cookies on + the + Website.

    +
  • +
  • +

    Functionality Cookies

    +

    Type: Persistent Cookies

    +

    Administered by: Us

    +

    Purpose: These Cookies allow us to remember choices You make when You use the + Website, such as remembering your login details or language preference. The + purpose of these Cookies is to provide You with a more personal experience + and + to avoid You having to re-enter your preferences every time You use the + Website.

    +
  • +
+

For more information about the cookies we use and your choices regarding cookies, + please + visit our Cookies Policy or the Cookies section of our Privacy Policy.

+

Use of Your Personal Data

+

The Company may use Personal Data for the following purposes:

+
    +
  • +

    To provide and maintain our Service, including to monitor + the + usage of our Service.

    +
  • +
  • +

    To manage Your Account: to manage Your registration as a + user of + the Service. The Personal Data You provide can give You access to different + functionalities of the Service that are available to You as a registered + user. +

    +
  • +
  • +

    For the performance of a contract: the development, + compliance + and undertaking of the purchase contract for the products, items or services + You + have purchased or of any other contract with Us through the Service.

    +
  • +
  • +

    To contact You: To contact You by email, telephone calls, + SMS, + or other equivalent forms of electronic communication, such as a mobile + application's push notifications regarding updates or informative + communications + related to the functionalities, products or contracted services, including + the + security updates, when necessary or reasonable for their implementation.

    +
  • +
  • +

    To provide You with news, special offers and general + information + about other goods, services and events which we offer that are similar to + those + that you have already purchased or enquired about unless You have opted not + to + receive such information.

    +
  • +
  • +

    To manage Your requests: To attend and manage Your requests + to + Us.

    +
  • +
  • +

    For business transfers: We may use Your information to + evaluate + or conduct a merger, divestiture, restructuring, reorganization, + dissolution, or + other sale or transfer of some or all of Our assets, whether as a going + concern + or as part of bankruptcy, liquidation, or similar proceeding, in which + Personal + Data held by Us about our Service users is among the assets transferred.

    +
  • +
  • +

    For other purposes: We may use Your information for other + purposes, such as data analysis, identifying usage trends, determining the + effectiveness of our promotional campaigns and to evaluate and improve our + Service, products, services, marketing and your experience.

    +
  • +
+

We may share Your personal information in the following situations:

+
    +
  • With Service Providers: We may share Your personal information + with + Service Providers to monitor and analyze the use of our Service, to contact You. +
  • +
  • For business transfers: We may share or transfer Your personal + information in connection with, or during negotiations of, any merger, sale of + Company assets, financing, or acquisition of all or a portion of Our business to + another company. +
  • +
  • With Affiliates: We may share Your information with Our + affiliates, + in which case we will require those affiliates to honor this Privacy Policy. + Affiliates include Our parent company and any other subsidiaries, joint venture + partners or other companies that We control or that are under common control + with + Us. +
  • +
  • With business partners: We may share Your information with Our + business partners to offer You certain products, services or promotions. +
  • +
  • With other users: when You share personal information or + otherwise + interact in the public areas with other users, such information may be viewed by + all + users and may be publicly distributed outside. If You interact with other users + or + register through a Third-Party Social Media Service, Your contacts on the + Third-Party Social Media Service may see Your name, profile, pictures and + description of Your activity. Similarly, other users will be able to view + descriptions of Your activity, communicate with You and view Your profile. +
  • +
  • With Your consent: We may disclose Your personal information + for + any other purpose with Your consent. +
  • +
+

Retention of Your Personal Data

+

The Company will retain Your Personal Data only for as long as is necessary for the + purposes set out in this Privacy Policy. We will retain and use Your Personal Data + to + the extent necessary to comply with our legal obligations (for example, if we are + required to retain your data to comply with applicable laws), resolve disputes, and + enforce our legal agreements and policies.

+

The Company will also retain Usage Data for internal analysis purposes. Usage Data is + generally retained for a shorter period of time, except when this data is used to + strengthen the security or to improve the functionality of Our Service, or We are + legally obligated to retain this data for longer time periods.

+

Transfer of Your Personal Data

+

Your information, including Personal Data, is processed at the Company's operating + offices and in any other places where the parties involved in the processing are + located. It means that this information may be transferred to — and maintained on — + computers located outside of Your state, province, country or other governmental + jurisdiction where the data protection laws may differ than those from Your + jurisdiction.

+

Your consent to this Privacy Policy followed by Your submission of such information + represents Your agreement to that transfer.

+

The Company will take all steps reasonably necessary to ensure that Your data is + treated + securely and in accordance with this Privacy Policy and no transfer of Your Personal + Data will take place to an organization or a country unless there are adequate + controls + in place including the security of Your data and other personal information.

+

Disclosure of Your Personal Data

+

Business Transactions

+

If the Company is involved in a merger, acquisition or asset sale, Your Personal Data + may + be transferred. We will provide notice before Your Personal Data is transferred and + becomes subject to a different Privacy Policy.

+

Law enforcement

+

Under certain circumstances, the Company may be required to disclose Your Personal + Data + if required to do so by law or in response to valid requests by public authorities + (e.g. + a court or a government agency).

+

Other legal requirements

+

The Company may disclose Your Personal Data in the good faith belief that such action + is + necessary to:

+
    +
  • Comply with a legal obligation
  • +
  • Protect and defend the rights or property of the Company
  • +
  • Prevent or investigate possible wrongdoing in connection with the Service
  • +
  • Protect the personal safety of Users of the Service or the public
  • +
  • Protect against legal liability
  • +
+

Security of Your Personal Data

+

The security of Your Personal Data is important to Us, but remember that no method of + transmission over the Internet, or method of electronic storage is 100% secure. + While We + strive to use commercially acceptable means to protect Your Personal Data, We cannot + guarantee its absolute security.

+

Children's Privacy

+

Our Service does not address anyone under the age of 13. We do not knowingly collect + personally identifiable information from anyone under the age of 13. If You are a + parent + or guardian and You are aware that Your child has provided Us with Personal Data, + please + contact Us. If We become aware that We have collected Personal Data from anyone + under + the age of 13 without verification of parental consent, We take steps to remove that + information from Our servers.

+

If We need to rely on consent as a legal basis for processing Your information and + Your + country requires consent from a parent, We may require Your parent's consent before + We + collect and use that information.

+

Links to Other Websites

+

Our Service may contain links to other websites that are not operated by Us. If You + click + on a third party link, You will be directed to that third party's site. We strongly + advise You to review the Privacy Policy of every site You visit.

+

We have no control over and assume no responsibility for the content, privacy + policies or + practices of any third party sites or services.

+

Changes to this Privacy Policy

+

We may update Our Privacy Policy from time to time. We will notify You of any changes + by + posting the new Privacy Policy on this page.

+

We will let You know via email and/or a prominent notice on Our Service, prior to the + change becoming effective and update the "Last updated" date at the top of this + Privacy + Policy.

+

You are advised to review this Privacy Policy periodically for any changes. Changes + to + this Privacy Policy are effective when they are posted on this page.

+

Contact Us

+

If you have any questions about this Privacy Policy, You can contact us:

+
+
+
+
+
+ <%- include('partials/footer.ejs', {now: 'pp'}) %> +
<%- include('partials/scripts.ejs', {now: "pp"}) %> diff --git a/theme/dbd-soft-ui/views/settings.ejs b/theme/dbd-soft-ui/views/settings.ejs index 1ac5c31..50b47f4 100644 --- a/theme/dbd-soft-ui/views/settings.ejs +++ b/theme/dbd-soft-ui/views/settings.ejs @@ -1,451 +1,436 @@ - - <%- include('partials/preloader.ejs', {now:'settings'}) %> - - <%- themeConfig?.customHtml %> + <%- include("partials/preloader.ejs", {now:"settings"}) %> + + <%- themeConfig?.customHtml %> - <%- include('partials/preload.ejs') %> - + -
-
+ + src="/js/dashboard/functions.js"> @@ -454,35 +439,35 @@ - - - - <%- include('partials/scripts.ejs', {now: "settings" }) %> + function updateSlider(slideAmount, id) { + var sliderDiv = document.getElementById(`value_${id}`); + sliderDiv.innerHTML = slideAmount; + } + + + + + <%- include("partials/scripts.ejs", {now: "settings" }) %> diff --git a/theme/dbd-soft-ui/views/shards.ejs b/theme/dbd-soft-ui/views/shards.ejs index 98e0c95..2ee0378 100644 --- a/theme/dbd-soft-ui/views/shards.ejs +++ b/theme/dbd-soft-ui/views/shards.ejs @@ -1,18 +1,3 @@ - <%- include('partials/preloader.ejs', {now:'index', req: req}) %> @@ -24,120 +9,120 @@ let gradone; let gradtwo; if (currentScheme == "blue") { - colone = "#21d4fd"; - coltwo = "#2152ff"; - gradone = "rgba(33,212,253,0.1)"; - gradtwo = "rgba(33,82,255,0.1)"; + colone = "#21d4fd"; + coltwo = "#2152ff"; + gradone = "rgba(33,212,253,0.1)"; + gradtwo = "rgba(33,82,255,0.1)"; } if (currentScheme == "pink") { - colone = "#FF0080"; - coltwo = "#7928CA"; - gradone = "rgba(255,0,128,0.1)"; - gradtwo = "rgba(121,40,202,0.1)"; + colone = "#FF0080"; + coltwo = "#7928CA"; + gradone = "rgba(255,0,128,0.1)"; + gradtwo = "rgba(121,40,202,0.1)"; } if (currentScheme == "red") { - colone = "#ea0606"; - coltwo = "#ff667c"; - gradone = "rgba(255,102,124,0.1)"; - gradtwo = "rgba(234,6,6,0.1)"; + colone = "#ea0606"; + coltwo = "#ff667c"; + gradone = "rgba(255,102,124,0.1)"; + gradtwo = "rgba(234,6,6,0.1)"; } if (currentScheme == "green") { - colone = "#17ad37"; - coltwo = "#98ec2d"; - gradone = "rgba(23,173,55,0.1)"; - gradtwo = "rgba(152,236,45,0.1)"; + colone = "#17ad37"; + coltwo = "#98ec2d"; + gradone = "rgba(23,173,55,0.1)"; + gradtwo = "rgba(152,236,45,0.1)"; } if (currentScheme == "yellow") { - colone = "#f53939"; - coltwo = "#fbcf33"; - gradone = "rgba(245,57,57,0.1)"; - gradtwo = "rgba(251,207,51,0.1)"; + colone = "#f53939"; + coltwo = "#fbcf33"; + gradone = "rgba(245,57,57,0.1)"; + gradtwo = "rgba(251,207,51,0.1)"; } if (currentScheme == "dark") { - colone = "#141727"; - coltwo = "#3A416F"; - gradone = "rgba(20,23,39,0.1)"; - gradtwo = "rgba(58,65,111,0.1)"; + colone = "#141727"; + coltwo = "#3A416F"; + gradone = "rgba(20,23,39,0.1)"; + gradtwo = "rgba(58,65,111,0.1)"; } if (currentScheme == "custom") { - colone = themeConfig.themeColors.primaryColor; - coltwo = themeConfig.themeColors.secondaryColor; - gradone = hexToRgbA(themeConfig.themeColors.primaryColor, 0.1); - gradtwo = hexToRgbA(themeConfig.themeColors.secondaryColor, 0.1); + colone = themeConfig.themeColors.primaryColor; + coltwo = themeConfig.themeColors.secondaryColor; + gradone = hexToRgbA(themeConfig.themeColors.primaryColor, 0.1); + gradtwo = hexToRgbA(themeConfig.themeColors.secondaryColor, 0.1); } function hexToRgbA(hex){ - var c; - if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)){ - c= hex.substring(1).split(''); - if(c.length== 3){ - c= [c[0], c[0], c[1], c[1], c[2], c[2]]; - } - c= '0x'+c.join(''); - return 'rgba('+[(c>>16)&255, (c>>8)&255, c&255].join(',')+',1)'; - } - throw new Error('Bad Hex'); + var c; + if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)){ + c= hex.substring(1).split(''); + if(c.length== 3){ + c= [c[0], c[0], c[1], c[1], c[2], c[2]]; + } + c= '0x'+c.join(''); + return 'rgba('+[(c>>16)&255, (c>>8)&255, c&255].join(',')+',1)'; + } + throw new Error('Bad Hex'); } %> - - <%- themeConfig?.customHtml %> + + <%- themeConfig?.customHtml %> <%- include('partials/preload.ejs') %> <%- include('partials/sidebar.ejs', {config: config, now:'shards'}) %>
- - <%- include('partials/navbar.ejs', {now:'shards'}) %> - - <% let image; if (themeConfig.shardspage.backgroundUrl) { image=themeConfig.shardspage.backgroundUrl } else { const images=["curved-1", "curved-2" , "curved-3" , "curved-4" , "curved-5" , "curved-6" , "curved-7" - , "curved-8" , "curved-9" , "curved-10" , "curved-11" , "curved-12" , "curved-13" , "curved-14" - , "curved-15" , "curved-16" , "curved-17" , "curved-18" ]; image="/img/curved-images/" + images[Math.floor(Math.random() * - images.length)]+ ".webp";} %> -
- -
-
-
-
- profile_image -
-
-
-
-
- Bot Shards Status -
-

- Total Shards: - Loading -

-
-
-
-
-
-
-
- - Loading... - -
-
-
- <%- include('partials/footer.ejs') %> + + <%- include('partials/navbar.ejs', {now:'shards'}) %> + + <% let image; if (themeConfig.shardspage.backgroundUrl) { image=themeConfig.shardspage.backgroundUrl } else { const images=["curved-1", "curved-2" , "curved-3" , "curved-4" , "curved-5" , "curved-6" , "curved-7" + , "curved-8" , "curved-9" , "curved-10" , "curved-11" , "curved-12" , "curved-13" , "curved-14" + , "curved-15" , "curved-16" , "curved-17" , "curved-18" ]; image="/img/curved-images/" + images[Math.floor(Math.random() * + images.length)]+ ".webp";} %> +
+ +
+
+
+
+ profile_image +
+
+
+
+
+ Bot Shards Status +
+

+ Total Shards: + Loading +

+
+
+
+
+
+
+
+ + Loading... + +
+
+
+ <%- include('partials/footer.ejs') %>
@@ -145,169 +130,169 @@ function hexToRgbA(hex){ <%- include('partials/scripts.ejs', {now: "shards"}) %> diff --git a/theme/dbd-soft-ui/views/src/css/soft-ui-dashboard.min.css b/theme/dbd-soft-ui/views/src/css/soft-ui-dashboard.min.css index 9736870..60937e8 100644 --- a/theme/dbd-soft-ui/views/src/css/soft-ui-dashboard.min.css +++ b/theme/dbd-soft-ui/views/src/css/soft-ui-dashboard.min.css @@ -14741,23 +14741,8 @@ fieldset:disabled .btn { .d-print-none { display: none !important; } -} /*! +} -========================================================= -* Soft UI Dashboard - v1.0.3 -========================================================= - -* Product Page: https://www.creative-tim.com/product/soft-ui-dashboard -* Copyright 2021 Creative Tim (https://www.creative-tim.com) -* Licensed under MIT (site.license) - -* Coded by www.creative-tim.com - -========================================================= - -* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -*/ .alert-primary { background-image: linear-gradient(310deg, #7928ca 0, #d6006c 100%); } diff --git a/yarn.lock b/yarn.lock index 6c6eb12..2f071ef 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18,6 +18,57 @@ resolved "https://registry.npmjs.org/@discordjs/collection/-/collection-0.4.0.tgz" integrity sha512-zmjq+l/rV35kE6zRrwe8BHqV78JvIh2ybJeZavBi5NySjWXqN3hmmAKg7kYMMXSeiWtSsMoZ/+MQi0DiQWy2lw== +"@eslint-community/eslint-utils@^4.2.0": + version "4.4.0" + resolved "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz" + integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== + dependencies: + eslint-visitor-keys "^3.3.0" + +"@eslint-community/regexpp@^4.4.0": + version "4.5.1" + resolved "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.5.1.tgz" + integrity sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ== + +"@eslint/eslintrc@^2.0.3": + version "2.0.3" + resolved "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.0.3.tgz" + integrity sha512-+5gy6OQfk+xx3q0d6jGZZC3f3KzAkXc/IanVxd1is/VIIziRqqt3ongQz0FiTUXqTk0c7aDB3OaFuKnuSoJicQ== + dependencies: + ajv "^6.12.4" + debug "^4.3.2" + espree "^9.5.2" + globals "^13.19.0" + ignore "^5.2.0" + import-fresh "^3.2.1" + js-yaml "^4.1.0" + minimatch "^3.1.2" + strip-json-comments "^3.1.1" + +"@eslint/js@8.43.0": + version "8.43.0" + resolved "https://registry.npmjs.org/@eslint/js/-/js-8.43.0.tgz" + integrity sha512-s2UHCoiXfxMvmfzqoN+vrQ84ahUSYde9qNO1MdxmoEhyHWsfmwOpFlwYV+ePJEVc7gFnATGUi376WowX1N7tFg== + +"@humanwhocodes/config-array@^0.11.10": + version "0.11.10" + resolved "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz" + integrity sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ== + dependencies: + "@humanwhocodes/object-schema" "^1.2.1" + debug "^4.1.1" + minimatch "^3.0.5" + +"@humanwhocodes/module-importer@^1.0.1": + version "1.0.1" + resolved "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz" + integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== + +"@humanwhocodes/object-schema@^1.2.1": + version "1.2.1" + resolved "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz" + integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== + "@javascript-obfuscator/escodegen@2.3.0": version "2.3.0" resolved "https://registry.npmjs.org/@javascript-obfuscator/escodegen/-/escodegen-2.3.0.tgz" @@ -35,6 +86,27 @@ resolved "https://registry.npmjs.org/@javascript-obfuscator/estraverse/-/estraverse-5.4.0.tgz" integrity sha512-CZFX7UZVN9VopGbjTx4UXaXsi9ewoM1buL0kY7j1ftYdSs7p2spv9opxFjHlQ/QGTgh4UqufYqJJ0WKLml7b6w== +"@nodelib/fs.scandir@2.1.5": + version "2.1.5" + resolved "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz" + integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== + dependencies: + "@nodelib/fs.stat" "2.0.5" + run-parallel "^1.1.9" + +"@nodelib/fs.stat@2.0.5": + version "2.0.5" + resolved "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz" + integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== + +"@nodelib/fs.walk@^1.2.8": + version "1.2.8" + resolved "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz" + integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== + dependencies: + "@nodelib/fs.scandir" "2.1.5" + fastq "^1.6.0" + "@sapphire/async-queue@^1.1.9": version "1.3.1" resolved "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.3.1.tgz" @@ -98,11 +170,36 @@ accepts@~1.3.4, accepts@~1.3.8: mime-types "~2.1.34" negotiator "0.6.3" -acorn@8.7.0: +acorn-jsx@^5.3.2: + version "5.3.2" + resolved "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz" + integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== + +"acorn@^6.0.0 || ^7.0.0 || ^8.0.0", acorn@8.7.0: version "8.7.0" resolved "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz" integrity sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ== +acorn@^8.8.0: + version "8.9.0" + resolved "https://registry.npmjs.org/acorn/-/acorn-8.9.0.tgz" + integrity sha512-jaVNAFBHNLXspO543WnNNPZFRtavh3skAkITqD0/2aeMkKZTN+254PyhwxFYrk3vQ1xfY+2wbesJMs/JC8/PwQ== + +ajv@^6.10.0, ajv@^6.12.4: + version "6.12.6" + resolved "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== + ansi-styles@^4.1.0: version "4.3.0" resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz" @@ -110,6 +207,11 @@ ansi-styles@^4.1.0: dependencies: color-convert "^2.0.1" +argparse@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz" + integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== + array-differ@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz" @@ -167,11 +269,40 @@ balanced-match@^1.0.0: resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== +base64-js@^1.3.1: + version "1.5.1" + resolved "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz" + integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== + base64id@~2.0.0, base64id@2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz" integrity sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog== +better-sqlite3@^7.1.1: + version "7.6.2" + resolved "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-7.6.2.tgz" + integrity sha512-S5zIU1Hink2AH4xPsN0W43T1/AJ5jrPh7Oy07ocuW/AKYYY02GWzz9NH0nbSMn/gw6fDZ5jZ1QsHt1BXAwJ6Lg== + dependencies: + bindings "^1.5.0" + prebuild-install "^7.1.0" + +bindings@^1.5.0: + version "1.5.0" + resolved "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz" + integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== + dependencies: + file-uri-to-path "1.0.0" + +bl@^4.0.3: + version "4.1.0" + resolved "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz" + integrity sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w== + dependencies: + buffer "^5.5.0" + inherits "^2.0.4" + readable-stream "^3.4.0" + body-parser@^1.20.0: version "1.20.0" resolved "https://registry.npmjs.org/body-parser/-/body-parser-1.20.0.tgz" @@ -226,6 +357,14 @@ buffer-from@^1.0.0: resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== +buffer@^5.5.0: + version "5.7.1" + resolved "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz" + integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.1.13" + bytes@3.1.2: version "3.1.2" resolved "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz" @@ -239,7 +378,12 @@ call-bind@^1.0.0, call-bind@^1.0.2: function-bind "^1.1.1" get-intrinsic "^1.0.2" -chalk@^4.0.2, chalk@4.1.2: +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + +chalk@^4.0.0, chalk@^4.0.2, chalk@4.1.2: version "4.1.2" resolved "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== @@ -262,6 +406,11 @@ charenc@0.0.2: resolved "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz" integrity sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc= +chownr@^1.1.1: + version "1.1.4" + resolved "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz" + integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg== + class-validator@0.13.2: version "0.13.2" resolved "https://registry.npmjs.org/class-validator/-/class-validator-0.13.2.tgz" @@ -352,6 +501,15 @@ cors@~2.8.5: object-assign "^4" vary "^1" +cross-spawn@^7.0.2: + version "7.0.3" + resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + crypt@0.0.2: version "0.0.2" resolved "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz" @@ -370,6 +528,20 @@ dbd-dark-dashboard@^1.6.58: discord-dashboard "*" node-fetch "2.6.7" +debug@^4.1.1: + version "4.3.4" + resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + dependencies: + ms "2.1.2" + +debug@^4.3.2: + version "4.3.4" + resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + dependencies: + ms "2.1.2" + debug@~4.3.1: version "4.3.4" resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz" @@ -391,7 +563,19 @@ debug@2.6.9: dependencies: ms "2.0.0" -deep-is@~0.1.3: +decompress-response@^6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz" + integrity sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ== + dependencies: + mimic-response "^3.1.0" + +deep-extend@^0.6.0: + version "0.6.0" + resolved "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz" + integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== + +deep-is@^0.1.3, deep-is@~0.1.3: version "0.1.4" resolved "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== @@ -434,6 +618,11 @@ destroy@1.2.0: resolved "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz" integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== +detect-libc@^2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.1.tgz" + integrity sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w== + discord-api-types@^0.26.0: version "0.26.1" resolved "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.26.1.tgz" @@ -446,7 +635,7 @@ discord-dashboard-pp-system@^1.0.2: dependencies: uuid "*" -discord-dashboard@*, discord-dashboard@^2.3.39: +discord-dashboard@*: version "2.3.39" resolved "https://registry.npmjs.org/discord-dashboard/-/discord-dashboard-2.3.39.tgz" integrity sha512-33x+QUAB8qz+bcmUGhatMEDkVgHukc7xsX2xzSv9pU6OMQxq6dQZ5ovirNTae0TZYh/QUa3Fo/hmgAUVOzP9Xw== @@ -489,6 +678,13 @@ discord.js@*, discord.js@^13.*.*: node-fetch "^2.6.1" ws "^8.4.0" +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + ee-first@1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz" @@ -506,6 +702,13 @@ encodeurl@~1.0.2: resolved "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz" integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k= +end-of-stream@^1.1.0, end-of-stream@^1.4.1: + version "1.4.4" + resolved "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz" + integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== + dependencies: + once "^1.4.0" + engine.io-parser@~5.0.3: version "5.0.3" resolved "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.3.tgz" @@ -574,6 +777,19 @@ escape-html@~1.0.3: resolved "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz" integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= +escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + +eslint-scope@^7.2.0: + version "7.2.0" + resolved "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.0.tgz" + integrity sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw== + dependencies: + esrecurse "^4.3.0" + estraverse "^5.2.0" + eslint-scope@7.1.0: version "7.1.0" resolved "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.0.tgz" @@ -582,16 +798,87 @@ eslint-scope@7.1.0: esrecurse "^4.3.0" estraverse "^5.2.0" +eslint-visitor-keys@^3.3.0: + version "3.4.1" + resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz" + integrity sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA== + +eslint-visitor-keys@^3.4.1: + version "3.4.1" + resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz" + integrity sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA== + eslint-visitor-keys@3.2.0: version "3.2.0" resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.2.0.tgz" integrity sha512-IOzT0X126zn7ALX0dwFiUQEdsfzrm4+ISsQS8nukaJXwEyYKRSnEIIDULYg1mCtGp7UUXgfGl7BIolXREQK+XQ== +"eslint@^6.0.0 || ^7.0.0 || >=8.0.0", eslint@^8.23.0: + version "8.43.0" + resolved "https://registry.npmjs.org/eslint/-/eslint-8.43.0.tgz" + integrity sha512-aaCpf2JqqKesMFGgmRPessmVKjcGXqdlAYLLC3THM8t5nBRZRQ+st5WM/hoJXkdioEXLLbXgclUpM0TXo5HX5Q== + dependencies: + "@eslint-community/eslint-utils" "^4.2.0" + "@eslint-community/regexpp" "^4.4.0" + "@eslint/eslintrc" "^2.0.3" + "@eslint/js" "8.43.0" + "@humanwhocodes/config-array" "^0.11.10" + "@humanwhocodes/module-importer" "^1.0.1" + "@nodelib/fs.walk" "^1.2.8" + ajv "^6.10.0" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.3.2" + doctrine "^3.0.0" + escape-string-regexp "^4.0.0" + eslint-scope "^7.2.0" + eslint-visitor-keys "^3.4.1" + espree "^9.5.2" + esquery "^1.4.2" + esutils "^2.0.2" + fast-deep-equal "^3.1.3" + file-entry-cache "^6.0.1" + find-up "^5.0.0" + glob-parent "^6.0.2" + globals "^13.19.0" + graphemer "^1.4.0" + ignore "^5.2.0" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + is-path-inside "^3.0.3" + js-yaml "^4.1.0" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.4.1" + lodash.merge "^4.6.2" + minimatch "^3.1.2" + natural-compare "^1.4.0" + optionator "^0.9.1" + strip-ansi "^6.0.1" + strip-json-comments "^3.1.0" + text-table "^0.2.0" + +espree@^9.5.2: + version "9.5.2" + resolved "https://registry.npmjs.org/espree/-/espree-9.5.2.tgz" + integrity sha512-7OASN1Wma5fum5SrNhFMAMJxOUAbhyfQ8dQ//PJaJbNw0URTPWqIghHWt1MmAANKhHZIYOHruW4Kw4ruUWOdGw== + dependencies: + acorn "^8.8.0" + acorn-jsx "^5.3.2" + eslint-visitor-keys "^3.4.1" + esprima@^4.0.1: version "4.0.1" resolved "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== +esquery@^1.4.2: + version "1.5.0" + resolved "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz" + integrity sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg== + dependencies: + estraverse "^5.1.0" + esrecurse@^4.3.0: version "4.3.0" resolved "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz" @@ -599,7 +886,7 @@ esrecurse@^4.3.0: dependencies: estraverse "^5.2.0" -estraverse@^5.2.0: +estraverse@^5.1.0, estraverse@^5.2.0: version "5.3.0" resolved "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz" integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== @@ -614,6 +901,11 @@ etag@~1.8.1: resolved "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz" integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= +expand-template@^2.0.3: + version "2.0.3" + resolved "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz" + integrity sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg== + express-partials@^0.3.0: version "0.3.0" resolved "https://registry.npmjs.org/express-partials/-/express-partials-0.3.0.tgz" @@ -674,16 +966,40 @@ express-session@^1.17.3: utils-merge "1.0.1" vary "~1.1.2" -fast-deep-equal@3.1.3: +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3, fast-deep-equal@3.1.3: version "3.1.3" resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== -fast-levenshtein@~2.0.6: +fast-json-stable-stringify@^2.0.0: + version "2.1.0" + resolved "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + +fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: version "2.0.6" resolved "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= +fastq@^1.6.0: + version "1.15.0" + resolved "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz" + integrity sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw== + dependencies: + reusify "^1.0.4" + +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== + dependencies: + flat-cache "^3.0.4" + +file-uri-to-path@1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz" + integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== + filelist@^1.0.1: version "1.0.3" resolved "https://registry.npmjs.org/filelist/-/filelist-1.0.3.tgz" @@ -704,6 +1020,27 @@ finalhandler@~1.1.2: statuses "~1.5.0" unpipe "~1.0.0" +find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + +flat-cache@^3.0.4: + version "3.0.4" + resolved "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz" + integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== + dependencies: + flatted "^3.1.0" + rimraf "^3.0.2" + +flatted@^3.1.0: + version "3.2.7" + resolved "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz" + integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ== + foreach@^2.0.5: version "2.0.5" resolved "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz" @@ -737,6 +1074,16 @@ fresh@0.5.2: resolved "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz" integrity sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac= +fs-constants@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz" + integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" + integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== + function-bind@^1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" @@ -759,6 +1106,42 @@ get-symbol-description@^1.0.0: call-bind "^1.0.2" get-intrinsic "^1.1.1" +github-from-package@0.0.0: + version "0.0.0" + resolved "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz" + integrity sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw== + +glob-parent@^6.0.2: + version "6.0.2" + resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz" + integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== + dependencies: + is-glob "^4.0.3" + +glob@^7.1.3: + version "7.2.3" + resolved "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz" + integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.1.1" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globals@^13.19.0: + version "13.20.0" + resolved "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz" + integrity sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ== + dependencies: + type-fest "^0.20.2" + +graphemer@^1.4.0: + version "1.4.0" + resolved "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz" + integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== + has-bigints@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz" @@ -829,11 +1212,47 @@ iconv-lite@0.4.24: dependencies: safer-buffer ">= 2.1.2 < 3" -inherits@^2.0.3, inherits@2.0.4: +ieee754@^1.1.13: + version "1.2.1" + resolved "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz" + integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== + +ignore@^5.2.0: + version "5.2.4" + resolved "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz" + integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== + +import-fresh@^3.0.0, import-fresh@^3.2.1: + version "3.3.0" + resolved "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz" + integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz" + integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz" + integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@^2.0.3, inherits@^2.0.4, inherits@2, inherits@2.0.4: version "2.0.4" resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== +ini@~1.3.0: + version "1.3.8" + resolved "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz" + integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== + internal-slot@^1.0.3: version "1.0.3" resolved "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz" @@ -893,6 +1312,11 @@ is-date-object@^1.0.1: dependencies: has-tostringtag "^1.0.0" +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz" + integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== + is-generator-function@^1.0.7: version "1.0.10" resolved "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz" @@ -900,6 +1324,13 @@ is-generator-function@^1.0.7: dependencies: has-tostringtag "^1.0.0" +is-glob@^4.0.0, is-glob@^4.0.3: + version "4.0.3" + resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== + dependencies: + is-extglob "^2.1.1" + is-nan@^1.2.1: version "1.3.2" resolved "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz" @@ -920,6 +1351,11 @@ is-number-object@^1.0.4: dependencies: has-tostringtag "^1.0.0" +is-path-inside@^3.0.3: + version "3.0.3" + resolved "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz" + integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== + is-regex@^1.1.4: version "1.1.4" resolved "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz" @@ -967,6 +1403,11 @@ is-weakref@^1.0.2: dependencies: call-bind "^1.0.2" +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" + integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== + jake@^10.8.5: version "10.8.5" resolved "https://registry.npmjs.org/jake/-/jake-10.8.5.tgz" @@ -1011,11 +1452,28 @@ js-string-escape@1.0.1: resolved "https://registry.npmjs.org/js-string-escape/-/js-string-escape-1.0.1.tgz" integrity sha1-4mJbrbwNZ8dTPp7cEGjFh65BN+8= +js-yaml@^4.1.0: + version "4.1.0" + resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz" + integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== + dependencies: + argparse "^2.0.1" + json-buffer@3.0.1: version "3.0.1" resolved "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz" integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz" + integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== + keyv@^4.5.2: version "4.5.2" resolved "https://registry.npmjs.org/keyv/-/keyv-4.5.2.tgz" @@ -1023,6 +1481,14 @@ keyv@^4.5.2: dependencies: json-buffer "3.0.1" +levn@^0.4.1: + version "0.4.1" + resolved "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz" + integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== + dependencies: + prelude-ls "^1.2.1" + type-check "~0.4.0" + levn@~0.3.0: version "0.3.0" resolved "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz" @@ -1036,6 +1502,30 @@ libphonenumber-js@^1.9.43: resolved "https://registry.npmjs.org/libphonenumber-js/-/libphonenumber-js-1.9.51.tgz" integrity sha512-MGidRDs7s2nUybwrB/UjZT4nPXZPYQZQTu/sF3/O2v/DocmD8N6G+a9kwDt2qm7DaOo35XRt7hAIbYL+ml942Q== +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" + +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + +lodash@^4.17.20: + version "4.17.21" + resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + md5@2.3.0: version "2.3.0" resolved "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz" @@ -1077,7 +1567,12 @@ mime@1.6.0: resolved "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz" integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== -minimatch@^3.0.4: +mimic-response@^3.1.0: + version "3.1.0" + resolved "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz" + integrity sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ== + +minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== @@ -1091,6 +1586,16 @@ minimatch@^5.0.1: dependencies: brace-expansion "^2.0.1" +minimist@^1.2.0, minimist@^1.2.3: + version "1.2.8" + resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz" + integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== + +mkdirp-classic@^0.5.2, mkdirp-classic@^0.5.3: + version "0.5.3" + resolved "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz" + integrity sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A== + mkdirp@1.0.4: version "1.0.4" resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz" @@ -1122,11 +1627,28 @@ multimatch@5.0.0: arrify "^2.0.1" minimatch "^3.0.4" +napi-build-utils@^1.0.1: + version "1.0.2" + resolved "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz" + integrity sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg== + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz" + integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== + negotiator@0.6.3: version "0.6.3" resolved "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz" integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg== +node-abi@^3.3.0: + version "3.45.0" + resolved "https://registry.npmjs.org/node-abi/-/node-abi-3.45.0.tgz" + integrity sha512-iwXuFrMAcFVi/ZoZiqq8BzAdsLw9kxDfTC0HMyjXfSL/6CSDAGD5UmR7azrAgWV1zKYq7dUUMj4owusBWKLsiQ== + dependencies: + semver "^7.3.5" + node-fetch@^2.6.1, node-fetch@^2.6.7, node-fetch@2.6.7: version "2.6.7" resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz" @@ -1186,6 +1708,13 @@ on-headers@~1.0.2: resolved "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz" integrity sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA== +once@^1.3.0, once@^1.3.1, once@^1.4.0: + version "1.4.0" + resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz" + integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== + dependencies: + wrappy "1" + opencollective-postinstall@2.0.3: version "2.0.3" resolved "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz" @@ -1203,16 +1732,87 @@ optionator@^0.8.1: type-check "~0.3.2" word-wrap "~1.2.3" +optionator@^0.9.1: + version "0.9.1" + resolved "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz" + integrity sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw== + dependencies: + deep-is "^0.1.3" + fast-levenshtein "^2.0.6" + levn "^0.4.1" + prelude-ls "^1.2.1" + type-check "^0.4.0" + word-wrap "^1.2.3" + +p-limit@^3.0.2: + version "3.1.0" + resolved "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== + dependencies: + yocto-queue "^0.1.0" + +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" + +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + parseurl@~1.3.3: version "1.3.3" resolved "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz" integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" + integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== + +path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + path-to-regexp@0.1.7: version "0.1.7" resolved "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz" integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w= +prebuild-install@^7.1.0: + version "7.1.1" + resolved "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.1.tgz" + integrity sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw== + dependencies: + detect-libc "^2.0.0" + expand-template "^2.0.3" + github-from-package "0.0.0" + minimist "^1.2.3" + mkdirp-classic "^0.5.3" + napi-build-utils "^1.0.1" + node-abi "^3.3.0" + pump "^3.0.0" + rc "^1.2.7" + simple-get "^4.0.0" + tar-fs "^2.0.0" + tunnel-agent "^0.6.0" + +prelude-ls@^1.2.1: + version "1.2.1" + resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz" + integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== + prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz" @@ -1236,6 +1836,19 @@ proxy-addr@~2.0.7: forwarded "0.2.0" ipaddr.js "1.9.1" +pump@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz" + integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + +punycode@^2.1.0: + version "2.3.0" + resolved "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz" + integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA== + qs@6.10.3: version "6.10.3" resolved "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz" @@ -1248,6 +1861,19 @@ qs@6.9.7: resolved "https://registry.npmjs.org/qs/-/qs-6.9.7.tgz" integrity sha512-IhMFgUmuNpyRfxA90umL7ByLlgRXu6tIfKPpF5TmcfRLlLCckfP/g3IQmju6jjpu+Hh8rA+2p6A27ZSPOOHdKw== +queue-microtask@^1.2.2: + version "1.2.3" + resolved "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz" + integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== + +quick.db@^7.1.3: + version "7.1.3" + resolved "https://registry.npmjs.org/quick.db/-/quick.db-7.1.3.tgz" + integrity sha512-0S1fVb9OAZGhkI4ZIc5Oe4yWMwhz20xSsziwd6+yGWKKMsPt+XOfj/gD5CesGxd2WdqBkZFBiP8ZqWDu55HLHA== + dependencies: + better-sqlite3 "^7.1.1" + lodash "^4.17.20" + random-bytes@~1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz" @@ -1278,6 +1904,25 @@ raw-body@2.5.1: iconv-lite "0.4.24" unpipe "1.0.0" +rc@^1.2.7: + version "1.2.8" + resolved "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz" + integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== + dependencies: + deep-extend "^0.6.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~2.0.1" + +readable-stream@^3.1.1, readable-stream@^3.4.0: + version "3.6.2" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz" + integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + readline-sync@^1.4.10: version "1.4.10" resolved "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.10.tgz" @@ -1288,7 +1933,31 @@ reflect-metadata@0.1.13: resolved "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz" integrity sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg== -safe-buffer@^5.1.2, safe-buffer@5.2.1: +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + +reusify@^1.0.4: + version "1.0.4" + resolved "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz" + integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== + +rimraf@^3.0.2: + version "3.0.2" + resolved "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== + dependencies: + glob "^7.1.3" + +run-parallel@^1.1.9: + version "1.2.0" + resolved "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz" + integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== + dependencies: + queue-microtask "^1.2.2" + +safe-buffer@^5.0.1, safe-buffer@^5.1.2, safe-buffer@~5.2.0, safe-buffer@5.2.1: version "5.2.1" resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -1298,6 +1967,13 @@ safe-buffer@^5.1.2, safe-buffer@5.2.1: resolved "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== +semver@^7.3.5: + version "7.5.2" + resolved "https://registry.npmjs.org/semver/-/semver-7.5.2.tgz" + integrity sha512-SoftuTROv/cRjCze/scjGyiDtcUyxw1rgYQSZY7XTmtR5hX+dm76iDbTH8TkLPHCQmlbQVSSbNZCPM2hb0knnQ== + dependencies: + lru-cache "^6.0.0" + send@0.17.2: version "0.17.2" resolved "https://registry.npmjs.org/send/-/send-0.17.2.tgz" @@ -1332,6 +2008,18 @@ setprototypeof@1.2.0: resolved "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz" integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + side-channel@^1.0.4: version "1.0.4" resolved "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz" @@ -1341,6 +2029,20 @@ side-channel@^1.0.4: get-intrinsic "^1.0.2" object-inspect "^1.9.0" +simple-concat@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz" + integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== + +simple-get@^4.0.0: + version "4.0.1" + resolved "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz" + integrity sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA== + dependencies: + decompress-response "^6.0.0" + once "^1.3.1" + simple-concat "^1.0.0" + socket.io-adapter@~2.4.0: version "2.4.0" resolved "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.4.0.tgz" @@ -1390,6 +2092,13 @@ statuses@2.0.1: resolved "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz" integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + string-template@1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/string-template/-/string-template-1.0.0.tgz" @@ -1418,6 +2127,23 @@ stringz@2.1.0: dependencies: char-regex "^1.0.2" +strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: + version "3.1.1" + resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== + +strip-json-comments@~2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz" + integrity sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ== + supports-color@^7.1.0: version "7.2.0" resolved "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz" @@ -1425,6 +2151,32 @@ supports-color@^7.1.0: dependencies: has-flag "^4.0.0" +tar-fs@^2.0.0: + version "2.1.1" + resolved "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz" + integrity sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng== + dependencies: + chownr "^1.1.1" + mkdirp-classic "^0.5.2" + pump "^3.0.0" + tar-stream "^2.1.4" + +tar-stream@^2.1.4: + version "2.2.0" + resolved "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz" + integrity sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ== + dependencies: + bl "^4.0.3" + end-of-stream "^1.4.1" + fs-constants "^1.0.0" + inherits "^2.0.3" + readable-stream "^3.1.1" + +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz" + integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== + toidentifier@1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz" @@ -1445,6 +2197,20 @@ tslib@^2.3.1, tslib@2.3.1: resolved "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz" integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw== +tunnel-agent@^0.6.0: + version "0.6.0" + resolved "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz" + integrity sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w== + dependencies: + safe-buffer "^5.0.1" + +type-check@^0.4.0, type-check@~0.4.0: + version "0.4.0" + resolved "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz" + integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== + dependencies: + prelude-ls "^1.2.1" + type-check@~0.3.2: version "0.3.2" resolved "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz" @@ -1452,6 +2218,11 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" +type-fest@^0.20.2: + version "0.20.2" + resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz" + integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== + type-is@~1.6.18: version "1.6.18" resolved "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz" @@ -1482,6 +2253,18 @@ unpipe@~1.0.0, unpipe@1.0.0: resolved "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz" integrity sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw= +uri-js@^4.2.2: + version "4.4.1" + resolved "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== + dependencies: + punycode "^2.1.0" + +util-deprecate@^1.0.1: + version "1.0.2" + resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" + integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== + util@^0.12.0: version "0.12.4" resolved "https://registry.npmjs.org/util/-/util-0.12.4.tgz" @@ -1550,11 +2333,23 @@ which-typed-array@^1.1.2: has-tostringtag "^1.0.0" is-typed-array "^1.1.7" -word-wrap@~1.2.3: +which@^2.0.1: + version "2.0.2" + resolved "https://registry.npmjs.org/which/-/which-2.0.2.tgz" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +word-wrap@^1.2.3, word-wrap@~1.2.3: version "1.2.3" resolved "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz" integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== +wrappy@1: + version "1.0.2" + resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" + integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== + ws@^8.4.0: version "8.5.0" resolved "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz" @@ -1565,6 +2360,16 @@ ws@~8.2.3: resolved "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz" integrity sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA== +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== + zod@^3.11.6: version "3.14.4" resolved "https://registry.npmjs.org/zod/-/zod-3.14.4.tgz"