aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bin/main.ml32
1 files changed, 30 insertions, 2 deletions
diff --git a/bin/main.ml b/bin/main.ml
index 4d12cee..29dea84 100644
--- a/bin/main.ml
+++ b/bin/main.ml
@@ -54,18 +54,46 @@ let actor =
}
|}
+let actor_whitelist =
+ [
+ "https://fosstodon.org/users/marcc";
+ "https://universeodon.com/users/icecreambook";
+ "https://mastodon.social/users/ronent";
+ "https://graphics.social/users/theohonohan";
+ ]
+
let () =
- Post.add fake_post;
- Post.add fake_post_2;
let port =
Sys.getenv_opt "PORT" |> Option.map int_of_string
|> Option.value ~default:8080
in
let env = Sys.getenv_opt "ENV" |> Option.value ~default:"PROD" in
+ let disable_auth =
+ Sys.getenv_opt "DISABLE_AUTH" |> Option.value ~default:"false"
+ in
let interface = if env = "DEV" then "localhost" else "0.0.0.0" in
+ if env = "DEV" then Post.add fake_post;
+ if env = "DEV" then Post.add fake_post;
+ if env = "DEV" then Post.add fake_post;
+ if env = "DEV" then Post.add fake_post;
Dream.run ~port ~interface @@ Dream.logger
@@ Dream.router
[
+ Dream.get "/static/**" (Dream.static "./static");
+ Dream.get "/feed.xml" (fun _ ->
+ let posts = Post.get_all () in
+ let maybe_latest_post = Post.latest_post () in
+ match maybe_latest_post with
+ | Some latest_post ->
+ let rss_posts = posts |> List.map Post.to_rss_entry in
+ let rss =
+ Xml.format_rss "https://galaxy.mccd.space"
+ (Post.published latest_post)
+ rss_posts
+ in
+ Dream.respond rss
+ ~headers:[ ("Content-Type", "application/rss+xml") ]
+ | None -> Dream.html "No posts hav been published!");
Dream.get "/actor" (fun _ ->
Dream.log "Sending actor";
Dream.respond actor