feat: use commit time as version id

This commit is contained in:
Yidadaa
2023-05-04 00:12:00 +08:00
parent 074bd9f045
commit fce3b3ce7b
3 changed files with 30 additions and 12 deletions

View File

@@ -53,10 +53,9 @@ export const useUpdateStore = create<UpdateStore>()(
}));
try {
// 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);
const remoteCommitTime = data[0].commit.committer.date;
const remoteId = new Date(remoteCommitTime).getTime().toString();
set(() => ({
remoteVersion: remoteId,
}));