1
0
mirror of https://git.sr.ht/~cadence/bibliogram synced 2024-11-22 16:17:29 +00:00

Try to provide commit hash in version

This commit is contained in:
Cadence Fish 2020-01-28 19:23:53 +13:00
parent 7b5db91efc
commit c1fb079a51
No known key found for this signature in database
GPG Key ID: 81015DF9AA8607E1

View File

@ -1,4 +1,5 @@
const constants = require("../../lib/constants") const constants = require("../../lib/constants")
const child_process = require("child_process")
const {fetchUser} = require("../../lib/collectors") const {fetchUser} = require("../../lib/collectors")
function reply(statusCode, content) { function reply(statusCode, content) {
@ -9,6 +10,16 @@ function reply(statusCode, content) {
} }
} }
let commit = ""
{
const p = child_process.spawn("git", ["rev-parse", "--short", "HEAD"])
p.on("error", console.error)
p.stdout.on("data", data => {
const string = data.toString()
commit = "-" + string.match(/[0-9a-f]+/)[0]
})
}
module.exports = [ module.exports = [
{ {
route: `/api/user/(${constants.external.username_regex})`, methods: ["GET"], code: async ({fill}) => { route: `/api/user/(${constants.external.username_regex})`, methods: ["GET"], code: async ({fill}) => {
@ -35,7 +46,7 @@ module.exports = [
version: "2.0", version: "2.0",
software: { software: {
name: "bibliogram", name: "bibliogram",
version: "1.0.0" version: "1.0.0"+commit
}, },
protocols: [], protocols: [],
services: { services: {