feat: use Forgejo stars API instead of GitHub
This commit is contained in:
parent
b3ec0c9695
commit
e4da2ef485
1 changed files with 3 additions and 2 deletions
|
|
@ -38,10 +38,11 @@ export const useGitHubStars = (owner: string, repo: string) => {
|
||||||
|
|
||||||
const fetchStars = async () => {
|
const fetchStars = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`https://api.github.com/repos/${owner}/${repo}`);
|
const baseUrl = import.meta.env.VITE_FORGEJO_BASE_URL || 'https://forge.wilddragon.net';
|
||||||
|
const response = await fetch(`${baseUrl}/api/v1/repos/${owner}/${repo}`);
|
||||||
if (!response.ok) return;
|
if (!response.ok) return;
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
const count = data.stargazers_count;
|
const count = data.stars_count;
|
||||||
if (typeof count === 'number') {
|
if (typeof count === 'number') {
|
||||||
setStarCount(count);
|
setStarCount(count);
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue