Add stats and current git commit to footer

This commit is contained in:
2025-10-08 11:44:40 +02:00
parent e717b2bd07
commit 9e0042b09f
2 changed files with 26 additions and 1 deletions

19
app/Helpers/GitHelper.php Normal file
View File

@@ -0,0 +1,19 @@
<?php
namespace App\Helpers;
use Illuminate\Support\Facades\Cache;
class GitHelper
{
public static function shortCommit()
{
return Cache::remember("git_commit", now()->addMinutes(60), function () {
try {
return trim(exec('git rev-parse --short HEAD'));
} catch (\Exception $e) {
return 'unknown';
}
});
}
}

View File

@@ -1,4 +1,4 @@
<footer class="mt-auto bg-white z-10 rounded-lg shadow dark:bg-neutral-950 m-4">
<footer class="bg-white z-10 rounded-lg shadow dark:bg-neutral-950 m-4 mb-0 mt-auto">
<div class="w-full xl:max-w-[95%] 2xl:max-w-[84%] mx-auto p-4">
<div class="sm:flex sm:items-center sm:justify-between">
<a href="https://hstream.moe/" class="flex items-center mb-4 sm:mb-0">
@@ -65,3 +65,9 @@
</div>
</footer>
@include('modals.language-selector')
<div class="m-2 w-full mx-auto">
<div class="text-sm text-gray-500 text-center">
<p>Render time: {{ number_format(microtime(true) - (defined('LARAVEL_START') ? LARAVEL_START : request()->server('REQUEST_TIME_FLOAT')), 3) }} seconds | Memory usage: {{ number_format(memory_get_peak_usage(true) / 1048576, 2) }} MB | Git: <a href="https://gitea.hstream.moe/w33b/hstream/commits/branch/main" target="_blank">{{ \App\Helpers\GitHelper::shortCommit() }}</a></p>
</div>
</div>