|
|
|
@ -204,20 +204,23 @@
|
|
|
|
|
* @param CommunityServer $server
|
|
|
|
|
*/
|
|
|
|
|
private function merge_from($server) {
|
|
|
|
|
// Merge room hint information.
|
|
|
|
|
$this->room_hints = [
|
|
|
|
|
...$this->room_hints,
|
|
|
|
|
...$server->room_hints
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
// Merge public key information.
|
|
|
|
|
if (!$this->has_pubkey() && $server->has_pubkey()) {
|
|
|
|
|
$this->pubkey = $server->pubkey;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Prefer HTTPS URLs over HTTP.
|
|
|
|
|
if (str_starts_with($server->base_url, "https:")) {
|
|
|
|
|
$this->base_url = $server->get_scheme() . "://" . $this->get_hostname();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Overwrite IPs
|
|
|
|
|
// Prefer domain names over IPs (connections to SOGS survive relocation).
|
|
|
|
|
if (filter_var($this->get_hostname(), FILTER_VALIDATE_IP)) {
|
|
|
|
|
$this->base_url = $this->get_scheme() . "://" . $server->get_hostname();
|
|
|
|
|
}
|
|
|
|
@ -227,6 +230,7 @@
|
|
|
|
|
* Re-introduces the server to a consistent state after merging.
|
|
|
|
|
*/
|
|
|
|
|
private function merge_consistency() {
|
|
|
|
|
// Remove duplicate room hints; does not require sorting.
|
|
|
|
|
$this->room_hints = array_unique($this->room_hints);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|