summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Sulzer <jonas@violoncello.ch>2018-11-30 09:51:48 +0100
committerJulius Härtl <jus@bitgrid.net>2018-12-03 11:07:22 +0100
commita89dc2819eeb6fb326934552954ca47e1cc61c6f (patch)
treec81b5f52988f4a36f29cf5297e34e55b57a1db06
parente1005958df4f8c15678088f31a7143116956199c (diff)
add check for .well-known/webfinger
Signed-off-by: Jonas Sulzer <jonas@violoncello.ch>
-rw-r--r--lib/Controller/NavigationController.php17
-rw-r--r--src/App.vue8
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;
@@ -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 {
}
}
-
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 @@
</p>
</form>
</template>
+ <template v-else-if="serverData.error">
+ <h2>{{ t('social', 'Social app setup') }}</h2>
+ <p>{{ t('social', '.well-known/webfinger isn\'t properly set up!') }}</p>
+ <p>{{ 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: ') }}<a class="external_link" href="https://docs.nextcloud.com/server/15/go.php?to=admin-setup-well-known-URL" target="_blank" rel="noreferrer noopener">{{ t('social', 'Open Documentation') }} ↗</a></p>
+ </template>
<template v-else>
<p>{{ t('social', 'The social app requires to be setup by the server administrator.') }}</p>
</template>
@@ -57,6 +62,9 @@
#social-spacer a:focus {
border: none !important;
}
+ a.external_link {
+ text-decoration: underline;
+ }
</style>