From 40172fa66206b2fe7a80dbfdcc02e88110ab6c29 Mon Sep 17 00:00:00 2001
From: Jean-Laurent DUZANT <jean-laurent.duzant@xelians.fr>
Date: Thu, 16 Mar 2023 17:19:34 +0100
Subject: [PATCH] FIX #24074 TIME 0:05

---
 rest/index.php                                |  3 +--
 .../controllers/AuthenticationController.php  | 21 -------------------
 .../app/home/aboutUs/about-us.component.ts    | 21 +++++++------------
 3 files changed, 9 insertions(+), 36 deletions(-)

diff --git a/rest/index.php b/rest/index.php
index a5263adfc8..6fc30fccd4 100755
--- a/rest/index.php
+++ b/rest/index.php
@@ -94,8 +94,7 @@ $app->patch('/configurations/{id}', \Configuration\controllers\ConfigurationCont
 $app->delete('/configurations/{id}', \Configuration\controllers\ConfigurationController::class . ':delete');
 $app->get('/configurations/{id}/connection', \Configuration\controllers\ConfigurationController::class . ':testConnection');
 
-// GitInformation
-$app->get('/repoInformation', \SrcCore\controllers\AuthenticationController::class . ':getGitRepoInformation');
+// CommitInformation
 $app->get('/commitInformation', \SrcCore\controllers\AuthenticationController::class . ':getGitCommitInformation');
 
 //Connectors
diff --git a/src/core/controllers/AuthenticationController.php b/src/core/controllers/AuthenticationController.php
index bf67b18007..a8256349f1 100755
--- a/src/core/controllers/AuthenticationController.php
+++ b/src/core/controllers/AuthenticationController.php
@@ -556,27 +556,6 @@ class AuthenticationController
         return true;
     }
 
-    public function getGitRepoInformation(Request $request, Response $response)
-    {
-        if (!file_exists('package.json')) {
-            return $response->withJson(['url' => null]);
-        }
-
-        $license = json_decode(file_get_contents('package.json'), true);
-
-        if (empty($license) || empty($license['license'])) {
-            return $response->withJson(['url' => null]);
-        }
-
-        if ($license['license'] == "GPL-3.0") {
-            return $response->withJson(['url' => "https://labs.maarch.org/maarch/MaarchParapheur"]);
-        } elseif (strtolower($license['license']) == "maarch") {
-            return $response->withJson(['url' => "https://labs.maarch.org/maarch/MaarchParapheurPro"]);
-        } else {
-            return $response->withJson(['url' => null]);
-        }
-    }
-
     public function getGitCommitInformation(Request $request, Response $response)
     {
         if (!file_exists('.git/HEAD')) {
diff --git a/src/frontend/app/home/aboutUs/about-us.component.ts b/src/frontend/app/home/aboutUs/about-us.component.ts
index 96fbf1b3a7..4bf180906b 100644
--- a/src/frontend/app/home/aboutUs/about-us.component.ts
+++ b/src/frontend/app/home/aboutUs/about-us.component.ts
@@ -79,7 +79,7 @@ export class AboutUsComponent implements OnInit {
         this.license = environment.LICENSE;
         this.currentYear = new Date().getFullYear();
         await this.loadCommitInformation();
-        await this.getGitRepoLink();
+        this.repoUrl = this.getGitRepoLink();
         this.loading = false;
     }
 
@@ -99,17 +99,12 @@ export class AboutUsComponent implements OnInit {
     }
 
     getGitRepoLink() {
-        return new Promise((resolve) => {
-            this.http.get('../rest/repoInformation').pipe(
-                tap((data: any) => {
-                    this.repoUrl = data.url !== null ? data.url : this.translate.instant('lang.undefined');
-                    resolve(true);
-                }),
-                catchError((err: any) => {
-                    this.notify.handleErrors(err);
-                    return of(false);
-                })
-            ).subscribe();
-        });
+        if (this.license === 'GPL-3.0') {
+            return 'https://labs.maarch.org/maarch/MaarchParapheur';
+        } else if (this.license === 'MAARCH') {
+            return 'https://labs.maarch.org/maarch/MaarchParapheurPro';
+        } else {
+            return null;
+        }
     }
 }
-- 
GitLab