Commit graph

268 commits

Author SHA1 Message Date
fr33domlover
32c87e3839 Improve the AP async HTTP delivery API and per-actor key support
New iteration of the ActivityPub delivery implementation and interface.
Advantages over previous interface:

* When sending a ByteString body, the sender is explicitly passed as a
  parameter instead of JSON-parsing it out of the ByteString
* Clear 3 operations provided: Send, Resend and Forward
* Support for per-actor keys
* Actor-type-specific functions (e.g. deliverRemoteDB_D) removed
* Only the most high-level API is exposed to Activity handler code, making
  handler code more concise and clear

Also added in this patch:

* Foundation for per-actor key support
* 1 key per actor allowed in DB
* Disabled C2S and S2S handlers now un-exported for clarity
* Audience and capability parsing automatically done for all C2S handlers
* Audience and activity composition automatically done for Vervis.Client
  builder functions

Caveats:

* Actor documents still don't link to their per-actor keys; that should be the
  last piece to complete per-actor key support
* No moderation and anti-spam tools yet
* Delivery API doesn't yet have good integration of persistence layer, e.g.
  activity is separately encoded into bytestring for DB and for HTTP; this will
  be improved in the next iteration
* Periodic delivery now done in 3 separate steps, running sequentially; it
  simplifies the code, but may be changed for efficiency/robustness in the next
  iterations
* Periodic delivery collects per-actor keys in a
  1-DB-transaction-for-each-delivery fashion, rather than grabbing them in the
  big Esqueleto query (or keeping the signed output in the DB; this isn't done
  currently to allow for smooth actor key renewal)
* No support yet in the API for delivery where the actor key has already been
  fetched, rather than doing a DB transaction to grab it; such support would be
  just an optimization, so it's low-priority, but will be added in later
  iterations
2022-10-12 16:50:11 +00:00
fr33domlover
0d1de1278b UI: Add settings option to change main UI color 2022-09-28 06:03:43 +00:00
fr33domlover
91b2d36a19 Move models and routes files from config/ to new th/ dir 2022-07-25 18:40:36 +00:00
fr33domlover
066285d3a3 Move robots.txt and favicon from config/ to new embed/ dir 2022-07-25 17:40:19 +00:00
fr33domlover
b3cd7ca28f C2S: Implement ticket tracker creation
* Publish a Create activity and respond with a Grant activity
* postProjectsR reuses that code
* No automatic following at the moment
* Workflow and role specified in new project form are ignored for now
* Can't create tracker under a group yet, just under the user
2022-07-25 17:15:22 +00:00
fr33domlover
88b8027572 DB: Move project inbox, outbox & followers into a new Actor table 2022-07-19 12:12:49 +00:00
fr33domlover
86b35e9b56 Style: Replace yesod favicon with Vervis icon made by ikomi (thanks <3) 2022-07-12 14:08:37 +00:00
fr33domlover
bfa9774f83 DB: Switch to more flexible collaborator model 2022-06-22 06:19:37 +00:00
fr33domlover
cb11ea6447 DB: Add media type field to 'Patch' entity
This patch (haha) also adds a VCS field to the AP representation of repos
2020-08-14 21:16:33 +00:00
fr33domlover
b16c9505af S2S & C2S: Switch from single-patch MR version to multi-patch bundle support 2020-08-13 10:26:20 +00:00
fr33domlover
9317e514b2 S2S unresolve, C2S resolve & unresolve, use C2S in the UI buttons 2020-08-05 08:28:58 +00:00
fr33domlover
7f106023b0 S2S: Implement inbox handlers for Resolve activity 2020-07-28 09:35:27 +00:00
fr33domlover
c1f0722c21 C2S: createTicketC: Allow to submit MRs i.e. Ticket with a Patch attached 2020-07-22 13:00:48 +00:00
fr33domlover
d392a37707 Rename InboxR to InboxDebugR, much clearer that way 2020-07-02 13:34:38 +00:00
fr33domlover
bc4248d7ca S2S: Handle remote dep in sharerAcceptF
If sharer receives Accept on an Offer/Dep where the sharer hosts the child
ticket, it records a RemoteTicketDependency and runs inbox forwarding to ticket
followers. But this relies on a TicketDependencyOffer record already existing.
I'll take care of that in the next patches.

