diff --git a/client/src/modules/contentmanager.js b/client/src/modules/contentmanager.js
index f617389d..cdf89451 100644
--- a/client/src/modules/contentmanager.js
+++ b/client/src/modules/contentmanager.js
@@ -151,19 +151,20 @@ export default class {
try {
const readUserConfig = await this.readUserConfig(contentPath);
userConfig.enabled = readUserConfig.enabled || false;
- userConfig.config = readConfig.defaultConfig.map(config => {
- const userSet = readUserConfig.config.find(c => c.category === config.category);
+ userConfig.config = readConfig.defaultConfig.map(category => {
+ let newCategory = readUserConfig.config.find(c => c.category === category.category);
// return userSet || config;
- if (!userSet) return config;
+ if (!newCategory) newCategory = {settings: []};
- config.settings = config.settings.map(setting => {
- const userSetting = userSet.settings.find(s => s.id === setting.id);
- if (!userSetting) return setting;
+ category.settings = category.settings.map(setting => {
+ if (setting.type === 'array' || setting.type === 'custom') setting.path = contentPath;
+ const newSetting = newCategory.settings.find(s => s.id === setting.id);
+ if (!newSetting) return setting;
- setting.value = userSetting.value;
+ setting.value = newSetting.value;
return setting;
});
- return config;
+ return category;
});
userConfig.css = readUserConfig.css || null;
// userConfig.config = readUserConfig.config;
@@ -175,13 +176,13 @@ export default class {
defaultConfig: readConfig.defaultConfig,
schemes: readConfig.configSchemes,
userConfig
- }
+ };
const paths = {
contentPath,
dirName,
mainPath
- }
+ };
const content = await this.loadContent(paths, configs, readConfig.info, readConfig.main, readConfig.dependencies);
if (reload) this.localContent[index] = content;
diff --git a/client/src/modules/plugin.js b/client/src/modules/plugin.js
index 0a4aa768..9ada7016 100644
--- a/client/src/modules/plugin.js
+++ b/client/src/modules/plugin.js
@@ -56,6 +56,7 @@ export default class Plugin {
get name() { return this.info.name }
get authors() { return this.info.authors }
get version() { return this.info.version }
+ get contentPath() { return this.paths.contentPath }
get pluginPath() { return this.paths.contentPath }
get dirName() { return this.paths.dirName }
get enabled() { return this.userConfig.enabled }
diff --git a/client/src/styles/partials/generic/drawers.scss b/client/src/styles/partials/generic/drawers.scss
index b2854af7..0575e2cf 100644
--- a/client/src/styles/partials/generic/drawers.scss
+++ b/client/src/styles/partials/generic/drawers.scss
@@ -1,7 +1,14 @@
.bd-drawer {
- border-bottom: 1px solid rgba(114, 118, 126, 0.3);
margin-bottom: 15px;
+ .bd-settings-category > & {
+ border-bottom: 1px solid rgba(114, 118, 126, 0.3);
+
+ .bd-drawer-contents > .bd-form-item:last-child > .bd-form-divider:last-child {
+ display: none;
+ }
+ }
+
.bd-form-header {
margin-top: 0;
cursor: pointer;
@@ -44,7 +51,7 @@
}
&.bd-drawer-open {
- .bd-drawer-open-button {
+ > .bd-drawer-header .bd-drawer-open-button {
.bd-chevron-1 {
svg {
transform: rotate(90deg)
@@ -59,7 +66,7 @@
}
}
- .bd-drawer-contents {
+ > .bd-drawer-contents-wrap > .bd-drawer-contents {
transform: scaleY(1) translateY(0%);
margin-top: 0%;
opacity: 1;
diff --git a/client/src/styles/partials/generic/forms/main.scss b/client/src/styles/partials/generic/forms/main.scss
index efb9bc1a..b4a2627c 100644
--- a/client/src/styles/partials/generic/forms/main.scss
+++ b/client/src/styles/partials/generic/forms/main.scss
@@ -38,3 +38,13 @@
}
}
}
+
+.bd-form-customsetting {
+ &.bd-form-customsetting-debug + .bd-form-divider {
+ margin-top: 0;
+ }
+
+ > .bd-drawer {
+ margin-bottom: 0;
+ }
+}
diff --git a/client/src/styles/partials/generic/index.scss b/client/src/styles/partials/generic/index.scss
index db30a069..e3614c84 100644
--- a/client/src/styles/partials/generic/index.scss
+++ b/client/src/styles/partials/generic/index.scss
@@ -6,3 +6,4 @@
@import './forms/index.scss';
@import './material-buttons.scss';
@import './drawers.scss';
+@import './preformatted.scss';
diff --git a/client/src/styles/partials/generic/preformatted.scss b/client/src/styles/partials/generic/preformatted.scss
new file mode 100644
index 00000000..0581c294
--- /dev/null
+++ b/client/src/styles/partials/generic/preformatted.scss
@@ -0,0 +1,20 @@
+.bd-pre-wrap {
+ background: rgba(0, 0, 0, 0.1);
+ border: 1px solid rgba(0, 0, 0, 0.3);
+ border-radius: 3px;
+ color: #b9bbbe;
+ white-space: pre-wrap;
+ font-family: monospace;
+ overflow-y: auto;
+
+ &:focus {
+ color: #fff;
+ border-color: #040405;
+ }
+
+ @include scrollbar;
+}
+
+.bd-pre {
+ padding: 11px;
+}
diff --git a/client/src/ui/components/bd/setting/Array.vue b/client/src/ui/components/bd/setting/Array.vue
index 4ccb8a5c..ee533255 100644
--- a/client/src/ui/components/bd/setting/Array.vue
+++ b/client/src/ui/components/bd/setting/Array.vue
@@ -104,8 +104,10 @@
for (let newCategory of newSettings) {
const category = settings.find(c => c.category === newCategory.category);
+ if (!category) continue;
for (let newSetting of newCategory.settings) {
const setting = category.settings.find(s => s.id === newSetting.id);
+ if (!setting) continue;
setting.value = setting.old_value = newSetting.value;
setting.changed = false;
}
diff --git a/client/src/ui/components/bd/setting/Custom.vue b/client/src/ui/components/bd/setting/Custom.vue
new file mode 100644
index 00000000..7fee204f
--- /dev/null
+++ b/client/src/ui/components/bd/setting/Custom.vue
@@ -0,0 +1,68 @@
+/**
+ * BetterDiscord Custom Setting Component
+ * Copyright (c) 2015-present Jiiks/JsSucks - https://github.com/Jiiks / https://github.com/JsSucks
+ * All rights reserved.
+ * https://betterdiscord.net
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+*/
+
+
+
+