Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
alpha1
Maxence Lange 2018-11-23 20:07:32 -01:00 zatwierdzone przez Julius Härtl
rodzic 8f9ba58c71
commit 56e011049e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4C614C6ED2CDE6DF
4 zmienionych plików z 83 dodań i 3 usunięć

Wyświetl plik

@ -5,7 +5,7 @@
<name>Social</name>
<summary>🎉 Nextcloud becomes part of the federated social networks!</summary>
<description><![CDATA[test]]></description>
<version>0.0.37</version>
<version>0.0.41</version>
<licence>agpl</licence>
<author mail="maxence@artificial-owl.com">Maxence Lange</author>
<author mail="jus@bitgrid.net">Julius Härtl</author>

Wyświetl plik

@ -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'],
[

Wyświetl plik

@ -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

Wyświetl plik

@ -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);
}
}
}