where?
This commit is contained in:
parent
c870a2dec5
commit
0e22250f71
9 changed files with 72 additions and 735 deletions
|
@ -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]) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -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}`);
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -586,25 +586,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card h-10">
|
||||
<div class="card-header pb-0 p-3">
|
||||
<h6 class="mb-0">Admin Controls</h6>
|
||||
<h7 style="text-align:center;">CHECK FOR UPDATES</h7>
|
||||
</div>
|
||||
<div class="card-body p-3">
|
||||
<div class="row">
|
||||
<div class="col-12"><a disabled href="#"
|
||||
onclick="window.location = '../control?action=update&type=live'"
|
||||
type="button" class="btn bg-gradient-info btn-lg w-100"><i
|
||||
class="fas fa-exclamation-circle" style="color: white !important;" ></i> LIVE</a>
|
||||
</div>
|
||||
<div class="col-12"><a href="#"
|
||||
onclick="window.location = '../control?action=update&type=npm'"
|
||||
type="button" class="btn bg-gradient-danger btn-lg w-100"><i
|
||||
class="fab fa-npm" style="color: white !important;"></i> NPM</a></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-12 mb-lg-0 mb-4">
|
||||
|
|
|
@ -47,57 +47,13 @@
|
|||
<textarea id="<%= option.optionId %>" name="<%= option.optionId %>" formType="embedBuilder"
|
||||
style="visibility: hidden;width: .1px;height: .1px"><%- JSON.stringify(actual[s.categoryId][option.optionId]) || "" %></textarea>
|
||||
<div class="iframe-container">
|
||||
<%
|
||||
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);
|
||||
}
|
||||
|
||||
%>
|
||||
<iframe class="responsive-iframe"
|
||||
src="data:text/html;charset=utf-8,<%= encodeURIComponent(config.theme.embedBuilderComponent.replace('{{ContentJsonReplacer}}', embedContent).replace('{{msgSource}}', option.optionId).replace('{{botusername}}', option.optionType.data.username).replace('{{botavatar}}', option.optionType.data.avatarURL)) %>"></iframe>
|
||||
<iframe class="responsive-iframe" src="https://courses.beatrun.ru/embedbuilder/index.html?username=<%=option.optionType.data.username%>&avatar=<%=encodeURIComponent(option.optionType.data.avatarURL)%>&message=<%=option.optionId%>"></iframe>
|
||||
</div>
|
||||
<script>
|
||||
setTimeout(() => {
|
||||
window.addEventListener('message', function (e) {
|
||||
if (e.data[0] === '<%= option.optionId %>') {
|
||||
console.log(e.data)
|
||||
document.getElementById('<%= option.optionId %>').innerHTML = JSON.stringify(e.data[1]);
|
||||
optionEdited(document.getElementById('<%= option.optionId %>'))
|
||||
}
|
||||
|
|
|
@ -73,11 +73,11 @@ if(req.cookies?.selectedTheme == "dark" || req.cookies?.selectedTheme == "auto"
|
|||
const swal = params.get('swal');
|
||||
const result = params.get('result');
|
||||
if (swal) {
|
||||
if (swal === "savedSuccess") sweetalert('success', '<%= themeConfig?.sweetalert?.success?.settingsSave || 'Successfully saved setttings!' %>', 3000);
|
||||
if (swal === "savedError") sweetalert('error', '<%= themeConfig?.sweetalert?.error?.settingsSave || 'Failed to save setttings!' %>', 3000);
|
||||
if (swal === "savedSuccess") sweetalert('success', '<%= req?.locales?.partials?.sweetalert?.success?.settingsSave || 'Successfully saved setttings!' %>', 3000);
|
||||
if (swal === "savedError") sweetalert('error', '<%= req?.locales?.partials?.sweetalert?.errors?.settingsSave || 'Failed to save setttings!' %>', 3000);
|
||||
|
||||
<% if (req.session.user) { %>if (swal === "logged") sweetalert('success', '<%= themeConfig?.sweetalert?.success?.login || 'Successfully logged in!' %>', 3000); <% } %>
|
||||
<% if (!req.session.user) { %>if (swal === "loggedout") sweetalert('success', '<%= themeConfig?.sweetalert?.success?.logout || 'Successfully logged out!' %>', 3000); <% } %>
|
||||
<% if (req.session.user) { %>if (swal === "logged") sweetalert('success', '<%= req?.locales?.partials?.sweetalert?.success?.login || 'Successfully logged in!' %>', 3000); <% } %>
|
||||
<% if (!req.session.user) { %>if (swal === "loggedout") sweetalert('success', '<%= req?.locales?.partials?.sweetalert?.success?.logout || 'Successfully logged out!' %>', 3000); <% } %>
|
||||
|
||||
params.delete('swal');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue