trying to fix /.well-known/host-meta
This commit is contained in:
parent
0c7f0aa3fa
commit
02cee2c562
|
@ -15,9 +15,10 @@ php_value memory_limit 512M
|
||||||
<IfModule mod_rewrite.c>
|
<IfModule mod_rewrite.c>
|
||||||
RewriteEngine on
|
RewriteEngine on
|
||||||
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||||
|
RewriteRule ^.well-known/host-meta /public.php?service=host-meta [QSA,L]
|
||||||
RewriteRule ^.well-known/carddav /remote.php/carddav/ [R]
|
RewriteRule ^.well-known/carddav /remote.php/carddav/ [R]
|
||||||
RewriteRule ^.well-known/caldav /remote.php/caldav/ [R]
|
RewriteRule ^.well-known/caldav /remote.php/caldav/ [R]
|
||||||
RewriteRule ^apps/([^/]*)/(.*\.(css|php))$ index.php?app=$1&getfile=$2 [QSA,L]
|
RewriteRule ^apps/([^/]*)/(.*\.(css|php))$ index.php?app=$1&getfile=$2 [QSA,L]
|
||||||
RewriteRule ^remote/(.*) remote.php [QSA,L]
|
RewriteRule ^remote/(.*) remote.php [QSA,L]
|
||||||
</IfModule>
|
</IfModule>
|
||||||
Options -Indexes
|
Options -Indexes
|
||||||
|
|
|
@ -3,9 +3,6 @@ $hostMetaHeader = array(
|
||||||
'Access-Control-Allow-Origin' => '*',
|
'Access-Control-Allow-Origin' => '*',
|
||||||
'Content-Type' => 'application/xml+xrd'
|
'Content-Type' => 'application/xml+xrd'
|
||||||
);
|
);
|
||||||
$appInfoDir = __DIR__;
|
|
||||||
$thisAppDir = dirname($appInfoDir);
|
|
||||||
$appsDir = dirname($thisAppDir);
|
|
||||||
$ownCloudDir = dirname($appsDir);
|
$ownCloudDir = dirname($appsDir);
|
||||||
$docRoot = $_SERVER['DOCUMENT_ROOT'];
|
$docRoot = $_SERVER['DOCUMENT_ROOT'];
|
||||||
try {
|
try {
|
||||||
|
@ -29,23 +26,7 @@ $hostMetaContents = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||||
<Title>Resource Descriptor</Title>
|
<Title>Resource Descriptor</Title>
|
||||||
</Link>
|
</Link>
|
||||||
</XRD>";
|
</XRD>";
|
||||||
@mkdir($hostMetaDir);
|
|
||||||
$hostMeta = fopen($hostMetaPath, 'w');
|
|
||||||
if(!$hostMeta) {
|
|
||||||
die("Could not open " . $hostMetaPath . " for writing, please check permissions!");
|
|
||||||
}
|
|
||||||
if(!fwrite($hostMeta, $hostMetaContents, strlen($hostMetaContents))) {
|
|
||||||
die("Could not write to " . $hostMetaPath . ", please check permissions!");
|
|
||||||
}
|
|
||||||
fclose($hostMeta);
|
|
||||||
|
|
||||||
// write custom headers into .htaccess:
|
|
||||||
$htaccess = fopen($hostMetaDir . '/.htaccess', 'w');
|
|
||||||
//TODO: check compatibility!
|
|
||||||
fwrite($htaccess, "<filesMatch \"^host-meta$\">
|
|
||||||
<ifModule mod_headers.c>\n");
|
|
||||||
foreach($hostMetaHeader as $header => $value) {
|
foreach($hostMetaHeader as $header => $value) {
|
||||||
fwrite($htaccess, "Header set " . $header . " \"" . $value . "\"\n");
|
header($header . ": " . $value);
|
||||||
}
|
}
|
||||||
fwrite($htaccess, "</ifModule>\n</filesMatch>");
|
echo $hostMetaContents;
|
||||||
fclose($htaccess);
|
|
Loading…
Reference in New Issue