检测版本更新

close #231
This commit is contained in:
BTMuli
2026-03-10 12:46:46 +08:00
parent b5c7c6e8b1
commit c56b05b4f1
9 changed files with 1103 additions and 941 deletions

26
src/utils/Github.ts Normal file
View File

@@ -0,0 +1,26 @@
/**
* Github API
* @since Beta v0.9.8
*/
import TGHttp from "@utils/TGHttp.js";
/**
* 获取最新Release版本
* @since Beta v0.9.8
* @returns 最新版本
*/
export async function getLatestReleaseVersion(): Promise<string> {
const latestReleaseApi: Readonly<string> =
"https://api.github.com/repos/BTMuli/TeyvatGuide/releases/latest";
try {
const latestReleaseResp = await TGHttp<TGApp.Plugins.Github.LastestReleaseResp>(
latestReleaseApi,
{ method: "GET" },
);
return latestReleaseResp.tag_name.replace("v", "");
} catch (e) {
console.error(e);
return "0";
}
}