Title: Implement minimal core framework with PL injection and update build config
Key features implemented: - Updated package metadata and dependencies in PKG-INFO, setup files - Added main.py entry point for backward compatibility with README launch method - Enhanced CLI with config options, system info command, and proper signal handling - Implemented minimal PluginManager loading only plugin-loader core plugin - Refactored PluginLoader to follow minimal core design, removed sandbox/isolation complexity - Updated auto-dependency plugin with safer PL injection mechanism and disabled pl_injection - Removed legacy plugin files (firewall, frp_proxy, ftp_server, multi_lang_deploy, ops_toolbox, security_gateway) as functionality moved to core plugin system - Improved gitignore with comprehensive ignore patterns The changes implement a minimal core framework design where only the plugin-loader is directly loaded by the core, with all other plugins managed through the PL injection mechanism, significantly simplifying the architecture.
This commit is contained in:
Binary file not shown.
@@ -417,21 +417,17 @@ class PluginManager:
|
||||
|
||||
permissions = manifest.get("permissions", [])
|
||||
|
||||
if use_sandbox:
|
||||
from oss.plugin.loader import PluginLoader as FrameworkLoader
|
||||
fl = FrameworkLoader(enable_sandbox=True)
|
||||
result = fl.load_sandbox_plugin(plugin_dir)
|
||||
if not result: return None
|
||||
module, instance = result["module"], result["instance"]
|
||||
else:
|
||||
spec = importlib.util.spec_from_file_location(f"plugin.{plugin_name}", str(main_file))
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
module.__package__ = f"plugin.{plugin_name}"
|
||||
module.__path__ = [str(plugin_dir)]
|
||||
sys.modules[spec.name] = module
|
||||
spec.loader.exec_module(module)
|
||||
if not hasattr(module, "New"): return None
|
||||
instance = module.New()
|
||||
# 不再使用沙箱,所有插件都直接加载(核心插件是可信的)
|
||||
# use_sandbox 参数保留但不再实际使用
|
||||
spec = importlib.util.spec_from_file_location(f"plugin.{plugin_name}", str(main_file))
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
module.__package__ = f"plugin.{plugin_name}"
|
||||
module.__path__ = [str(plugin_dir)]
|
||||
sys.modules[spec.name] = module
|
||||
spec.loader.exec_module(module)
|
||||
if not hasattr(module, "New"):
|
||||
return None
|
||||
instance = module.New()
|
||||
|
||||
if self.permission_check and permissions:
|
||||
instance = PluginProxy(plugin_name, instance, permissions, self.plugins)
|
||||
|
||||
Reference in New Issue
Block a user