Maybe fix things with .onion...
This commit is contained in:
parent
06aba96872
commit
ecd02e13db
@ -49,7 +49,12 @@ if (class_exists('\OC\Files\Type\TemplateManager')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Whitelist the wopi URL for iframes, required for Firefox
|
// Whitelist the wopi URL for iframes, required for Firefox
|
||||||
$wopiUrl = str_replace("hostname.host", $_SERVER["HTTP_HOST"], \OC::$server->getConfig()->getAppValue('richdocuments', 'wopi_url'));
|
$replaceWith = str_replace("hostname.host", $_SERVER['HTTP_HOST'], $this->config->getAppValue('richdocuments', 'wopi_url'));
|
||||||
|
// Use plain HTTP for .onion/TOR
|
||||||
|
if (strpos($replaceWith, ".onion") !== FALSE) {
|
||||||
|
$replaceWith = str_replace("https://", "http://", $replaceWith);
|
||||||
|
}
|
||||||
|
$wopiUrl = $replaceWith;
|
||||||
if ($wopiUrl !== '') {
|
if ($wopiUrl !== '') {
|
||||||
$manager = \OC::$server->getContentSecurityPolicyManager();
|
$manager = \OC::$server->getContentSecurityPolicyManager();
|
||||||
$policy = new ContentSecurityPolicy();
|
$policy = new ContentSecurityPolicy();
|
||||||
|
@ -129,7 +129,12 @@ class DocumentController extends Controller {
|
|||||||
|
|
||||||
$response = new TemplateResponse('richdocuments', 'documents', $params, 'empty');
|
$response = new TemplateResponse('richdocuments', 'documents', $params, 'empty');
|
||||||
$policy = new ContentSecurityPolicy();
|
$policy = new ContentSecurityPolicy();
|
||||||
$policy->addAllowedFrameDomain(str_replace("hostname.host", $_SERVER["HTTP_HOST"], $this->appConfig->getAppValue('wopi_url')));
|
$replaceWith = str_replace("hostname.host", $_SERVER['HTTP_HOST'], $this->config->getAppValue('richdocuments', 'wopi_url'));
|
||||||
|
// Use plain HTTP for .onion/TOR
|
||||||
|
if (strpos($replaceWith, ".onion") !== FALSE) {
|
||||||
|
$replaceWith = str_replace("https://", "http://", $replaceWith);
|
||||||
|
}
|
||||||
|
$policy->addAllowedFrameDomain($replaceWith);
|
||||||
$policy->allowInlineScript(true);
|
$policy->allowInlineScript(true);
|
||||||
$response->setContentSecurityPolicy($policy);
|
$response->setContentSecurityPolicy($policy);
|
||||||
return $response;
|
return $response;
|
||||||
@ -192,7 +197,12 @@ class DocumentController extends Controller {
|
|||||||
|
|
||||||
$response = new TemplateResponse('richdocuments', 'documents', $params, 'empty');
|
$response = new TemplateResponse('richdocuments', 'documents', $params, 'empty');
|
||||||
$policy = new ContentSecurityPolicy();
|
$policy = new ContentSecurityPolicy();
|
||||||
$policy->addAllowedFrameDomain(str_replace("hostname.host", $_SERVER["HTTP_HOST"], $this->appConfig->getAppValue('wopi_url')));
|
$replaceWith = str_replace("hostname.host", $_SERVER['HTTP_HOST'], $this->config->getAppValue('richdocuments', 'wopi_url'));
|
||||||
|
// Use plain HTTP for .onion/TOR
|
||||||
|
if (strpos($replaceWith, ".onion") !== FALSE) {
|
||||||
|
$replaceWith = str_replace("https://", "http://", $replaceWith);
|
||||||
|
}
|
||||||
|
$policy->addAllowedFrameDomain($replaceWith);
|
||||||
$policy->allowInlineScript(true);
|
$policy->allowInlineScript(true);
|
||||||
$response->setContentSecurityPolicy($policy);
|
$response->setContentSecurityPolicy($policy);
|
||||||
return $response;
|
return $response;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user