sharerAcceptF and sharerRejectF now use the insertToInbox from
Vervis.Federation.Util instead of their own copies of it, which were identical
anyway. Perhaps gradually all the inbox insertion in all S2S handlers will
switch to using that function.
2020-06-21 08:02:05 +00:00
fr33domlover
a2468c52fd Prepare for ticket dependency federation
To be honest, this is a huge patch that changes tons of stuff and probably
should have been broken up into small changes. But I already had the codebase
not building, so... just did all of this at once :P

Basically this patch does the following:

- DB migrations for ticket dependency related tables, e.g. allowing a remote
  author and a remote child
- Allowing S2S handlers to provide an async continued processing function,
  which is executed and the result then added to the debug page
- Most UI and functionality related to ticket deps is disabled, new
  implementation being added gradually via ActivityPub
- Improvements to AP tools, e.g. allow to specify multiple hosts for approved
  forwarding when sending out an activity, and allow to specify audience of
  software-authored activities using a convenient human-friendly structure
- Implementation of S2S sharerOfferDepF which creates a dependency under a
  sharer-hosted ticket/patch and sends back an Accept
2020-06-18 10:38:04 +00:00
fr33domlover
d9c00cba1f Add repo-hosted patch routes and GET handlers 2020-05-26 14:51:11 +00:00
fr33domlover
e29233a59f Rename RepoPatchR to RepoCommitR, we'll use the old name for merge requests 2020-05-26 08:54:21 +00:00
fr33domlover
e68a659221 Support forwarding activities from repo actors 2020-05-25 13:36:34 +00:00
fr33domlover
17e59af1c4 AP: In getSharerPatchR, provide the list of patch versions, latest first 2020-05-25 12:39:25 +00:00
fr33domlover
c63479470e Add patch version route and GET handler, serving a specific patch file 2020-05-25 09:40:48 +00:00
fr33domlover
02c42029d2 Add GET routes and handlers for sharer-hosted patches 2020-05-24 09:17:49 +00:00
fr33domlover
bb6785de75 DB: Generalize TicketProjectLocal into TicketContextLocal
This is the first step preparing for patches and merge requests.

The work-item aspect of MRs will reuse the Ticket related tables, except MRs
will live under repos. So, the context of tickets will no longer be just
projects, but will also be repos.

So, TicketProjectLocal turns into TicketContextLocal, and there are 2 new
tables that refer to it: TicketProjectLocal and TicketRepoLocal. Tickets will
have the former, MRs will have the latter.
2020-05-18 10:28:43 +00:00
fr33domlover
43cd1a95f3 S2S: sharerCreateNoteF caches note and does inbox fwd if sharer is ticket owner 2020-05-13 13:06:28 +00:00
fr33domlover
23056b3b3c DB: Attach a RemoteDiscussion to each RemoteTicket, for caching comments 2020-04-14 18:24:19 +00:00
fr33domlover
6c8b9664a2 When HTTP-fetching actors, remember their 'followers' as a LocalURI
The implementation felt quite weird, had to add an extra field to Fetched and
to VerifKeyDetail. Should probably figure out the whole mess in that code, have
something clean there. Easily add fields. Easily and safely re-fetch an actor
or key.
2020-04-11 14:58:38 +00:00
fr33domlover
04fc94cedb S2S: Write Create/Ticket project inbox handler: list ticket & do inbox fwding 2020-04-11 13:57:43 +00:00
fr33domlover
f18c15f038 Rename the TicketR routes to ProjectTicketR for clarity
Now it's much clearer when looking at the code, that these routes are about
project-hosted tickets, and it's easier to see where the author-hosted
equivalents are missing.
2020-04-09 07:36:01 +00:00
fr33domlover
4a362632be Update S2S Accept handler to handle Accept on a Create/Ticket 2020-04-08 17:02:04 +00:00
fr33domlover
318f182245 Add OAuth2 subsite 2020-03-28 14:28:24 +00:00
fr33domlover
a00c45a444 Implement C2S Create{Ticket}, available in PublishR and in postTicketsR
IMPORTANT: Since a lot of ticket code still doesn't use TicketUnderProject,
creating tickets now appears to be failing. Usage of this patch as is, is at
your own risk ^_^ the next patches will update the ticket handlers to fix this
problem.
2020-02-22 19:45:27 +00:00
fr33domlover
0de98a9cdd Implement sharer ticket JSON view, including discussion, followers, deps etc. 2020-02-10 14:10:01 +00:00
fr33domlover
00e0f7c14f DB: Switch RemoteMessage to use RemoteObject 2020-02-10 14:07:00 +00:00
fr33domlover
32173fe0c0 Add tickets-under-sharer route, just plain JSON view 2020-02-08 15:24:36 +00:00
fr33domlover
5e9dd3555d DB: Add and populate TicketUnderProject table
A row in this table will be required for local-project-local-author tickets
hosted under the project, and non-existence of a row will be required for such
tickets hosted by the author. So I'll need to CAREFULLY update all the ticket
route handler code and all the ticket related AP code. The latter includes C2S
and S2S for tickets, ticket deps, ticket discussion... everything that is under
tickets.
2020-02-08 11:49:30 +00:00
fr33domlover
7612b4e01e DB: Switch RemoteDiscussion to use RemoteObject instead of instance+ident 2020-02-08 10:55:19 +00:00
fr33domlover
fb9e2dd4dd DB: In TAL and TAR, rename 'offer' to 'open'
That's because with the Create flow added, the activity that reports a ticket
can be either Create or Offer, maybe later Announce too.

