diff --git a/web/components/Footer.tsx b/web/components/Footer.tsx index 0a63659a..cd92752b 100644 --- a/web/components/Footer.tsx +++ b/web/components/Footer.tsx @@ -1,9 +1,10 @@ import getConfig from 'next/config' import CopyleftIcon from './CopyleftIcon' +import Link from 'next/link' const Footer: React.FunctionComponent = () => { const { publicRuntimeConfig } = getConfig() - const { modifiedDate, modifiedYear } = publicRuntimeConfig + const { modifiedDate, modifiedYear, gitHash } = publicRuntimeConfig return (
@@ -13,6 +14,17 @@ const Footer: React.FunctionComponent = () => {

{modifiedYear} Conky developers, updated{' '} {new Date(modifiedDate).toLocaleString()} UTC + {gitHash && ( + + {' '} + + {`(${gitHash})`} + + + )}

diff --git a/web/next.config.mjs b/web/next.config.mjs index 8febd58a..2adea4c7 100644 --- a/web/next.config.mjs +++ b/web/next.config.mjs @@ -1,13 +1,25 @@ // @ts-check +import { spawn } from 'child_process' -/** - * @type {import('next').NextConfig} - */ -const nextConfig = { - publicRuntimeConfig: { - modifiedDate: new Date().toISOString(), - modifiedYear: new Date().getFullYear(), - }, +const config = async (_phase, { _defaultConfig }) => { + const gitHash = await new Promise((resolve) => { + const git = spawn('git', ['rev-parse', '--short', 'HEAD']) + git.stdout.on('data', (data) => { + resolve(data.toString().trim()) + }) + }) + + /** + * @type {import('next').NextConfig} + */ + const nextConfig = { + publicRuntimeConfig: { + modifiedDate: new Date().toISOString(), + modifiedYear: new Date().getFullYear(), + gitHash, + }, + } + return nextConfig } -export default nextConfig +export default config