'1.7', 'website' => 'Nextcloud', 'host' => $this->request->getServerHost(), 'contact' => '', 'ssl' => 'false', ]; return new DataResponse($data); } /** * Get the capabilities * * @return DataResponse}, array{}> * * 200: Capabilities returned */ #[PublicPage] #[ApiRoute(verb: 'GET', url: '/capabilities', root: '/cloud')] public function getCapabilities(): DataResponse { $result = []; [$major, $minor, $micro] = \OCP\Util::getVersion(); $result['version'] = [ 'major' => (int)$major, 'minor' => (int)$minor, 'micro' => (int)$micro, 'string' => \OC_Util::getVersionString(), 'edition' => '', 'extendedSupport' => \OCP\Util::hasExtendedSupport() ]; if ($this->userSession->isLoggedIn()) { $result['capabilities'] = $this->capabilitiesManager->getCapabilities(); } else { $result['capabilities'] = $this->capabilitiesManager->getCapabilities(true); } $response = new DataResponse($result); $response->setETag(md5(json_encode($result))); return $response; } #[PublicPage] #[BruteForceProtection('login')] #[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)] #[ApiRoute(verb: 'POST', url: '/check', root: '/person')] public function personCheck(string $login = '', string $password = ''): DataResponse { if ($login !== '' && $password !== '') { if ($this->userManager->checkPassword($login, $password)) { return new DataResponse([ 'person' => [ 'personid' => $login ] ]); } $response = new DataResponse([], 102); $response->throttle(); return $response; } return new DataResponse([], 101); } #[PublicPage] #[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)] #[ApiRoute(verb: 'GET', url: '/key/{cloudId}', root: '/identityproof')] public function getIdentityProof(string $cloudId): DataResponse { $userObject = $this->userManager->get($cloudId); if ($userObject !== null) { $key = $this->keyManager->getKey($userObject); $data = [ 'public' => $key->getPublic(), ]; return new DataResponse($data); } return new DataResponse(['Account not found'], 404); } }