do not init plugins that are disabled

This commit is contained in:
Raven Scott
2025-12-19 22:58:32 -05:00
parent a3ea306a76
commit 3275f937e8
3 changed files with 56 additions and 21 deletions
Vendored
BIN
View File
Binary file not shown.
+8 -8
View File
@@ -104,7 +104,7 @@ async function loadPlugin(domain, pluginDir) {
// Check if plugin is disabled (after system plugin override) // Check if plugin is disabled (after system plugin override)
if (config.enabled === false) { if (config.enabled === false) {
logInfo('PluginHandler', `Plugin ${domain} is disabled in config.json, skipping load`); logInfo('PluginHandler', `Plugin ${domain} is disabled in config.json, skipping initialization completely (no hyperdb, no channels, nothing)`);
return null; return null;
} }
@@ -446,12 +446,12 @@ async function discoverInternalDomains() {
const config = loadPluginConfig(pluginDir); const config = loadPluginConfig(pluginDir);
// If plugin has valid config and is enabled, it's an internal domain // If plugin has valid config and is enabled, it's an internal domain
if (config && config.name && config.version) { if (config && config.name && config.version) {
// Only register domain if plugin is enabled // Only register domain if plugin is enabled (default true, explicitly check for false)
if (config.enabled !== false) { if (config.enabled === false) {
logDebug('PluginHandler', `Plugin ${domain} is disabled in config.json, not registering as internal domain`);
} else {
internalDomains.add(domain); internalDomains.add(domain);
logDebug('PluginHandler', `Discovered internal domain from plugin: ${domain}`); logDebug('PluginHandler', `Discovered internal domain from plugin: ${domain}`);
} else {
logDebug('PluginHandler', `Plugin ${domain} is disabled, not registering as internal domain`);
} }
} }
} catch (err) { } catch (err) {
@@ -509,10 +509,10 @@ async function getAllPluginDomainsFromDisk() {
const config = loadPluginConfig(pluginDir); const config = loadPluginConfig(pluginDir);
if (config && config.name && config.version) { if (config && config.name && config.version) {
// Only add domain if plugin is enabled // Only add domain if plugin is enabled
if (config.enabled !== false) { if (config.enabled === false) {
domains.add(domain); logDebug('PluginHandler', `Plugin ${domain} is disabled in config.json, not including in plugin domains list`);
} else { } else {
logDebug('PluginHandler', `Plugin ${domain} is disabled, not including in plugin domains list`); domains.add(domain);
} }
} }
} catch (err) { } catch (err) {
+47 -12
View File
@@ -2,7 +2,7 @@
"name": "File Drop", "name": "File Drop",
"version": "1.0.4", "version": "1.0.4",
"domain": "file.drop", "domain": "file.drop",
"enabled": true, "enabled": false,
"description": "Temporary 24-hour file storage with shareable links", "description": "Temporary 24-hour file storage with shareable links",
"author": "P2NS", "author": "P2NS",
"license": "MIT", "license": "MIT",
@@ -17,14 +17,46 @@
"name": "files", "name": "files",
"compact": true, "compact": true,
"fields": [ "fields": [
{ "name": "id", "type": "string", "required": true }, {
{ "name": "filename", "type": "string", "required": true }, "name": "id",
{ "name": "size", "type": "uint", "required": true }, "type": "string",
{ "name": "mimeType", "type": "string", "required": true }, "required": true
{ "name": "driveKey", "type": "string", "required": true }, },
{ "name": "destroyOnDownload", "type": "bool", "required": false }, {
{ "name": "uploadedAt", "type": "uint", "required": true }, "name": "filename",
{ "name": "expiresAt", "type": "uint", "required": true } "type": "string",
"required": true
},
{
"name": "size",
"type": "uint",
"required": true
},
{
"name": "mimeType",
"type": "string",
"required": true
},
{
"name": "driveKey",
"type": "string",
"required": true
},
{
"name": "destroyOnDownload",
"type": "bool",
"required": false
},
{
"name": "uploadedAt",
"type": "uint",
"required": true
},
{
"name": "expiresAt",
"type": "uint",
"required": true
}
] ]
} }
] ]
@@ -33,7 +65,9 @@
{ {
"name": "files", "name": "files",
"schema": "@filedrop/files", "schema": "@filedrop/files",
"key": ["id"] "key": [
"id"
]
} }
], ],
"indexes": [ "indexes": [
@@ -41,9 +75,10 @@
"name": "files-by-expiry", "name": "files-by-expiry",
"collection": "@filedrop/files", "collection": "@filedrop/files",
"unique": false, "unique": false,
"key": ["expiresAt"] "key": [
"expiresAt"
]
} }
] ]
} }
} }