mirror of
https://git.quad4.io/RNS-Things/MeshChatX.git
synced 2026-07-28 13:19:22 +00:00
fix(meshchat): add error handling for ValueError in JSON responses and adjust script source policies based on request path
This commit is contained in:
@@ -9068,6 +9068,8 @@ class ReticulumMeshChat:
|
||||
"has_argos_cli": self.translator_handler.has_argos_cli,
|
||||
},
|
||||
)
|
||||
except ValueError as e:
|
||||
return web.json_response({"message": str(e)}, status=400)
|
||||
except Exception as e:
|
||||
return web.json_response(
|
||||
{"message": str(e)},
|
||||
@@ -9104,6 +9106,8 @@ class ReticulumMeshChat:
|
||||
libretranslate_url=libretranslate_url,
|
||||
)
|
||||
return web.json_response(result)
|
||||
except ValueError as e:
|
||||
return web.json_response({"message": str(e)}, status=400)
|
||||
except Exception as e:
|
||||
return web.json_response(
|
||||
{"message": str(e)},
|
||||
@@ -11569,7 +11573,11 @@ class ReticulumMeshChat:
|
||||
"'self'",
|
||||
]
|
||||
|
||||
script_sources = ["'self'", "'unsafe-inline'", "'unsafe-eval'"]
|
||||
path = request.path
|
||||
if path.startswith("/reticulum-docs/") or path.startswith("/rnode-flasher/"):
|
||||
script_sources = ["'self'", "'unsafe-inline'"]
|
||||
else:
|
||||
script_sources = ["'self'"]
|
||||
style_sources = ["'self'", "'unsafe-inline'"]
|
||||
|
||||
if self.current_context and self.current_context.config:
|
||||
|
||||
Reference in New Issue
Block a user