pull/6542/head
Daniel Supernault 4 months ago
parent f5d2d95e76
commit 0175b4a605
No known key found for this signature in database
GPG Key ID: 23740873EE6F76A1

@ -291,21 +291,16 @@ class UserAccountDelete extends Command
$appUrl = config('app.url'); $appUrl = config('app.url');
$userAgent = "(Pixelfed/{$version}; +{$appUrl})"; $userAgent = "(Pixelfed/{$version}; +{$appUrl})";
$requests = function () use ($client, $urls, $digest, $payload, $userAgent) { $requests = function () use ($client, $urls, $digest, $payload) {
foreach ($urls as $url) { foreach ($urls as $url) {
$headers = HttpSignature::instanceActorSignWithDigest($url, $digest, [ $headers = HttpSignature::instanceActorSignWithDigest($url, $digest, [
'Content-Type' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"', 'Content-Type' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
]); ]);
$headers['User-Agent'] = $userAgent;
yield function () use ($client, $url, $headers, $payload) { yield function () use ($client, $url, $headers, $payload) {
return $client->postAsync($url, [ return $client->postAsync($url, [
'curl' => [ 'headers' => $headers,
CURLOPT_HTTPHEADER => $headers, 'body' => $payload,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HEADER => true,
],
]); ]);
}; };
} }
@ -361,8 +356,6 @@ class UserAccountDelete extends Command
'Content-Type' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"', 'Content-Type' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
]); ]);
$headers['User-Agent'] = $userAgent;
$this->info('Target: '.$url); $this->info('Target: '.$url);
$this->newLine(); $this->newLine();
@ -385,11 +378,8 @@ class UserAccountDelete extends Command
try { try {
$response = $client->post($url, [ $response = $client->post($url, [
'curl' => [ 'headers' => $headers,
CURLOPT_HTTPHEADER => $headers, 'body' => $payload,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HEADER => true,
],
]); ]);
$status = $response->getStatusCode(); $status = $response->getStatusCode();

@ -186,6 +186,7 @@ class HttpSignature
$signatureHeader = 'keyId="'.$keyId.'",headers="'.$signedHeaders.'",algorithm="rsa-sha256",signature="'.$signature.'"'; $signatureHeader = 'keyId="'.$keyId.'",headers="'.$signedHeaders.'",algorithm="rsa-sha256",signature="'.$signature.'"';
unset($headers['(request-target)']); unset($headers['(request-target)']);
unset($headers['Host']);
$headers['Signature'] = $signatureHeader; $headers['Signature'] = $signatureHeader;
return $headers; return $headers;

Loading…
Cancel
Save