MCPcopy
hub / github.com/ChatGPTNextWeb/NextChat / getVersion

Function getVersion

app/store/update.ts:32–50  ·  view source on GitHub ↗
(type: VersionType)

Source from the content-addressed store, hash-verified

30type VersionType = "date" | "tag";
31
32async function getVersion(type: VersionType) {
33 if (type === "date") {
34 const data = (await (await fetch(FETCH_COMMIT_URL)).json()) as {
35 commit: {
36 author: { name: string; date: string };
37 };
38 sha: string;
39 }[];
40 const remoteCommitTime = data[0].commit.author.date;
41 const remoteId = new Date(remoteCommitTime).getTime().toString();
42 return remoteId;
43 } else if (type === "tag") {
44 const data = (await (await fetch(FETCH_TAG_URL)).json()) as {
45 commit: { sha: string; url: string };
46 name: string;
47 }[];
48 return data.at(0)?.name;
49 }
50}
51
52export const useUpdateStore = createPersistStore(
53 {

Callers 1

getLatestVersionFunction · 0.85

Calls 2

atMethod · 0.80
fetchFunction · 0.70

Tested by

no test coverage detected