From f63c465981aada885a3a535f2d4e657fb7f2b577 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Tue, 7 Nov 2023 09:26:29 +0100 Subject: [PATCH] fixup! feat(scopes): List and access OpenAPI scopes --- lib/Service/AppsService.php | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/lib/Service/AppsService.php b/lib/Service/AppsService.php index dc1f20e..2800fc4 100644 --- a/lib/Service/AppsService.php +++ b/lib/Service/AppsService.php @@ -21,21 +21,17 @@ public function findSupported(): array { $apis = ['core']; foreach ($this->appManager->getInstalledApps() as $app) { - $path = $this->getSpecPath($app); - if ($path != null && file_exists($path)) { - $apis[] = $app; - - try { - $baseDir = $this->appManager->getAppPath($app); - $iterator = new \DirectoryIterator($baseDir); - foreach ($iterator as $file) { - if (str_starts_with($file->getFilename(), 'openapi-') - && str_ends_with($file->getFilename(), '.json')) { - $apis[] = $app . '-' . substr($file->getFilename(), 8, -5); - } + try { + $baseDir = $this->appManager->getAppPath($app); + $iterator = new \DirectoryIterator($baseDir); + foreach ($iterator as $file) { + if ($file->getFilename() == 'openapi.json') { + $apis[] = $app; + } else if (str_starts_with($file->getFilename(), 'openapi-') && str_ends_with($file->getFilename(), '.json')) { + $apis[] = $app . '-' . substr($file->getFilename(), 8, -5); } - } catch (AppPathNotFoundException) { } + } catch (AppPathNotFoundException) { } } return $apis;