diff --git a/client/src/modules/contentmanager.js b/client/src/modules/contentmanager.js index f89e7f94..ac0b33c3 100644 --- a/client/src/modules/contentmanager.js +++ b/client/src/modules/contentmanager.js @@ -225,6 +225,10 @@ export default class { setting.setContentPath(contentPath); } + for (let scheme of userConfig.config.schemes) { + scheme.setContentPath(contentPath); + } + Utils.deepfreeze(defaultConfig, object => object instanceof Combokeys); const configs = { diff --git a/client/src/structs/settings/settingsscheme.js b/client/src/structs/settings/settingsscheme.js index d0201660..5d8f03f3 100644 --- a/client/src/structs/settings/settingsscheme.js +++ b/client/src/structs/settings/settingsscheme.js @@ -32,6 +32,21 @@ export default class SettingsScheme { return this.args.icon_url; } + /** + * The path of the scheme's icon relative to the content path. + */ + get icon_path() { + return this.args.icon_path; + } + + /** + * The MIME type of the scheme's icon. + * This is only needed when using `icon_path` and the MIME type cannot be determined from the file contents. (Usually when using an SVG.) + */ + get icon_type() { + return this.args.icon_type; + } + /** * The scheme's name. */ @@ -53,6 +68,14 @@ export default class SettingsScheme { return this.args.settings || []; } + /** + * The path of the plugin/theme this scheme is part of. + * Use scheme.setContentPath to change. + */ + get path() { + return this.args.path; + } + /** * Checks if this scheme's values are currently applied to a set. * @param {SettingsSet} set The set to check @@ -89,4 +112,12 @@ export default class SettingsScheme { return set.merge(this); } + /** + * Sets the path of the plugin/theme this setting is part of. + * @param {String} contentPath The plugin/theme's directory path + */ + setContentPath(contentPath) { + this.args.path = contentPath; + } + } diff --git a/client/src/ui/components/bd/SettingsPanel.vue b/client/src/ui/components/bd/SettingsPanel.vue index d9576e91..9f3bd55b 100644 --- a/client/src/ui/components/bd/SettingsPanel.vue +++ b/client/src/ui/components/bd/SettingsPanel.vue @@ -12,13 +12,7 @@
- +
@@ -49,12 +43,14 @@ diff --git a/common/modules/utils.js b/common/modules/utils.js index 508cf1fe..c00ddc1a 100644 --- a/common/modules/utils.js +++ b/common/modules/utils.js @@ -385,7 +385,7 @@ export class FileUtils { */ static async toDataURI(buffer, type) { if (typeof buffer === 'string') buffer = await this.readFileBuffer(buffer); - if (!type) type = this.getFileType(buffer).mime; + if (!type) type = (await this.getFileType(buffer)).mime; return `data:${type};base64,${buffer.toString('base64')}`; } }