-- | Query information about the server.
data ServerInfo :: Effect where
NodeName :: ServerInfo m Text
ServerActor :: ServerInfo m Actor
makeEffect ''ServerInfo
-- | Create an `Id` for a local actor given only a name.
localActorId
:: (ServerInfo :> es)
=> Text
-> Eff es Id
localActorId actorName = localId ("/ap/a/" <> actorName)
do
us <- nodeName
return ("https://" <> us <> suffix)
fmap Id . localUrl
interpret $ \_ -> \case
NodeName -> getsConfig name
ServerActor -> do
config <- getConfig
let actorId = Id ("https://" <> config.name <> "/ap/a/server")
return (Actor {
id = actorId,
accountName = "server",
publicKey = PublicKey {
id = Id (actorId.url <> "#key"),
publicKeyPem = config.serverKey.private_pub,
owner = actorId
},
inbox = Just (Inbox (actorId.url <> "/inbox")),
outbox = Nothing,
followers = Nothing,
following = Nothing,
displayName = Nothing,
summary = Nothing,
locked = True,
subtype = Service
})