From b3923428e5c5c50b0952f75b011191ceb034bae6 Mon Sep 17 00:00:00 2001 From: Terrtia Date: Tue, 25 Sep 2018 14:37:14 +0200 Subject: [PATCH 1/3] fix: [Flask] remove hardcoded url --- .../modules/dashboard/templates/index.html | 9 +-- .../sentiment_analysis_plot_tool.html | 4 +- .../sentiment_analysis_trending.html | 4 +- .../trendingcharts/templates/Trending.html | 5 +- .../templates/Moduletrending.html | 6 +- var/www/static/js/indexjavascript.js | 18 +++++- var/www/static/js/moduleTrending.js | 63 +++++++++++-------- var/www/static/js/sentiment_plot.js | 28 ++++++--- var/www/static/js/sentiment_trending.js | 16 ++++- var/www/static/js/trendingchart.js | 53 +++++++++------- 10 files changed, 136 insertions(+), 70 deletions(-) diff --git a/var/www/modules/dashboard/templates/index.html b/var/www/modules/dashboard/templates/index.html index e7331b6f..6d1bf12d 100644 --- a/var/www/modules/dashboard/templates/index.html +++ b/var/www/modules/dashboard/templates/index.html @@ -24,8 +24,7 @@ window.glob_tabvar = []; // Avoid undefined window.threshold_stucked_module = {{ threshold_stucked_module }} function update_values() { - $SCRIPT_ROOT = {{ request.script_root|tojson|safe }}; - $.getJSON($SCRIPT_ROOT+"/_stuff", + $.getJSON("{{ url_for('dashboard.stuff') }}", function(data) { window.glob_tabvar = data; }); @@ -189,14 +188,16 @@ - + - + diff --git a/var/www/modules/sentiment/templates/sentiment_analysis_trending.html b/var/www/modules/sentiment/templates/sentiment_analysis_trending.html index f0c12790..d1ed7c02 100644 --- a/var/www/modules/sentiment/templates/sentiment_analysis_trending.html +++ b/var/www/modules/sentiment/templates/sentiment_analysis_trending.html @@ -230,7 +230,9 @@ - + - +
diff --git a/var/www/modules/trendingmodules/templates/Moduletrending.html b/var/www/modules/trendingmodules/templates/Moduletrending.html index e7ac8232..5c24110a 100644 --- a/var/www/modules/trendingmodules/templates/Moduletrending.html +++ b/var/www/modules/trendingmodules/templates/Moduletrending.html @@ -34,10 +34,12 @@ - + diff --git a/var/www/modules/PasteSubmit/templates/submiting.html b/var/www/modules/PasteSubmit/templates/submiting.html index 6174742f..d7aa5716 100644 --- a/var/www/modules/PasteSubmit/templates/submiting.html +++ b/var/www/modules/PasteSubmit/templates/submiting.html @@ -205,7 +205,7 @@ var ltagsgalaxies $(document).ready(function(){ - $.getJSON('/Tags/get_all_tags_taxonomies', + $.getJSON("{{ url_for('Tags.get_all_tags_taxonomies') }}", function(data) { ltags = $('#ltags').tagSuggest({ @@ -215,7 +215,7 @@ }); }); - $.getJSON('/Tags/get_all_tags_galaxies', + $.getJSON("{{ url_for('Tags.get_all_tags_galaxy') }}", function(data) { ltagsgalaxies = $('#ltagsgalaxies').tagSuggest({ @@ -242,7 +242,7 @@ function submitPaste(){ diff --git a/var/www/modules/Tags/templates/galaxies.html b/var/www/modules/Tags/templates/galaxies.html index 2dc6d473..01c42e77 100644 --- a/var/www/modules/Tags/templates/galaxies.html +++ b/var/www/modules/Tags/templates/galaxies.html @@ -12,7 +12,7 @@ - + diff --git a/var/www/modules/Tags/templates/tag_galaxy_info.html b/var/www/modules/Tags/templates/tag_galaxy_info.html index 9ee05049..53759cbe 100644 --- a/var/www/modules/Tags/templates/tag_galaxy_info.html +++ b/var/www/modules/Tags/templates/tag_galaxy_info.html @@ -12,7 +12,7 @@ - + diff --git a/var/www/modules/Tags/templates/tagged.html b/var/www/modules/Tags/templates/tagged.html index c0628eb7..044defdf 100644 --- a/var/www/modules/Tags/templates/tagged.html +++ b/var/www/modules/Tags/templates/tagged.html @@ -178,7 +178,7 @@ $(document).ready(function(){ $("#nbr_entry").hide(); $("#loading_gif_browse").hide(); - $.getJSON('/Tags/get_all_tags', + $.getJSON("{{ url_for('Tags.get_all_tags') }}", function(data) { activePage = "page-Tags" $("#"+activePage).addClass("active"); diff --git a/var/www/modules/Tags/templates/taxonomies.html b/var/www/modules/Tags/templates/taxonomies.html index 83d8a930..1d928bc9 100644 --- a/var/www/modules/Tags/templates/taxonomies.html +++ b/var/www/modules/Tags/templates/taxonomies.html @@ -12,7 +12,7 @@ - + diff --git a/var/www/modules/hashDecoded/templates/hashDecoded.html b/var/www/modules/hashDecoded/templates/hashDecoded.html index f65f647b..1d0fb808 100644 --- a/var/www/modules/hashDecoded/templates/hashDecoded.html +++ b/var/www/modules/hashDecoded/templates/hashDecoded.html @@ -244,11 +244,11 @@ }); {% if type %} - chart.stackBarChart =barchart_type_stack('/hashDecoded/hash_by_type_json?type={{type}}', 'id'); + chart.stackBarChart =barchart_type_stack("{{ url_for('hashDecoded.hash_by_type_json') }}?type={{type}}", 'id'); {% elif daily_type_chart %} - chart.stackBarChart =barchart_type_stack('/hashDecoded/range_type_json?date_from={{daily_date}}&date_to={{daily_date}}', 'id'); + chart.stackBarChart =barchart_type_stack("{{ url_for('hashDecoded.range_type_json') }}?date_from={{daily_date}}&date_to={{daily_date}}", 'id'); {% else %} - chart.stackBarChart = barchart_type_stack("/hashDecoded/range_type_json?date_from={{date_from}}&date_to={{date_to}}", 'id') + chart.stackBarChart = barchart_type_stack("{{ url_for('hashDecoded.range_type_json') }}?date_from={{date_from}}&date_to={{date_to}}", 'id') {% endif %} chart.onResize(); @@ -260,7 +260,7 @@ - + @@ -34,7 +34,7 @@ -
+ diff --git a/var/www/modules/PasteSubmit/templates/edit_tag_export.html b/var/www/modules/PasteSubmit/templates/edit_tag_export.html index 7921d1d7..04a506d6 100644 --- a/var/www/modules/PasteSubmit/templates/edit_tag_export.html +++ b/var/www/modules/PasteSubmit/templates/edit_tag_export.html @@ -15,10 +15,10 @@ - - - - + + + +