summaryrefslogtreecommitdiff
path: root/lib/handlers.ml
diff options
context:
space:
mode:
authorMarius Peter <marius.peter@tutanota.com>2025-06-09 18:12:49 +0200
committerMarius Peter <marius.peter@tutanota.com>2025-06-09 18:12:49 +0200
commitacf181316989cabc6ea16b42537eec8b03257187 (patch)
tree02149598d5c357257908a6c16ca9f6416175f67f /lib/handlers.ml
parent50960c7ccbae4a4e8f4f53010543752635b4d8cd (diff)
Refactor miscellaneous functions.
Diffstat (limited to 'lib/handlers.ml')
-rw-r--r--lib/handlers.ml29
1 files changed, 15 insertions, 14 deletions
diff --git a/lib/handlers.ml b/lib/handlers.ml
index 21d3ea8..7d2fe8d 100644
--- a/lib/handlers.ml
+++ b/lib/handlers.ml
@@ -22,27 +22,27 @@ module Repo = struct
let authors = [ "John Pork"; "Sebastian Jellybean" ] in
Views.Repo.summary (repo req) branches commits authors |> Dream_html.respond
- let refs req =
- let* branches = all_branches (repo req) in
- Views.Repo.refs (repo req) branches |> Dream_html.respond
-
let log req =
let* commits = recent_commits (repo req) 100 in
Views.Repo.log (repo req) commits |> Dream_html.respond
- let tree_head req =
+ let files_at_head req =
let* tree = head_tree (repo req) in
- Views.Repo.tree (repo req) tree |> Dream_html.respond
+ Views.Repo.files (repo req) tree |> Dream_html.respond
- let tree_id req =
+ let files_id req =
let id = id_of_req req in
let* tree = tree_of_id (repo req) id in
- Views.Repo.tree (repo req) tree |> Dream_html.respond
+ Views.Repo.files (repo req) tree |> Dream_html.respond
- let blob_id req =
+ let file_id req =
let id = id_of_req req in
let* blob = blob_of_id (repo req) id in
- Views.Repo.blob (repo req) blob |> Dream_html.respond
+ Views.Repo.file (repo req) blob |> Dream_html.respond
+
+ let refs req =
+ let* branches = all_branches (repo req) in
+ Views.Repo.refs (repo req) branches |> Dream_html.respond
let commit req =
let id = id_of_req req in
@@ -58,11 +58,12 @@ let all_handlers =
Repo.
[
get "/" summary;
- get "/refs/" refs;
+ get "/summary/" summary;
get "/log/" log;
- get "/tree/" tree_head;
- get "/tree/:id" tree_id;
- get "/blob/:id" blob_id;
+ get "/files/" files_at_head;
+ get "/files/:id" files_id;
+ get "/file/:id" file_id;
+ get "/refs/" refs;
get "/commit/:id" commit;
];
get "/static/**" (static "./lib/static");
Copyright 2019--2025 Marius PETER