From 867761a2e764c6c6327434585498ed62c54f6eac Mon Sep 17 00:00:00 2001 From: Marc Coquand Date: Sun, 3 Dec 2023 12:52:07 -0600 Subject: Formatting, support whitelist --- lib/post.ml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'lib/post.ml') diff --git a/lib/post.ml b/lib/post.ml index 5c3d494..dbca936 100644 --- a/lib/post.ml +++ b/lib/post.ml @@ -48,7 +48,11 @@ type mastodon_tag = { } [@@deriving yojson] [@@yojson.allow_extra_fields] -type mastodon_object = { tag : mastodon_tag list; url : string } +type mastodon_object = { + tag : mastodon_tag list; + url : string; + content : string; +} [@@deriving yojson] [@@yojson.allow_extra_fields] type mastodon_post = { @@ -61,7 +65,7 @@ type mastodon_post = { let mastodon_actor post = post.actor let post_of_mastodon_post actor_name = function - | { published; obj = { tag; url }; _ } -> + | { published; obj = { tag; url; content }; _ } -> let tags = List.filter_map (fun { name; kind; _ } -> @@ -70,18 +74,14 @@ let post_of_mastodon_post actor_name = function if kind = "Hashtag" then Some name else None) tag in - { link = url; summary = published; tags; published; author = actor_name } + { + link = url; + summary = content; + tags; + published; + author = actor_name; + author_link = url; + } let get_tld (link : string) = Uri.of_string link |> Uri.host_with_default ~default:"" - -let db = ref [] - -let add (entry : t) = - db := entry :: !db; - print_endline (entry.link ^ " added to db"); - print_endline ("New db size: " ^ string_of_int (List.length !db)) - -let get_all () = - print_endline ("db size: " ^ string_of_int (List.length !db)); - !db -- cgit v1.2.3