frontend: Provide UI for phase 1 of plugin manager

For phase 1 of the plugin manager, the ability to toggle off/on plugins
to be loaded at launch is provided.

This commit adds a new Plugin Manager dialog which can be accessed from
the Tools menu, which shows a list of all installed 3rd party plugins
with a checkbox to toggle them off or on.  If a change is made, the user
is prompted to restart OBS. To allow this, the plugin manager uses a
json based config file stored in the OBS config directory. Additionally
for sources in the source tree, a sample UI has been provided that
indicates any sources whose parent module is disabled, by turning its
title red.
This commit is contained in:
FiniteSingularity
2025-08-28 14:29:10 -04:00
committed by Ryan Foster
parent 14004cec96
commit 23b67268e7
15 changed files with 670 additions and 10 deletions
+33 -10
View File
@@ -22,8 +22,11 @@
#include "ColorSelect.hpp"
#include "OBSBasicControls.hpp"
#include "OBSBasicStats.hpp"
#include "plugin-manager/PluginManager.hpp"
#include "VolControl.hpp"
#include <obs-module.h>
#ifdef YOUTUBE_ENABLED
#include <docks/YouTubeAppDock.hpp>
#endif
@@ -184,9 +187,9 @@ static void SetSafeModuleNames()
return;
#else
string module;
stringstream modules(SAFE_MODULES);
stringstream modules_(SAFE_MODULES);
while (getline(modules, module, '|')) {
while (getline(modules_, module, '|')) {
/* When only disallowing third-party plugins, still add
* "unsafe" bundled modules to the safe list. */
if (disable_3p_plugins || !unsafe_modules.count(module))
@@ -195,6 +198,24 @@ static void SetSafeModuleNames()
#endif
}
static void SetCoreModuleNames()
{
#ifndef SAFE_MODULES
throw "SAFE_MODULES not defined";
#else
std::string safeModules = SAFE_MODULES;
if (safeModules.empty()) {
throw "SAFE_MODULES is empty";
}
string module;
stringstream modules_(SAFE_MODULES);
while (getline(modules_, module, '|')) {
obs_add_core_module(module.c_str());
}
#endif
}
extern void setupDockAction(QDockWidget *dock);
OBSBasic::OBSBasic(QWidget *parent) : OBSMainWindow(parent), undo_s(ui), ui(new Ui::OBSBasic)
@@ -996,26 +1017,23 @@ void OBSBasic::OBSInit()
#endif
struct obs_module_failure_info mfi;
/* Safe Mode disables third-party plugins so we don't need to add earch
* paths outside the OBS bundle/installation. */
// Safe Mode disables third-party plugins so we don't need to add each path outside the OBS bundle/installation.
if (safe_mode || disable_3p_plugins) {
SetSafeModuleNames();
} else {
AddExtraModulePaths();
}
// Core modules are not allowed to be disabled by the user via plugin manager.
SetCoreModuleNames();
/* Modules can access frontend information (i.e. profile and scene collection data) during their initialization, and some modules (e.g. obs-websockets) are known to use the filesystem location of the current profile in their own code.
Thus the profile and scene collection discovery needs to happen before any access to that information (but after intializing global settings) to ensure legacy code gets valid path information.
*/
RefreshSceneCollections(true);
blog(LOG_INFO, "---------------------------------");
obs_load_all_modules2(&mfi);
blog(LOG_INFO, "---------------------------------");
obs_log_loaded_modules();
blog(LOG_INFO, "---------------------------------");
obs_post_load_modules();
App()->loadAppModules(mfi);
BPtr<char *> failed_modules = mfi.failed_modules;
@@ -2070,3 +2088,8 @@ OBSPromptResult OBSBasic::PromptForName(const OBSPromptRequest &request, const O
return result;
}
void OBSBasic::on_actionOpenPluginManager_triggered()
{
App()->pluginManagerOpenDialog();
}