diff --git a/rest/index.php b/rest/index.php index a5263adfc8b765f6c54db5808a7ed99012b01ef2..6fc30fccd47df48c65761133f524da4bd02eb161 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 bf67b1800775703936c385d23139fc4f8c63fd95..a8256349f12a936c9df43997c74a1de3b9d260ee 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 96fbf1b3a7e82511d9118bd87d2f037f5d9f38cb..4bf180906bddffeacbfed26c21500e2f3717ddc7 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; + } } }