Commit graph

88 commits

Author SHA1 Message Date
fr33domlover
6786e2e0e1 Implement theater-based remote delivery and port personGrant 2023-05-24 22:17:14 +00:00
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
dae8554a12 UI: getPatchR: Display diff-syntax-highlighted patch content file 2022-09-19 11:00:47 +00:00
fr33domlover
c495d78d05 C2S, UI: Loom creation and Repo linking to a Loom
RepoSourceR, for a repo that doesn't have a loom, lists looms that want to
serve that repo with buttons for bidirectionally linking the repo to a loom

Once linked, the repo navbar has a Patches/MRs link pointing to the LoomClothsR
of the linked Loom
2022-09-17 08:31:22 +00:00
fr33domlover
e78f043f49 C2S & UI: Allow creation of a new Repo 2022-09-16 10:34:44 +00:00
fr33domlover
2e72684fd5 Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:

- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
  i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
  common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
  are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
  which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
  code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
  so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
  I haven't tested them yet on a read DB so there may be errors there; I'll fix
  them in the next patches if I find any (probably going to test on the main
  instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
  and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
  for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
  removed, I haven't removed them; that's because I wonder if at some point
  users can have a tree of inboxes much like in email; I don't have an excuse
  for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
  figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
  they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +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
02c42029d2 Add GET routes and handlers for sharer-hosted patches 2020-05-24 09:17:49 +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
e0300ba0fa Write recipient filtering utility function 2020-02-19 10:59:38 +00:00
fr33domlover
b95e9a8006 Weird initial (but complete) display of Darcs patches 2019-10-31 10:11:13 +00:00
fr33domlover
a700dc4208 Make the hook config file path include the instance host
Before this patch, if you ran more than 1 instance as the same OS user, they'd
use the same config file path and overwrite it and cause post hooks to have
errors due to wrong config being used.
2019-10-20 09:19:49 +00:00
fr33domlover
3c01f4136c Mechanism for reporting git pushes to Vervis via post-receive hooks
Here's how it works:

- When Vervis starts, it writes a config file and it writes post-receive hooks
  into all the repos it manages
- When a git push is accepted, git runs the post-receive hook, which is a
  trivial shell script that executes the actual Haskell program implementing
  the hook logic
- The Haskell hook program generates a Push JSON object and HTTP POSTs it to
  Vervis running on localhost
- Vervis currently responds with an error, the next step is to implement the
  actual publishing of ForgeFed Push activities
2019-09-05 12:02:42 +00:00
fr33domlover
2c18660a3b Provide AP representation of commits, and support committer field 2019-08-06 13:23:11 +00:00
fr33domlover
8fc5c80dd6 New Network.FedURI with separate URI modes for dev and for fediverse
FedURIs, until now, have been requiring HTTPS, and no port number, and DNS
internet domain names. This works just fine on the forge fediverse, but it
makes local dev builds much less useful.

This patch introduces URI types that have a type tag specifying one of 2 modes:

- `Dev`: Works with URIs like `http://localhost:3000/s/fr33`
- `Fed`: Works with URIs like `https://dev.community/s/fr33`

This should allow even to run multiple federating instances for development,
without needing TLS or reverse proxies or editing the hosts files or anything
like that.
2019-07-23 13:59:48 +00:00
fr33domlover
81a05a950f Implement getTicketDepR, not used anywhere else yet
This patch also disables the ability to specify deps when creating a ticket,
because those deps won't be in the ticket object anymore. Instead of coding a
workaround and getting complications later, I just disabled that thing. It
wasn't really being used by anyone anyway.
2019-07-11 15:14:16 +00:00
fr33domlover
90cb4fcd88 Data.Aeson.Encode.Pretty.ToEncoding: Use encodePrettyToTextBuilder as base
aeson-pretty implements by formatting using a text Builder, and the ByteString
is encoded from that. So instead of decoding the ByteString to produce Text or
Builder, use the Builder as the starting point, to match how aeson-pretty works
and save computation and weird backwards-decoding stuff.
2019-06-29 22:39:42 +00:00
fr33domlover
55fdb5437c Write C2S Offer{Ticket} handler, not used in any route handlers yet
This patch doesn't just add the handler code, it also does lots of refactoring
and moves around pieces of code that are used in multiple places. There is
still lots of refactoring to make though. In this patch I tried to make minimal
changes to the existing Note handler to avoid breaking it. In later patches
I'll do some more serious refactoring, hopefully resulting with less mess in
the code.
2019-06-22 18:03:20 +00:00
fr33domlover
4b20ed23b6 Stop using Vervis.Import and NoImplicitPrelude, switch to plain regular imports 2019-06-15 08:24:08 +00:00
fr33domlover
7686f3777e New module structure for ActivityPub C2S and S2S code 2019-06-15 04:39:13 +00:00
fr33domlover
5df8965488 Some cleanup and term updates in Web.ActivityPub to match the spec and plans
* No more full URIs, all terms are used as short non-prefixed names
* Some terms support parsing full URI form for compatibility with objects in DB
* No more @context checking when parsing
* Use the new ForgeFed context URI specified in the spec draft
* Use an extension context URI for all custom properties not specific to forges
* Rename "events" property to "history", thanks cjslep for suggesting this name
2019-06-12 00:11:24 +00:00
fr33domlover
71ab1c4459 Syntax-highlight the pretty JSON display of AP objects 2019-06-09 14:32:57 +00:00
fr33domlover
b1897a20c0 Allow ticket author to be a remote actor 2019-06-07 04:26:32 +00:00
fr33domlover
23e760e373 Build with LTS 13, GHC 8.6 2019-05-24 11:49:39 +00:00
fr33domlover
7bcbe52274 Implement getOutboxR, both (trivial) HTML and AS2 2019-05-20 23:51:06 +00:00
fr33domlover
6d304b9307 Smarter treatment of recipients that are collections
- Allow client to specify recipients that don't need to be delivered to
- When fetching recipient, recognize collections and don't try to deliver to
  them
- Remember collections in DB, and use that to skip HTTP delivery
2019-05-17 22:42:01 +00:00
fr33domlover
9a306e762c Unfinished updated outbox handler 2019-04-11 13:44:44 +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
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
ad3a20d783 Receive remote comments on local ticket discussion 2019-03-21 22:57:15 +00:00
fr33domlover
f6cbc1eb8a Use file based switches to relax keyfile loading rules 2019-03-11 02:01:41 +00:00
fr33domlover
c2bf470fb6 Generate and keep permanent salt for generating hashids for URIs 2019-02-08 21:54:22 +00:00
fr33domlover
8ac559d064 New datatype FedURI for @id URIs
Using a dedicated type allows to record in the type the guarantees that we
provide, such as scheme being HTTPS and authority being present. Allows to
replace ugly `fromJust` and such with direct field access.
2019-02-07 23:08:28 +00:00
fr33domlover
8166d5b5eb Support for instance-scope keys when verifying HTTP signature 2019-02-06 02:48:23 +00:00
fr33domlover
e8a5ef4e86 Replace unused symbol name with underscore 2019-02-05 12:56:06 +00:00
fr33domlover
d4c7fa5809 When parsing ID URIs in AP JSON, make sure their authority part is non-empty 2019-02-05 12:54:55 +00:00
fr33domlover
02da508ed0 Allow actor publicKey to be a URI, and require the URI to match the Sig keyId 2019-02-04 10:07:25 +00:00
fr33domlover
c336d56036 Allow actor public key to be in a separate document 2019-02-03 23:39:56 +00:00
fr33domlover
991296faa1 Move some JSON/AP codec utils to new Data.Aeson.Local module 2019-02-03 11:01:36 +00:00
fr33domlover
1f47ca39eb Federation test outbox page with form for entering JSON 2019-01-21 15:54:57 +00:00
fr33domlover
33338a73cc Upgrade to GHC 8.4 and LTS 12 2018-12-05 03:41:19 +00:00
fr33domlover
13bd369de3 Darcs patch reader: Join adjacent remove-add sequences like in the Git module 2018-07-09 19:12:11 +00:00
fr33domlover
16c71b666f Data.List.Local: Generalize input list to be any Foldable 2018-07-08 21:57:08 +00:00
fr33domlover
c8146bbff4 Data.List.Local: Comment out the unused groupByFst 2018-07-08 21:56:08 +00:00
fr33domlover
dbec638415 Generate commit diff data for git repos 2018-05-19 16:10:03 +00:00
fr33domlover
8eca3fa647 Upgrade to GHC 8 and LTS 10.10 2018-05-16 00:02:54 +00:00
fr33domlover
abfb77479f Move DarcsRev and code we're sharing with it into a separate library 2018-03-20 23:45:09 +00:00
fr33domlover
cd1f7af46e Migration: Safe IsString instances for Field, Entity, Unique 2016-09-01 17:37:20 +00:00
fr33domlover
26624404ca Forgot to record Data.Maybe.Local util module 2016-08-10 21:23:55 +00:00
fr33domlover
dc54a89503 Ticket tree view page 2016-08-04 07:36:24 +00:00