mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-04-28 11:40:47 +00:00
Refactor API routing, add cache and security
Centralize API routing and security: moved loopback/API-key/auth/CSRF decorators into python/helpers/api.py and added register_api_route to dynamically dispatch handlers from built-in python/api and plugin api folders. Added a simple thread-safe in-memory cache (python/helpers/cache.py) to store wrapped handlers. register_api_route resolves handler classes, enforces allowed methods, composes required security wrappers, caches the resulting callables, and registers a single /api/<path> rule. Also updated runtime RFC URL to use /api/rfc. Removed the duplicate handler registration and security helper code from run_ui.py and replaced it with the new register_api_route import.
This commit is contained in:
parent
5acb733b9e
commit
4e243a996c
4 changed files with 208 additions and 154 deletions
|
|
@ -138,7 +138,7 @@ def _get_rfc_url() -> str:
|
|||
if url.endswith("/"):
|
||||
url = url[:-1]
|
||||
url = url + ":" + str(set["rfc_port_http"])
|
||||
url += "/rfc"
|
||||
url += "/api/rfc"
|
||||
return url
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue