diff --git a/public/index.html b/public/index.html index b8b486660..21f0c25de 100644 --- a/public/index.html +++ b/public/index.html @@ -1440,7 +1440,10 @@
-

User Settings

+
+

User Settings

+
+
diff --git a/public/script.js b/public/script.js index 6193c0c5a..169ad3937 100644 --- a/public/script.js +++ b/public/script.js @@ -386,7 +386,15 @@ $(document).ajaxError(function myErrorHandler(_, xhr) { async function getClientVersion() { try { const response = await fetch('/version'); - CLIENT_VERSION = await response.text(); + const data = await response.json(); + CLIENT_VERSION = data.agent; + let displayVersion = `SillyTavern ${data.pkgVersion}`; + + if (data.gitRevision && data.gitBranch) { + displayVersion += ` '${data.gitBranch}' (${data.gitRevision})`; + } + + $('#version_display').text(displayVersion); } catch (err) { console.log("Couldn't get client version", err); } diff --git a/public/style.css b/public/style.css index 42ca2be14..83602950f 100644 --- a/public/style.css +++ b/public/style.css @@ -191,6 +191,11 @@ code { transition: background-image 0.5s ease-in-out; } +#version_display { + padding: 5px; + opacity: 0.8; +} + #bg1 { background-image: url('backgrounds/tavern day.jpg'); z-index: -2; @@ -3517,6 +3522,10 @@ toolcool-color-picker { justify-content: space-evenly; } +.spaceBetween { + justify-content: space-between; +} + .widthNatural { width: unset !important; min-width: unset !important; diff --git a/server.js b/server.js index b0e503ea7..71a8108c9 100644 --- a/server.js +++ b/server.js @@ -308,7 +308,7 @@ app.get('/deviceinfo', function (request, response) { return response.send(deviceInfo); }); app.get('/version', function (_, response) { - let pkgVersion, gitRevision; + let pkgVersion, gitRevision, gitBranch; try { const pkgJson = require('./package.json'); pkgVersion = pkgJson.version; @@ -316,13 +316,18 @@ app.get('/version', function (_, response) { gitRevision = require('child_process') .execSync('git rev-parse --short HEAD', { cwd: __dirname }) .toString().trim(); + + gitBranch = require('child_process') + .execSync('git rev-parse --abbrev-ref HEAD', { cwd: __dirname }) + .toString().trim(); } } catch { // suppress exception } finally { - response.send(`SillyTavern:${gitRevision || pkgVersion}:Cohee#1207`) + const agent = `SillyTavern:${gitRevision || pkgVersion}:Cohee#1207`; + response.send({ agent, pkgVersion, gitRevision, gitBranch }); } })