The old TAL unique name mentioned in the migration has what may look like a
typo, "Locale" instead of "Local". That's because I made a typo in migration
115, and now needed to specify the typoed name I used then. I verified in dev
DB and on dev.angeley.es DB that the typo is reflected in the PostgreSQL
database side and fixed by the new migrations.
2020-02-08 09:35:35 +00:00
fr33domlover
6e2445a31f DB: Remove unnecessary fkey from TicketAuthorRemote to Ticket
Since it points to TicketProjectLocal which in turn points to Ticket.
2020-02-07 23:05:42 +00:00
fr33domlover
5b57039447 DB: Point from TicketAuthorRemote to TicketProjectLocal 2020-02-07 19:42:02 +00:00
fr33domlover
ea7d806233 DB: Remove 'project' and 'accept' from Ticket, use TicketProjectLocal instead 2020-02-06 17:25:09 +00:00
fr33domlover
7809512117 DB: Add TicketProjectLocal table, pointing to Ticket but not in use yet 2020-02-06 04:18:19 +00:00
fr33domlover
813869755a DB: Remove foreign key from TicketAuthorLocal to Ticket, not needed anymore
Since TicketAuthorLocal now points to LocalTicket, which in turn points to
Ticket.
2020-02-06 03:41:16 +00:00
fr33domlover
fd704e231f DB: Add foreign key from TicketAuthorLocal to LocalTicket
Right now it's in addition to the Ticket one. The next patch will remove the
Ticket old, so TicketAuthorLocal will point only to the LocalTicket.
2020-02-06 03:17:00 +00:00
fr33domlover
443ff6daa1 Switch ticket routes to use the KeyHashid of LocalTicket instead of Ticket 2020-02-06 00:52:15 +00:00
fr33domlover
cd5180a1d5 DB: Remove did and fsid from Ticket, get them from LocalTicket
Everywhere Ticket is found, a matching LocalTicket is now expected to be found
too. Ticket doesn't point at LocalTicket because there will be remote cached
tickets too. Also, ticket URLs are going to switch the khid from Ticket to
LocalTicket (much like it's already the case for MessageR).
2020-02-05 14:09:12 +00:00
fr33domlover
deeac7e760 DB: Add LocalTicket table
This is a step preparing for the Create flow for tickets. Each Ticket now gets
a matching LocalTicket that points to it. But otherwise the LocalTicket isn't
in use yet.
2020-02-05 12:08:39 +00:00
fr33domlover
1a5654f8ae Stop assigning ticket numbers, allow them to be NULL 2020-02-03 15:44:16 +00:00
fr33domlover
1cb3812ef5 Remove ticket numbers from UI and from URLs, use KeyHashid instead 2020-02-03 14:53:12 +00:00
fr33domlover
f4a5866dec Very basic support for ticket label colors
- WorkflowField now has a color, it's a simple `Maybe Int` for now. Valid
  values are only 1-4
- That color is used for displaying ticket class params a.k.a labels in ticket
  list view
- Ticket list now also serves a paged OrderedCollection

I tried to use a single SQL query to grab the tickets along with their labels,
but couldn't figure out a way to aggregate tuples/rows into an array (it seems
only single values are supported in Esqueleto). Instead of doing manual SQL or
adding Esqueleto functions, I just switched from 1 query to O(n) queries: Each
ticket has its own query selecting its labels. I guess it's slower, but also,
ticket list is paged now with fixed page size so it's really O(1) ^_^
2020-01-16 10:29:47 +00:00
fr33domlover
d01bc5bad7 Implement ticket class params 2020-01-05 14:33:10 +00:00