From 2f2e0b6762826cc2bb0ae05b928d0f7d0920bbdd Mon Sep 17 00:00:00 2001 From: Yifei Zhang Date: Thu, 30 Mar 2023 18:15:49 +0000 Subject: [PATCH] fix: commit id as version id --- app/layout.tsx | 3 ++- app/store/update.ts | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/layout.tsx b/app/layout.tsx index cc8e45de..32d3576c 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -8,7 +8,8 @@ import { ACCESS_CODES, IS_IN_DOCKER } from "./api/access"; let COMMIT_ID: string | undefined; try { COMMIT_ID = process - .execSync("git describe --tags --abbrev=0") + // .execSync("git describe --tags --abbrev=0") + .execSync("git rev-parse --short HEAD") .toString() .trim(); } catch (e) { diff --git a/app/store/update.ts b/app/store/update.ts index 0699369d..97fb343c 100644 --- a/app/store/update.ts +++ b/app/store/update.ts @@ -26,8 +26,10 @@ export const useUpdateStore = create()( } try { - const data = await (await fetch(FETCH_TAG_URL)).json(); - const remoteId = data[0].name as string; + // const data = await (await fetch(FETCH_TAG_URL)).json(); + // const remoteId = data[0].name as string; + const data = await (await fetch(FETCH_COMMIT_URL)).json(); + const remoteId = (data[0].sha as string).substring(0, 7); set(() => ({ lastUpdate: Date.now(), remoteId,