From e06f40b6650a9fa40421b9d60d3cbf7738bc1029 Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Sun, 21 Apr 2019 10:58:57 +0000 Subject: [PATCH] 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. --- config/routes | 4 +++- src/Vervis/Foundation.hs | 5 ++++- src/Vervis/Handler/Inbox.hs | 31 ++++++++++++++++++++++++------- src/Vervis/Handler/Person.hs | 2 +- src/Vervis/Handler/Project.hs | 2 +- 5 files changed, 33 insertions(+), 11 deletions(-) diff --git a/config/routes b/config/routes index 452369f..72c8201 100644 --- a/config/routes +++ b/config/routes @@ -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 diff --git a/src/Vervis/Foundation.hs b/src/Vervis/Foundation.hs index 7d8db78..f59d5b1 100644 --- a/src/Vervis/Foundation.hs +++ b/src/Vervis/Foundation.hs @@ -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 diff --git a/src/Vervis/Handler/Inbox.hs b/src/Vervis/Handler/Inbox.hs index 95436dc..74378bb 100644 --- a/src/Vervis/Handler/Inbox.hs +++ b/src/Vervis/Handler/Inbox.hs @@ -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|

- 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.

Last 10 activities posted: