Use containerMenu as a base for HintMenu instead of regular menu
Change-Id: Ic1ed2e216a9c61aabf1f1cac41972b1a4e96a91a
diff --git a/lib/Kalamar.pm b/lib/Kalamar.pm
index b6a5db0..2fb41b9 100644
--- a/lib/Kalamar.pm
+++ b/lib/Kalamar.pm
@@ -142,6 +142,13 @@
'Access-Control-Allow-Methods' =>
$h->header('Access-Control-Allow-Methods') // 'GET, POST, OPTIONS'
);
+ #This is only for testing
+ $h->header('Access-Control-Allow-Origin' => '*'); #https://stackoverflow.com/questions/61161128/allow-cors-with-mojoliciouspluginsecurecors
+ $h->access_control_allow_origin('*');
+ $h->header('Access-Control-Allow-Methods' => 'GET, OPTIONS, POST, DELETE, PUT');
+ $h->header('Access-Control-Allow-Headers' => 'Content-Type' => 'application/json');
+ $h->header('Access-Control-Allow-Headers' => 'Origin, X-Requested-With, Accept, Authorization, Content-Type');
+ #end test
}
);
diff --git a/lib/Kalamar/Plugin/CSP.pm b/lib/Kalamar/Plugin/CSP.pm
index 59c6c58..cd5dbec 100644
--- a/lib/Kalamar/Plugin/CSP.pm
+++ b/lib/Kalamar/Plugin/CSP.pm
@@ -17,7 +17,6 @@
my $with_nonce = delete $param->{-with_nonce};
my $disabled = delete $param->{-disable};
-
if ($disabled) {
$app->log->warn('CSP DISABLED!','NEVER USE IN PRODUCTION!');
};
@@ -49,7 +48,7 @@
my $csp = \( generate(%directives) );
# Add csp header
- unless ($disabled) {
+ unless ($disabled) {
$app->hook(
before_dispatch => sub {
my $c = shift;
@@ -92,7 +91,7 @@
$app->helper(
csp_nonce_tag => sub {
- my $c = shift;
+ my $c = shift;
if ($disabled || !$c->content_block_ok('nonce_js')) {
return '';
};
diff --git a/lib/Kalamar/Plugin/QueryReference.pm b/lib/Kalamar/Plugin/QueryReference.pm
index bb1b390..1823c53 100644
--- a/lib/Kalamar/Plugin/QueryReference.pm
+++ b/lib/Kalamar/Plugin/QueryReference.pm
@@ -25,11 +25,12 @@
$r->add_type('qname' => qr![-_\.a-zA-Z0-9]+!);
-
+
# List queries
$r->get('/query')->to(
cb => sub {
my $c = shift;
+ #$c->res->headers->header('Access-Control-Allow-Origin' => '127.0.0.1:3000'); #Does not seem to be necessary
# Use mock up
if ($ENV{QUERY_REF_MOCKUP}) {
@@ -104,6 +105,7 @@
$r->put('/query/<qname:qname>')->to(
cb => sub {
my $c = shift;
+ #$c->res->headers->header('Access-Control-Allow-Origin' => '127.0.0.1:3000'); #Does not seem to be necessary
my $v = $c->validation;
# Missing: definition
@@ -239,6 +241,7 @@
$r->delete('/query/<qname:qname>')->to(
cb => sub {
my $c = shift;
+ #$c->res->headers->header('Access-Control-Allow-Origin' => '127.0.0.1:3000'); #Does not seem to be necessary
my $qname = $c->stash('qname');
# Use mock up
@@ -324,6 +327,7 @@
$r->get('/query/<qname:qname>')->to(
cb => sub {
my $c = shift;
+ #$c->res->headers->header('Access-Control-Allow-Origin' => '127.0.0.1:3000'); #Does not seem to be necessary
my $qname = $c->stash('qname');
# Use mock up