Update ActivityPub

This commit is contained in:
Daniel Supernault 2019-02-25 14:23:54 -07:00
parent e2707ba174
commit d2823e64fa
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
2 changed files with 7 additions and 6 deletions

View File

@ -30,7 +30,7 @@ class Helpers {
public static function validateObject($data)
{
// todo: undo
$verbs = ['Create', 'Announce', 'Like', 'Follow', 'Delete', 'Accept', 'Reject'];
$verbs = ['Create', 'Announce', 'Like', 'Follow', 'Delete', 'Accept', 'Reject', 'Undo'];
$valid = Validator::make($data, [
'type' => [
@ -41,7 +41,7 @@ class Helpers {
'actor' => 'required|string',
'object' => 'required',
'object.type' => 'required_if:type,Create',
'object.attachment' => 'required_if:type,Create',
//'object.attachment' => 'required_if:type,Create',
'object.attributedTo' => 'required_if:type,Create',
'published' => 'required_if:type,Create|date'
])->passes();
@ -136,7 +136,7 @@ class Helpers {
'127.0.0.1', 'localhost', '::1'
];
$valid = filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED|FILTER_FLAG_HOST_REQUIRED);
$valid = filter_var($url, FILTER_VALIDATE_URL);
if(in_array(parse_url($valid, PHP_URL_HOST), $localhosts)) {
return false;
@ -232,8 +232,8 @@ class Helpers {
$ts = is_array($res['published']) ? $res['published'][0] : $res['published'];
$status = new Status;
$status->profile_id = $profile->id;
$status->url = $url;
$status->uri = $url;
$status->url = isset($res['url']) ? $res['url'] : $url;
$status->uri = isset($res['url']) ? $res['url'] : $url;
$status->caption = strip_tags($res['content']);
$status->rendered = Purify::clean($res['content']);
$status->created_at = Carbon::parse($ts);

View File

@ -108,7 +108,8 @@ class HttpSignature {
'(request-target)' => 'post '.parse_url($url, PHP_URL_PATH),
'Date' => $date->format('D, d M Y H:i:s \G\M\T'),
'Host' => parse_url($url, PHP_URL_HOST),
'Content-Type' => 'application/activity+json',
'Accept' => 'application/activity+json, application/json',
'Content-Type' => 'application/activity+json'
];
if($digest) {