From 76ec0e888b520a7aabec544e8b71e03e84cf2830 Mon Sep 17 00:00:00 2001 From: Lars Lehmann Date: Mon, 25 Apr 2022 22:44:41 +0200 Subject: [PATCH 1/2] Add version endpoint --- data/web/api/openapi.yaml | 21 +++++++++++++++++++++ data/web/json_api.php | 4 ++++ 2 files changed, 25 insertions(+) diff --git a/data/web/api/openapi.yaml b/data/web/api/openapi.yaml index ef8b0bd1f..834b85896 100644 --- a/data/web/api/openapi.yaml +++ b/data/web/api/openapi.yaml @@ -5072,6 +5072,27 @@ paths: of used storage. operationId: Get vmail status summary: Get vmail status + /api/v1/get/status/version: + get: + responses: + "401": + $ref: "#/components/responses/Unauthorized" + "200": + content: + application/json: + examples: + response: + value: + version: "2022-04" + description: OK + headers: {} + tags: + - Status + description: >- + Using this endpoint you can get the current running release of this + instance. + operationId: Get version status + summary: Get version status /api/v1/get/syncjobs/all/no_log: get: responses: diff --git a/data/web/json_api.php b/data/web/json_api.php index efe02340c..8d64a0b0d 100644 --- a/data/web/json_api.php +++ b/data/web/json_api.php @@ -1472,6 +1472,10 @@ if (isset($_GET['query'])) { 'solr_documents' => $solr_documents )); break; + case "version": + echo json_encode(array( + 'version' => $GLOBALS['MAILCOW_GIT_VERSION'] + )); } } break; From 9e1554f5c70113e2942fdd02018d7d4013c19960 Mon Sep 17 00:00:00 2001 From: Lars Lehmann Date: Tue, 26 Apr 2022 13:12:31 +0200 Subject: [PATCH 2/2] Add missing break --- data/web/json_api.php | 1 + 1 file changed, 1 insertion(+) diff --git a/data/web/json_api.php b/data/web/json_api.php index 8d64a0b0d..c82aba6ce 100644 --- a/data/web/json_api.php +++ b/data/web/json_api.php @@ -1476,6 +1476,7 @@ if (isset($_GET['query'])) { echo json_encode(array( 'version' => $GLOBALS['MAILCOW_GIT_VERSION'] )); + break; } } break;