diff --git a/appinfo/info.xml b/appinfo/info.xml
index cc73dcb2..5c0227ba 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -5,7 +5,7 @@
Social
🎉 Nextcloud becomes part of the federated social networks!
- 0.0.37
+ 0.0.41
agpl
Maxence Lange
Julius Härtl
diff --git a/appinfo/routes.php b/appinfo/routes.php
index 3703c956..293d4bb7 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -20,8 +20,9 @@ return [
'name' => 'Navigation#account', 'url' => '/account/{path}', 'verb' => 'GET',
'requirements' => ['path' => '.+'], 'defaults' => ['path' => '']
],
- // ['name' => 'Navigation#public', 'url' => '/{username}', 'verb' => 'GET'],
-
+ ['name' => 'Navigation#public', 'url' => '/{username}', 'verb' => 'GET'],
+ ['name' => 'Navigation#documentsGet', 'url' => '/documents/get', 'verb' => 'GET'],
+ ['name' => 'Navigation#documentsGetPublic', 'url' => '/documents/public', 'verb' => 'GET'],
// ['name' => 'Account#create', 'url' => '/local/account/{username}', 'verb' => 'POST'],
['name' => 'Account#info', 'url' => '/local/account/{username}', 'verb' => 'GET'],
@@ -47,6 +48,7 @@ return [
['name' => 'Local#accountsSearch', 'url' => '/api/v1/accounts/search', 'verb' => 'GET'],
['name' => 'Local#accountFollow', 'url' => '/api/v1/account/follow', 'verb' => 'PUT'],
['name' => 'Local#accountUnfollow', 'url' => '/api/v1/account/follow', 'verb' => 'DELETE'],
+ ['name' => 'Local#accountInfo', 'url' => '/api/v1/account/info', 'verb' => 'GET'],
['name' => 'Local#actorInfo', 'url' => '/api/v1/actor/info', 'verb' => 'GET'],
[
diff --git a/lib/Controller/LocalController.php b/lib/Controller/LocalController.php
index c824aeaa..cd6bb0f3 100644
--- a/lib/Controller/LocalController.php
+++ b/lib/Controller/LocalController.php
@@ -37,6 +37,7 @@ use OCA\Social\AppInfo\Application;
use OCA\Social\Exceptions\InvalidResourceException;
use OCA\Social\Model\ActivityPub\ACore;
use OCA\Social\Model\Post;
+use OCA\Social\Service\ActivityPub\DocumentService;
use OCA\Social\Service\ActivityPub\FollowService;
use OCA\Social\Service\ActivityPub\NoteService;
use OCA\Social\Service\ActivityPub\PersonService;
@@ -78,6 +79,9 @@ class LocalController extends Controller {
/** @var NoteService */
private $noteService;
+ /** @var DocumentService */
+ private $documentService;
+
/** @var MiscService */
private $miscService;
@@ -92,12 +96,14 @@ class LocalController extends Controller {
* @param ActorService $actorService
* @param PostService $postService
* @param NoteService $noteService
+ * @param DocumentService $documentService
* @param MiscService $miscService
*/
public function __construct(
IRequest $request, $userId, PersonService $personService,
FollowService $followService, ActorService $actorService,
PostService $postService, NoteService $noteService,
+ DocumentService $documentService,
MiscService $miscService
) {
parent::__construct(Application::APP_NAME, $request);
@@ -109,6 +115,7 @@ class LocalController extends Controller {
$this->followService = $followService;
$this->postService = $postService;
$this->noteService = $noteService;
+ $this->documentService = $documentService;
$this->miscService = $miscService;
}
@@ -179,6 +186,9 @@ class LocalController extends Controller {
* @NoAdminRequired
* @NoSubAdminRequired
*
+ * @param int $since
+ * @param int $limit
+ *
* @return DataResponse
*/
public function streamHome(int $since = 0, int $limit = 5): DataResponse {
@@ -343,6 +353,29 @@ class LocalController extends Controller {
}
+ /**
+ *
+ * // TODO: Delete the NoCSRF check
+ *
+ * @NoCSRFRequired
+ * @NoAdminRequired
+ * @NoSubAdminRequired
+ *
+ * @param string $account
+ *
+ * @return DataResponse
+ */
+ public function accountInfo(string $account): DataResponse {
+ try {
+ $actor = $this->personService->getFromAccount($account);
+
+ return $this->success(['account' => $actor]);
+ } catch (Exception $e) {
+ return $this->fail($e);
+ }
+ }
+
+
/**
*
* // TODO: Delete the NoCSRF check
diff --git a/lib/Controller/NavigationController.php b/lib/Controller/NavigationController.php
index 54c7e184..2801bcb3 100644
--- a/lib/Controller/NavigationController.php
+++ b/lib/Controller/NavigationController.php
@@ -32,6 +32,7 @@ namespace OCA\Social\Controller;
use daita\MySmallPhpTools\Traits\TArrayTools;
use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse;
+use Exception;
use OC\User\NoUserException;
use OCA\Social\AppInfo\Application;
use OCA\Social\Exceptions\AccountAlreadyExistsException;
@@ -237,4 +238,48 @@ class NavigationController extends Controller {
return $page;
}
+
+
+ /**
+ *
+ * // TODO: Delete the NoCSRF check
+ *
+ * @NoCSRFRequired
+ * @NoAdminRequired
+ * @NoSubAdminRequired
+ *
+ * @param string $id
+ *
+ * @return DataResponse
+ */
+ public function documentsGet(string $id): DataResponse {
+ try {
+ return $this->success([$id]);
+ } catch (Exception $e) {
+ return $this->fail($e);
+ }
+ }
+
+
+ /**
+ *
+ * // TODO: Delete the NoCSRF check
+ *
+ * @PublicPage
+ * @NoCSRFRequired
+ * @NoAdminRequired
+ * @NoSubAdminRequired
+ *
+ * @param string $id
+ *
+ * @return DataResponse
+ */
+ public function documentsGetPublic(string $id): DataResponse {
+ try {
+ return $this->success([$id]);
+ } catch (Exception $e) {
+ return $this->fail($e);
+ }
+ }
+
}