Skip to content

Commit d95879d

Browse files
committed
Updated for custom CSP changes
1 parent d23bf62 commit d95879d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

controller/pagecontroller.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use \OCP\IRequest;
1616
use \OCP\AppFramework\Http\TemplateResponse;
1717
use \OCP\AppFramework\Controller;
18+
use \OCP\AppFramework\Http\ContentSecurityPolicy;
1819

1920
class PageController extends Controller {
2021

@@ -37,7 +38,11 @@ public function __construct($appName, IRequest $request, $userId){
3738
* @NoCSRFRequired
3839
*/
3940
public function index() {
40-
$params = array('user' => $this->userId);
41-
return new TemplateResponse('ownnote', 'main', $params); // templates/main.php
41+
$params = array('user' => $this->userId);
42+
$csp = new \OCP\AppFramework\Http\ContentSecurityPolicy();
43+
$csp->addAllowedImageDomain('data:');
44+
$response = new TemplateResponse('ownnote', 'main', $params);
45+
$response->setContentSecurityPolicy($csp);
46+
return $response;
4247
}
4348
}

0 commit comments

Comments
 (0)