Skip to content

Commit

Permalink
Adjustment to previous commit for the gitVersion function
Browse files Browse the repository at this point in the history
  • Loading branch information
austinwbest committed Sep 29, 2024
1 parent 95914f3 commit e3dc9d0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions root/app/www/public/functions/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -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);

Expand Down
10 changes: 7 additions & 3 deletions root/app/www/public/functions/git.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit e3dc9d0

Please sign in to comment.