1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-28 02:36:50 +00:00
pixelfed/app/Util/ActivityPub/Validator/Accept.php

32 lines
604 B
PHP
Raw Normal View History

2018-12-29 23:56:39 +00:00
<?php
namespace App\Util\ActivityPub\Validator;
use Validator;
use Illuminate\Validation\Rule;
class Accept {
public static function validate($payload)
{
$valid = Validator::make($payload, [
'@context' => 'required',
'id' => 'required|string',
'type' => [
'required',
Rule::in(['Accept'])
],
2019-08-12 07:19:34 +00:00
'actor' => 'required|url',
2018-12-29 23:56:39 +00:00
'object' => 'required',
2019-08-12 07:19:34 +00:00
'object.id' => 'required|url',
2018-12-29 23:56:39 +00:00
'object.type' => [
'required',
Rule::in(['Follow'])
],
2019-08-12 07:19:34 +00:00
'object.actor' => 'required|url',
'object.object' => 'required|url|same:actor',
2018-12-29 23:56:39 +00:00
])->passes();
return $valid;
}
}