mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-19 12:40:09 +01:00
Patch missing folder autogenerate for plugins (#2273)
This commit is contained in:
parent
de9f9a0ce8
commit
f5565dd6c9
@ -45,6 +45,15 @@ class ImportedPlugin {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the plugin folder exists and if it does not, creates the folder.
|
||||
*/
|
||||
static checkPluginFolderExists() {
|
||||
const dir = path.resolve(pluginsPath);
|
||||
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads plugins from `plugins` folder in storage that are custom loaded and defined.
|
||||
* only loads plugins that are active: true.
|
||||
@ -52,6 +61,7 @@ class ImportedPlugin {
|
||||
*/
|
||||
static async activeImportedPlugins() {
|
||||
const plugins = [];
|
||||
this.checkPluginFolderExists();
|
||||
const folders = fs.readdirSync(path.resolve(pluginsPath));
|
||||
for (const folder of folders) {
|
||||
const configLocation = path.resolve(
|
||||
@ -72,6 +82,7 @@ class ImportedPlugin {
|
||||
*/
|
||||
static listImportedPlugins() {
|
||||
const plugins = [];
|
||||
this.checkPluginFolderExists();
|
||||
if (!fs.existsSync(pluginsPath)) return plugins;
|
||||
|
||||
const folders = fs.readdirSync(path.resolve(pluginsPath));
|
||||
|
Loading…
Reference in New Issue
Block a user