add commit ID embedding for easier debugging

This commit is contained in:
Eduard Prigoana 2026-03-28 15:31:18 +02:00
parent 27defce9b0
commit 0424e6bea7
3 changed files with 30 additions and 0 deletions

View file

@ -4520,6 +4520,7 @@
</div>
</div>
</div>
<p id="settings-commit-info" style="text-align:center;color:var(--muted-foreground);font-size:0.75rem;padding:1rem 0 0.5rem"></p>
</div>
</div>
</div>
@ -4591,6 +4592,7 @@
</p>
<div class="about-footer">
<p class="version">Version 2.5.0</p>
<p class="version" id="about-commit-info"></p>
<p class="disclaimer">
This is an independent client and is not affiliated with or endorsed by TIDAL or any
music streaming service.

View file

@ -402,6 +402,21 @@ document.addEventListener('DOMContentLoaded', async () => {
// Initialize analytics
initAnalytics();
// Populate commit info
{
const repo = 'https://github.com/monochrome-music/monochrome';
const hash = typeof __COMMIT_HASH__ !== 'undefined' ? __COMMIT_HASH__ : 'dev';
const commitLink = hash !== 'dev' && hash !== 'unknown'
? `<a href="${repo}/commit/${hash}" target="_blank" rel="noopener noreferrer" style="color:inherit;text-decoration:underline">${hash}</a>`
: hash;
const repoLink = `<a href="${repo}" target="_blank" rel="noopener noreferrer" style="color:inherit;text-decoration:underline">monochrome-music/monochrome</a>`;
const html = `Commit ${commitLink} · ${repoLink}`;
const aboutEl = document.getElementById('about-commit-info');
const settingsEl = document.getElementById('settings-commit-info');
if (aboutEl) aboutEl.innerHTML = html;
if (settingsEl) settingsEl.innerHTML = html;
}
new ThemeStore();
await HiFiClient.initialize({
storage: [

View file

@ -6,12 +6,25 @@ import path from 'path';
import uploadPlugin from './vite-plugin-upload.js';
import blobAssetPlugin from './vite-plugin-blob.js';
import svgUse from './vite-plugin-svg-use.js';
import { execSync } from 'child_process';
function getGitCommitHash() {
try {
return execSync('git rev-parse --short HEAD').toString().trim();
} catch {
return 'unknown';
}
}
export default defineConfig(({ mode }) => {
const IS_NEUTRALINO = mode === 'neutralino';
const commitHash = getGitCommitHash();
return {
base: './',
define: {
__COMMIT_HASH__: JSON.stringify(commitHash),
},
worker: {
format: 'es',
},