diff --git a/static/js/grid_loader.js b/static/js/grid_loader.js index f203bd7..39ba154 100644 --- a/static/js/grid_loader.js +++ b/static/js/grid_loader.js @@ -88,11 +88,20 @@ const insertGame = (gridboxnum, game) => { const insertLeague = (league) => { var btn = document.createElement("BUTTON"); btn.className = "filter"; - btn.innerHTML = league; + btn.innerHTML = escapeHtml(league); $('#filters').append(btn); return btn; } +function escapeHtml(unsafe) { + return unsafe + .replace(/&/g, "&") + .replace(//g, ">") + .replace(/"/g, """) + .replace(/'/g, "'"); + } + const clearBox = (box) => { box.className = "emptyslot"; box.timestamp = null; diff --git a/templates/game_box.html b/templates/game_box.html index c4d1d1d..d94ac25 100644 --- a/templates/game_box.html +++ b/templates/game_box.html @@ -5,18 +5,18 @@ src={% if state.bases[number] %}"/static/img/base_filled.png" alt="{{state.bases {% if number <= state.outs %}/static/img/out_out.png{% else %}/static/img/out_in.png{% endif %} {%- endmacro %}
-
Inning: {% if state.display_top_of_inning == true %}🔼{% else %}🔽{% endif %} {{ state.display_inning }}/{{ state.max_innings }}
-
{{ state.title }}
-
{{ state.weather_emoji }} {{ state.weather_text }}
+
Inning: {% if state.display_top_of_inning == true %}🔼{% else %}🔽{% endif %} {{ state.display_inning | escape }}/{{ state.max_innings | escape }}
+
{{ state.title | escape }}
+
{{ state.weather_emoji | escape }} {{ state.weather_text | escape }}
-
{{ state.away_name }}
+
{{ state.away_name | escape }}
{{ state.away_score }}
-
{{ state.home_name }}
+
{{ state.home_name | escape }}
{{ state.home_score }}
@@ -38,16 +38,16 @@ src={% if state.bases[number] %}"/static/img/base_filled.png" alt="{{state.bases
PITCHER
-
{{ state.pitcher }}
+
{{ state.pitcher | escape }}
BATTER
-
{{ state.batter }}
+
{{ state.batter | escape }}
-
{{ state.update_emoji }}
-
{{ state.update_text }}
+
{{ state.update_emoji | escape }}
+
{{ state.update_text | escape }}
\ No newline at end of file