2022-10-03 02:44:20 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace KaraDAV;
|
|
|
|
|
|
|
|
use KD2\WebDAV\Server as WebDAV_Server;
|
|
|
|
|
|
|
|
class WebDAV extends WebDAV_Server
|
|
|
|
{
|
2022-10-10 12:01:20 +00:00
|
|
|
protected function html_directory(string $uri, iterable $list): ?string
|
2022-10-03 02:44:20 +00:00
|
|
|
{
|
2022-10-10 12:01:20 +00:00
|
|
|
$out = parent::html_directory($uri, $list);
|
2022-10-03 02:44:20 +00:00
|
|
|
|
|
|
|
if (null !== $out) {
|
2022-10-10 12:01:20 +00:00
|
|
|
$out = str_replace('<body>', sprintf('<body style="opacity: 0"><script type="text/javascript" src="%swebdav.js"></script>', WWW_URL), $out);
|
2022-10-03 02:44:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return $out;
|
|
|
|
}
|
2022-10-10 12:01:20 +00:00
|
|
|
|
|
|
|
public function http_options(): void
|
|
|
|
{
|
|
|
|
parent::http_options();
|
|
|
|
|
|
|
|
header('Access-Control-Allow-Origin: *');
|
|
|
|
header('Access-Control-Allow-Credentials: true');
|
|
|
|
header('Access-Control-Allow-Headers: Authorization, *');
|
|
|
|
header('Access-Control-Allow-Methods: GET,HEAD,PUT,DELETE,COPY,MOVE,PROPFIND,MKCOL,LOCK,UNLOCK');
|
|
|
|
}
|
2022-10-03 02:44:20 +00:00
|
|
|
}
|