From a89dc2819eeb6fb326934552954ca47e1cc61c6f Mon Sep 17 00:00:00 2001
From: Jonas Sulzer
Date: Fri, 30 Nov 2018 09:51:48 +0100
Subject: add check for .well-known/webfinger
Signed-off-by: Jonas Sulzer
---
lib/Controller/NavigationController.php | 17 +++++++++++++++--
src/App.vue | 8 ++++++++
2 files changed, 23 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;
@@ -174,6 +180,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;
@@ -301,4 +315,3 @@ class NavigationController extends Controller {
}
}
-
diff --git a/src/App.vue b/src/App.vue
index c7c9355b..299d4c2e 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -23,6 +23,11 @@
+
+ {{ t('social', 'Social app setup') }}
+ {{ t('social', '.well-known/webfinger isn\'t properly set up!') }}
+ {{ t('social', 'Social needs the .well-known auto discovery to be properly set up. If Nextcloud is not installed in the root of the domain it is often the case, that Nextcloud can\'t configure this automatically. To use Social the admin of this Nextcloud instance needs to manually configure the .well-known redirects: ') }}{{ t('social', 'Open Documentation') }} ↗
+
{{ t('social', 'The social app requires to be setup by the server administrator.') }}
@@ -57,6 +62,9 @@
#social-spacer a:focus {
border: none !important;
}
+ a.external_link {
+ text-decoration: underline;
+ }
--
cgit v1.2.3