Add version api endpoint (#4429)

This commit is contained in:
Jesse Hills 2023-02-14 11:38:05 +13:00 committed by GitHub
parent 3a101e8ec5
commit dfeeccfcca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -545,6 +545,14 @@ class DownloadBinaryRequestHandler(BaseHandler):
self.finish()
class EsphomeVersionHandler(BaseHandler):
@authenticated
def get(self):
self.set_header("Content-Type", "application/json")
self.write(json.dumps({"version": const.__version__}))
self.finish()
def _list_dashboard_entries():
files = settings.list_yaml_files()
return [DashboardEntry(file) for file in files]
@ -1134,6 +1142,7 @@ def make_app(debug=get_bool_env(ENV_DEV)):
(f"{rel}rename", EsphomeRenameHandler),
(f"{rel}prometheus-sd", PrometheusServiceDiscoveryHandler),
(f"{rel}boards/([a-z0-9]+)", BoardsRequestHandler),
(f"{rel}version", EsphomeVersionHandler),
],
**app_settings,
)