Add debug info to Notice Grabber
This commit is contained in:
parent
1b1631b530
commit
0ae5b603ee
@ -109,7 +109,7 @@ class ActivityPubPlugin extends Plugin
|
|||||||
common_debug('ActivityPubPlugin Notice Grabber: '.$candidate->getUrl(). ' is different of '.$url);
|
common_debug('ActivityPubPlugin Notice Grabber: '.$candidate->getUrl(). ' is different of '.$url);
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
common_debug('ActivityPubPlugin Notice Grabber: failed to find: '.$url. 'offline.');
|
common_debug('ActivityPubPlugin Notice Grabber: failed to find: '.$url.' offline.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ class ActivityPubPlugin extends Plugin
|
|||||||
$settings
|
$settings
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
common_debug('ActivityPubPlugin Notice Grabber: failed to find: '.$url. 'online.');
|
common_debug('ActivityPubPlugin Notice Grabber: failed to find: '.$url.' online.');
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,24 +207,34 @@ class Activitypub_notice extends Managed_DataObject
|
|||||||
*/
|
*/
|
||||||
public static function validate_remote_notice($data)
|
public static function validate_remote_notice($data)
|
||||||
{
|
{
|
||||||
|
if (!isset($data->attributedTo)) {
|
||||||
|
common_debug('ActivityPub Notice Validator: Rejected because attributedTo was not specified.');
|
||||||
|
throw new Exception('No attributedTo specified.');
|
||||||
|
}
|
||||||
if (!isset($data->id)) {
|
if (!isset($data->id)) {
|
||||||
|
common_debug('ActivityPub Notice Validator: Rejected because Object ID was not specified.');
|
||||||
throw new Exception('Object ID not specified.');
|
throw new Exception('Object ID not specified.');
|
||||||
} elseif (!filter_var($data->id, FILTER_VALIDATE_URL)) {
|
} elseif (!filter_var($data->id, FILTER_VALIDATE_URL)) {
|
||||||
|
common_debug('ActivityPub Notice Validator: Rejected because Object ID is invalid.');
|
||||||
throw new Exception('Invalid Object ID.');
|
throw new Exception('Invalid Object ID.');
|
||||||
}
|
}
|
||||||
if ($data->type !== 'Note') {
|
if (!isset($data->type) || $data->type !== 'Note') {
|
||||||
|
common_debug('ActivityPub Notice Validator: Rejected because of Type.');
|
||||||
throw new Exception('Invalid Object type.');
|
throw new Exception('Invalid Object type.');
|
||||||
}
|
}
|
||||||
if (!isset($data->content)) {
|
if (!isset($data->content)) {
|
||||||
|
common_debug('ActivityPub Notice Validator: Rejected because Content was not specified.');
|
||||||
throw new Exception('Object content was not specified.');
|
throw new Exception('Object content was not specified.');
|
||||||
}
|
}
|
||||||
if (!isset($data->url)) {
|
if (!isset($data->url)) {
|
||||||
throw new Exception('Object url was not specified.');
|
throw new Exception('Object URL was not specified.');
|
||||||
} elseif (!filter_var($data->url, FILTER_VALIDATE_URL)) {
|
} elseif (!filter_var($data->url, FILTER_VALIDATE_URL)) {
|
||||||
|
common_debug('ActivityPub Notice Validator: Rejected because Object URL is invalid.');
|
||||||
throw new Exception('Invalid Object URL.');
|
throw new Exception('Invalid Object URL.');
|
||||||
}
|
}
|
||||||
if (!isset($data->to)) {
|
if (!isset($data->cc)) {
|
||||||
throw new Exception('Object To was not specified.');
|
common_debug('ActivityPub Notice Validator: Rejected because Object CC was not specified.');
|
||||||
|
throw new Exception('Object CC was not specified.');
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user