mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-01-30 19:03:21 +00:00
Merge pull request #917 from pixelfed/frontend-ui-refactor
Update FederationController
This commit is contained in:
commit
1af7f5a8c1
1 changed files with 14 additions and 0 deletions
|
@ -199,9 +199,16 @@ XML;
|
||||||
$body = $request->getContent();
|
$body = $request->getContent();
|
||||||
$bodyDecoded = json_decode($body, true, 8);
|
$bodyDecoded = json_decode($body, true, 8);
|
||||||
$signature = $request->header('signature');
|
$signature = $request->header('signature');
|
||||||
|
$date = $request->header('date');
|
||||||
if(!$signature) {
|
if(!$signature) {
|
||||||
abort(400, 'Missing signature header');
|
abort(400, 'Missing signature header');
|
||||||
}
|
}
|
||||||
|
if(!$date) {
|
||||||
|
abort(400, 'Missing date header');
|
||||||
|
}
|
||||||
|
if(!now()->parse($date)->gt(now()->subDays(1)) || !now()->parse($date)->lt(now()->addDays(1))) {
|
||||||
|
abort(400, 'Invalid date');
|
||||||
|
}
|
||||||
$signatureData = HttpSignature::parseSignatureHeader($signature);
|
$signatureData = HttpSignature::parseSignatureHeader($signature);
|
||||||
$keyId = Helpers::validateUrl($signatureData['keyId']);
|
$keyId = Helpers::validateUrl($signatureData['keyId']);
|
||||||
$id = Helpers::validateUrl($bodyDecoded['id']);
|
$id = Helpers::validateUrl($bodyDecoded['id']);
|
||||||
|
@ -235,9 +242,16 @@ XML;
|
||||||
protected function blindKeyRotation(Request $request, Profile $profile)
|
protected function blindKeyRotation(Request $request, Profile $profile)
|
||||||
{
|
{
|
||||||
$signature = $request->header('signature');
|
$signature = $request->header('signature');
|
||||||
|
$date = $request->header('date');
|
||||||
if(!$signature) {
|
if(!$signature) {
|
||||||
abort(400, 'Missing signature header');
|
abort(400, 'Missing signature header');
|
||||||
}
|
}
|
||||||
|
if(!$date) {
|
||||||
|
abort(400, 'Missing date header');
|
||||||
|
}
|
||||||
|
if(!now()->parse($date)->gt(now()->subDays(1)) || !now()->parse($date)->lt(now()->addDays(1))) {
|
||||||
|
abort(400, 'Invalid date');
|
||||||
|
}
|
||||||
$signatureData = HttpSignature::parseSignatureHeader($signature);
|
$signatureData = HttpSignature::parseSignatureHeader($signature);
|
||||||
$keyId = Helpers::validateUrl($signatureData['keyId']);
|
$keyId = Helpers::validateUrl($signatureData['keyId']);
|
||||||
$actor = Profile::whereKeyId($keyId)->whereNotNull('remote_url')->firstOrFail();
|
$actor = Profile::whereKeyId($keyId)->whereNotNull('remote_url')->firstOrFail();
|
||||||
|
|
Loading…
Reference in a new issue