diff --git a/apps/api/src/app/info/info.service.ts b/apps/api/src/app/info/info.service.ts index 43aef61f6..1edbe072a 100644 --- a/apps/api/src/app/info/info.service.ts +++ b/apps/api/src/app/info/info.service.ts @@ -90,6 +90,27 @@ export class InfoService { }); } + private async countGitHubContributors(): Promise { + try { + const get = bent( + `https://api.github.com/repos/ghostfolio/ghostfolio/contributors`, + 'GET', + 'json', + 200, + { + 'User-Agent': 'request' + } + ); + + const contributors = await get(); + return contributors?.length; + } catch (error) { + console.error(error); + + return undefined; + } + } + private async countGitHubStargazers(): Promise { try { const get = bent( @@ -131,11 +152,13 @@ export class InfoService { const activeUsers1d = await this.countActiveUsers(1); const activeUsers30d = await this.countActiveUsers(30); + const gitHubContributors = await this.countGitHubContributors(); const gitHubStargazers = await this.countGitHubStargazers(); return { activeUsers1d, activeUsers30d, + gitHubContributors, gitHubStargazers }; } diff --git a/apps/client/src/app/pages/about/about-page.html b/apps/client/src/app/pages/about/about-page.html index fc7a2d8a1..0f327c693 100644 --- a/apps/client/src/app/pages/about/about-page.html +++ b/apps/client/src/app/pages/about/about-page.html @@ -94,7 +94,7 @@
-
+

{{ statistics?.activeUsers1d ?? '-' }}

@@ -102,7 +102,7 @@ Active Users (Last 24 hours)
-
+

{{ statistics?.activeUsers30d ?? '-' }}

@@ -110,7 +110,13 @@ Active Users (Last 30 days)
-
+
+

+ {{ statistics?.gitHubContributors ?? '-' }} +

+
Contributors on GitHub
+
+

{{ statistics?.gitHubStargazers ?? '-' }}

diff --git a/libs/common/src/lib/interfaces/statistics.interface.ts b/libs/common/src/lib/interfaces/statistics.interface.ts index dcb2729e5..5bac1387f 100644 --- a/libs/common/src/lib/interfaces/statistics.interface.ts +++ b/libs/common/src/lib/interfaces/statistics.interface.ts @@ -1,5 +1,6 @@ export interface Statistics { activeUsers1d: number; activeUsers30d: number; + gitHubContributors: number; gitHubStargazers: number; }