add commmit field

This commit is contained in:
ashley 2024-05-09 14:58:20 +00:00
parent 3a3cacb6d0
commit fd26924324

View file

@ -30,6 +30,7 @@ const pkg = require("../../../package.json");
const os = require('os'); const os = require('os');
const cnf = require("../../../config.json"); const cnf = require("../../../config.json");
const innertube = require("../libpoketube-youtubei-objects.json"); const innertube = require("../libpoketube-youtubei-objects.json");
const { exec } = require('child_process');
const verfull = "v24.0605-VeE-MINOR_UPDATE-stable-dev-nonLTS-git-MTcxNTAwOTczNQ=="; const verfull = "v24.0605-VeE-MINOR_UPDATE-stable-dev-nonLTS-git-MTcxNTAwOTczNQ==";
const versmol = "v24.0605-vEe" const versmol = "v24.0605-vEe"
@ -211,6 +212,8 @@ app.use("/sb/i/:v/:imagePath/:img", async function (req, res) {
}); });
app.get("/api/version.json", async (req, res) => { app.get("/api/version.json", async (req, res) => {
let latestCommitHash;
const invidious = await modules const invidious = await modules
.fetch("https://invid-api.poketube.fun/api/v1/stats") .fetch("https://invid-api.poketube.fun/api/v1/stats")
.then((res) => res.text()) .then((res) => res.text())
@ -220,12 +223,15 @@ app.use("/sb/i/:v/:imagePath/:img", async function (req, res) {
const totalMemory = os.totalmem() / (1024 * 1024 * 1024); const totalMemory = os.totalmem() / (1024 * 1024 * 1024);
const roundedMemory = totalMemory.toFixed(2); const roundedMemory = totalMemory.toFixed(2);
exec('git rev-list HEAD -n 1 --abbrev-commit', (error, stdout, stderr) => latestCommitHash = error || stderr ? console.error(`Error executing command: ${error || stderr}`) : stdout.trim());
const response = { const response = {
pt_version: { pt_version: {
version:versmol, version:versmol,
version_full:verfull version_full:verfull
}, },
branch, branch,
commit: latestCommitHash,
updatequote, updatequote,
relaseunixdate, relaseunixdate,
vernum: versionnumber, vernum: versionnumber,