aboutsummaryrefslogtreecommitdiff
path: root/lib/activitypub/constants.ml
diff options
context:
space:
mode:
authorMarc Coquand <marc@mccd.space>2023-12-20 20:43:25 -0600
committerMarc Coquand <marc@mccd.space>2023-12-20 20:43:25 -0600
commitcc783c157f31e7e713c8b83be67449b1859dac27 (patch)
tree52559c115159671839f4b497b9191222faa35520 /lib/activitypub/constants.ml
downloadfixgen-cc783c157f31e7e713c8b83be67449b1859dac27.tar.gz
fixgen-cc783c157f31e7e713c8b83be67449b1859dac27.tar.bz2
fixgen-cc783c157f31e7e713c8b83be67449b1859dac27.zip
Initial commit
Diffstat (limited to '')
-rw-r--r--lib/activitypub/constants.ml49
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/activitypub/constants.ml b/lib/activitypub/constants.ml
new file mode 100644
index 0000000..0488335
--- /dev/null
+++ b/lib/activitypub/constants.ml
@@ -0,0 +1,49 @@
+open Containers
+
+module ContentType = struct
+ let ld_json_activity_streams = "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\""
+
+ let xrd_xml = "application/xrd+xml"
+ let ld_json = "application/ld+json"
+ let activity_json = "application/activity+json"
+ let plain_json = "application/json"
+ let html = "text/html"
+ let any = "*/*"
+
+ let content_types = [
+ ld_json_activity_streams, `JSON;
+ ld_json, `JSON;
+ activity_json, `JSON;
+ plain_json, `JSON;
+ html, `HTML;
+ any, `HTML;
+ ]
+
+ let of_string content_type =
+ List.find_opt
+ (fun (str, _) ->
+ String.prefix ~pre:str content_type) content_types
+ |> Option.map snd
+
+
+end
+
+module Webfinger = struct
+ let json_rd = "application/jrd+json"
+
+ let self_rel = "self"
+ let ostatus_rel = "http://ostatus.org/schema/1.0/subscribe"
+ let profile_page = "http://webfinger.net/rel/profile-page"
+end
+
+module ActivityStreams = struct
+
+ let public = "https://www.w3.org/ns/activitystreams#Public"
+
+ let context : string * Yojson.Safe.t =
+ "@context", `List [
+ `String "https://www.w3.org/ns/activitystreams";
+ `String "https://w3id.org/security/v1"
+ ]
+
+end