Skip to content

armgit / VERT

Public Imported from GitHub
0

The next-generation file converter. Open source, fully local* and free forever.

feat: footer commit hash

Maya3b443e16be5e
diff --git a/src/app.d.ts b/src/app.d.ts
index a762596..29ed65b 100644
--- a/src/app.d.ts
+++ b/src/app.d.ts
@@ -29,6 +29,8 @@ declare global {
interface Window {
plausible: TrackEvent;
}
+
+ const __COMMIT_HASH__: string;
}
/**
diff --git a/src/lib/components/layout/Footer.svelte b/src/lib/components/layout/Footer.svelte
index 6303e72..419bbcd 100644
--- a/src/lib/components/layout/Footer.svelte
+++ b/src/lib/components/layout/Footer.svelte
@@ -6,6 +6,7 @@
[m["footer.source_code"](), GITHUB_URL_VERT],
[m["footer.discord_server"](), DISCORD_URL],
[m["footer.privacy_policy"](), "/privacy"],
+ [__COMMIT_HASH__, `${GITHUB_URL_VERT}/commit/${__COMMIT_HASH__}`]
]);
const year = new Date().getFullYear();
diff --git a/vite.config.ts b/vite.config.ts
index c08fc5e..28657ae 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -3,6 +3,14 @@ import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig, type PluginOption } from "vite";
import svg from "@poppanator/sveltekit-svg";
import wasm from "vite-plugin-wasm";
+import { execSync } from "child_process";
+
+let commitHash = "unknown";
+try {
+ commitHash = execSync("git rev-parse --short HEAD").toString().trim();
+} catch (e) {
+ console.warn("Could not determine Git commit hash:", e);
+}
export default defineConfig(({ command }) => {
const plugins: PluginOption[] = [
@@ -50,5 +58,8 @@ export default defineConfig(({ command }) => {
build: {
target: "esnext",
},
+ define: {
+ __COMMIT_HASH__: JSON.stringify(commitHash),
+ },
};
});