mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-29 20:13:00 +00:00
fix(starlark): load schema from schema.json in standalone mode
The standalone API endpoint was returning schema: null because it didn't load the schema.json file. Now reads schema from disk when returning app details via web service. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7259,6 +7259,17 @@ def get_starlark_app(app_id):
|
|||||||
app_data = manifest.get('apps', {}).get(app_id)
|
app_data = manifest.get('apps', {}).get(app_id)
|
||||||
if not app_data:
|
if not app_data:
|
||||||
return jsonify({'status': 'error', 'message': f'App not found: {app_id}'}), 404
|
return jsonify({'status': 'error', 'message': f'App not found: {app_id}'}), 404
|
||||||
|
|
||||||
|
# Load schema from schema.json if it exists
|
||||||
|
schema = None
|
||||||
|
schema_file = _STARLARK_APPS_DIR / app_id / 'schema.json'
|
||||||
|
if schema_file.exists():
|
||||||
|
try:
|
||||||
|
with open(schema_file, 'r') as f:
|
||||||
|
schema = json.load(f)
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning(f"Failed to load schema for {app_id}: {e}")
|
||||||
|
|
||||||
return jsonify({
|
return jsonify({
|
||||||
'status': 'success',
|
'status': 'success',
|
||||||
'app': {
|
'app': {
|
||||||
@@ -7266,7 +7277,7 @@ def get_starlark_app(app_id):
|
|||||||
'name': app_data.get('name', app_id),
|
'name': app_data.get('name', app_id),
|
||||||
'enabled': app_data.get('enabled', True),
|
'enabled': app_data.get('enabled', True),
|
||||||
'config': app_data.get('config', {}),
|
'config': app_data.get('config', {}),
|
||||||
'schema': None,
|
'schema': schema,
|
||||||
'render_interval': app_data.get('render_interval', 300),
|
'render_interval': app_data.get('render_interval', 300),
|
||||||
'display_duration': app_data.get('display_duration', 15),
|
'display_duration': app_data.get('display_duration', 15),
|
||||||
'has_frames': False,
|
'has_frames': False,
|
||||||
|
|||||||
Reference in New Issue
Block a user