Web.ActivityPub: Remove fake extContext, the URI doesn't work anymore anyway

This commit is contained in:
fr33domlover 2022-07-25 09:10:24 +00:00
parent e2591734d3
commit 3cda2205c5

View file

@ -171,9 +171,6 @@ secContext = "https://w3id.org/security/v2"
forgeContext :: Text forgeContext :: Text
forgeContext = "https://forgefed.org/ns" forgeContext = "https://forgefed.org/ns"
extContext :: Text
extContext = "https://angeley.es/as2-ext"
publicURI :: Text publicURI :: Text
publicURI = "https://www.w3.org/ns/activitystreams#Public" publicURI = "https://www.w3.org/ns/activitystreams#Public"
@ -237,7 +234,7 @@ data PublicKey u = PublicKey
} }
instance ActivityPub PublicKey where instance ActivityPub PublicKey where
jsonldContext _ = [secContext, extContext] jsonldContext _ = [secContext]
parseObject o = do parseObject o = do
mtyp <- optional $ o .: "@type" <|> o .: "type" mtyp <- optional $ o .: "@type" <|> o .: "type"
for_ mtyp $ \ t -> for_ mtyp $ \ t ->
@ -334,7 +331,7 @@ data SshPublicKey u = SshPublicKey
} }
instance ActivityPub SshPublicKey where instance ActivityPub SshPublicKey where
jsonldContext _ = [secContext, forgeContext, extContext] jsonldContext _ = [secContext, forgeContext]
parseObject o = do parseObject o = do
mtyp <- optional $ o .: "@type" <|> o .: "type" mtyp <- optional $ o .: "@type" <|> o .: "type"
for_ mtyp $ \ t -> for_ mtyp $ \ t ->
@ -438,7 +435,7 @@ data Actor u = Actor
} }
instance ActivityPub Actor where instance ActivityPub Actor where
jsonldContext _ = [as2Context, secContext, forgeContext, extContext] jsonldContext _ = [as2Context, secContext, forgeContext]
parseObject o = do parseObject o = do
mlocal <- parseActorLocal o mlocal <- parseActorLocal o
(h, local) <- (h, local) <-
@ -476,8 +473,8 @@ data TicketTracker u = TicketTracker
, ticketTrackerTeam :: LocalURI , ticketTrackerTeam :: LocalURI
} }
instance ActivityPub Project where instance ActivityPub TicketTracker where
jsonldContext _ = [as2Context, secContext, forgeContext, extContext] jsonldContext _ = [as2Context, secContext, forgeContext]
parseObject o = do parseObject o = do
(h, a) <- parseObject o (h, a) <- parseObject o
unless (actorType (actorDetail a) == ActorTypeTicketTracker) $ unless (actorType (actorDetail a) == ActorTypeTicketTracker) $
@ -516,7 +513,7 @@ data Collection a u = Collection
} }
instance (FromJSON a, ToJSON a) => ActivityPub (Collection a) where instance (FromJSON a, ToJSON a) => ActivityPub (Collection a) where
jsonldContext _ = [as2Context, forgeContext, extContext] jsonldContext _ = [as2Context, forgeContext]
parseObject o = do parseObject o = do
ObjURI authority id_ <- o .: "id" ObjURI authority id_ <- o .: "id"
fmap (authority,) $ fmap (authority,) $
@ -574,7 +571,7 @@ data CollectionPage a u = CollectionPage
} }
instance (FromJSON a, ToJSON a) => ActivityPub (CollectionPage a) where instance (FromJSON a, ToJSON a) => ActivityPub (CollectionPage a) where
jsonldContext _ = [as2Context, forgeContext, extContext] jsonldContext _ = [as2Context, forgeContext]
parseObject o = do parseObject o = do
PageURI authority id_ <- o .: "id" PageURI authority id_ <- o .: "id"
fmap (authority,) $ fmap (authority,) $
@ -610,7 +607,7 @@ instance (FromJSON a, ToJSON a) => ActivityPub (CollectionPage a) where
data Recipient u = RecipientActor (Actor u) | RecipientCollection (Collection (ObjURI u) u) data Recipient u = RecipientActor (Actor u) | RecipientCollection (Collection (ObjURI u) u)
instance ActivityPub Recipient where instance ActivityPub Recipient where
jsonldContext _ = [as2Context, secContext, forgeContext, extContext] jsonldContext _ = [as2Context, secContext, forgeContext]
parseObject o = parseObject o =
second RecipientActor <$> parseObject o <|> second RecipientActor <$> parseObject o <|>
second RecipientCollection <$> parseObject o second RecipientCollection <$> parseObject o
@ -736,7 +733,7 @@ withAuthorityMaybeP a m = do
else fail "URI authority mismatch" else fail "URI authority mismatch"
instance ActivityPub Note where instance ActivityPub Note where
jsonldContext _ = [as2Context, extContext] jsonldContext _ = [as2Context]
parseObject o = do parseObject o = do
typ <- o .: "type" typ <- o .: "type"
unless (typ == ("Note" :: Text)) $ unless (typ == ("Note" :: Text)) $
@ -1130,7 +1127,7 @@ data Ticket u = Ticket
} }
instance ActivityPub Ticket where instance ActivityPub Ticket where
jsonldContext _ = [as2Context, forgeContext, extContext] jsonldContext _ = [as2Context, forgeContext]
parseObject o = do parseObject o = do
typ <- o .: "type" typ <- o .: "type"
unless (typ == ("Ticket" :: Text)) $ unless (typ == ("Ticket" :: Text)) $
@ -1260,7 +1257,7 @@ data Commit u = Commit
} }
instance ActivityPub Commit where instance ActivityPub Commit where
jsonldContext _ = [as2Context, forgeContext, extContext] jsonldContext _ = [as2Context, forgeContext]
parseObject o = do parseObject o = do
typ <- o .: "type" typ <- o .: "type"
unless (typ == ("Commit" :: Text)) $ unless (typ == ("Commit" :: Text)) $
@ -1587,7 +1584,7 @@ data Activity u = Activity
} }
instance ActivityPub Activity where instance ActivityPub Activity where
jsonldContext _ = [as2Context, forgeContext, extContext] jsonldContext _ = [as2Context, forgeContext]
parseObject o = do parseObject o = do
ObjURI a actor <- o .: "actor" ObjURI a actor <- o .: "actor"
fmap (a,) $ fmap (a,) $