diff --git a/.gitignore b/.gitignore
index 19e89a6a..618e4f99 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,5 @@ tests/clover.xml
*.spec
*.tar.gz
richdocuments.zip
-build/
\ No newline at end of file
+build/
+/nbproject/private/
\ No newline at end of file
diff --git a/appinfo/app.php b/appinfo/app.php
index bafc3467..d747b5fc 100644
--- a/appinfo/app.php
+++ b/appinfo/app.php
@@ -49,7 +49,7 @@ if (class_exists('\OC\Files\Type\TemplateManager')) {
}
// Whitelist the wopi URL for iframes, required for Firefox
-$wopiUrl = \OC::$server->getConfig()->getAppValue('richdocuments', 'wopi_url');
+$wopiUrl = str_replace("hostname.host", $_SERVER["HTTP_HOST"], \OC::$server->getConfig()->getAppValue('richdocuments', 'wopi_url'));
if ($wopiUrl !== '') {
$manager = \OC::$server->getContentSecurityPolicyManager();
$policy = new ContentSecurityPolicy();
diff --git a/lib/Controller/DocumentController.php b/lib/Controller/DocumentController.php
index ccbc46ee..83b997d0 100644
--- a/lib/Controller/DocumentController.php
+++ b/lib/Controller/DocumentController.php
@@ -129,7 +129,7 @@ class DocumentController extends Controller {
$response = new TemplateResponse('richdocuments', 'documents', $params, 'empty');
$policy = new ContentSecurityPolicy();
- $policy->addAllowedFrameDomain($this->appConfig->getAppValue('wopi_url'));
+ $policy->addAllowedFrameDomain(str_replace("hostname.host", $_SERVER["HTTP_HOST"], $this->appConfig->getAppValue('wopi_url')));
$policy->allowInlineScript(true);
$response->setContentSecurityPolicy($policy);
return $response;
@@ -192,7 +192,7 @@ class DocumentController extends Controller {
$response = new TemplateResponse('richdocuments', 'documents', $params, 'empty');
$policy = new ContentSecurityPolicy();
- $policy->addAllowedFrameDomain($this->appConfig->getAppValue('wopi_url'));
+ $policy->addAllowedFrameDomain(str_replace("hostname.host", $_SERVER["HTTP_HOST"], $this->appConfig->getAppValue('wopi_url')));
$policy->allowInlineScript(true);
$response->setContentSecurityPolicy($policy);
return $response;
diff --git a/lib/WOPI/DiscoveryManager.php b/lib/WOPI/DiscoveryManager.php
index fd9da51c..6f7e184c 100644
--- a/lib/WOPI/DiscoveryManager.php
+++ b/lib/WOPI/DiscoveryManager.php
@@ -66,7 +66,8 @@ class DiscoveryManager {
public function get() {
// First check if there is a local valid discovery file
- try {
+ // Skylar Ittner (2017-09-06): Disable the cache so clients on multiple hosts can use it without breaking Content Security Policy
+ /*try {
$file = $this->appData->getFile('discovery.xml');
$decodedFile = json_decode($file->getContent(), true);
if($decodedFile['timestamp'] + 3600 > $this->timeFactory->getTime()) {
@@ -74,9 +75,9 @@ class DiscoveryManager {
}
} catch (NotFoundException $e) {
$file = $this->appData->newFile('discovery.xml');
- }
+ }*/
- $remoteHost = $this->config->getAppValue('richdocuments', 'wopi_url');
+ $remoteHost = str_replace("hostname.host", $_SERVER["HTTP_HOST"], $this->config->getAppValue('richdocuments', 'wopi_url'));
$wopiDiscovery = $remoteHost . '/hosting/discovery';
$client = $this->clientService->newClient();
@@ -87,12 +88,13 @@ class DiscoveryManager {
}
$responseBody = $response->getBody();
- $file->putContent(
+ // Skylar: Disable saving too, we don't need it if we're not loading ever
+ /*$file->putContent(
json_encode([
'data' => $responseBody,
'timestamp' => $this->timeFactory->getTime(),
])
- );
+ );*/
return $responseBody;
}
diff --git a/nbproject/project.properties b/nbproject/project.properties
new file mode 100644
index 00000000..76f6f918
--- /dev/null
+++ b/nbproject/project.properties
@@ -0,0 +1,7 @@
+include.path=${php.global.include.path}
+php.version=PHP_56
+source.encoding=UTF-8
+src.dir=.
+tags.asp=false
+tags.short=false
+web.root=.
diff --git a/nbproject/project.xml b/nbproject/project.xml
new file mode 100644
index 00000000..962786fb
--- /dev/null
+++ b/nbproject/project.xml
@@ -0,0 +1,9 @@
+
+