From c7a0379fa9f74fc0a295b6523efdc756c4973124 Mon Sep 17 00:00:00 2001 From: abdulmohsen Date: Tue, 5 Mar 2024 17:19:58 +0300 Subject: [PATCH] Fixed searching metadata/extra fields. Added system ENV. --- src/API/History/Index.php | 4 ++-- src/API/System/Env.php | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 src/API/System/Env.php diff --git a/src/API/History/Index.php b/src/API/History/Index.php index 948ca3e8..177ca9d0 100644 --- a/src/API/History/Index.php +++ b/src/API/History/Index.php @@ -135,7 +135,7 @@ final class Index ); } - if (preg_match('/[^a-zA-Z0-9_]/', $sField)) { + if (preg_match('/[^a-zA-Z0-9_\.]/', $sField)) { return api_error( 'Invalid value for key query string expected value format is [a-zA-Z0-9_].', HTTP_STATUS::HTTP_BAD_REQUEST @@ -166,7 +166,7 @@ final class Index ); } - if (preg_match('/[^a-zA-Z0-9_]/', $sField)) { + if (preg_match('/[^a-zA-Z0-9_\.]/', $sField)) { return api_error( 'Invalid value for key query string expected value format is [a-zA-Z0-9_].', HTTP_STATUS::HTTP_BAD_REQUEST diff --git a/src/API/System/Env.php b/src/API/System/Env.php new file mode 100644 index 00000000..a74c1cbd --- /dev/null +++ b/src/API/System/Env.php @@ -0,0 +1,36 @@ + (string)$request->getUri()->withHost('')->withPort(0)->withScheme(''), + 'data' => [], + ]; + + foreach (getenv() as $key => $val) { + if (false === str_starts_with($key, 'WS_') && $key !== 'HTTP_PORT') { + continue; + } + $response['data'][] = [ + 'key' => $key, + 'value' => $val, + ]; + } + + return api_response($response, HTTP_STATUS::HTTP_OK, []); + } +}