Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/apps.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichiel de Jong <michiel@unhosted.org>2012-05-11 14:00:31 +0400
committerMichiel de Jong <michiel@unhosted.org>2012-05-11 17:21:45 +0400
commita6f5a43f90232e1a8a4a002ed37ba0684484cfb4 (patch)
tree08778fcbf3409f03aded2aa1561efdc1d2095253 /user_webfinger
parentd03191e2c4f919e22ed9dc4c99fcdba2a72f1a31 (diff)
move host-meta to JRD because I can't work out how to deal with ampersands in XRD
Diffstat (limited to 'user_webfinger')
-rw-r--r--user_webfinger/host-meta.php18
1 files changed, 6 insertions, 12 deletions
diff --git a/user_webfinger/host-meta.php b/user_webfinger/host-meta.php
index 30072a728..7a60a81a4 100644
--- a/user_webfinger/host-meta.php
+++ b/user_webfinger/host-meta.php
@@ -1,31 +1,25 @@
<?php
$hostMetaHeader = array(
'Access-Control-Allow-Origin' => '*',
- '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 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
-<XRD xmlns=\"http://docs.oasis-open.org/ns/xri/xrd-1.0\" xmlns:hm=\"http://host-meta.net/xrd/1.0\">
- <hm:Host xmlns=\"http://host-meta.net/xrd/1.0\">" . $serverName . "</hm:Host>
- <Link rel=\"lrdd\" template=\"" . $lrddTmpl . "\">
- <Title>Resource Descriptor</Title>
- </Link>
-</XRD>";
+$hostMetaContents = "{\"links\":[{\"rel\":\"lrdd\",\"template\":\"http://mich.oc/public.php?service=webfinger&q={uri}\"}]}";
foreach($hostMetaHeader as $header => $value) {
header($header . ": " . $value);
}