Skip to content

Commit d834190

Browse files
committed
Fix CSP nonce for older versions
1 parent acfcb32 commit d834190

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

docker-compose.dev.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
args:
77
NC_VERSION: v31.0.0rc4
88
ports:
9-
- 8080:8080
9+
- 8010:8080
1010
volumes:
1111
- nc31-config:/nextcloud/config
1212
- nc31-data:/nextcloud/data
@@ -19,7 +19,7 @@ services:
1919
args:
2020
NC_VERSION: v30.0.6
2121
ports:
22-
- 8080:8080
22+
- 8009:8080
2323
volumes:
2424
- nc30-config:/nextcloud/config
2525
- nc30-data:/nextcloud/data
@@ -32,7 +32,7 @@ services:
3232
args:
3333
NC_VERSION: v29.0.12
3434
ports:
35-
- 8080:8080
35+
- 8008:8080
3636
volumes:
3737
- nc29-config:/nextcloud/config
3838
- nc29-data:/nextcloud/data

templates/editor.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@
55

66
script('openincryptpad', 'openincryptpad-editor');
77
style('openincryptpad', 'editor');
8+
9+
if ($_['cspNonce']) {
10+
$nonce = $_['cspNonce']; // For Nextcloud version >= 30
11+
} else {
12+
$nonce = base64_encode($_['requesttoken']); // For Nextcloud version < 30
13+
}
814
?>
915

10-
<script nonce="<?php p($_['cspNonce']) ?>"><?php print_unescaped($_['infoScript']) ?></script>
16+
<script nonce="<?php p($nonce) ?>"><?php print_unescaped($_['infoScript']) ?></script>
1117

12-
<script nonce="<?php p($_['cspNonce']) ?>"
18+
<script nonce="<?php p($nonce) ?>"
1319
src="<?php p($_["apiUrl"]) ?>" type="text/javascript"></script>
1420
<div id="unsaved-indicator">
1521
<?php p($l->t('Saving...')); ?>

0 commit comments

Comments
 (0)