|
60 | 60 | #include <sstream> |
61 | 61 | #endif |
62 | 62 | #include <string> |
63 | | -#include <unordered_set> |
64 | 63 |
|
65 | 64 | #ifdef _WIN32 |
66 | 65 | #define WIN32_LEAN_AND_MEAN |
@@ -103,98 +102,6 @@ extern bool cef_js_avail; |
103 | 102 | extern void DestroyPanelCookieManager(); |
104 | 103 | extern void CheckExistingCookieId(); |
105 | 104 |
|
106 | | -static void AddExtraModulePaths() |
107 | | -{ |
108 | | - string plugins_path, plugins_data_path; |
109 | | - char *s; |
110 | | - |
111 | | - s = getenv("OBS_PLUGINS_PATH"); |
112 | | - if (s) |
113 | | - plugins_path = s; |
114 | | - |
115 | | - s = getenv("OBS_PLUGINS_DATA_PATH"); |
116 | | - if (s) |
117 | | - plugins_data_path = s; |
118 | | - |
119 | | - if (!plugins_path.empty() && !plugins_data_path.empty()) { |
120 | | -#if defined(__APPLE__) |
121 | | - plugins_path += "/%module%.plugin/Contents/MacOS"; |
122 | | - plugins_data_path += "/%module%.plugin/Contents/Resources"; |
123 | | - obs_add_module_path(plugins_path.c_str(), plugins_data_path.c_str()); |
124 | | -#else |
125 | | - string data_path_with_module_suffix; |
126 | | - data_path_with_module_suffix += plugins_data_path; |
127 | | - data_path_with_module_suffix += "/%module%"; |
128 | | - obs_add_module_path(plugins_path.c_str(), data_path_with_module_suffix.c_str()); |
129 | | -#endif |
130 | | - } |
131 | | - |
132 | | - if (portable_mode) |
133 | | - return; |
134 | | - |
135 | | - char base_module_dir[512]; |
136 | | -#if defined(_WIN32) |
137 | | - int ret = GetProgramDataPath(base_module_dir, sizeof(base_module_dir), "obs-studio/plugins/%module%"); |
138 | | -#elif defined(__APPLE__) |
139 | | - int ret = GetAppConfigPath(base_module_dir, sizeof(base_module_dir), "obs-studio/plugins/%module%.plugin"); |
140 | | -#else |
141 | | - int ret = GetAppConfigPath(base_module_dir, sizeof(base_module_dir), "obs-studio/plugins/%module%"); |
142 | | -#endif |
143 | | - |
144 | | - if (ret <= 0) |
145 | | - return; |
146 | | - |
147 | | - string path = base_module_dir; |
148 | | -#if defined(__APPLE__) |
149 | | - /* User Application Support Search Path */ |
150 | | - obs_add_module_path((path + "/Contents/MacOS").c_str(), (path + "/Contents/Resources").c_str()); |
151 | | - |
152 | | -#ifndef __aarch64__ |
153 | | - /* Legacy System Library Search Path */ |
154 | | - char system_legacy_module_dir[PATH_MAX]; |
155 | | - GetProgramDataPath(system_legacy_module_dir, sizeof(system_legacy_module_dir), "obs-studio/plugins/%module%"); |
156 | | - std::string path_system_legacy = system_legacy_module_dir; |
157 | | - obs_add_module_path((path_system_legacy + "/bin").c_str(), (path_system_legacy + "/data").c_str()); |
158 | | - |
159 | | - /* Legacy User Application Support Search Path */ |
160 | | - char user_legacy_module_dir[PATH_MAX]; |
161 | | - GetAppConfigPath(user_legacy_module_dir, sizeof(user_legacy_module_dir), "obs-studio/plugins/%module%"); |
162 | | - std::string path_user_legacy = user_legacy_module_dir; |
163 | | - obs_add_module_path((path_user_legacy + "/bin").c_str(), (path_user_legacy + "/data").c_str()); |
164 | | -#endif |
165 | | -#else |
166 | | -#if ARCH_BITS == 64 |
167 | | - obs_add_module_path((path + "/bin/64bit").c_str(), (path + "/data").c_str()); |
168 | | -#else |
169 | | - obs_add_module_path((path + "/bin/32bit").c_str(), (path + "/data").c_str()); |
170 | | -#endif |
171 | | -#endif |
172 | | -} |
173 | | - |
174 | | -/* First-party modules considered to be potentially unsafe to load in Safe Mode |
175 | | - * due to them allowing external code (e.g. scripts) to modify OBS's state. */ |
176 | | -static const unordered_set<string> unsafe_modules = { |
177 | | - "frontend-tools", // Scripting |
178 | | - "obs-websocket", // Allows outside modifications |
179 | | -}; |
180 | | - |
181 | | -static void SetSafeModuleNames() |
182 | | -{ |
183 | | -#ifndef SAFE_MODULES |
184 | | - return; |
185 | | -#else |
186 | | - string module; |
187 | | - stringstream modules(SAFE_MODULES); |
188 | | - |
189 | | - while (getline(modules, module, '|')) { |
190 | | - /* When only disallowing third-party plugins, still add |
191 | | - * "unsafe" bundled modules to the safe list. */ |
192 | | - if (disable_3p_plugins || !unsafe_modules.count(module)) |
193 | | - obs_add_safe_module(module.c_str()); |
194 | | - } |
195 | | -#endif |
196 | | -} |
197 | | - |
198 | 105 | extern void setupDockAction(QDockWidget *dock); |
199 | 106 |
|
200 | 107 | OBSBasic::OBSBasic(QWidget *parent) : OBSMainWindow(parent), undo_s(ui), ui(new Ui::OBSBasic) |
@@ -952,14 +859,6 @@ void OBSBasic::OBSInit() |
952 | 859 | #endif |
953 | 860 | struct obs_module_failure_info mfi; |
954 | 861 |
|
955 | | - /* Safe Mode disables third-party plugins so we don't need to add earch |
956 | | - * paths outside the OBS bundle/installation. */ |
957 | | - if (safe_mode || disable_3p_plugins) { |
958 | | - SetSafeModuleNames(); |
959 | | - } else { |
960 | | - AddExtraModulePaths(); |
961 | | - } |
962 | | - |
963 | 862 | /* 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. |
964 | 863 | |
965 | 864 | 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. |
|
0 commit comments