Commit Graph
42 Commits
Author SHA1 Message Date
cloudhead 4816a4de5f radicle: Rename many more methods using new naming 2023-12-06 10:02:00 +01:00
cloudhead 8319fde08f node: Rename node tracking module 2023-12-06 10:00:45 +01:00
Sebastian Martinez e360c6333d httpd: Add node policies endpoint
New endpoint on `PUT api/v1/node/policies/repos/:rid` and `DELETE api/v1/node/policies/repos/:rid`,
that allows to track and untrack a project.

For tracking a project we also accept `?from=<nid>` to specify
where we should fetch from after tracking a repo.
2023-12-05 16:07:22 +01:00
cloudhead 0a645b797b radicle: Consolidate databases
Instead of having a routing database, and an addresses database,
consolidate that in a single database called `node.db`.

We also simplify database access, by providing a single type for opening
the database, and use traits to access the various functions.

We create a new `seed::Store` that has seed-related methods split out of
the `address::Store`.

Note that tracking is still in its own database currently, as it isn't
ephemeral state. This makes it easy to delete the new `node.db` without
risk of losing any important information.

To avoid renaming all database methods, we create a `Stores` wrapper
that allows us to access routing, addresses, seeds etc. without type
ambiguity.

This is a breaking change and requires `addresses.db` and `routing.db`
to be deleted.
2023-11-30 13:00:59 +01:00
cloudhead c197bc8763 radicle: Explorer and preferred seed configuration
Allows users to configure the default node explorer to use.
Allows users to configure their preferred seeds.
2023-11-30 10:46:32 +01:00
Sebastian Martinez 43586b8a61 httpd: Announce refs in project POST/PATCH routes 2023-11-24 13:47:14 +01:00
Sebastian Martinez d894a8b68b httpd: Show private projects in project listing
We check if the `SocketAddr` from the request is equal to `127.0.0.1`
and if so we also list private repos.
2023-11-22 12:36:22 +01:00
Fintan Halpenny eb4712e788 radicle: return verified doc
The `identity_doc_at` and `identity_doc` methods on `ReadRepository`
returned the unverified identity document. Every usage of these
methods would always verify the document after.

Simplify the code by calling verified in the methods and directly return the
verified identity document.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-11-06 12:06:13 +01:00
Sebastian Martinez c1a026fc81 httpd: Parse git URIs into Embed
Currently we only handle data Uris, but when a user sends a comment that
has a existing git Oid, due to editing a comment we also need to handle
this case.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-10-30 15:41:34 +01:00
cloudhead 472f38bacf cob: Introduce xyz.radicle.id COB
Introduces a new COB type to store repository identity documents.

The reason for this change is to:

1. Simplify the code, as the identity document logic resembled a COB,
   yet it had custom logic. This allows existing COB code to be used for
   identities.
2. Make identity document update logic more flexible, since COB actions
   can be added in the future.
3. Re-purpose existing tools around COBs to work on identities, eg. `rad
   cob`.
4. Unify the concept of an identity change proposal, with regular identity
   changes. This means we can remove the `id.proposal` COB in favor of
   using the `id` COB itself.

Notes
-----

* Each repository has one Identity COB.
* The `Proposal` COB has been repurposed into the `Identity` COB.
* Identity documents are stored as *embeds* inside the Identity COB
  actions.
* The action that contains new document versions is called `revision`,
  just like the Patches COB.
* The namespaced `rad/id` ref is a symbolic reference to that Identity
  COB.
* The canonical `rad/id` ref is a direct reference to the commit in the
  Identity COB that contains the latest *accepted* revision of the
  document.
* All commands for managing identities have been folded into `rad id`.
  Hence `rad delegate` and `rad edit` are removed.
* The concept of "rebasing" an identity document is gone.
* The `rad id` output has been updated to match the style of other
  commands.
* When a revision has enough signatures, it is automatically adopted as
  the current identity, there is no longer the need for a "commit"
  action.
* When an identity revision is proposed, and the current identity has a
  threshold of `1`, that identity is automatically accepted due to the
  above point.
* The idea of "verifying a peer's identity branch" no longer applies, as
  COBs cannot be verified one history at a time.
* Since the root commit of the Identity COB does not have a "Resource"
  to point to (it would have to point to itself, which is impossible),
  we've made the resource id optional for COBs.
