Skip to content

Commit

Permalink
fixup! feat(scopes): List and access OpenAPI scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
provokateurin committed Nov 7, 2023
1 parent 9603e20 commit f63c465
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions lib/Service/AppsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f63c465

Please sign in to comment.