mirror of
https://github.com/zadam/trilium.git
synced 2025-11-08 06:15:48 +01:00
website: add a GitHub social button to the site's header
This commit is contained in:
15
apps/website/src/github-utils.ts
Normal file
15
apps/website/src/github-utils.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
const API_URL = "https://api.github.com/repos/TriliumNext/Trilium";
|
||||
|
||||
/** Returns the number of stargazers of the Trilium's GitHub repository. */
|
||||
export async function getRepoStargazersCount() {
|
||||
const response = await fetch(API_URL);
|
||||
|
||||
if (response.ok) {
|
||||
const details = await response.json();
|
||||
if ("stargazers_count" in details) {
|
||||
return details["stargazers_count"];
|
||||
}
|
||||
}
|
||||
|
||||
return 31862; // The count as of 2025-10-03
|
||||
}
|
||||
Reference in New Issue
Block a user