mirror of
https://github.com/friendica/friendica
synced 2025-04-27 15:10:11 +00:00
Improved server detection / gsid introduced
This commit is contained in:
parent
a77c0194dc
commit
95b4f35a12
6 changed files with 412 additions and 51 deletions
|
@ -1532,7 +1532,7 @@ class Contact
|
|||
$data = Probe::uri($url, "", $uid);
|
||||
// Ensure that there is a gserver entry
|
||||
if (!empty($data['baseurl']) && ($data['network'] != Protocol::PHANTOM)) {
|
||||
GServer::check($data['baseurl']);
|
||||
$data['gsid'] = GServer::getID($data['baseurl']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1575,6 +1575,7 @@ class Contact
|
|||
'confirm' => $data['confirm'] ?? '',
|
||||
'poco' => $data['poco'] ?? '',
|
||||
'baseurl' => $data['baseurl'] ?? '',
|
||||
'gsid' => $data['gsid'] ?? null,
|
||||
'name-date' => DateTimeFormat::utcNow(),
|
||||
'uri-date' => DateTimeFormat::utcNow(),
|
||||
'avatar-date' => DateTimeFormat::utcNow(),
|
||||
|
@ -2082,7 +2083,7 @@ class Contact
|
|||
|
||||
$fields = ['uid', 'avatar', 'name', 'nick', 'location', 'keywords', 'about',
|
||||
'unsearchable', 'url', 'addr', 'batch', 'notify', 'poll', 'request', 'confirm', 'poco',
|
||||
'network', 'alias', 'baseurl', 'forum', 'prv', 'contact-type', 'pubkey'];
|
||||
'network', 'alias', 'baseurl', 'gsid', 'forum', 'prv', 'contact-type', 'pubkey'];
|
||||
$contact = DBA::selectFirst('contact', $fields, ['id' => $id]);
|
||||
if (!DBA::isResult($contact)) {
|
||||
return false;
|
||||
|
@ -2135,6 +2136,10 @@ class Contact
|
|||
}
|
||||
}
|
||||
|
||||
if (!empty($ret['baseurl']) && empty($contact['gsid'])) {
|
||||
$ret['gsid'] = GServer::getID($ret['baseurl']);
|
||||
}
|
||||
|
||||
$new_pubkey = $ret['pubkey'];
|
||||
|
||||
$update = false;
|
||||
|
@ -2303,6 +2308,10 @@ class Contact
|
|||
$ret = Probe::uri($url, $network, $uid, false);
|
||||
}
|
||||
|
||||
if (!empty($ret['baseurl'])) {
|
||||
$ret['gsid'] = GServer::getID($ret['baseurl']);
|
||||
}
|
||||
|
||||
if (($network != '') && ($ret['network'] != $network)) {
|
||||
Logger::log('Expected network ' . $network . ' does not match actual network ' . $ret['network']);
|
||||
return $result;
|
||||
|
@ -2415,6 +2424,7 @@ class Contact
|
|||
'nick' => $ret['nick'],
|
||||
'network' => $ret['network'],
|
||||
'baseurl' => $ret['baseurl'],
|
||||
'gsid' => $ret['gsid'] ?? null,
|
||||
'protocol' => $protocol,
|
||||
'pubkey' => $ret['pubkey'],
|
||||
'rel' => $new_relation,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue