discoveryService->resetCache(); $this->discoveryService->fetch(); $output->writeln('✓ Fetched /hosting/discovery endpoint'); $this->parser->getUrlSrcValue('application/vnd.openxmlformats-officedocument.wordprocessingml.document'); $output->writeln('✓ Valid mimetype response'); // FIXME: Optional when allowing generic WOPI servers $this->parser->getUrlSrcValue('Capabilities'); $output->writeln('✓ Valid capabilities entry'); } public function testCapabilities(OutputInterface $output): void { $this->capabilitiesService->resetCache(); $this->capabilitiesService->fetch(); $output->writeln('✓ Fetched /hosting/capabilities endpoint'); if ($this->capabilitiesService->getCapabilities() === []) { throw new \Exception('Empty capabilities, unexpected result from ' . $this->capabilitiesService->getCapabilitiesEndpoint()); } $output->writeln('✓ Detected WOPI server: ' . $this->capabilitiesService->getServerProductName() . ' ' . $this->capabilitiesService->getProductVersion() . ''); } /** * Detect public URL of the WOPI server for setting CSP on F7cloud * * This value is not meant to be set manually. If this turns out to be the wrong URL * it is likely a misconfiguration on your WOPI server. Collabora will inherit the URL to use * form the request and the ssl.enable/ssl.termination settings and server_name (if configured) */ public function autoConfigurePublicUrl(): void { $determinedUrl = $this->parser->getUrlSrcValue('application/vnd.openxmlformats-officedocument.wordprocessingml.document'); $detectedUrl = $this->appConfig->domainOnly($determinedUrl); $this->appConfig->setAppValue('public_wopi_url', $detectedUrl); } }