Fixes for GoToSocial
rodzic
a04d81e4f7
commit
811ad7828f
12
index.php
12
index.php
|
@ -456,7 +456,7 @@
|
||||||
"Host: {$host}",
|
"Host: {$host}",
|
||||||
"Date: {$date}",
|
"Date: {$date}",
|
||||||
"Signature: {$signature_header}",
|
"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 );
|
list( , $follow_name, $follow_server ) = explode( "@", $user );
|
||||||
|
|
||||||
// Get the Webfinger
|
// 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}";
|
$webfingerURl = "https://{$follow_server}/.well-known/webfinger?resource=acct:{$follow_name}@{$follow_server}";
|
||||||
$webfingerJSON = file_get_contents( $webfingerURl );
|
$webfinger = getDataFromURl( $webfingerURl );
|
||||||
$webfinger = json_decode( $webfingerJSON, true );
|
|
||||||
|
|
||||||
// Get the link to the user
|
// Get the link to the user
|
||||||
foreach( $webfinger["links"] as $link ) {
|
foreach( $webfinger["links"] as $link ) {
|
||||||
|
@ -1339,7 +1338,7 @@ HTML;
|
||||||
$profileURl = $link["href"];
|
$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
|
// Get the user's details
|
||||||
$profileData = getDataFromURl( $profileURl );
|
$profileData = getDataFromURl( $profileURl );
|
||||||
|
@ -1415,7 +1414,8 @@ HTML;
|
||||||
|
|
||||||
// There might be many different hashing algorithms
|
// There might be many different hashing algorithms
|
||||||
// TODO: Find a way to transform these automatically
|
// 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";
|
$digestAlgorithm = "sha256";
|
||||||
} else if ( "SHA-512" == $digestAlgorithm ) {
|
} else if ( "SHA-512" == $digestAlgorithm ) {
|
||||||
$digestAlgorithm = "sha512";
|
$digestAlgorithm = "sha512";
|
||||||
|
|
Ładowanie…
Reference in New Issue