« get me outta code hell

experimental site header in generated HTML - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2022-07-12 13:53:34 -0300
committer(quasar) nebula <qznebula@protonmail.com>2022-07-12 13:53:34 -0300
commitb6b8be24a705d0c9d710066751480304dd64d758 (patch)
tree0faafaafa301042c7abf6a9b46326f0038e85473
parentf5854466cb8837350fea5a86d62b3806b35073d2 (diff)
experimental site header in generated HTML
-rwxr-xr-xsrc/upd8.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/upd8.js b/src/upd8.js
index 7f05fba..4861139 100755
--- a/src/upd8.js
+++ b/src/upd8.js
@@ -54,6 +54,8 @@ import {
   unlink,
 } from 'fs/promises';
 
+import { execSync } from 'child_process';
+
 import genThumbs from './gen-thumbs.js';
 import {listingSpec, listingTargetSpec} from './listing-spec.js';
 import urlSpec from './url-spec.js';
@@ -151,6 +153,15 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
 
 const CACHEBUST = 11;
 
+let COMMIT;
+try {
+  COMMIT = execSync('git log --format="%h %B" -n 1 HEAD').toString().trim();
+} catch (error) {
+  COMMIT = '(failed to detect)';
+}
+
+const BUILD_TIME = new Date();
+
 const DEFAULT_STRINGS_FILE = 'strings-default.json';
 
 // Code that's common 8etween the 8uild code (i.e. upd8.js) and gener8ted
@@ -1219,6 +1230,31 @@ writePage.html = (
           'data-rebase-media': to('media.root'),
           'data-rebase-data': to('data.root'),
         })}>
+            <!--
+              ${[
+                wikiInfo.canonicalBase
+                  ? `hsmusic.wiki - ${wikiInfo.name}, ${wikiInfo.canonicalBase}`
+                  : `hsmusic.wiki - ${wikiInfo.name}`,
+                'Code copyright 2019-2022 Quasar Nebula et al (MIT License)',
+                ...wikiInfo.canonicalBase === 'https://hsmusic.wiki/' ? [
+                  'Data avidly compiled and localization brought to you',
+                  'by our awesome team and community of wiki contributors',
+                  '***',
+                  'Want to contribute? Join our Discord or leave feedback!',
+                  '- https://hsmusic.wiki/discord/',
+                  '- https://hsmusic.wiki/feedback/',
+                  '- https://github.com/hsmusic/',
+                ] : [
+                  'https://github.com/hsmusic/',
+                ],
+                '***',
+                `Site built: ${BUILD_TIME.toLocaleString('en-US', {
+                  dateStyle: 'long',
+                  timeStyle: 'long',
+                })}`,
+                `Latest code commit: ${COMMIT}`,
+              ].filter(Boolean).join('\n')}
+            -->
             <head>
                 <title>${
                   showWikiNameInTitle