feat: add API endpoint to extract plugin assets

This commit is contained in:
Stream
2025-08-27 20:03:59 +08:00
parent 11f4743624
commit a015f05aea
3 changed files with 29 additions and 1 deletions

View File

@ -186,6 +186,11 @@ class PluginService:
mime_type, _ = guess_type(asset_file)
return manager.fetch_asset(tenant_id, asset_file), mime_type or "application/octet-stream"
@staticmethod
def extract_asset(tenant_id: str, plugin_unique_identifier: str, file_name: str) -> bytes:
manager = PluginAssetManager()
return manager.extract_asset(tenant_id, plugin_unique_identifier, file_name)
@staticmethod
def check_plugin_unique_identifier(tenant_id: str, plugin_unique_identifier: str) -> bool:
"""
@ -499,4 +504,4 @@ class PluginService:
Fetch plugin readme
"""
manager = PluginInstaller()
return manager.fetch_plugin_readme(tenant_id, plugin_unique_identifier, language)
return manager.fetch_plugin_readme(tenant_id, plugin_unique_identifier, language)