#lang racket ;; static generation rules (require json "compile.rkt") (define ACTOR-CONTEXT (list "https://www.w3.org/ns/activitystreams" "https://w3id.org/security/v1" (hash 'manuallyApprovesFollowers "as:manuallyApprovesFollowers" 'sensitive "as:sensitive" 'movedTo "as:movedTo" 'Hashtag "as:Hashtag" 'toot "http://joinmastodon.org/ns#" 'Emoji "toot:Emoji" 'focalPoint (hash '@container "@list" '@id "toot:focalPoint") 'featured "toot:featured"))) (define compile-index-json (rule '("db/actorkey.pub") "public/index.json" (lambda (in out) (define key (port->string (hash-ref in "db/actorkey.pub"))) (define actor (hash '@context ACTOR-CONTEXT 'Type "Person" 'id "https://example.tld/" 'name "haskal" 'preferredUsername "haskal" 'icon (hash 'type "Image" 'url "something" 'sensitive #f) 'image (hash 'type "Image" 'url "something" 'sensitive #f) 'tag (list (hash 'type "Hashtag" 'href "https://example.tld/tags/blahaj" 'name "#blahaj")) 'manuallyApprovesFollowers #f 'summary "summary lol" 'attachment (list (hash 'type "PropertyValue" 'name "pronouns" 'value "they/them")) 'url "https://example.tld/" 'inbox "https://example.tld/inbox" 'sharedInbox "https://example.tld/inbox" 'endpoints (hash 'sharedInbox "https://example.tld/inbox") 'outbox "https://example.tld/outbox" 'following 'null 'followers "https://example.tld/followers" 'liked 'null 'publicKey (hash 'id "https://example.tld/#main-key" 'type "Key" 'owner "https://example.tld/" 'publicKeyPem key))) (write-json actor out)))) (define compiler-rules (set compile-index-json)) (define ops (generate-operations compiler-rules)) (for ([op (in-list ops)]) (printf "executing ~s\n" op) (execute-rule op))