kopia lustrzana https://github.com/nextcloud/social
rodzic
745810e2b0
commit
1ebb155fcf
|
@ -60,7 +60,7 @@ return [
|
|||
|
||||
['name' => 'ActivityPub#displayPost', 'url' => '/@{username}/{token}', 'verb' => 'GET'],
|
||||
|
||||
['name' => 'OStatus#subscribe', 'url' => '/ostatus/follow/{uri}', 'verb' => 'GET'],
|
||||
['name' => 'OStatus#subscribe', 'url' => '/ostatus/follow/', 'verb' => 'GET'],
|
||||
['name' => 'OStatus#followRemote', 'url' => '/api/v1/ostatus/followRemote/{local}', 'verb' => 'GET'],
|
||||
['name' => 'OStatus#getLink', 'url' => '/api/v1/ostatus/link/{local}/{account}', 'verb' => 'GET'],
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse;
|
|||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use Exception;
|
||||
use OCA\Social\AppInfo\Application;
|
||||
use OCA\Social\Exceptions\InvalidResourceException;
|
||||
use OCA\Social\Exceptions\RetrieveAccountFormatException;
|
||||
use OCA\Social\Service\AccountService;
|
||||
use OCA\Social\Service\CacheActorService;
|
||||
|
@ -104,24 +105,30 @@ class OStatusController extends Controller {
|
|||
* @return Response
|
||||
*/
|
||||
public function subscribe(string $uri): Response {
|
||||
|
||||
try {
|
||||
$actor = $this->cacheActorService->getFromAccount($uri);
|
||||
|
||||
try {
|
||||
$actor = $this->cacheActorService->getFromAccount($uri);
|
||||
} catch (InvalidResourceException $e) {
|
||||
$actor = $this->cacheActorService->getFromId($uri);
|
||||
}
|
||||
|
||||
$user = $this->userSession->getUser();
|
||||
if ($user === null) {
|
||||
throw new Exception('Failed to retrieve current user');
|
||||
}
|
||||
|
||||
return new TemplateResponse('social', 'ostatus', [
|
||||
return new TemplateResponse(
|
||||
'social', 'ostatus', [
|
||||
'serverData' => [
|
||||
'account' => $actor->getAccount(),
|
||||
'account' => $actor->getAccount(),
|
||||
'currentUser' => [
|
||||
'uid' => $user->getUID(),
|
||||
'uid' => $user->getUID(),
|
||||
'displayName' => $user->getDisplayName(),
|
||||
]
|
||||
]
|
||||
], 'guest');
|
||||
], 'guest'
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e);
|
||||
}
|
||||
|
@ -134,18 +141,21 @@ class OStatusController extends Controller {
|
|||
* @PublicPage
|
||||
*
|
||||
* @param string $local
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function followRemote(string $local): Response {
|
||||
try {
|
||||
$following = $this->accountService->getActor($local);
|
||||
|
||||
return new TemplateResponse('social', 'ostatus', [
|
||||
return new TemplateResponse(
|
||||
'social', 'ostatus', [
|
||||
'serverData' => [
|
||||
'local' => $local,
|
||||
'local' => $local,
|
||||
'account' => $following->getAccount()
|
||||
]
|
||||
], 'guest');
|
||||
], 'guest'
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e);
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ class ActionsRequestBuilder extends CoreRequestBuilder {
|
|||
*
|
||||
* @return ACore
|
||||
*/
|
||||
protected function parseActionsSelectSql($data): ACore {
|
||||
public function parseActionsSelectSql($data): ACore {
|
||||
$item = new ACore();
|
||||
$item->importFromDatabase($data);
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ class ActorsRequestBuilder extends CoreRequestBuilder {
|
|||
* @return Person
|
||||
* @throws SocialAppConfigException
|
||||
*/
|
||||
protected function parseActorsSelectSql($data): Person {
|
||||
public function parseActorsSelectSql($data): Person {
|
||||
$root = $this->configService->getSocialUrl();
|
||||
|
||||
$actor = new Person();
|
||||
|
|
|
@ -105,7 +105,7 @@ class CacheDocumentsRequestBuilder extends CoreRequestBuilder {
|
|||
*
|
||||
* @return Document
|
||||
*/
|
||||
protected function parseCacheDocumentsSelectSql(array $data): Document {
|
||||
public function parseCacheDocumentsSelectSql(array $data): Document {
|
||||
$document = new Document();
|
||||
$document->importFromDatabase($data);
|
||||
|
||||
|
|
|
@ -913,7 +913,7 @@ class CoreRequestBuilder {
|
|||
* @return Person
|
||||
* @throws InvalidResourceException
|
||||
*/
|
||||
protected function parseCacheActorsLeftJoin(array $data): Person {
|
||||
public function parseCacheActorsLeftJoin(array $data): Person {
|
||||
$new = [];
|
||||
|
||||
foreach ($data as $k => $v) {
|
||||
|
|
|
@ -128,7 +128,7 @@ class FollowsRequestBuilder extends CoreRequestBuilder {
|
|||
*
|
||||
* @return Follow
|
||||
*/
|
||||
protected function parseFollowsSelectSql($data): Follow {
|
||||
public function parseFollowsSelectSql($data): Follow {
|
||||
$follow = new Follow();
|
||||
$follow->importFromDatabase($data);
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ class HashtagsRequestBuilder extends CoreRequestBuilder {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function parseHashtagsSelectSql($data): array {
|
||||
public function parseHashtagsSelectSql($data): array {
|
||||
return [
|
||||
'hashtag' => $this->get('hashtag', $data, ''),
|
||||
'trend' => $this->getArray('trend', $data, [])
|
||||
|
|
|
@ -105,7 +105,7 @@ class RequestQueueRequestBuilder extends CoreRequestBuilder {
|
|||
*
|
||||
* @return RequestQueue
|
||||
*/
|
||||
protected function parseRequestQueueSelectSql($data): RequestQueue {
|
||||
public function parseRequestQueueSelectSql($data): RequestQueue {
|
||||
$queue = new RequestQueue();
|
||||
$queue->importFromDatabase($data);
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ class StreamActionsRequestBuilder extends CoreRequestBuilder {
|
|||
*
|
||||
* @return StreamAction
|
||||
*/
|
||||
protected function parseStreamActionsSelectSql($data): StreamAction {
|
||||
public function parseStreamActionsSelectSql($data): StreamAction {
|
||||
$action = new StreamAction();
|
||||
$action->importFromDatabase($data);
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ class StreamQueueRequestBuilder extends CoreRequestBuilder {
|
|||
*
|
||||
* @return StreamQueue
|
||||
*/
|
||||
protected function parseStreamQueueSelectSql($data): StreamQueue {
|
||||
public function parseStreamQueueSelectSql($data): StreamQueue {
|
||||
$queue = new StreamQueue();
|
||||
$queue->importFromDatabase($data);
|
||||
|
||||
|
|
|
@ -236,6 +236,13 @@ class CacheDocumentService {
|
|||
throw new CacheDocumentDoesNotExistException();
|
||||
}
|
||||
|
||||
// right now, we do not handle cache for local avatar, we need to change this
|
||||
// so the current avatar is cached, or a new avatar is uploaded
|
||||
if ($path === 'avatar') {
|
||||
throw new CacheContentException();
|
||||
}
|
||||
|
||||
|
||||
$pos = strrpos($path, '/');
|
||||
$dir = substr($path, 0, $pos);
|
||||
$filename = substr($path, $pos + 1);
|
||||
|
|
|
@ -129,9 +129,7 @@ $finger = [
|
|||
[
|
||||
'rel' => 'http://ostatus.org/schema/1.0/subscribe',
|
||||
'template' => urldecode(
|
||||
$href = $urlGenerator->linkToRouteAbsolute(
|
||||
'social.OStatus.subscribe', ['uri' => '{uri}']
|
||||
)
|
||||
$href = $urlGenerator->linkToRouteAbsolute('social.OStatus.subscribe') . '?uri={uri}'
|
||||
)
|
||||
]
|
||||
]
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
script('social', 'ostatus');
|
||||
style('social', 'style');
|
||||
|
||||
?>
|
||||
<span id="serverData" data-server="<?php p(json_encode($_['serverData']));?>"></span>
|
||||
<div id="vue-content"></div>
|
||||
|
|
Ładowanie…
Reference in New Issue