From 2456148ac49d492e19ff1ff05532e300ff4784e9 Mon Sep 17 00:00:00 2001 From: Daniel Kastl Date: Thu, 13 Jun 2024 16:53:34 +0900 Subject: [PATCH 1/3] Adds CORS docs Signed-off-by: Daniel Kastl --- doc/index.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/doc/index.md b/doc/index.md index 6b3a499..086a66e 100644 --- a/doc/index.md +++ b/doc/index.md @@ -72,3 +72,42 @@ curl -sX GET "${BROKER_URL}/v2/subscriptions" -H "Accept: application/json" | jq These cURL commands should help you interact with the FIWARE broker and test the Redmine GTT FIWARE plugin effectively. If you encounter any issues or need further assistance, please let us know! + +#### CORS Issues + +If you encounter CORS issues, for example when you use FIWARE-Big-Bang, you can extend +the Ngix configuration as follows: + +```nginx +[snip] + +server { + [snip] + + # Add CORS Headers + add_header 'Access-Control-Allow-Origin' '*' always; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE, PUT, PATCH' always; + add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, Accept, Authorization, X-Requested-With, fiware-service, fiware-servicepath' always; + add_header 'Access-Control-Expose-Headers' 'location, fiware-correlator' always; + + location / { + if ($request_method = 'OPTIONS') { + add_header 'Access-Control-Allow-Origin' '*' always; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE, PUT, PATCH' always; + add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, Accept, Authorization, X-Requested-With, fiware-service, fiware-servicepath' always; + add_header 'Access-Control-Expose-Headers' 'location, fiware-correlator' always; + add_header 'Access-Control-Max-Age' 1728000; + add_header 'Content-Type' 'text/plain charset=UTF-8'; + add_header 'Content-Length' 0; + return 204; + } + + [snip] + } + + [snip] +} +``` + +In particular `location` and `fiware-service, fiware-servicepath` are important +for the FIWARE broker to work correctly. From 8e6153785de3317f0fe8901d9065296396273588 Mon Sep 17 00:00:00 2001 From: Daniel Kastl Date: Thu, 13 Jun 2024 23:23:03 +0900 Subject: [PATCH 2/3] Flips coordinates for geoquery, fixes #43 Signed-off-by: Daniel Kastl --- app/views/subscription_templates/_form.html.erb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/subscription_templates/_form.html.erb b/app/views/subscription_templates/_form.html.erb index ba6beaf..b99c981 100644 --- a/app/views/subscription_templates/_form.html.erb +++ b/app/views/subscription_templates/_form.html.erb @@ -61,14 +61,16 @@ if (link) { link.addEventListener('click', function(e) { e.preventDefault(); - var geom = JSON.parse(e.target.dataset.geom).geometry.coordinates[0].map(coord => [Number(coord[0].toFixed(5)), Number(coord[1].toFixed(5))]).join(';'); + var geom = JSON.parse(e.target.dataset.geom).geometry.coordinates[0] + .map(coord => [Number(coord[1].toFixed(5)), Number(coord[0].toFixed(5))]) // Flip the coordinates + .join(';'); document.querySelector('input[name="subscription_template[expression_coords]"]').value = geom; document.querySelector('select[name="subscription_template[expression_geometry]"]').value = 'polygon'; document.querySelector('input[name="subscription_template[expression_georel]"]').value = 'coveredBy'; }); } }); - +

<%= content_tag :label, l(:field_subscription_template_alteration_types) %> From 7356f7d71039f5636755412a6e3a1db8a14695ab Mon Sep 17 00:00:00 2001 From: Daniel Kastl Date: Thu, 13 Jun 2024 23:26:01 +0900 Subject: [PATCH 3/3] Update init.rb --- init.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.rb b/init.rb index 10fb638..6bc4b5b 100644 --- a/init.rb +++ b/init.rb @@ -12,7 +12,7 @@ author_url 'https://github.com/georepublic' url 'https://github.com/gtt-project/redmine_gtt_fiware' description 'Adds FIWARE integration capabilities for GTT projects' - version '1.0.0' + version '1.0.3' # Specify the minimum required Redmine version requires_redmine :version_or_higher => '5.0.0'