forked from mirror/pixelfed
Update ActivityPub
This commit is contained in:
parent
e2707ba174
commit
d2823e64fa
2 changed files with 7 additions and 6 deletions
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue