From e3dc9d0c95911e19540c67a88a44a830571eab5b Mon Sep 17 00:00:00 2001 From: Austin Best Date: Sun, 29 Sep 2024 12:06:22 -0400 Subject: [PATCH] Adjustment to previous commit for the gitVersion function --- root/app/www/public/functions/api.php | 4 ++-- root/app/www/public/functions/git.php | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/root/app/www/public/functions/api.php b/root/app/www/public/functions/api.php index 9dcb972..1e31288 100644 --- a/root/app/www/public/functions/api.php +++ b/root/app/www/public/functions/api.php @@ -257,7 +257,7 @@ function apiRequestLocal($endpoint, $parameters = [], $payload = []) apiResponse(423, ['error' => 'Migration in progress']); } - return 'v' . gitVersion(); + return gitVersion(true); case 'stats-getContainersList': return apiResponse(200, getContainerStats()); case 'stats-getOverview': @@ -467,7 +467,7 @@ function apiRequestServerPings() $servers = []; foreach ($serversTable as $server) { if ($server['id'] == APP_SERVER_ID) { - $servers[strtolower($server['name'])] = ['id' => $server['id'], 'name' => $server['name'] . ' [v' . gitVersion() . ']', 'code' => 200]; + $servers[strtolower($server['name'])] = ['id' => $server['id'], 'name' => $server['name'] . ' [' . gitVersion(true) . ']', 'code' => 200]; } else { apiSetActiveServer($server['id'], $serversTable); diff --git a/root/app/www/public/functions/git.php b/root/app/www/public/functions/git.php index 8dbe8a4..43b56d1 100644 --- a/root/app/www/public/functions/git.php +++ b/root/app/www/public/functions/git.php @@ -34,11 +34,15 @@ function gitMessage() return DOCKWATCH_COMMIT_MSG; } -function gitVersion() +function gitVersion($full = false) { if (!defined('DOCKWATCH_COMMITS') && !defined('DOCKWATCH_BRANCH')) { - return '0.0.0'; + return ($full ? 'v' : '') . '0.0.0 - ' . gitBranch(); } - return APP_X . '.' . APP_Y . '.' . DOCKWATCH_COMMITS . ' - ' . DOCKWATCH_BRANCH; + if ($full) { + return 'v' . APP_X . '.' . APP_Y . '.' . DOCKWATCH_COMMITS . ' - ' . gitBranch(); + } + + return APP_X . '.' . APP_Y . '.' . DOCKWATCH_COMMITS; }