mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-07-02 21:31:37 +08:00
fix(plugin): allow dev local hot sync across system version gate (#5961)
This commit is contained in:
@@ -466,7 +466,8 @@ class PluginManager(ConfigReloadMixin, metaclass=Singleton):
|
||||
pid=plugin_dir_name,
|
||||
package_version=package_version,
|
||||
repo_path=local_repo_path,
|
||||
strict_compat=False
|
||||
strict_compat=False,
|
||||
strict_system_version=not settings.DEV
|
||||
)
|
||||
if candidate:
|
||||
return candidate
|
||||
@@ -488,6 +489,9 @@ class PluginManager(ConfigReloadMixin, metaclass=Singleton):
|
||||
candidate = candidate or PluginHelper().get_local_plugin_candidate(pid)
|
||||
if not candidate:
|
||||
return False
|
||||
if candidate.get("compatible") is False:
|
||||
logger.info(f"本地插件 {pid} 不满足同步条件,跳过自动同步:{candidate.get('skip_reason')}")
|
||||
return False
|
||||
|
||||
source_dir = Path(candidate.get("path"))
|
||||
dest_dir = settings.ROOT_PATH / "app" / "plugins" / pid.lower()
|
||||
|
||||
@@ -307,9 +307,11 @@ class PluginHelper(metaclass=WeakSingleton):
|
||||
|
||||
def get_local_plugin_candidate(self, pid: str, package_version: Optional[str] = None,
|
||||
repo_path: Optional[Path] = None,
|
||||
strict_compat: bool = True) -> Optional[dict]:
|
||||
strict_compat: bool = True,
|
||||
strict_system_version: bool = True) -> Optional[dict]:
|
||||
"""
|
||||
获取指定插件ID的本地插件候选
|
||||
:param strict_system_version: 是否将主系统版本范围不匹配视为不可用候选
|
||||
"""
|
||||
if not pid:
|
||||
return None
|
||||
@@ -352,7 +354,7 @@ class PluginHelper(metaclass=WeakSingleton):
|
||||
candidate["compatible"] = False
|
||||
candidate["skip_reason"] = f"package.json 未声明 {settings.VERSION_FLAG} 兼容"
|
||||
self.annotate_plugin_system_version(candidate)
|
||||
if candidate.get("system_version_compatible") is False:
|
||||
if strict_system_version and candidate.get("system_version_compatible") is False:
|
||||
candidate["compatible"] = False
|
||||
candidate["skip_reason"] = candidate.get("system_version_message")
|
||||
if package_version is not None:
|
||||
@@ -369,6 +371,10 @@ class PluginHelper(metaclass=WeakSingleton):
|
||||
candidates = self.get_local_plugin_candidates()
|
||||
for candidate_pid, candidate in candidates.items():
|
||||
if candidate_pid.lower() == pid.lower():
|
||||
if strict_system_version and candidate.get("system_version_compatible") is False:
|
||||
candidate = candidate.copy()
|
||||
candidate["compatible"] = False
|
||||
candidate["skip_reason"] = candidate.get("system_version_message")
|
||||
return candidate
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user