added proper version information
Co-authored-by: Spacelord <Spacelord09@users.noreply.github.com>
This commit is contained in:
parent
587dac99c5
commit
5d99baea8e
@ -137,7 +137,7 @@
|
||||
</div>
|
||||
<!-- Align the mode picker at the bottom of the navbar -->
|
||||
|
||||
<ul class="nav flex-column mb-2 position-absolute bottom-0 align-items-center w-100">
|
||||
<ul class="nav flex-column mb-5 position-absolute bottom-0 align-items-center w-100">
|
||||
<div class="input-group mb-3 justify-content-center w-100">
|
||||
<label class="btn btn-secondary" for="mode_light"><i class="bi bi-brightness-high"></i></label>
|
||||
<input type="radio" class="btn-check" name="options" id="mode_light" autocomplete="off" />
|
||||
@ -177,7 +177,23 @@
|
||||
});
|
||||
</script>
|
||||
</ul>
|
||||
<div onclick="toggleAutoReload();" class="text-secondary versionInfo nav flex-column position-absolute bottom-0 align-items-center w-100">AssetFlow Alpha V0.0.1 </div>
|
||||
<div onclick="toggleAutoReload();" class="text-secondary versionInfo nav flex-column position-absolute bottom-0 align-items-center w-100" id="versionInfo">AssetFlow Alpha <i>No version info</i> </div>
|
||||
<script>
|
||||
// Request /api/v1/version
|
||||
// If the response is 200, set the commit hash
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/api/v1/version",
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
$('#versionInfo').text(`AssetFlow Alpha ${data.version} ${data.commit}`);
|
||||
},
|
||||
error: function (data) {
|
||||
createNewToast('<i class="bi bi-exclamation-triangle-fill"></i> Unable to load version information', "text-bg-danger", 3000, false)
|
||||
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</nav>
|
||||
|
||||
<main class="col-md-9 ms-sm-auto col-lg-10 px-md-4" style="min-height: 100%">
|
||||
|
10
src/routes/api/v1/version.ts
Normal file
10
src/routes/api/v1/version.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import express, { Request, Response } from 'express';
|
||||
|
||||
function get(req: Request, res: Response) {
|
||||
const revision = require('child_process')
|
||||
.execSync('git rev-parse --short HEAD')
|
||||
.toString().trim()
|
||||
res.status(200).send({ version: '1.0.0', commit: revision });
|
||||
};
|
||||
|
||||
export default { get };
|
Loading…
Reference in New Issue
Block a user