diff options
Diffstat (limited to 'lib/Controller/NavigationController.php')
-rw-r--r-- | lib/Controller/NavigationController.php | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/Controller/NavigationController.php b/lib/Controller/NavigationController.php index 0911b12f..223f633f 100644 --- a/lib/Controller/NavigationController.php +++ b/lib/Controller/NavigationController.php @@ -52,6 +52,7 @@ use OCP\IConfig; use OCP\IL10N; use OCP\IRequest; use OCP\IURLGenerator; +use OCP\Http\Client\IClientService; class NavigationController extends Controller { @@ -69,6 +70,9 @@ class NavigationController extends Controller { /** @var IURLGenerator */ private $urlGenerator; + /** @var IClientService */ + private $clientService; + /** @var ActorService */ private $actorService; @@ -93,6 +97,7 @@ class NavigationController extends Controller { * @param string $userId * @param IConfig $config * @param IURLGenerator $urlGenerator + * @param IClientService $clientService * @param ActorService $actorService * @param DocumentService $documentService * @param ConfigService $configService @@ -101,7 +106,7 @@ class NavigationController extends Controller { * @param IL10N $l10n */ public function __construct( - IRequest $request, $userId, IConfig $config, IURLGenerator $urlGenerator, + IRequest $request, $userId, IConfig $config, IURLGenerator $urlGenerator, IClientService $clientService, ActorService $actorService, DocumentService $documentService, ConfigService $configService, PersonService $personService, MiscService $miscService, IL10N $l10n @@ -111,6 +116,7 @@ class NavigationController extends Controller { $this->userId = $userId; $this->config = $config; $this->urlGenerator = $urlGenerator; + $this->clientService = $clientService; $this->actorService = $actorService; $this->documentService = $documentService; @@ -175,6 +181,14 @@ class NavigationController extends Controller { } try { + $url = $this->request->getServerProtocol() . '://' . $this->request->getServerHost() . '/.well-known/webfinger'; + $response = $this->clientService->newClient()->get($url); + } catch (\GuzzleHttp\Exception\ClientException $e) { + $data['serverData']['error'] = $this->l10n->t('.well-known/webfinger isn\'t properly set up'); + $data['serverData']['setup'] = true; + } + + try { $this->actorService->createActor($this->userId, $this->userId); $data['serverData']['firstrun'] = true; } catch (AccountAlreadyExistsException $e) { @@ -301,4 +315,3 @@ class NavigationController extends Controller { } } - |