Skip to content

Commit

Permalink
Merge pull request pixelfed#2946 from pixelfed/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
dansup authored Sep 20, 2021
2 parents 68437e6 + 8c6ef9b commit dbf3141
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Updated
- Updated NotificationService, fix 500 bug. ([4a609dc3](https://github.com/pixelfed/pixelfed/commit/4a609dc3))
- Update HttpSignatures, update instance actor headers. Fixes #2935. ([a900de21](https://github.com/pixelfed/pixelfed/commit/a900de21))
- ([](https://github.com/pixelfed/pixelfed/commit/))

## [v0.11.1 (2021-09-07)](https://github.com/pixelfed/pixelfed/compare/v0.11.0...v0.11.1)
Expand Down
13 changes: 6 additions & 7 deletions app/Services/ActivityPubFetchService.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Services;

use Zttp\Zttp;
use Illuminate\Support\Facades\Http;
use App\Profile;
use App\Util\ActivityPub\Helpers;
use App\Util\ActivityPub\HttpSignature;
Expand All @@ -15,14 +15,13 @@ public static function get($url)
return 0;
}

$headers = HttpSignature::instanceActorSign($url, false, [
'Accept' => 'application/activity+json, application/json',
'User-Agent' => '(Pixelfed/'.config('pixelfed.version').'; +'.config('app.url').')'
]);
$headers = HttpSignature::instanceActorSign($url, false);
$headers['Accept'] = 'application/activity+json, application/json';
$headers['User-Agent'] = '(Pixelfed/'.config('pixelfed.version').'; +'.config('app.url').')';

return Zttp::withHeaders($headers)
return Http::withHeaders($headers)
->timeout(30)
->get($url)
->body();
}
}
}
3 changes: 1 addition & 2 deletions app/Util/ActivityPub/HttpSignature.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static function instanceActorSign($url, $body = false, $addlHeaders = [])
$digest = self::_digest($body);
}
$headers = self::_headersToSign($url, $body ? $digest : false);
$headers = array_unique(array_merge($headers, $addlHeaders));
$headers = array_merge($headers, $addlHeaders);
$stringToSign = self::_headersToSigningString($headers);
$signedHeaders = implode(' ', array_map('strtolower', array_keys($headers)));
$key = openssl_pkey_get_private($privateKey);
Expand Down Expand Up @@ -133,7 +133,6 @@ protected static function _headersToSign($url, $digest = false) {
'Date' => $date->format('D, d M Y H:i:s \G\M\T'),
'Host' => parse_url($url, PHP_URL_HOST),
'Accept' => 'application/activity+json, application/json',
'Content-Type' => 'application/activity+json'
];

if($digest) {
Expand Down

0 comments on commit dbf3141

Please sign in to comment.