2023-10-12 17:32:33 +02:00
Sebastian Martinez 0dd85ca24a httpd: Add configuration to /node endpoint
Adds the "config" key containing node configuration.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-10-11 13:51:38 +02:00
Sebastian Martinez da7258d2bf httpd: Improve data-uri support
We were just using `strip_prefix` with a hardcoded value, which wasn't
able to adjust to URIs that start with `data:image/png` or other content
and types.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-09-26 17:33:06 +02:00
Sebastian Martinez b47609a06e httpd: Add routes for handling embeds in issues
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-09-19 10:00:01 +02:00
Sebastian Martinez df2251f6ee httpd: Add socketAddress to /node endpoint
This allows us in the web client to show and let user copy the node id
together with the correct port number

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-08-03 13:30:55 +02:00
xphoniex 2e25250be4 httpd: Add a cache for /tree
This improves response time of:

- GET /api/v1/projects/<RID>/tree/<OID>/ from 205.71ms down to 376.4µs
- GET /api/v1/projects/<RID>/tree/<OID>/.nix from 111.06ms down to 351.70µs

Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-07-25 13:10:58 +02:00
xphoniex d0d47f791b node: Add access to routing.db on profile
httpd: Use routing.db to return `trackings` of an RID

Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-06-02 13:42:44 +02:00
Alexis Sellier 90cf62b027 cob: Redesign merge state
Move `merges` from `Revision` to `Patch`, and key them by actor.

This ensures that only one merge is possible per actor. We also make
sure that only one revision can be merged at a time, and signal a
conflict if more than one revision is considered merged.

Finally, we make sure that merges have the same target-branch commit
to be considered equal.
2023-05-19 18:40:46 +02:00
Sebastian Martinez c70252429c httpd: Add cob state to listing endpoints
This commit adds the cob state of either patches or issues to the
corresponding endpoint.

So we can either query a cob listing with the required state or expect
the default state.
And once filtered by cob state we paginate.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-04-20 20:38:15 +02:00
Rūdolfs Ošiņš da96a82fc1 httpd: Use camelCase in query params
It's more ergonomic to consume in JS/TS.

Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
2023-03-17 17:11:00 +01:00
xphoniex 44bf989d2e httpd: Add root handlers for /api/v1 and /api
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-03-12 19:12:40 +01:00
Alexis Sellier 346737e3f8 Remove need to pass public key in cob store 2023-03-06 10:56:20 +01:00
xphoniex da594fb521 httpd: Use repo.identity_doc() instead of repo.identity_of(..)
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-02-28 18:08:26 +01:00
Sebastian Martinez 6793b8e7d3 httpd: Add issue and patch counts
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-27 12:57:20 +01:00
xphoniex e7de186e0e httpd: Add /raw route
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-02-23 06:16:37 +00:00
xphoniex 9a03136516 httpd: Use State instead of Extension for root_handler
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-02-23 05:54:31 +00:00
xphoniex b0b94fea18 httpd: Move test utility mod from inside api to root
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-02-22 17:06:32 +01:00
xphoniex 1185a1fc6b httpd: Change 500 into 404 when project doesn't exist
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-02-22 17:06:32 +01:00
xphoniex 7e9b9c944b httpd: Return correct count for patches
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-02-16 16:51:02 +01:00
Alexis Sellier 8b90dd674f Make ReadStorage more usable
Previously, we were not able to access a `ReadRepository` instance
through `ReadStorage`. With this change, we are able to.
2023-02-15 22:08:20 +01:00
Sebastian Martinez 95dca98a43 httpd: Add delegates to project routes
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-14 14:50:42 +01:00
Sebastian Martinez d88858e58b radicle-httpd: Add DELETE to allowed methods
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-09 16:48:48 +01:00
Sebastian Martinez ffdf7c171d httpd: Refactor auth and session handling
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-04 19:38:26 +01:00
Sebastian Martinez 932d8d2ed8 Add web-based authentication
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-01-27 17:23:05 +01:00
Han Xu 64a933dccd httpd: Dogfood the new radicle-surf API
Signed-off-by: Han Xu <keepsimple@gmail.com>
2023-01-18 14:22:01 +01:00
xphoniex d98073a55d httpd: Add api tests
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-01-12 20:30:53 +01:00
xphoniex a93803c8ca httpd: Use TraceLayer on uppermost router
This allows prefix of each route e.g. `/api/*` to be visible in logs.

Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-12-26 15:56:21 +01:00
Alexis Sellier cc942024ce Make Doc type payload generic 2022-12-09 22:05:38 +01:00
xphoniex 591b86aee5 Migrate /v1/stats route
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-11-30 13:06:03 +00:00
xphoniex de1f84b792 Migrate /projects: root, project, commit, activity handlers
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-11-30 13:06:03 +00:00
xphoniex 2d49f8bbff Migrate /v1/delegates route
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-11-30 13:06:03 +00:00
xphoniex b26562f2c5 Migrate /v1/sessions route
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-11-30 13:06:03 +00:00
xphoniex ae2a35abb9 Migrate /v1/, /v1/node routes to heartwood
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-11-30 13:06:03 +00:00