/babillard -> /

This commit is contained in:
Swrup 2022-02-18 19:02:17 +01:00
parent ad460ee549
commit d69a6daeab
4 changed files with 13 additions and 16 deletions

View file

@ -121,7 +121,7 @@ module Marker = struct
let thread_preview_div = Jv.get Jv.global "thread_preview_div" in let thread_preview_div = Jv.get Jv.global "thread_preview_div" in
ignore @@ Jv.set thread_preview_div "innerHTML" thread_preview; ignore @@ Jv.set thread_preview_div "innerHTML" thread_preview;
let thread_link = Jv.get Jv.global "thread_link" in let thread_link = Jv.get Jv.global "thread_link" in
let link = Format.sprintf "/babillard/%s" thread_id in let link = Format.sprintf "/%s" thread_id in
ignore @@ Jv.set thread_link "href" (Jv.of_string link); ignore @@ Jv.set thread_link "href" (Jv.of_string link);
ignore @@ Jv.set thread_link "innerText" (Jv.of_string "[View Thread]"); ignore @@ Jv.set thread_link "innerText" (Jv.of_string "[View Thread]");
let _ = Js_pretty_post.make_pretty () in let _ = Js_pretty_post.make_pretty () in
@ -161,7 +161,7 @@ module Marker = struct
let () = let () =
log "fetch thread geojson@."; log "fetch thread geojson@.";
let window = Jv.get Jv.global "window" in let window = Jv.get Jv.global "window" in
let link = Jv.of_string "/babillard/markers" in let link = Jv.of_string "/markers" in
let fetchfutur = Jv.call window "fetch" [| link |] in let fetchfutur = Jv.call window "fetch" [| link |] in
ignore @@ Jv.call fetchfutur "then" [| Jv.repr markers_handle_response |] ignore @@ Jv.call fetchfutur "then" [| Jv.repr markers_handle_response |]
end end

View file

@ -157,7 +157,7 @@ let newthread_post request =
in in
match res with match res with
| Ok thread_id -> | Ok thread_id ->
let adress = Format.asprintf "/babillard/%s" thread_id in let adress = Format.asprintf "/%s" thread_id in
Dream.respond ~status:`See_Other Dream.respond ~status:`See_Other
~headers:[ ("Location", adress) ] ~headers:[ ("Location", adress) ]
"Your thread was posted!" "Your thread was posted!"
@ -206,7 +206,7 @@ let reply_post request =
in in
match res with match res with
| Ok post_id -> | Ok post_id ->
let adress = Format.sprintf "/babillard/%s#%s" parent_id post_id in let adress = Format.sprintf "/%s#%s" parent_id post_id in
Dream.respond ~status:`See_Other Dream.respond ~status:`See_Other
~headers:[ ("Location", adress) ] ~headers:[ ("Location", adress) ]
"Your reply was posted!" "Your reply was posted!"
@ -217,9 +217,7 @@ let reply_post request =
Dream.empty `Bad_Request ) Dream.empty `Bad_Request )
let redirect_to_babillard _request = let redirect_to_babillard _request =
Dream.respond ~status:`Moved_Permanently Dream.respond ~status:`Moved_Permanently ~headers:[ ("Location", "/") ] ""
~headers:[ ("Location", "/babillard") ]
""
let () = let () =
Dream.run ~secret:"yolo" ~port:3696 Dream.run ~secret:"yolo" ~port:3696
@ -230,7 +228,6 @@ let () =
*) *)
@@ Dream.router @@ Dream.router
[ Dream.get "/assets/**" (Dream.static ~loader:asset_loader "") [ Dream.get "/assets/**" (Dream.static ~loader:asset_loader "")
; Dream.get "/" redirect_to_babillard
; Dream.get "/about" about ; Dream.get "/about" about
; Dream.get "/register" register_get ; Dream.get "/register" register_get
; Dream.post "/register" register_post ; Dream.post "/register" register_post
@ -243,13 +240,13 @@ let () =
; Dream.get "/profile" profile_get ; Dream.get "/profile" profile_get
; Dream.post "/profile" profile_post ; Dream.post "/profile" profile_post
; Dream.get "/thread_view/:thread_id" thread_view ; Dream.get "/thread_view/:thread_id" thread_view
; Dream.get "/babillard/markers" markers ; Dream.get "/markers" markers
; Dream.get "/post_pic/:post_id" post_image ; Dream.get "/post_pic/:post_id" post_image
; Dream.get "/babillard" babillard_get ; Dream.get "/" babillard_get
; Dream.get "/babillard/new_thread" newthread_get ; Dream.get "/new_thread" newthread_get
; Dream.post "/babillard/new_thread" newthread_post ; Dream.post "/new_thread" newthread_post
; Dream.get "/babillard/:thread_id" thread_get ; Dream.get "/:thread_id" thread_get
; Dream.post "/reply/:thread_id" reply_post ; Dream.post "/:thread_id" reply_post
; Dream.get "/post_pic/:post_id" post_image ; Dream.get "/post_pic/:post_id" post_image
] ]
@@ Dream.not_found @@ Dream.not_found

View file

@ -19,7 +19,7 @@ let render_unsafe ~title ~content request =
<div class="collapse navbar-collapse" id="navbarCollapse"> <div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="navbar-nav me-auto mb-2 mb-md-0"> <ul class="navbar-nav me-auto mb-2 mb-md-0">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="/babillard">Babillard</a> <a class="nav-link" href="/">Babillard</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="/user">Discover users</a> <a class="nav-link" href="/user">Discover users</a>

View file

@ -6,7 +6,7 @@ let f thread_view thread_id request =
% | Some _ -> % | Some _ ->
<div class="postForm"> <div class="postForm">
<%s! Dream.form_tag ~action:( Format.sprintf "/reply/%s" thread_id) <%s! Dream.form_tag ~action:( Format.sprintf "/%s" thread_id)
~enctype:`Multipart_form_data request %> ~enctype:`Multipart_form_data request %>
<label for="replyComment" id="replyCommentLabel" class="form-label">Comment:</label> <label for="replyComment" id="replyCommentLabel" class="form-label">Comment:</label>