Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Correctly unload plugin paths

Chocobozzz07880c3642ca
diff --git a/server/helpers/decache.ts b/server/helpers/decache.ts
index 08ab545e42..6be446ff64 100644
--- a/server/helpers/decache.ts
+++ b/server/helpers/decache.ts
@@ -3,16 +3,16 @@
import { extname } from 'path'
-function decachePlugin (pluginPath: string, libraryPath: string) {
+function decachePlugin (libraryPath: string) {
const moduleName = find(libraryPath)
if (!moduleName) return
searchCache(moduleName, function (mod) {
delete require.cache[mod.id]
- })
- removeCachedPath(pluginPath)
+ removeCachedPath(mod.path)
+ })
}
function decacheModule (name: string) {
@@ -22,9 +22,9 @@ function decacheModule (name: string) {
searchCache(moduleName, function (mod) {
delete require.cache[mod.id]
- })
- removeCachedPath(moduleName)
+ removeCachedPath(mod.path)
+ })
}
// ---------------------------------------------------------------------------
diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.ts
index 9086a4c8e8..88c5b60d77 100644
--- a/server/lib/plugins/plugin-manager.ts
+++ b/server/lib/plugins/plugin-manager.ts
@@ -496,7 +496,7 @@ export class PluginManager implements ServerHook {
// Delete cache if needed
const modulePath = join(pluginPath, packageJSON.library)
- decachePlugin(pluginPath, modulePath)
+ decachePlugin(modulePath)
const library: PluginLibrary = require(modulePath)
if (!isLibraryCodeValid(library)) {