From c584f227c1e076d27929e164aa732346ab1d6904 Mon Sep 17 00:00:00 2001 From: Chuck Date: Wed, 18 Feb 2026 21:41:50 -0500 Subject: [PATCH] fix(starlark): use manifest filename field for .star downloads Tronbyte apps don't always name their .star file to match the directory. For example, the "analogclock" app has "analog_clock.star" (with underscore). The manifest.yaml contains a "filename" field with the correct name. Changes: - download_star_file() now accepts optional filename parameter - Install endpoint passes metadata['filename'] to download_star_file() - Falls back to {app_id}.star if filename not in manifest Fixes: "Failed to download .star file for analogclock" error Co-Authored-By: Claude Sonnet 4.5 --- plugin-repos/starlark-apps/tronbyte_repository.py | 12 ++++++++---- web_interface/blueprints/api_v3.py | 4 +++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/plugin-repos/starlark-apps/tronbyte_repository.py b/plugin-repos/starlark-apps/tronbyte_repository.py index b34f172b..c0a4aeb0 100644 --- a/plugin-repos/starlark-apps/tronbyte_repository.py +++ b/plugin-repos/starlark-apps/tronbyte_repository.py @@ -334,22 +334,26 @@ class TronbyteRepository: 'cached': False } - def download_star_file(self, app_id: str, output_path: Path) -> Tuple[bool, Optional[str]]: + def download_star_file(self, app_id: str, output_path: Path, filename: Optional[str] = None) -> Tuple[bool, Optional[str]]: """ Download the .star file for an app. Args: - app_id: App identifier + app_id: App identifier (directory name) output_path: Where to save the .star file + filename: Optional specific filename from manifest (e.g., "analog_clock.star") + If not provided, assumes {app_id}.star Returns: Tuple of (success, error_message) """ - star_path = f"{self.APPS_PATH}/{app_id}/{app_id}.star" + # Use provided filename or fall back to app_id.star + star_filename = filename or f"{app_id}.star" + star_path = f"{self.APPS_PATH}/{app_id}/{star_filename}" content = self._fetch_raw_file(star_path) if not content: - return False, f"Failed to download .star file for {app_id}" + return False, f"Failed to download .star file for {app_id} (tried {star_filename})" try: output_path.parent.mkdir(parents=True, exist_ok=True) diff --git a/web_interface/blueprints/api_v3.py b/web_interface/blueprints/api_v3.py index 1fc251e8..90f381a8 100644 --- a/web_interface/blueprints/api_v3.py +++ b/web_interface/blueprints/api_v3.py @@ -7558,7 +7558,9 @@ def install_from_tronbyte_repository(): temp_path = tmp.name try: - success, error = repo.download_star_file(data['app_id'], Path(temp_path)) + # Pass filename from metadata (e.g., "analog_clock.star" for analogclock app) + filename = metadata.get('filename') if metadata else None + success, error = repo.download_star_file(data['app_id'], Path(temp_path), filename=filename) if not success: return jsonify({'status': 'error', 'message': f'Failed to download app: {error}'}), 500