diff --git a/client/src/modules/content.js b/client/src/modules/content.js index ce2047fd..ebd85c33 100644 --- a/client/src/modules/content.js +++ b/client/src/modules/content.js @@ -78,10 +78,9 @@ export default class Content { */ async saveConfiguration() { try { - Database.insertOrUpdate({ type: 'contentconfig', $or: [{ id: this.id }, { name: this.name }] }, { - type: 'contentconfig', + Database.insertOrUpdate({ type: `${this.type}-config`, id: this.id }, { + type: `${this.type}-config`, id: this.id, - name: this.name, enabled: this.enabled, config: this.settings.strip().settings, data: this.data diff --git a/client/src/modules/contentmanager.js b/client/src/modules/contentmanager.js index 55fcb18e..8316da2d 100644 --- a/client/src/modules/contentmanager.js +++ b/client/src/modules/contentmanager.js @@ -39,6 +39,27 @@ export default class { return this._localContent ? this._localContent : (this._localContent = []); } + /** + * The type of content this content manager manages. + */ + static get contentType() { + return undefined; + } + + /** + * The name of this content manager. + */ + static get moduleName() { + return undefined; + } + + /** + * The path used to store this content manager's content. + */ + static get pathId() { + return undefined; + } + /** * Local path for content. * @return {String} @@ -100,7 +121,7 @@ export default class { const directories = await FileUtils.listDirectory(this.contentPath); for (let dir of directories) { - // If content is already loaded this should resolve. + // If content is already loaded this should resolve if (this.getContentByDirName(dir)) continue; try { @@ -185,7 +206,7 @@ export default class { try { const id = readConfig.info.id || readConfig.info.name.toLowerCase().replace(/[^a-zA-Z0-9-]/g, '-').replace(/--/g, '-'); - const readUserConfig = await Database.find({ type: 'contentconfig', id }); + const readUserConfig = await Database.find({ type: `${this.contentType}-config`, id }); if (readUserConfig.length) { userConfig.enabled = readUserConfig[0].enabled || false; userConfig.config = readUserConfig[0].config;