mirror of
https://code.sup39.dev/repos/Wqawg
synced 2024-12-28 12:34:50 +09:00
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
|
||||
/inbox InboxR GET POST
|
||||
/inbox InboxR GET
|
||||
/akey1 ActorKey1R GET
|
||||
/akey2 ActorKey2R GET
|
||||
|
||||
|
@ -50,6 +50,7 @@
|
|||
|
||||
/s SharersR GET
|
||||
/s/#ShrIdent SharerR GET
|
||||
/s/#ShrIdent/inbox SharerInboxR GET POST
|
||||
/s/#ShrIdent/outbox OutboxR GET POST
|
||||
/s/#ShrIdent/outbox/#OutboxItemKeyHashid OutboxItemR GET
|
||||
|
||||
|
@ -91,6 +92,7 @@
|
|||
/s/#ShrIdent/p ProjectsR GET POST
|
||||
/s/#ShrIdent/p/!new ProjectNewR GET
|
||||
/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/d ProjectDevsR GET POST
|
||||
/s/#ShrIdent/p/#PrjIdent/d/!new ProjectDevNewR GET
|
||||
|
|
|
@ -178,7 +178,8 @@ instance Yesod App where
|
|||
handler
|
||||
(getCurrentRoute >>= \ mr -> case mr of
|
||||
Nothing -> return False
|
||||
Just InboxR -> return False
|
||||
Just (SharerInboxR _) -> return False
|
||||
Just (ProjectInboxR _ _) -> return False
|
||||
Just (GitUploadRequestR _ _) -> return False
|
||||
Just r -> isWriteRequest r
|
||||
)
|
||||
|
@ -803,6 +804,7 @@ instance YesodBreadcrumbs App where
|
|||
|
||||
SharersR -> ("Sharers", Just HomeR)
|
||||
SharerR shar -> (shr2text shar, Just SharersR)
|
||||
SharerInboxR shr -> ("Inbox", Just $ SharerR shr)
|
||||
|
||||
PeopleR -> ("People", Just HomeR)
|
||||
|
||||
|
@ -871,6 +873,7 @@ instance YesodBreadcrumbs App where
|
|||
ProjectR shar proj -> ( prj2text proj
|
||||
, Just $ ProjectsR shar
|
||||
)
|
||||
ProjectInboxR shr prj -> ("Inbox", Just $ ProjectR shr prj)
|
||||
ProjectEditR shr prj -> ("Edit", Just $ ProjectR shr prj)
|
||||
ProjectDevsR shr prj -> ( "Collaborators"
|
||||
, Just $ ProjectR shr prj
|
||||
|
|
|
@ -15,7 +15,10 @@
|
|||
|
||||
module Vervis.Handler.Inbox
|
||||
( getInboxR
|
||||
, postInboxR
|
||||
, getSharerInboxR
|
||||
, getProjectInboxR
|
||||
, postSharerInboxR
|
||||
, postProjectInboxR
|
||||
, getPublishR
|
||||
, getOutboxR
|
||||
, getOutboxItemR
|
||||
|
@ -104,12 +107,14 @@ getInboxR = do
|
|||
defaultLayout
|
||||
[whamlet|
|
||||
<p>
|
||||
Welcome to the ActivityPub inbox test page! It's the beginning of
|
||||
federation support in Vervis. Currently POSTing activities
|
||||
doesn't do anything, they're just verified and the results are
|
||||
displayed on this page. To test, go to another Vervis instance's
|
||||
outbox page, submit an activity, and come back here to see
|
||||
results.
|
||||
Welcome to the ActivityPub inbox test page! Activities received
|
||||
by this Vervis instance are listed here for testing and
|
||||
debugging. To test, go to another Vervis instance and publish
|
||||
something that supports federation (currently, only ticket
|
||||
comments), either through the regular UI or via the /publish
|
||||
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:
|
||||
<ul>
|
||||
$forall (time, report) <- acts
|
||||
|
@ -131,6 +136,12 @@ getInboxR = do
|
|||
<div>#{msg}
|
||||
|]
|
||||
|
||||
getSharerInboxR :: ShrIdent -> Handler TypedContent
|
||||
getSharerInboxR _ = error "TODO implement getSharerInboxR"
|
||||
|
||||
getProjectInboxR :: ShrIdent -> PrjIdent -> Handler TypedContent
|
||||
getProjectInboxR _ _ = error "TODO implement getProjectInboxR"
|
||||
|
||||
postInboxR :: Handler ()
|
||||
postInboxR = do
|
||||
federation <- getsYesod $ appFederation . appSettings
|
||||
|
@ -184,6 +195,12 @@ postInboxR = do
|
|||
throwE "Activity's actor != Signature key's actor"
|
||||
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 = checkMMap fromTextarea toTextarea textareaField
|
||||
|
|
|
@ -142,7 +142,7 @@ getPerson shr sharer person = do
|
|||
, actorUsername = Just $ shr2text shr
|
||||
, actorName = sharerName sharer
|
||||
, actorSummary = Nothing
|
||||
, actorInbox = route2local InboxR
|
||||
, actorInbox = route2local $ SharerInboxR shr
|
||||
, actorPublicKeys =
|
||||
[ Left $ route2local ActorKey1R
|
||||
, Left $ route2local ActorKey2R
|
||||
|
|
|
@ -139,7 +139,7 @@ getProjectR shar proj = selectRep $ do
|
|||
, actorName =
|
||||
Just $ fromMaybe (prj2text proj) $ projectName project
|
||||
, actorSummary = projectDesc project
|
||||
, actorInbox = route2local InboxR
|
||||
, actorInbox = route2local $ ProjectInboxR shar proj
|
||||
, actorPublicKeys = []
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue