commit 9f00ca8ba772576efc2e81bba261a7a9104f367f
parent 9c302a6c71ceeb04d14ea68306e0ed39535f9a9f
Author: Andrew Laack <andrew@laack.co>
Date: Thu, 27 Aug 2026 10:22:57 -0500
home screen + navigation
Diffstat:
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/example/haskell.rl b/example/haskell.rl
@@ -1,3 +1,5 @@
# Haskell
This is just some information from this site
+
+<script> alert() </script>
diff --git a/learning/bin/main.ml b/learning/bin/main.ml
@@ -1,3 +1,6 @@
+let escape input =
+ Dream.html_escape input
+
let countPrefix char data =
let rec go idx =
if String.length data > idx && data.[idx] = char
@@ -12,9 +15,9 @@ let handle_normal_line line =
let hashCount = countPrefix '#' line in
if hashCount > 0
then
- "<h" ^ string_of_int hashCount ^ ">" ^ line ^ "</h" ^ string_of_int hashCount ^ ">"
+ "<h" ^ string_of_int hashCount ^ ">" ^ escape line ^ "</h" ^ string_of_int hashCount ^ ">"
else
- "<content-block>" ^ line ^ "</content-block>"
+ "<content-block>" ^ escape line ^ "</content-block>"
else
(* return nothing if the line is empty *)
""
@@ -68,7 +71,7 @@ let remove_file_extension file_name =
String.sub file_name 0 fin_period_pos
let course_to_html name =
- "<div> <a href=\"/course/" ^ (remove_file_extension name) ^ "\">" ^ (remove_file_extension name) ^ "</div>"
+ "<div> <a href=\"/course/" ^ escape (remove_file_extension name) ^ "\">" ^ escape (remove_file_extension name) ^ "</div>"
let get_courses =
basic_html_prefix ^ arr_to_string (Sys.readdir "../example/") course_to_html ^ basic_html_suffix