Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
pull/525/head
Maxence Lange 2019-05-17 09:19:45 -01:00
rodzic 1ad4d54ac7
commit ec822a440b
53 zmienionych plików z 1290 dodań i 118 usunięć

Wyświetl plik

@ -37,7 +37,6 @@ use OC;
use OC\User\NoUserException;
use OCA\Social\AppInfo\Application;
use OCA\Social\Exceptions\AccountAlreadyExistsException;
use OCA\Social\Exceptions\ItemUnknownException;
use OCA\Social\Exceptions\SocialAppConfigException;
use OCA\Social\Exceptions\UrlCloudException;
use OCA\Social\Service\AccountService;
@ -132,7 +131,6 @@ class NavigationController extends Controller {
*
* @return TemplateResponse
* @throws UrlCloudException
* @throws ItemUnknownException
*/
public function navigate(string $path = ''): TemplateResponse {
$data = [

Wyświetl plik

@ -32,6 +32,7 @@ namespace OCA\Social\Controller;
use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse;
use Exception;
use OCA\Social\AppInfo\Application;
use OCA\Social\Exceptions\CacheActorDoesNotExistException;
use OCA\Social\Exceptions\UrlCloudException;
@ -118,7 +119,7 @@ class SocialPubController extends Controller {
$data['application'] = $displayName . ' - ' . $data['application'];
} catch (CacheActorDoesNotExistException $e) {
$status = Http::STATUS_NOT_FOUND;
} catch (\Exception $e) {
} catch (Exception $e) {
return $this->fail($e);
}
$page = new PublicTemplateResponse(Application::APP_NAME, 'main', $data);

Wyświetl plik

@ -31,6 +31,7 @@ namespace OCA\Social\Db;
use DateTime;
use Exception;
use OCA\Social\Exceptions\ActorDoesNotExistException;
use OCA\Social\Exceptions\SocialAppConfigException;
use OCA\Social\Model\ActivityPub\Actor\Person;
@ -111,11 +112,16 @@ class ActorsRequest extends ActorsRequestBuilder {
public function refreshKeys(Person $actor) {
$qb = $this->getActorsUpdateSql();
$qb->set('public_key', $qb->createNamedParameter($actor->getPublicKey()))
->set('private_key', $qb->createNamedParameter($actor->getPrivateKey()))
->set(
'creation',
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
);
->set('private_key', $qb->createNamedParameter($actor->getPrivateKey()));
try {
$qb->set(
'creation',
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
);
} catch (Exception $e) {
}
$this->limitToIdString($qb, $actor->getId());
$qb->execute();

Wyświetl plik

@ -65,13 +65,6 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
*/
public function save(Person $actor) {
if ($actor->getCreation() > 0) {
$dTime = new DateTime();
$dTime->setTimestamp($actor->getCreation());
} else {
$dTime = new DateTime('now');
}
$qb = $this->getCacheActorsInsertSql();
$qb->setValue('id', $qb->createNamedParameter($actor->getId()))
->setValue('account', $qb->createNamedParameter($actor->getAccount()))
@ -91,11 +84,22 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
->setValue('summary', $qb->createNamedParameter($actor->getSummary()))
->setValue('public_key', $qb->createNamedParameter($actor->getPublicKey()))
->setValue('source', $qb->createNamedParameter($actor->getSource()))
->setValue('details', $qb->createNamedParameter(json_encode($actor->getDetails())))
->setValue(
'creation',
$qb->createNamedParameter($dTime, IQueryBuilder::PARAM_DATE)
);
->setValue('details', $qb->createNamedParameter(json_encode($actor->getDetails())));
try {
if ($actor->getCreation() > 0) {
$dTime = new DateTime();
$dTime->setTimestamp($actor->getCreation());
} else {
$dTime = new DateTime('now');
}
$qb->setValue(
'creation',
$qb->createNamedParameter($dTime, IQueryBuilder::PARAM_DATE)
);
} catch (Exception $e) {
}
if ($actor->gotIcon()) {
$iconId = $actor->getIcon()
@ -121,13 +125,6 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
*/
public function update(Person $actor): int {
if ($actor->getCreation() > 0) {
$dTime = new DateTime();
$dTime->setTimestamp($actor->getCreation());
} else {
$dTime = new DateTime('now');
}
$qb = $this->getCacheActorsUpdateSql();
$qb->set('following', $qb->createNamedParameter($actor->getFollowing()))
->set('followers', $qb->createNamedParameter($actor->getFollowers()))
@ -143,11 +140,21 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
->set('summary', $qb->createNamedParameter($actor->getSummary()))
->set('public_key', $qb->createNamedParameter($actor->getPublicKey()))
->set('source', $qb->createNamedParameter($actor->getSource()))
->set('details', $qb->createNamedParameter(json_encode($actor->getDetails())))
->set(
'creation',
$qb->createNamedParameter($dTime, IQueryBuilder::PARAM_DATE)
);
->set('details', $qb->createNamedParameter(json_encode($actor->getDetails())));
try {
if ($actor->getCreation() > 0) {
$dTime = new DateTime();
$dTime->setTimestamp($actor->getCreation());
} else {
$dTime = new DateTime('now');
}
$qb->set(
'creation',
$qb->createNamedParameter($dTime, IQueryBuilder::PARAM_DATE)
);
} catch (Exception $e) {
}
if ($actor->gotIcon()) {
$iconId = $actor->getIcon()

Wyświetl plik

@ -57,11 +57,15 @@ class CacheDocumentsRequest extends CacheDocumentsRequestBuilder {
->setValue('error', $qb->createNamedParameter($document->getError()))
->setValue('local_copy', $qb->createNamedParameter($document->getLocalCopy()))
->setValue('parent_id', $qb->createNamedParameter($document->getParentId()))
->setValue('public', $qb->createNamedParameter(($document->isPublic()) ? '1' : '0'))
->setValue(
'creation',
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
);
->setValue('public', $qb->createNamedParameter(($document->isPublic()) ? '1' : '0'));
try {
$qb->setValue(
'creation',
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
);
} catch (Exception $e) {
}
$this->generatePrimaryKey($qb, $document->getId());
@ -83,11 +87,15 @@ class CacheDocumentsRequest extends CacheDocumentsRequestBuilder {
->set('error', $qb->createNamedParameter($document->getError()))
->set('local_copy', $qb->createNamedParameter($document->getLocalCopy()))
->set('parent_id', $qb->createNamedParameter($document->getParentId()))
->set('public', $qb->createNamedParameter(($document->isPublic()) ? '1' : '0'))
->set(
'creation',
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
);
->set('public', $qb->createNamedParameter(($document->isPublic()) ? '1' : '0'));
try {
$qb->set(
'creation',
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
);
} catch (Exception $e) {
}
$this->limitToIdString($qb, $document->getId());
$qb->execute();
@ -100,9 +108,13 @@ class CacheDocumentsRequest extends CacheDocumentsRequestBuilder {
public function initCaching(Document $document) {
$qb = $this->getCacheDocumentsUpdateSql();
$this->limitToIdString($qb, $document->getId());
$qb->set(
'caching', $qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
);
try {
$qb->set(
'caching', $qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
);
} catch (Exception $e) {
}
$qb->execute();
}

Wyświetl plik

@ -807,7 +807,6 @@ class CoreRequestBuilder {
*
* @return Document
* @throws InvalidResourceException
* @throws Exception
*/
protected function parseCacheDocumentsLeftJoin(array $data): Document {
$new = [];

Wyświetl plik

@ -54,8 +54,6 @@ class FollowsRequest extends FollowsRequestBuilder {
* Insert a new Note in the database.
*
* @param Follow $follow
*
* @throws Exception
*/
public function save(Follow $follow) {
$qb = $this->getFollowsInsertSql();
@ -63,11 +61,15 @@ class FollowsRequest extends FollowsRequestBuilder {
->setValue('actor_id', $qb->createNamedParameter($follow->getActorId()))
->setValue('type', $qb->createNamedParameter($follow->getType()))
->setValue('object_id', $qb->createNamedParameter($follow->getObjectId()))
->setValue('follow_id', $qb->createNamedParameter($follow->getFollowId()))
->setValue(
'creation',
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
);
->setValue('follow_id', $qb->createNamedParameter($follow->getFollowId()));
try {
$qb->setValue(
'creation',
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
);
} catch (Exception $e) {
}
$this->generatePrimaryKey($qb, $follow->getId());

Wyświetl plik

@ -1,9 +1,39 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
use Exception;
class AccountAlreadyExistsException extends Exception {
}

Wyświetl plik

@ -1,7 +1,36 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
use Exception;
class AccountDoesNotExistException extends Exception {

Wyświetl plik

@ -1,9 +1,39 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
use Exception;
class ActivityCantBeVerifiedException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class ActivityPubFormatException extends \Exception {
use Exception;
class ActivityPubFormatException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class ActorDoesNotExistException extends \Exception {
use Exception;
class ActorDoesNotExistException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class CacheActorDoesNotExistException extends \Exception {
use Exception;
class CacheActorDoesNotExistException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class CacheContentException extends \Exception {
use Exception;
class CacheContentException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class CacheContentMimeTypeException extends \Exception {
use Exception;
class CacheContentMimeTypeException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class CacheDocumentDoesNotExistException extends \Exception {
use Exception;
class CacheDocumentDoesNotExistException extends Exception {
}

Wyświetl plik

@ -1,9 +1,39 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
use Exception;
class DateTimeException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class EmptyQueueException extends \Exception {
use Exception;
class EmptyQueueException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class FollowDoesNotExistException extends \Exception {
use Exception;
class FollowDoesNotExistException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class FollowSameAccountException extends \Exception {
use Exception;
class FollowSameAccountException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class HashtagDoesNotExistException extends \Exception {
use Exception;
class HashtagDoesNotExistException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class InvalidOriginException extends \Exception {
use Exception;
class InvalidOriginException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class InvalidResourceEntryException extends \Exception {
use Exception;
class InvalidResourceEntryException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class InvalidResourceException extends \Exception {
use Exception;
class InvalidResourceException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class ItemNotFoundException extends \Exception {
use Exception;
class ItemNotFoundException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class ItemUnknownException extends \Exception {
use Exception;
class ItemUnknownException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class LinkedDataSignatureMissingException extends \Exception {
use Exception;
class LinkedDataSignatureMissingException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class NoHighPriorityRequestException extends \Exception {
use Exception;
class NoHighPriorityRequestException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class QueueStatusException extends \Exception {
use Exception;
class QueueStatusException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class RedundancyLimitException extends \Exception {
use Exception;
class RedundancyLimitException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class RequestContentException extends \Exception {
use Exception;
class RequestContentException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class RequestNetworkException extends \Exception {
use Exception;
class RequestNetworkException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class RequestResultNotJsonException extends \Exception {
use Exception;
class RequestResultNotJsonException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class RequestResultSizeException extends \Exception {
use Exception;
class RequestResultSizeException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class RequestServerException extends \Exception {
use Exception;
class RequestServerException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class RetrieveAccountFormatException extends \Exception {
use Exception;
class RetrieveAccountFormatException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class SignatureException extends \Exception {
use Exception;
class SignatureException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class SignatureIsGoneException extends \Exception {
use Exception;
class SignatureIsGoneException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class SocialAppConfigException extends \Exception {
use Exception;
class SocialAppConfigException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class StreamActionDoesNotExistException extends \Exception {
use Exception;
class StreamActionDoesNotExistException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class StreamNotFoundException extends \Exception {
use Exception;
class StreamNotFoundException extends Exception {
}

Wyświetl plik

@ -1,8 +1,40 @@
<?php
declare(strict_types=1);
/**
* Nextcloud - Social Support
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Maxence Lange <maxence@artificial-owl.com>
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Social\Exceptions;
class UrlCloudException extends \Exception {
use Exception;
class UrlCloudException extends Exception {
}

Wyświetl plik

@ -261,11 +261,12 @@ class FollowInterface implements IActivityPubInterface {
AP::$activityPub->getInterfaceFromType(SocialAppNotification::TYPE);
$notification = new SocialAppNotification();
$notification->setId($follow->getId() . '/notification')
$notification->setAttributedTo($follow->getActorId())
->setId($follow->getId() . '/notification')
->setSummary('{actor} is following you')
->setTo($follow->getObjectId())
->setLocal(true)
->setAttributedTo($follow->getActorId());
->setLocal(true);
$notificationInterface->save($notification);
}

Wyświetl plik

@ -32,6 +32,7 @@ namespace OCA\Social\Model\ActivityPub\Actor;
use DateTime;
use Exception;
use JsonSerializable;
use OCA\Social\AP;
use OCA\Social\Exceptions\InvalidOriginException;
@ -483,8 +484,6 @@ class Person extends ACore implements JsonSerializable {
public function importFromDatabase(array $data) {
parent::importFromDatabase($data);
$dTime = new DateTime($this->get('creation', $data, 'yesterday'));
$this->setPreferredUsername(
$this->validate(self::AS_USERNAME, 'preferred_username', $data, '')
)
@ -498,8 +497,13 @@ class Person extends ACore implements JsonSerializable {
->setFollowing($this->validate(self::AS_URL, 'following', $data, ''))
->setSharedInbox($this->validate(self::AS_URL, 'shared_inbox', $data, ''))
->setFeatured($this->validate(self::AS_URL, 'featured', $data, ''))
->setDetails($this->getArray('details', $data, []))
->setCreation($dTime->getTimestamp());
->setDetails($this->getArray('details', $data, []));
try {
$dTime = new DateTime($this->get('creation', $data, 'yesterday'));
$this->setCreation($dTime->getTimestamp());
} catch (Exception $e) {
}
}

Wyświetl plik

@ -237,8 +237,6 @@ class Document extends ACore implements JsonSerializable {
/**
* @param array $data
*
* @throws Exception
*/
public function importFromDatabase(array $data) {
parent::importFromDatabase($data);
@ -253,8 +251,11 @@ class Document extends ACore implements JsonSerializable {
if ($this->get('caching', $data, '') === '') {
$this->setCaching(0);
} else {
$date = new DateTime($this->get('caching', $data, ''));
$this->setCaching($date->getTimestamp());
try {
$date = new DateTime($this->get('caching', $data, ''));
$this->setCaching($date->getTimestamp());
} catch (Exception $e) {
}
}
}

Wyświetl plik

@ -129,6 +129,9 @@ class Note extends Stream implements JsonSerializable {
}
/**
* @param array $list
*/
public function importAttachments(array $list) {
$new = [];
foreach ($list as $item) {

Wyświetl plik

@ -212,12 +212,13 @@ class Stream extends ACore implements JsonSerializable {
}
/**
*
* @throws Exception
*/
public function convertPublished() {
$dTime = new DateTime($this->getPublished());
$this->setPublishedTime($dTime->getTimestamp());
try {
$dTime = new DateTime($this->getPublished());
$this->setPublishedTime($dTime->getTimestamp());
} catch (Exception $e) {
}
}
@ -289,8 +290,6 @@ class Stream extends ACore implements JsonSerializable {
/**
* @param array $data
*
* @throws Exception
*/
public function import(array $data) {
parent::import($data);

Wyświetl plik

@ -34,6 +34,7 @@ namespace OCA\Social\Model;
use daita\MySmallPhpTools\Traits\TArrayTools;
use daita\MySmallPhpTools\Traits\TStringTools;
use DateTime;
use Exception;
use JsonSerializable;
@ -323,8 +324,11 @@ class RequestQueue implements JsonSerializable {
if ($last === '') {
$this->setLast(0);
} else {
$dTime = new DateTime($last);
$this->setLast($dTime->getTimestamp());
try {
$dTime = new DateTime($last);
$this->setLast($dTime->getTimestamp());
} catch (Exception $e) {
}
}
}

Wyświetl plik

@ -33,6 +33,7 @@ namespace OCA\Social\Model;
use daita\MySmallPhpTools\Traits\TArrayTools;
use DateTime;
use Exception;
use JsonSerializable;
@ -239,8 +240,11 @@ class StreamQueue implements JsonSerializable {
if ($last === '') {
$this->setLast(0);
} else {
$dTime = new DateTime($last);
$this->setLast($dTime->getTimestamp());
try {
$dTime = new DateTime($last);
$this->setLast($dTime->getTimestamp());
} catch (Exception $e) {
}
}
}

Wyświetl plik

@ -161,7 +161,6 @@ class AccountService {
* @throws NoUserException
* @throws SocialAppConfigException
* @throws UrlCloudException
* @throws ItemUnknownException
*/
public function getActorFromUserId(string $userId, bool $create = false): Person {
$this->miscService->confirmUserId($userId);
@ -196,7 +195,6 @@ class AccountService {
* @throws NoUserException
* @throws SocialAppConfigException
* @throws UrlCloudException
* @throws ItemUnknownException
*/
public function createActor(string $userId, string $username) {

Wyświetl plik

@ -34,10 +34,8 @@ use daita\MySmallPhpTools\Traits\TStringTools;
use Exception;
use OCA\Social\AP;
use OCA\Social\Db\StreamRequest;
use OCA\Social\Exceptions\ItemUnknownException;
use OCA\Social\Exceptions\StreamNotFoundException;
use OCA\Social\Exceptions\RedundancyLimitException;
use OCA\Social\Exceptions\SocialAppConfigException;
use OCA\Social\Exceptions\StreamNotFoundException;
use OCA\Social\Model\ActivityPub\ACore;
use OCA\Social\Model\ActivityPub\Activity\Undo;
use OCA\Social\Model\ActivityPub\Actor\Person;
@ -45,6 +43,7 @@ use OCA\Social\Model\ActivityPub\Object\Announce;
use OCA\Social\Model\ActivityPub\Object\Note;
use OCA\Social\Model\ActivityPub\Stream;
/**
* Class BoostService
*
@ -154,9 +153,6 @@ class BoostService {
*
* @return Stream
* @throws StreamNotFoundException
* @throws SocialAppConfigException
* @throws ItemUnknownException
* @throws RedundancyLimitException
*/
public function get(Person $actor, string $postId): Stream {
$stream = $this->streamRequest->getStreamByObjectId($actor, Announce::TYPE, $postId);

Wyświetl plik

@ -50,6 +50,7 @@ use OCA\Social\Exceptions\UrlCloudException;
use OCA\Social\Model\ActivityPub\Actor\Person;
use OCA\Social\Model\ActivityPub\Object\Document;
use OCA\Social\Model\ActivityPub\Object\Image;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\Files\SimpleFS\ISimpleFile;
use OCP\IURLGenerator;
@ -148,6 +149,12 @@ class DocumentService {
$document->setMimeType($mime);
$document->setError(self::ERROR_MIMETYPE);
$this->cacheDocumentsRequest->endCaching($document);
} catch (NotFoundException $e) {
$this->miscService->log(
'Cannot save cache file ' . json_encode($document) . ' ' . json_encode($e), 1
);
$document->setError(self::ERROR_PERMISSION);
$this->cacheDocumentsRequest->endCaching($document);
} catch (NotPermittedException $e) {
$this->miscService->log(
'Cannot save cache file ' . json_encode($document) . ' ' . json_encode($e), 1

Wyświetl plik

@ -36,9 +36,11 @@ use daita\MySmallPhpTools\Traits\TArrayTools;
use DateTime;
use Exception;
use JsonLdException;
use OC;
use OCA\Social\AppInfo\Application;
use OCA\Social\Db\ActorsRequest;
use OCA\Social\Exceptions\ActorDoesNotExistException;
use OCA\Social\Exceptions\DateTimeException;
use OCA\Social\Exceptions\InvalidOriginException;
use OCA\Social\Exceptions\InvalidResourceException;
use OCA\Social\Exceptions\ItemUnknownException;
@ -187,10 +189,17 @@ class SignatureService {
* @throws SocialAppConfigException
* @throws ItemUnknownException
* @throws RequestResultNotJsonException
* @throws DateTimeException
*/
public function checkRequest(IRequest $request, int &$time = 0): string {
$dTime = new DateTime($request->getHeader('date'));
$time = $dTime->getTimestamp();
try {
$dTime = new DateTime($request->getHeader('date'));
$time = $dTime->getTimestamp();
} catch (Exception $e) {
throw new DateTimeException(
'datetime exception: ' . $e->getMessage() . ' - ' . $request->getHeader('date')
);
}
if ($time < (time() - self::DATE_DELAY)) {
throw new SignatureException('object is too old');
@ -221,6 +230,7 @@ class SignatureService {
* @throws SocialAppConfigException
* @throws ItemUnknownException
* @throws RequestResultNotJsonException
* @throws DateTimeException
*/
public function checkObject(ACore $object): bool {
try {
@ -237,8 +247,14 @@ class SignatureService {
}
}
$dTime = new DateTime($signature->getCreated());
$time = $dTime->getTimestamp();
try {
$dTime = new DateTime($signature->getCreated());
$time = $dTime->getTimestamp();
} catch (Exception $e) {
throw new DateTimeException(
'datetime exception: ' . $e->getMessage() . ' - ' . $signature->getCreated()
);
}
$object->setOrigin(
$this->getKeyOrigin($actorId), SignatureService::ORIGIN_SIGNATURE, $time
@ -432,6 +448,7 @@ class SignatureService {
* @return stdClass
* @throws NotPermittedException
* @throws JsonLdException
* @throws NotFoundException
*/
public static function documentLoader($url): stdClass {
$recursion = 0;
@ -472,7 +489,7 @@ class SignatureService {
private static function getContextCacheFolder(): ISimpleFolder {
$path = 'context';
$appData = \OC::$server->getAppDataDir(Application::APP_NAME);
$appData = OC::$server->getAppDataDir(Application::APP_NAME);
try {
$folder = $appData->getFolder($path);
} catch (NotFoundException $e) {
@ -492,6 +509,7 @@ class SignatureService {
* @return stdClass
* @throws JsonLdException
* @throws NotPermittedException
* @throws NotFoundException
*/
private static function generateContextCacheDocument(
ISimpleFolder $folder, string $filename, string $url
@ -522,6 +540,7 @@ class SignatureService {
* @param string $url
*
* @throws NotPermittedException
* @throws NotFoundException
*/
private static function updateContextCacheDocument(ISimpleFile $cache, string $url) {
if ($cache->getMTime() < (time() - 98765)) {