Fixes for GoToSocial

merge-requests/5/head
Terence Eden 2024-03-04 11:46:41 +00:00
rodzic a04d81e4f7
commit 811ad7828f
1 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -456,7 +456,7 @@
"Host: {$host}",
"Date: {$date}",
"Signature: {$signature_header}",
"Accept: application/activity+json",
"Accept: application/activity+json, application/json",
);
}
@ -1328,10 +1328,9 @@ HTML;
list( , $follow_name, $follow_server ) = explode( "@", $user );
// Get the Webfinger
// This request does not need to be signed.
// This request does not always need to be signed, but safest to do so anyway.
$webfingerURl = "https://{$follow_server}/.well-known/webfinger?resource=acct:{$follow_name}@{$follow_server}";
$webfingerJSON = file_get_contents( $webfingerURl );
$webfinger = json_decode( $webfingerJSON, true );
$webfinger = getDataFromURl( $webfingerURl );
// Get the link to the user
foreach( $webfinger["links"] as $link ) {
@ -1339,7 +1338,7 @@ HTML;
$profileURl = $link["href"];
}
}
if ( !isset( $profileURl ) ) { echo "No profile"; die(); }
if ( !isset( $profileURl ) ) { echo "No profile" . print_r( $webfinger, true ); die(); }
// Get the user's details
$profileData = getDataFromURl( $profileURl );
@ -1415,7 +1414,8 @@ HTML;
// There might be many different hashing algorithms
// TODO: Find a way to transform these automatically
if ( "SHA-256" == $digestAlgorithm ) {
// See https://github.com/superseriousbusiness/gotosocial/issues/1186#issuecomment-1976166659 and https://github.com/snarfed/bridgy-fed/issues/430 for hs2019
if ( "SHA-256" == $digestAlgorithm || "hs2019" == $digestAlgorithm ) {
$digestAlgorithm = "sha256";
} else if ( "SHA-512" == $digestAlgorithm ) {
$digestAlgorithm = "sha512";