diff --git a/src/js/js_map.ml b/src/js/js_map.ml index f9b7612..d31e729 100644 --- a/src/js/js_map.ml +++ b/src/js/js_map.ml @@ -130,7 +130,7 @@ module Marker = struct let thread_preview_div = Jv.get Jv.global "thread_preview_div" in ignore @@ Jv.set thread_preview_div "innerHTML" thread_preview; let thread_link = Jv.get Jv.global "thread_link" in - let link = Format.sprintf "/%s" thread_id in + let link = Format.sprintf "/thread/%s" thread_id in ignore @@ Jv.set thread_link "href" (Jv.of_string link); ignore @@ Jv.set thread_link "innerText" (Jv.of_string "[View Thread]"); let _ = Js_pretty_post.make_pretty () in diff --git a/src/permap.ml b/src/permap.ml index 1be67b2..50494da 100644 --- a/src/permap.ml +++ b/src/permap.ml @@ -157,7 +157,7 @@ let newthread_post request = in match res with | Ok thread_id -> - let adress = Format.asprintf "/%s" thread_id in + let adress = Format.asprintf "/thread/%s" thread_id in Dream.respond ~status:`See_Other ~headers:[ ("Location", adress) ] "Your thread was posted!" @@ -206,7 +206,7 @@ let reply_post request = in match res with | Ok post_id -> - let adress = Format.sprintf "/%s#%s" parent_id post_id in + let adress = Format.sprintf "/thread/%s#%s" parent_id post_id in Dream.respond ~status:`See_Other ~headers:[ ("Location", adress) ] "Your reply was posted!" @@ -238,12 +238,15 @@ let routes = ; get_ "/user" user ; get_ "/user/:user" user_profile ; get_ "/user/:user/avatar" avatar_image + ; get_ "/thread/:thread_id" thread_get + ; post "/thread/:thread_id" reply_post ] - @ ( if App.open_registration then - [ get_ "/register" register_get; post "/register" register_post ] - else [] ) - @ (* TODO: rename these two routes *) - [ get_ "/:thread_id" thread_get; post "/:thread_id" reply_post ] + @ + if App.open_registration then + [ get_ "/register" register_get; post "/register" register_post ] + else [] + + let () = let logger = if App.log then Dream.logger else Fun.id in diff --git a/src/thread_page.eml.html b/src/thread_page.eml.html index 9b7a979..f83e4eb 100644 --- a/src/thread_page.eml.html +++ b/src/thread_page.eml.html @@ -6,7 +6,7 @@ let f thread_view thread_id request = % | Some _ ->