mirror of
https://github.com/nextcloud/server.git
synced 2026-02-24 02:11:51 -05:00
31 lines
788 B
PHP
31 lines
788 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
namespace OC\OCM;
|
|
|
|
use OCP\AppFramework\Http\JSONResponse;
|
|
use OCP\Http\WellKnown\GenericResponse;
|
|
use OCP\Http\WellKnown\IHandler;
|
|
use OCP\Http\WellKnown\IRequestContext;
|
|
use OCP\Http\WellKnown\IResponse;
|
|
|
|
class OCMDiscoveryHandler implements IHandler {
|
|
public function __construct(
|
|
private readonly OCMDiscoveryService $discoveryService,
|
|
) {
|
|
}
|
|
|
|
public function handle(string $service, IRequestContext $context, ?IResponse $previousResponse): ?IResponse {
|
|
if ($service !== 'ocm') {
|
|
return $previousResponse;
|
|
}
|
|
|
|
return new GenericResponse(new JsonResponse($this->discoveryService->getLocalOCMProvider()));
|
|
}
|
|
}
|