Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.

Commit

Permalink
add commit info
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAwesome98-Real committed Feb 16, 2024
1 parent 2deed38 commit f691b12
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,4 @@ www/
# things for compile time data
src/static/images/88x31/3rdparty
src/_data/gd.json
src/_data/buildinfo.json
28 changes: 27 additions & 1 deletion prebuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,15 @@ for (let set of eightyeightbythirtyones) {
let url = new URL(button.src);
client
.get(
{ hostname: url.hostname, path: url.pathname + url.search, headers: { "User-Agent": "Mozilla/5.0" } },
{
hostname: url.hostname,
path: url.pathname + url.search,
headers: {
"User-Agent": `tauon.dev-prebuild-fetcher/${
require("./package.json").version
} node-http/${process.versions.node} <[email protected]>`,
},
},
(res) => {
let outfile =
"src/static/images/88x31/3rdparty/" +
Expand Down Expand Up @@ -68,3 +76,21 @@ let gd = new GD();
}
filesystem.writeFileSync("src/_data/gd.json", JSON.stringify(userinfo));
})();

const spawn = require("child_process").spawn;
const proc = spawn("git", ["log", "-n", "1", '--pretty=format:"%h%n%s%n%ad"']);

let output = "";
proc.stdout.on("data", (chunk) => {
output += chunk.toString();
});
proc.on("exit", () => {
let [hash, message, dateRaw] = output.slice(1, -1).split(/\r\n|\r|\n/g);
let data = {
hash,
message,
commitDate: new Date(dateRaw),
buildDate: new Date(),
};
filesystem.writeFileSync("src/_data/buildinfo.json", JSON.stringify(data));
});
3 changes: 3 additions & 0 deletions src/_includes/layouts/main.njk
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@
</style>
</div>
</div>
<br/>
<center><small>compiled at {{ buildinfo.buildDate }} - git commit hash {{ buildinfo.hash }} - {{ buildinfo.message }} (at {{ buildinfo.commitDate }})</small></center>
<br/>
<div class="browser_warning"><img src="/images/nochrome.png" height="48" /><span>it seems that your browser is based on <strong>chromium technologies!</strong> you should install a free browser such as <a href="https://www.mozilla.org/en-US/firefox/new/">firefox</a> to stop google taking over the web! (they have <a href="https://en.m.wikipedia.org/wiki/Web_Environment_Integrity">tried already</a>...)</span></div>
<script src="/js/nochrome.js"></script>
<script src="/js/abbr.js"></script>
Expand Down

0 comments on commit f691b12

Please sign in to comment.