aboutsummaryrefslogtreecommitdiffstats
path: root/include/network.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/network.php')
-rw-r--r--include/network.php24
1 files changed, 10 insertions, 14 deletions
diff --git a/include/network.php b/include/network.php
index f8cb68613..c41d87af0 100644
--- a/include/network.php
+++ b/include/network.php
@@ -1192,9 +1192,10 @@ function discover_by_webbie($webbie, $protocol = '') {
logger('webfinger: ' . print_r($x,true), LOGGER_DATA, LOG_INFO);
$arr = [
- 'address' => $webbie,
- 'protocol' => $protocol,
- 'success' => false,
+ 'address' => $webbie,
+ 'protocol' => $protocol,
+ 'success' => false,
+ 'xchan' => '',
'webfinger' => $x
];
/**
@@ -1207,7 +1208,7 @@ function discover_by_webbie($webbie, $protocol = '') {
*/
call_hooks('discover_channel_webfinger', $arr);
if($arr['success'])
- return true;
+ return $arr['xchan'];
return false;
}
@@ -1240,16 +1241,9 @@ function webfinger_rfc7033($webbie, $zot = false) {
}
logger('fetching url from resource: ' . $rhs . ':' . $webbie);
- // The default curl Accept: header is */*, which is incorrectly handled by Mastodon servers
- // and results in a 406 (Not Acceptable) response, and will also incorrectly produce an XML
- // document if you use 'application/jrd+json, */*'. We could set this to application/jrd+json,
- // but some test webfinger servers may not explicitly set the content type and they would be
- // blocked. The best compromise until Mastodon is fixed is to remove the Accept header which is
- // accomplished by setting it to nothing.
-
$counter = 0;
$s = z_fetch_url('https://' . $rhs . '/.well-known/webfinger?f=&resource=' . $resource . (($zot) ? '&zot=1' : ''),
- false, $counter, [ 'headers' => [ 'Accept:' ] ]);
+ false, $counter, [ 'headers' => [ 'Accept: application/jrd+json, */*' ] ]);
if($s['success']) {
$j = json_decode($s['body'], true);
@@ -1607,6 +1601,7 @@ function get_site_info() {
'register_policy' => $register_policy[get_config('system','register_policy')],
'invitation_only' => (bool) intval(get_config('system','invitation_only')),
'directory_mode' => $directory_mode[get_config('system','directory_mode')],
+ 'directory_server' => get_config('system','directory_server'),
'language' => get_config('system','language'),
'rss_connections' => (bool) intval(get_config('system','feed_contacts')),
'expiration' => $site_expire,
@@ -1844,7 +1839,8 @@ function z_mail($params) {
$messageHeader =
$params['additionalMailHeader'] .
"From: $fromName <{$params['fromEmail']}>\n" .
- "Reply-To: $fromName <{$params['replyTo']}>";
+ "Reply-To: $fromName <{$params['replyTo']}>\n" .
+ "Content-Type: text/plain; charset=UTF-8";
// send the message
$res = mail(
@@ -1873,7 +1869,7 @@ function probe_api_path($host) {
foreach($paths as $path) {
$curpath = $scheme . '://' . $host . $path;
$x = z_fetch_url($curpath);
- if($x['success'] && ! strlen($x['body'], 'not implemented'))
+ if($x['success'] && ! strpos($x['body'], 'not implemented'))
return str_replace('version', '', $curpath);
}
}