aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2018-10-02 16:43:05 +0200
committerGitHub <noreply@github.com>2018-10-02 16:43:05 +0200
commit67c76ffcea35f94cb129fef8af1bb6cdc770d019 (patch)
tree7fe5a0fed079f75d7b83208d41764470ae82228e
parentafef15b07bbe97820745c5a863f3be8086c73eab (diff)
parent4f19466108c084e5ef59df7becd2fc85e85c1524 (diff)
downloadnextcloud-server-67c76ffcea35f94cb129fef8af1bb6cdc770d019.tar.gz
nextcloud-server-67c76ffcea35f94cb129fef8af1bb6cdc770d019.zip
Merge pull request #11535 from nextcloud/bugfix/11031/theming-unsafe-eval
Manually instantiate jscolor to avoid csp errors
-rw-r--r--apps/theming/js/settings-admin.js4
-rw-r--r--apps/theming/templates/settings-admin.php2
2 files changed, 5 insertions, 1 deletions
diff --git a/apps/theming/js/settings-admin.js b/apps/theming/js/settings-admin.js
index afc218b7ffa..28f7645eae7 100644
--- a/apps/theming/js/settings-admin.js
+++ b/apps/theming/js/settings-admin.js
@@ -106,6 +106,10 @@ function hideUndoButton(setting, value) {
$(document).ready(function () {
$('#theming [data-toggle="tooltip"]').tooltip();
+ // manually instantiate jscolor to work around new Function call which violates strict CSP
+ var colorElement = $('#theming-color')[0];
+ var jscolor = new window.jscolor(colorElement, {hash: true});
+
$('#theming .theme-undo').each(function() {
var setting = $(this).data('setting');
var value = $('#theming-'+setting).val();
diff --git a/apps/theming/templates/settings-admin.php b/apps/theming/templates/settings-admin.php
index 0cc224abc24..656b23be4fb 100644
--- a/apps/theming/templates/settings-admin.php
+++ b/apps/theming/templates/settings-admin.php
@@ -62,7 +62,7 @@ style('theming', 'settings-admin');
<div>
<label>
<span><?php p($l->t('Color')) ?></span>
- <input id="theming-color" type="text" class="jscolor" data-jscolor="{hash:true}" maxlength="7" value="<?php p($_['color']) ?>" />
+ <input id="theming-color" type="text" maxlength="7" value="<?php p($_['color']) ?>" />
<div data-setting="color" data-toggle="tooltip" data-original-title="<?php p($l->t('Reset to default')); ?>" class="theme-undo icon icon-history"></div>
</label>
</div>