Merge pull request #1302 from bokicoder/main

PluginService: automatically install enabled plugins
This commit is contained in:
Lemmy
2026-01-07 11:27:18 -05:00
committed by GitHub
+13 -6
View File
@@ -147,12 +147,19 @@ Singleton {
if (manifest) {
pluginsToLoad.push(enabledIds[i]);
} else {
Logger.w("PluginService", "Plugin", enabledIds[i], "is enabled but not found on disk - cleaning up");
// Plugin was deleted from disk but still marked as enabled
// Unregister it completely and remove its widget from bar
var widgetId = "plugin:" + enabledIds[i];
removeWidgetFromBar(widgetId);
PluginRegistry.unregisterPlugin(enabledIds[i]);
Logger.w("PluginService", "Plugin", enabledIds[i], "is enabled but not found on disk - install");
var sourceUrl = PluginRegistry.getPluginSourceUrl(enabledIds[i]);
root.installPlugin({id: enabledIds[i], source: {url: sourceUrl}}, false, function (success, error, registeredKey) {
if (success) {
ToastService.showNotice(I18n.tr("panels.plugins.title"), I18n.tr("panels.plugins.install-success", {
"plugin": registeredKey
}));
} else {
ToastService.showError(I18n.tr("panels.plugins.title"), I18n.tr("panels.plugins.install-error", {
"error": error || "Unknown error"
}));
}
});
}
}