Add stats and current git commit to footer
This commit is contained in:
19
app/Helpers/GitHelper.php
Normal file
19
app/Helpers/GitHelper.php
Normal 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';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@@ -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="w-full xl:max-w-[95%] 2xl:max-w-[84%] mx-auto p-4">
|
||||||
<div class="sm:flex sm:items-center sm:justify-between">
|
<div class="sm:flex sm:items-center sm:justify-between">
|
||||||
<a href="https://hstream.moe/" class="flex items-center mb-4 sm:mb-0">
|
<a href="https://hstream.moe/" class="flex items-center mb-4 sm:mb-0">
|
||||||
@@ -65,3 +65,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
@include('modals.language-selector')
|
@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>
|
Reference in New Issue
Block a user