OpenWebAuth path is now fetched during probing

This commit is contained in:
Michael 2024-05-20 19:36:40 +00:00
parent ea5e1f1edc
commit da37516abf
13 changed files with 143 additions and 52 deletions

View file

@ -90,7 +90,7 @@ class APContact
$data['url'] = $link['href'];
}
if (!empty($link['href']) && !empty($link['type']) && ($link['rel'] == 'http://webfinger.net/rel/profile-page') && ($link['type'] == 'text/html')) {
if (!empty($link['href']) && !empty($link['type']) && ($link['rel'] == ActivityNamespace::WEBFINGERPROFILE) && ($link['type'] == 'text/html')) {
$data['alias'] = $link['href'];
}
}

View file

@ -1446,6 +1446,7 @@ class Contact
}
}
GServer::updateFromProbeArray($data);
self::updateFromProbeArray($contact_id, $data);
// Don't return a number for a deleted account
@ -2673,6 +2674,7 @@ class Contact
}
}
GServer::updateFromProbeArray($data);
return self::updateFromProbeArray($id, $data);
}
@ -3215,6 +3217,7 @@ class Contact
}
if ($probed) {
GServer::updateFromProbeArray($ret);
self::updateFromProbeArray($contact_id, $ret);
} else {
try {

View file

@ -2484,6 +2484,25 @@ class GServer
DI::keyValue()->set('poco_last_federation_discovery', time());
}
public static function updateFromProbeArray(array $data)
{
if (empty($data['gsid']) || empty($data['openwebauth'])) {
return;
}
$gserver = DBA::selectFirst('gserver', ['openwebauth'], ['id' => $data['gsid']]);
if (!DBA::isResult($gserver)) {
return;
}
if ($data['openwebauth'] == $gserver['openwebauth']) {
return;
}
Logger::debug('Set Open Web Auth path', ['baseurl' => $data['baseurl'], 'openwebauth' => $data['openwebauth']]);
self::update(['openwebauth' => $data['openwebauth']], ['id' => $data['gsid']]);
}
/**
* Set the protocol for the given server
*

View file

@ -711,13 +711,11 @@ class Profile
*
* It would be favourable to harmonize the two implementations.
*
* @param App $a Application instance.
*
* @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function zrlInit(App $a)
public static function zrlInit()
{
$my_url = DI::userSession()->getMyUrl();
$my_url = Network::isUrlValid($my_url);