From b133f22d7f09a12cf69117a8471cee4bce717ad1 Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Fri, 11 May 2012 12:00:31 +0200 Subject: [PATCH] move host-meta to JRD because I can't work out how to deal with ampersands in XRD --- apps/user_webfinger/host-meta.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/apps/user_webfinger/host-meta.php b/apps/user_webfinger/host-meta.php index 30072a728b9..7a60a81a4ae 100644 --- a/apps/user_webfinger/host-meta.php +++ b/apps/user_webfinger/host-meta.php @@ -1,31 +1,25 @@ '*', - 'Content-Type' => 'application/xml+xrd' + 'Content-Type' => 'application/json+jrd' ); $ownCloudDir = dirname($appsDir); $docRoot = $_SERVER['DOCUMENT_ROOT']; try { - $webRoot = substr(realpath($ownCloudDir), strlen(realpath($docRoot))); + $webRoot = substr(realpath($ownCloudDir), strlen(realpath($docRoot))); } catch(Exception $e) { - // some servers fail on realpath(), let's try it the unsecure way: - $webRoot = substr($ownCloudDir, strlen($docRoot)); + // some servers fail on realpath(), let's try it the unsecure way: + $webRoot = substr($ownCloudDir, strlen($docRoot)); } $serverName = $_SERVER['SERVER_NAME']; $lrddTmpl = 'http'; if(isset($_SERVER['HTTPS'])) { - $lrddTmpl .= 's'; + $lrddTmpl .= 's'; } $lrddTmpl .= '://' . $serverName . $webRoot . '/public.php?service=webfinger&q={uri}'; $hostMetaPath = $docRoot . '/.well-known/host-meta'; $hostMetaDir = $docRoot . '/.well-known'; -$hostMetaContents = " - - " . $serverName . " - - Resource Descriptor - -"; +$hostMetaContents = "{\"links\":[{\"rel\":\"lrdd\",\"template\":\"http://mich.oc/public.php?service=webfinger&q={uri}\"}]}"; foreach($hostMetaHeader as $header => $value) { header($header . ": " . $value); } -- 2.39.5