forked from XiaoMo/ChatGPT-Next-Web
fix(#65): fix unknown git commit id
This commit is contained in:
parent
b1f27aaf93
commit
efaf6590ef
@ -5,10 +5,15 @@ import "./styles/prism.scss";
|
|||||||
import process from "child_process";
|
import process from "child_process";
|
||||||
import { ACCESS_CODES } from "./api/access";
|
import { ACCESS_CODES } from "./api/access";
|
||||||
|
|
||||||
const COMMIT_ID = process
|
let COMMIT_ID: string | undefined;
|
||||||
.execSync("git rev-parse --short HEAD")
|
try {
|
||||||
.toString()
|
COMMIT_ID = process
|
||||||
.trim();
|
.execSync("git rev-parse --short HEAD")
|
||||||
|
.toString()
|
||||||
|
.trim();
|
||||||
|
} catch (e) {
|
||||||
|
console.error("No git or not from git repo.")
|
||||||
|
}
|
||||||
|
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
title: "ChatGPT Next Web",
|
title: "ChatGPT Next Web",
|
||||||
@ -17,7 +22,7 @@ export const metadata = {
|
|||||||
|
|
||||||
function Meta() {
|
function Meta() {
|
||||||
const metas = {
|
const metas = {
|
||||||
version: COMMIT_ID,
|
version: COMMIT_ID ?? "unknown",
|
||||||
access: ACCESS_CODES.size > 0 ? "enabled" : "disabled",
|
access: ACCESS_CODES.size > 0 ? "enabled" : "disabled",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user