mirror of
https://github.com/LiteyukiStudio/LiteyukiBot.git
synced 2024-11-22 22:37:37 +08:00
📝 新增gitea数据
This commit is contained in:
parent
da905d21bd
commit
dbc4d83b08
@ -83,6 +83,20 @@ async function getGithubStats() {
|
||||
}
|
||||
}
|
||||
|
||||
async function getRepoStats() {
|
||||
// 两个接口各数据,哪个大取哪个
|
||||
const githubStats = await getGithubStats();
|
||||
const giteaStats = await getGiteaStats();
|
||||
return {
|
||||
stars: Math.max(githubStats.stars, giteaStats.stars),
|
||||
forks: Math.max(githubStats.forks, giteaStats.forks),
|
||||
watchers: Math.max(githubStats.watchers, giteaStats.watchers),
|
||||
issues: Math.max(githubStats.issues, giteaStats.issues),
|
||||
prs: Math.max(githubStats.prs, giteaStats.prs),
|
||||
size: Math.max(githubStats.size, giteaStats.size),
|
||||
};
|
||||
}
|
||||
|
||||
// 实现接口
|
||||
export const statsApi: StatsApi = {
|
||||
getTotal: async () => {
|
||||
@ -103,7 +117,7 @@ export const statsApi: StatsApi = {
|
||||
return -1;
|
||||
}
|
||||
},
|
||||
getGithubStats: getGiteaStats,
|
||||
getGithubStats: getRepoStats,
|
||||
getPluginNum: async () => {
|
||||
try {
|
||||
const res = await fetch('/plugins.json');
|
||||
|
Loading…
Reference in New Issue
Block a user