mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-26 06:53:17 +00:00
Update HttpSignature
This commit is contained in:
parent
b43f06abaf
commit
f17ca9d904
3 changed files with 18 additions and 6 deletions
|
@ -282,14 +282,22 @@ class AccountController extends Controller
|
|||
$filterable['id'] = $profile->id;
|
||||
$filterable['type'] = $class;
|
||||
|
||||
Follower::whereProfileId($profile->id)->whereFollowingId($pid)->delete();
|
||||
$followed = Follower::whereProfileId($profile->id)->whereFollowingId($pid)->first();
|
||||
if($followed) {
|
||||
$followed->delete();
|
||||
$selfProfile = $request->user()->profile;
|
||||
$selfProfile->followers_count = Follower::whereFollowingId($pid)->count();
|
||||
$selfProfile->save();
|
||||
AccountService::del($selfProfile->id);
|
||||
}
|
||||
|
||||
Notification::whereProfileId($pid)
|
||||
->whereActorId($profile->id)
|
||||
->get()
|
||||
->map(function($n) use($pid) {
|
||||
NotificationService::del($pid, $n['id']);
|
||||
$n->forceDelete();
|
||||
});
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ use App\Profile;
|
|||
use App\Util\ActivityPub\Helpers;
|
||||
use App\Util\ActivityPub\HttpSignature;
|
||||
use Illuminate\Http\Client\ConnectionException;
|
||||
use Illuminate\Http\Client\RequestException;
|
||||
|
||||
class ActivityPubFetchService
|
||||
{
|
||||
|
@ -17,13 +18,16 @@ class ActivityPubFetchService
|
|||
}
|
||||
|
||||
$headers = HttpSignature::instanceActorSign($url, false);
|
||||
$headers['Accept'] = 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"';
|
||||
$headers['User-Agent'] = '(Pixelfed/'.config('pixelfed.version').'; +'.config('app.url').')';
|
||||
$headers['Accept'] = 'application/activity+json';
|
||||
|
||||
try {
|
||||
$res = Http::withHeaders($headers)
|
||||
->timeout(10)
|
||||
->timeout(30)
|
||||
->connectTimeout(5)
|
||||
->retry(3, 500)
|
||||
->get($url);
|
||||
} catch (RequestException $e) {
|
||||
return;
|
||||
} catch (ConnectionException $e) {
|
||||
return;
|
||||
} catch (Exception $e) {
|
||||
|
|
|
@ -130,8 +130,8 @@ class HttpSignature {
|
|||
|
||||
$headers = [
|
||||
'(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),
|
||||
'Date' => $date->format('D, d M Y H:i:s \G\M\T'),
|
||||
];
|
||||
|
||||
if($digest) {
|
||||
|
|
Loading…
Reference in a new issue