Skip to content

Commit 5aa2e4d

Browse files
committed
fix: Introduce internal require_api_key setting
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
1 parent 4da6e68 commit 5aa2e4d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

.github/workflows/cluster-faces-test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ jobs:
163163
run: |
164164
./occ config:app:set --lazy --value ${{ matrix.pure-js-mode }} recognize tensorflow.purejs
165165
./occ config:app:set --value true recognize faces.enabled
166+
# Don't force API key usage to allow tests to run
167+
./occ config:app:set --value false recognize require_api_key
166168
# only use one core. GH actions has 2
167169
./occ config:app:set --value 1 recognize tensorflow.cores
168170

lib/Dav/Faces/PropFindPlugin.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use OCA\Recognize\Db\FaceDetectionWithTitle;
1616
use OCP\AppFramework\Db\DoesNotExistException;
1717
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
18+
use OCP\AppFramework\Services\IAppConfig;
1819
use OCP\AppFramework\Utility\ITimeFactory;
1920
use OCP\DB\Exception;
2021
use OCP\Files\DavUtil;
@@ -47,6 +48,7 @@ public function __construct(
4748
private ICrypto $crypto,
4849
private LoggerInterface $logger,
4950
private ITimeFactory $timeFactory,
51+
private IAppConfig $appConfig,
5052
) {
5153
}
5254

@@ -130,6 +132,9 @@ public function beforeMethod(RequestInterface $request, ResponseInterface $respo
130132
if (!str_starts_with($request->getPath(), 'recognize')) {
131133
return;
132134
}
135+
if ($this->appConfig->getAppValueString('require_api_key', 'true') !== 'true') {
136+
return;
137+
}
133138
$key = $request->getHeader('X-Recognize-Api-Key');
134139
if ($key === null) {
135140
throw new Forbidden('You must provide a valid X-Recognize-Api-Key');

0 commit comments

Comments
 (0)