From 0e22250f7179ce15c9d9d4457d17dcbc5cca76e1 Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Mon, 26 Jun 2023 17:41:52 +0500 Subject: [PATCH] where? --- Routes/dashboard.js | 2 +- Routes/discord.js | 8 +- package.json | 2 - theme/dbd-soft-ui/index.js | 4 +- .../utils/functions/settingsPage.js | 8 +- theme/dbd-soft-ui/views/admin.ejs | 19 - .../components/formTypes/embedBuilder.ejs | 48 +- .../dbd-soft-ui/views/partials/preloader.ejs | 8 +- yarn.lock | 708 ++---------------- 9 files changed, 72 insertions(+), 735 deletions(-) diff --git a/Routes/dashboard.js b/Routes/dashboard.js index 672f75c..14281d2 100644 --- a/Routes/dashboard.js +++ b/Routes/dashboard.js @@ -122,7 +122,7 @@ module.exports = (app, config, themeConfig) => { }; } - if (c.optionType.type == "spacer") { /* ... */ } else { + if (c.optionType.type === "spacer" || c.optionType.type === "multiRow" || c.optionType.type === "embedBuilder") { /* ... */ } else { if (!actual[s.categoryId]) actual[s.categoryId] = {}; if (!actual[s.categoryId][c.optionId]) { diff --git a/Routes/discord.js b/Routes/discord.js index be59a82..3639d4d 100644 --- a/Routes/discord.js +++ b/Routes/discord.js @@ -120,7 +120,7 @@ module.exports = (app, config, themeConfig) => { OAuth2UserResponse = await oauth.getUser(OAuth2Response.access_token); } catch (err) { - console.log("Discord.js Route - OAuth2UserResponse (line 122)\n" + err); + console.log("Discord.js Route - OAuth2UserResponse (line 123)\n" + err); req.session.discordAuthStatus = { loading: false, @@ -204,7 +204,7 @@ module.exports = (app, config, themeConfig) => { OAuth2GuildsResponse = await oauth.getUserGuilds(OAuth2Response.access_token); } catch (err) { - req.config.reportError("Discord.js Route - OAuth2GuildsResponse (line 205)\n" + err); + req.config.reportError("Discord.js Route - OAuth2GuildsResponse (line 207)\n" + err); req.session.discordAuthStatus = { loading: false, @@ -294,7 +294,7 @@ module.exports = (app, config, themeConfig) => { */ }); } catch (err) { - req.config.reportError("Discord.js Route - guildAfterAuthorization (line 295)" + err); + req.config.reportError("Discord.js Route - guildAfterAuthorization (line 297)" + err); } } @@ -341,7 +341,7 @@ module.exports = (app, config, themeConfig) => { try { OAuth2GuildsResponse = await oauth.getUserGuilds(access_token); } catch (err) { - req.config.reportError("Discord.js Route - OAuth2GuildsResponse for ReloadGuilds (line 342)" + err); + req.config.reportError("Discord.js Route - OAuth2GuildsResponse for ReloadGuilds (line 344)" + err); return res.send({ error: true, diff --git a/package.json b/package.json index 6e3da0a..8dd0a59 100644 --- a/package.json +++ b/package.json @@ -26,9 +26,7 @@ "test": "echo \"Error: no test specified\" && exit 1" }, "devDependencies": { - "dbd-dark-dashboard": "^1.6.58", "eslint": "^8.23.0", - "javascript-obfuscator": "^4.0.0", "prettier": "2.7.1" }, "eslintConfig": { diff --git a/theme/dbd-soft-ui/index.js b/theme/dbd-soft-ui/index.js index ae49749..4746bf0 100644 --- a/theme/dbd-soft-ui/index.js +++ b/theme/dbd-soft-ui/index.js @@ -1,7 +1,7 @@ const consolePrefix = `${"[".blue}${"dbd-soft-ui".yellow}${"]".blue} `; const Keyv = require("keyv"); const path = require("path"); -const { readFileSync } = require("fs"); +// const { readFileSync } = require("fs"); module.exports = (themeConfig = {}) => { return { @@ -20,7 +20,7 @@ module.exports = (themeConfig = {}) => { addonLoaded: `${consolePrefix}${"Successfully loaded {{ADDON}}.".cyan}`, }, }, - embedBuilderComponent: readFileSync(path.join(__dirname, "/embedBuilderComponent.txt"), "utf8"), + // 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}`); diff --git a/theme/dbd-soft-ui/utils/functions/settingsPage.js b/theme/dbd-soft-ui/utils/functions/settingsPage.js index ca83235..c8ea9e9 100644 --- a/theme/dbd-soft-ui/utils/functions/settingsPage.js +++ b/theme/dbd-soft-ui/utils/functions/settingsPage.js @@ -167,7 +167,12 @@ module.exports = function (config, themeConfig) { if (!actual[s.categoryId]) actual[s.categoryId] = {}; - if (c.optionType.type == "spacer") { + if (c.optionType.type == "embedBuilder") { + actual[s.categoryId][c.optionId] = { + type: "embedBuilder", + themeOptions: c.themeOptions, + }; + } else if (c.optionType.type == "spacer") { actual[s.categoryId][c.optionId] = { type: "spacer", themeOptions: c.themeOptions, @@ -196,6 +201,7 @@ module.exports = function (config, themeConfig) { } continue; } + actual[s.categoryId][c.optionId] = await c.getActualSet({ guild: { id: req.params.id, diff --git a/theme/dbd-soft-ui/views/admin.ejs b/theme/dbd-soft-ui/views/admin.ejs index 9aa24e3..b72e753 100644 --- a/theme/dbd-soft-ui/views/admin.ejs +++ b/theme/dbd-soft-ui/views/admin.ejs @@ -586,25 +586,6 @@ -
-
-
Admin Controls
- CHECK FOR UPDATES -
-
-
- - -
-
-
diff --git a/theme/dbd-soft-ui/views/components/formTypes/embedBuilder.ejs b/theme/dbd-soft-ui/views/components/formTypes/embedBuilder.ejs index a6cf429..6dc6591 100644 --- a/theme/dbd-soft-ui/views/components/formTypes/embedBuilder.ejs +++ b/theme/dbd-soft-ui/views/components/formTypes/embedBuilder.ejs @@ -47,57 +47,13 @@
- <% - 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); - } - - %> - +