Switch from single inbox to individual inbox URIs; disable inbox post for now
Inbox post is disabled but in the next patches I'll code and integrate a fixed complete one, hopefully finally getting ticket comment federation ready for testing. I'm making this change because if an actor receives an activity due to being addressed in bto, ot bcc, or being listed in some remote collection, the server doesn't have a way to tell which actor(s) are the intended recipients, without having an individual inbox URL for each actor. I could use a different hack for this, but it wouldn't be compatible with other AP servers (unless the whole fediverse agrees on a method). I wasn't using sharedInbox anyway, and it's an optimization either way.
This commit is contained in:
parent
f7f15e0f63
commit
e06f40b665
5 changed files with 33 additions and 11 deletions
|
@ -25,7 +25,7 @@
|
||||||
-- ----------------------------------------------------------------------------
|
-- ----------------------------------------------------------------------------
|
||||||
|
|
||||||
/publish PublishR GET
|
/publish PublishR GET
|
||||||
/inbox InboxR GET POST
|
/inbox InboxR GET
|
||||||
/akey1 ActorKey1R GET
|
/akey1 ActorKey1R GET
|
||||||
/akey2 ActorKey2R GET
|
/akey2 ActorKey2R GET
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@
|
||||||
|
|
||||||
/s SharersR GET
|
/s SharersR GET
|
||||||
/s/#ShrIdent SharerR GET
|
/s/#ShrIdent SharerR GET
|
||||||
|
/s/#ShrIdent/inbox SharerInboxR GET POST
|
||||||
/s/#ShrIdent/outbox OutboxR GET POST
|
/s/#ShrIdent/outbox OutboxR GET POST
|
||||||
/s/#ShrIdent/outbox/#OutboxItemKeyHashid OutboxItemR GET
|
/s/#ShrIdent/outbox/#OutboxItemKeyHashid OutboxItemR GET
|
||||||
|
|
||||||
|
@ -91,6 +92,7 @@
|
||||||
/s/#ShrIdent/p ProjectsR GET POST
|
/s/#ShrIdent/p ProjectsR GET POST
|
||||||
/s/#ShrIdent/p/!new ProjectNewR GET
|
/s/#ShrIdent/p/!new ProjectNewR GET
|
||||||
/s/#ShrIdent/p/#PrjIdent ProjectR GET PUT POST
|
/s/#ShrIdent/p/#PrjIdent ProjectR GET PUT POST
|
||||||
|
/s/#ShrIdent/p/#PrjIdent/inbox ProjectInboxR GET POST
|
||||||
/s/#ShrIdent/p/#PrjIdent/edit ProjectEditR GET
|
/s/#ShrIdent/p/#PrjIdent/edit ProjectEditR GET
|
||||||
/s/#ShrIdent/p/#PrjIdent/d ProjectDevsR GET POST
|
/s/#ShrIdent/p/#PrjIdent/d ProjectDevsR GET POST
|
||||||
/s/#ShrIdent/p/#PrjIdent/d/!new ProjectDevNewR GET
|
/s/#ShrIdent/p/#PrjIdent/d/!new ProjectDevNewR GET
|
||||||
|
|
|
@ -178,7 +178,8 @@ instance Yesod App where
|
||||||
handler
|
handler
|
||||||
(getCurrentRoute >>= \ mr -> case mr of
|
(getCurrentRoute >>= \ mr -> case mr of
|
||||||
Nothing -> return False
|
Nothing -> return False
|
||||||
Just InboxR -> return False
|
Just (SharerInboxR _) -> return False
|
||||||
|
Just (ProjectInboxR _ _) -> return False
|
||||||
Just (GitUploadRequestR _ _) -> return False
|
Just (GitUploadRequestR _ _) -> return False
|
||||||
Just r -> isWriteRequest r
|
Just r -> isWriteRequest r
|
||||||
)
|
)
|
||||||
|
@ -803,6 +804,7 @@ instance YesodBreadcrumbs App where
|
||||||
|
|
||||||
SharersR -> ("Sharers", Just HomeR)
|
SharersR -> ("Sharers", Just HomeR)
|
||||||
SharerR shar -> (shr2text shar, Just SharersR)
|
SharerR shar -> (shr2text shar, Just SharersR)
|
||||||
|
SharerInboxR shr -> ("Inbox", Just $ SharerR shr)
|
||||||
|
|
||||||
PeopleR -> ("People", Just HomeR)
|
PeopleR -> ("People", Just HomeR)
|
||||||
|
|
||||||
|
@ -871,6 +873,7 @@ instance YesodBreadcrumbs App where
|
||||||
ProjectR shar proj -> ( prj2text proj
|
ProjectR shar proj -> ( prj2text proj
|
||||||
, Just $ ProjectsR shar
|
, Just $ ProjectsR shar
|
||||||
)
|
)
|
||||||
|
ProjectInboxR shr prj -> ("Inbox", Just $ ProjectR shr prj)
|
||||||
ProjectEditR shr prj -> ("Edit", Just $ ProjectR shr prj)
|
ProjectEditR shr prj -> ("Edit", Just $ ProjectR shr prj)
|
||||||
ProjectDevsR shr prj -> ( "Collaborators"
|
ProjectDevsR shr prj -> ( "Collaborators"
|
||||||
, Just $ ProjectR shr prj
|
, Just $ ProjectR shr prj
|
||||||
|
|
|
@ -15,7 +15,10 @@
|
||||||
|
|
||||||
module Vervis.Handler.Inbox
|
module Vervis.Handler.Inbox
|
||||||
( getInboxR
|
( getInboxR
|
||||||
, postInboxR
|
, getSharerInboxR
|
||||||
|
, getProjectInboxR
|
||||||
|
, postSharerInboxR
|
||||||
|
, postProjectInboxR
|
||||||
, getPublishR
|
, getPublishR
|
||||||
, getOutboxR
|
, getOutboxR
|
||||||
, getOutboxItemR
|
, getOutboxItemR
|
||||||
|
@ -104,12 +107,14 @@ getInboxR = do
|
||||||
defaultLayout
|
defaultLayout
|
||||||
[whamlet|
|
[whamlet|
|
||||||
<p>
|
<p>
|
||||||
Welcome to the ActivityPub inbox test page! It's the beginning of
|
Welcome to the ActivityPub inbox test page! Activities received
|
||||||
federation support in Vervis. Currently POSTing activities
|
by this Vervis instance are listed here for testing and
|
||||||
doesn't do anything, they're just verified and the results are
|
debugging. To test, go to another Vervis instance and publish
|
||||||
displayed on this page. To test, go to another Vervis instance's
|
something that supports federation (currently, only ticket
|
||||||
outbox page, submit an activity, and come back here to see
|
comments), either through the regular UI or via the /publish
|
||||||
results.
|
page, and then come back here to see the result. Activities that
|
||||||
|
aren't understood or their processing fails get listed here too,
|
||||||
|
with a report of what exactly happened.
|
||||||
<p>Last 10 activities posted:
|
<p>Last 10 activities posted:
|
||||||
<ul>
|
<ul>
|
||||||
$forall (time, report) <- acts
|
$forall (time, report) <- acts
|
||||||
|
@ -131,6 +136,12 @@ getInboxR = do
|
||||||
<div>#{msg}
|
<div>#{msg}
|
||||||
|]
|
|]
|
||||||
|
|
||||||
|
getSharerInboxR :: ShrIdent -> Handler TypedContent
|
||||||
|
getSharerInboxR _ = error "TODO implement getSharerInboxR"
|
||||||
|
|
||||||
|
getProjectInboxR :: ShrIdent -> PrjIdent -> Handler TypedContent
|
||||||
|
getProjectInboxR _ _ = error "TODO implement getProjectInboxR"
|
||||||
|
|
||||||
postInboxR :: Handler ()
|
postInboxR :: Handler ()
|
||||||
postInboxR = do
|
postInboxR = do
|
||||||
federation <- getsYesod $ appFederation . appSettings
|
federation <- getsYesod $ appFederation . appSettings
|
||||||
|
@ -184,6 +195,12 @@ postInboxR = do
|
||||||
throwE "Activity's actor != Signature key's actor"
|
throwE "Activity's actor != Signature key's actor"
|
||||||
return (contentType, (wv, (iid, rsid)))
|
return (contentType, (wv, (iid, rsid)))
|
||||||
|
|
||||||
|
postSharerInboxR :: ShrIdent -> Handler ()
|
||||||
|
postSharerInboxR _ = error "TODO implement postSharerInboxR"
|
||||||
|
|
||||||
|
postProjectInboxR :: ShrIdent -> PrjIdent -> Handler ()
|
||||||
|
postProjectInboxR _ _ = error "TODO implement postProjectInboxR"
|
||||||
|
|
||||||
{-
|
{-
|
||||||
jsonField :: (FromJSON a, ToJSON a) => Field Handler a
|
jsonField :: (FromJSON a, ToJSON a) => Field Handler a
|
||||||
jsonField = checkMMap fromTextarea toTextarea textareaField
|
jsonField = checkMMap fromTextarea toTextarea textareaField
|
||||||
|
|
|
@ -142,7 +142,7 @@ getPerson shr sharer person = do
|
||||||
, actorUsername = Just $ shr2text shr
|
, actorUsername = Just $ shr2text shr
|
||||||
, actorName = sharerName sharer
|
, actorName = sharerName sharer
|
||||||
, actorSummary = Nothing
|
, actorSummary = Nothing
|
||||||
, actorInbox = route2local InboxR
|
, actorInbox = route2local $ SharerInboxR shr
|
||||||
, actorPublicKeys =
|
, actorPublicKeys =
|
||||||
[ Left $ route2local ActorKey1R
|
[ Left $ route2local ActorKey1R
|
||||||
, Left $ route2local ActorKey2R
|
, Left $ route2local ActorKey2R
|
||||||
|
|
|
@ -139,7 +139,7 @@ getProjectR shar proj = selectRep $ do
|
||||||
, actorName =
|
, actorName =
|
||||||
Just $ fromMaybe (prj2text proj) $ projectName project
|
Just $ fromMaybe (prj2text proj) $ projectName project
|
||||||
, actorSummary = projectDesc project
|
, actorSummary = projectDesc project
|
||||||
, actorInbox = route2local InboxR
|
, actorInbox = route2local $ ProjectInboxR shar proj
|
||||||
, actorPublicKeys = []
|
, actorPublicKeys = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue