Commit graph

599 commits

Author SHA1 Message Date
fr33domlover
342467297a Put inbox activity auth code in a dedicated function in Vervis.Federation 2019-04-26 21:41:01 +00:00
fr33domlover
9d5399d636 Give project actors signing keys, just like user actors, needed for forwarding
Since project actors are the ones sending inbox forwards, they need to announce
keys and allow their HTTP Signatures to be verified.
2019-04-26 13:04:00 +00:00
fr33domlover
811217fd17 Return keyid and digest after inbox verification, for use in forwarding 2019-04-26 04:15:07 +00:00
fr33domlover
f346da9106 New module Yesod.ActivityPub, use it in Vervis.Federation for delivery POSTing 2019-04-26 03:23:49 +00:00
fr33domlover
71d21ad459 In httpPostAP, support the new signature headers 2019-04-26 00:25:50 +00:00
fr33domlover
46fb4d1512 Add settings switch for activity debug reports 2019-04-25 22:46:27 +00:00
fr33domlover
d24710c46a When receiving activity to inbox, verify the body digest
This patch does a small simple change, however at the cost of the request body
not being available for display in the latest activity list, unless processing
succeeds. I'll fix this situation in a separate patch.
2019-04-25 18:05:02 +00:00
fr33domlover
57374ec816 When POSTing activities, set a Digest header using SHA-256 2019-04-25 15:49:15 +00:00
fr33domlover
825a91d185 Incomplete project inbox handler 2019-04-24 00:47:21 +00:00
fr33domlover
f462a67680 Implement sharer inbox handler
It runs checks against all the relevant tables, but ultimately just inserts the
activity into the recipient's inbox and nothing more, leaving the RemoteMessage
creation and inbox forwarding to the project inbox handler.
2019-04-23 02:57:53 +00:00
fr33domlover
e06f40b665 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.
2019-04-21 10:58:57 +00:00
fr33domlover
f7f15e0f63 When sending ticket comment in regular Vervis UI, deliver it using ActivityPub 2019-04-20 21:34:45 +00:00
fr33domlover
4f5c6532ee Switch postOutboxR to the new handler 2019-04-19 03:14:12 +00:00
fr33domlover
fc2ace3370 Insert ticket commenter to ticket followers, and never deliver to themselves 2019-04-18 23:37:33 +00:00
fr33domlover
dedb9834e3 Tweak author link text in ticket comments 2019-04-18 23:14:36 +00:00
fr33domlover
47a9e0b5a0 Group by sharer ID too, hopefully this time it's enough 2019-04-18 20:20:58 +00:00
fr33domlover
4386e0f8af If federation is disabled, don't run periodic delivery 2019-04-18 19:50:31 +00:00
fr33domlover
50f12f855d In ticket summary SQL query, group by ticket ID, not by discussion ID
Each ticket has a single discussion ID, and each ticket has a unique one, so,
given an inner join of tickets and discussions, I think there should be exactly
1 way select a (ticket, discussion) pair given any of these.

But for some reason, PostgreSQL started complaining. Not sure what changed.
Anyway, for now, I switched the groupBy from discussion.id to ticket.id, which
is essentially the same, but for some reason makes PostgreSQL happy. It can't
tell that given a discussion ID, there's exactly 1 way to choose the ticket. Or
something like that. I wonder if I messed up something in DB migrations.
2019-04-18 19:35:04 +00:00
fr33domlover
b8c669f6fc New outbox post: Raise error if federation disabled but remote recipients found 2019-04-18 11:43:33 +00:00
fr33domlover
f37b9b3f52 Run the delivery worker priodically, settings control how often to run 2019-04-18 10:38:01 +00:00
fr33domlover
c9c7da5902 More insertBy' usage, and remove withHostLock from new outbox post handler 2019-04-16 18:03:02 +00:00
fr33domlover
735a6a39cb Use insertBy' in instanceAndActor 2019-04-16 17:26:06 +00:00
fr33domlover
c2ee6a7f16 Mention in INSTALL that Vervis needs PostgreSQL 9.5 or above
That's because insertBy' relies on insertUnique being done atomically, which
requires ON CONFLICT support, a feature that came with PostgreSQL 9.5.
2019-04-16 16:39:12 +00:00
fr33domlover
b0da8747a2 In ActorFetchShare, use insertBy' to allow non-shared insertions
Before this patch, the shared fetch used plain insert, because it relied on
being the only place in the codebase where new RemoteActors get inserted. I was
hoping for that to be the case, but while I tweak things and handle fetching
URIs that can be an actor or a public key (for which ActorFetchShare isn't
sufficient without some smart modification), I'd like concurrent insertions to
be safe, without getting in the way of ActorFetchShare.

With this patch, it now uses insertBy', which doesn't mind concurrent
insertions.
2019-04-16 16:33:08 +00:00
fr33domlover
7c2fad7417 Implement fetchAPIDOrH using a dedicated error type 2019-04-16 16:10:17 +00:00
fr33domlover
25fcceabde postOutboxR: Use ResultShare for fetching recipient actor 2019-04-16 14:34:17 +00:00
fr33domlover
d5eefd1553 Implement outbox remote delivery, in handler and periodic, not used yet 2019-04-16 14:27:50 +00:00
fr33domlover
7946fe441d Add field errorSince to RemoteActor to track inbox POST unreachability 2019-04-12 01:09:45 +00:00
fr33domlover
3f9364e4aa Rename RemoteSharer entity to RemoteActor 2019-04-12 00:56:27 +00:00
fr33domlover
7621c0280a Rewrite ticketFollowers migration without insertKey, it causes problems 2019-04-11 16:43:46 +00:00
fr33domlover
9a306e762c Unfinished updated outbox handler 2019-04-11 13:44:44 +00:00
fr33domlover
7dda068ba3 Make the DB migrations not depend on current model 2019-04-11 13:26:57 +00:00
fr33domlover
b31c6fe0ef Update homepage text 2019-04-06 23:06:46 +00:00
fr33domlover
1d854423cb Switch Audience from Vector to list and fix Public bug
* No good reason to use Vector, let's use list, it's just easier
* The Public URI recognizing code wasn't being used; now it is
2019-04-01 23:40:29 +00:00
fr33domlover
0c280c7af6 Add setting that says how much time to keep retrying activity delivery 2019-04-01 23:38:44 +00:00
fr33domlover
a3bd0356e2 Mention in homepage that I'm asking to do Freenode group registration 2019-03-29 19:38:25 +00:00
fr33domlover
c2415301bc More type-safe handling of DB key Hashids 2019-03-29 03:25:32 +00:00
fr33domlover
228e954706 Create Note outbox handler, not in use yet
I wrote a function handleOutboxNote that's supposed to do the whole outbox POST
handler process. There's an outbox item table in the DB now, I adapted things
in various source files. Ticket comment federation work is still in progress.
2019-03-28 21:08:30 +00:00
fr33domlover
cdb1c8b121 Add settings option to disable federation 2019-03-25 00:17:24 +00:00
fr33domlover
e53c056e1e Mention my IRC presence in homepage 2019-03-25 00:01:06 +00:00
fr33domlover
e36d960d2b Rename handleActivity to handleInboxActivity 2019-03-23 15:45:44 +00:00
fr33domlover
85c6354291 Switch jsonb support from persistent-postgresql to a custom module
The custom module provides a parametric wrapper, allowing any specific
FromJSON/ToJSON instance to be used. It's a standalone module though, and not a
wrapper of persistent-postgresql, because persistent-postgresql uses aeson
Value and it prevents using toEncoding to get from the value directly to a
string.
2019-03-23 15:29:50 +00:00
fr33domlover
0032456925 Add noteAudience; record recipient of local remotely-targetted activities in DB 2019-03-23 02:57:34 +00:00
fr33domlover
58a56b6743 Make noteId optional, to support taking a Note in postOutboxR 2019-03-23 02:05:30 +00:00
fr33domlover
88d4c976ee Add route getMessageR, returns an Activity Note for any locally created Message 2019-03-22 20:46:42 +00:00
fr33domlover
6c186355f3 Change some top-level routes' breadcrumbs to be under HomeR 2019-03-22 05:17:58 +00:00
fr33domlover
c27636a438 Add route /publish for sending activities, getOutboxR now free to return outbox 2019-03-22 05:17:54 +00:00
fr33domlover
d40e1b8891 In outbox post form, provide parent and context, and default to ticket comment 2019-03-21 23:56:47 +00:00
fr33domlover
ad3a20d783 Receive remote comments on local ticket discussion 2019-03-21 22:57:15 +00:00
fr33domlover
72f96a0dff When verifying HTTPsig, return iid&rsid and remove duplicate shared usage check
* Adapt DB related code to return the InstanceId and RemoteSharerId
* Previously, when fetching a known shared key, we were running a DB
  check/update for the shared usage record. I noticed - and hopefully I
  correctly noticed - that this check already runs when we discover the keyId
  points to a shared key we already know. So, after successful sig
  verification, there's no need to run the check again. So I removed it.
2019-03-21 21:38:59 +00:00