updated plugin refactor and added FTP and SCP plugins , also hydrusnetwork plugin migration

This commit is contained in:
2026-04-27 21:17:53 -07:00
parent bfd5c20dc3
commit 8685fbb723
24 changed files with 3650 additions and 405 deletions
+18
View File
@@ -422,6 +422,24 @@ class Provider(ABC):
_ = quiet_mode
return None
def config_helper_text(self) -> str:
"""Optional helper text shown in the config editor."""
return ""
def config_actions(self) -> List[Dict[str, Any]]:
"""Optional actions exposed in the config editor for this provider."""
return []
def run_config_action(self, action_id: str, **_kwargs: Any) -> Dict[str, Any]:
"""Execute a provider-owned config action from the config editor."""
return {
"ok": False,
"message": f"Provider '{self.name}' does not support config action '{action_id}'.",
}
def upload(self, file_path: str, **kwargs: Any) -> str:
"""Upload a file and return a URL or identifier."""
raise NotImplementedError(f"Provider '{self.name}' does not support upload")
+23 -8
View File
@@ -136,7 +136,28 @@ class ProviderRegistry:
self._discovered = False
self._external_dirs_scanned = False
def _ensure_builtin_package_dirs(self) -> None:
if self._builtin_package_dirs or not self.package_name:
return
try:
package = importlib.import_module(self.package_name)
except Exception:
return
package_path = getattr(package, "__path__", None)
if not package_path:
return
builtin_dirs: List[Path] = []
for entry in package_path:
try:
builtin_dirs.append(Path(str(entry)).resolve())
except Exception:
builtin_dirs.append(Path(str(entry)))
self._builtin_package_dirs = tuple(builtin_dirs)
def _is_builtin_package_dir(self, candidate: Path) -> bool:
self._ensure_builtin_package_dirs()
try:
resolved = candidate.resolve()
except Exception:
@@ -253,6 +274,7 @@ class ProviderRegistry:
if self._external_dirs_scanned:
return
self._external_dirs_scanned = True
self._ensure_builtin_package_dirs()
for plugin_dir in _iter_external_plugin_dirs():
if self._is_builtin_package_dir(plugin_dir):
@@ -302,15 +324,8 @@ class ProviderRegistry:
return
self._register_module(package)
self._ensure_builtin_package_dirs()
package_path = getattr(package, "__path__", None)
if package_path:
builtin_dirs: List[Path] = []
for entry in package_path:
try:
builtin_dirs.append(Path(str(entry)).resolve())
except Exception:
builtin_dirs.append(Path(str(entry)))
self._builtin_package_dirs = tuple(builtin_dirs)
if not package_path:
self._discover_external_plugins()
return