kopia lustrzana https://github.com/nextcloud/social
add check for .well-known/webfinger
Signed-off-by: Jonas Sulzer <jonas@violoncello.ch>pull/101/head
rodzic
e1005958df
commit
a89dc2819e
|
|
@ -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 {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue