Commit Graph

206 Commits

Author SHA1 Message Date
cloudhead 045b3e7175
node: Increase process ulimit on start
Users have been having issues with the process soft file limit.
We set that to a reasonably high value to avoid problems.
2024-01-17 17:34:25 +01:00
cloudhead 1e2776cb08
cli: Output explore URLs on push 2024-01-12 13:24:11 +01:00
Sebastian Martinez 14b90ffbf9
httpd: Change node id in `/` and add version to `/node` 2024-01-09 13:59:23 +01:00
Sebastian Martinez 9b98542692
httpd: Add `/api/v1/profile` route to get entire profile
That route is limited for requests that come from a loopback IP.
2024-01-09 13:59:23 +01:00
cloudhead 7d4ce8207d
httpd: `rad web --connect` takes an argument
To be able to connect to any running httpd, have `--connect` take the
address of the running daemon.
2024-01-09 13:33:26 +01:00
Sebastian Martinez 1bb400c278
httpd: Add edits field to revision json 2023-12-22 15:17:25 +01:00
Sebastian Martinez ee3dcfacf0
httpd: Allow edit revision embeds 2023-12-22 15:09:20 +01:00
Sebastian Martinez 5331cf3bcf
radicle: Move `DataUri` to `common::DataUri` 2023-12-22 15:09:20 +01:00
Fintan Halpenny 2dea54c6ee
cob: mandatory `Oid` in `CodeLocation`
To make `CodeLocation` reusable across different components, require
that a commit's `Oid` is part of the struct.

An `Oid` is necessary since the `path` can refer to a path at any
point in time throughout the history of the repository. By pinning the
commit that is being referred to, the path will refer to the path
within the associated tree [of the commit].

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-12-22 15:00:42 +01:00
Sebastian Martinez 1f36879aa2
cob: improve Comment generics
`Infallible` is a more appropriate type in comparsion to `()` for
comments that do not require a `CodeLocation`.

That is because if the type for `location` is `Option<()>`, this means
that `Some(())` can be constructed, however, we never intend to
construct that variant. On the other hand, `Infallible` can never be
constructed, and so, only `None` can be used.

This requires updates to some functions to use the generic `T` and
also handle the different kinds of `Comment`s -- `Infallible` and
`CodeLocation`.

X-Co-Authored-By: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-12-22 14:09:02 +01:00
Thomas Scholtes 48dedc6e7e
`rad-web` runs HTTP API and connects web app
Instead of `rad-web` just creating a session for an already running HTTP
API the command now starts the HTTP API, creates a session and opens the
authentication link.

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-12-19 13:14:07 +01:00
Sebastian Martinez bdcaa60474
httpd: Update axum and hyper dependency 2023-12-15 12:08:43 +01:00
Sebastian Martinez 53c08f5d26
httpd: Cleaning up `api::json` and review comments 2023-12-13 12:37:10 +01:00
cloudhead 6ca7da2768
radicle: Rename many more methods using new naming 2023-12-06 10:02:00 +01:00
cloudhead 1b026ae0ee
node: Rename node `tracking` module 2023-12-06 10:00:45 +01:00
Fintan Halpenny dce5316cbb
radicle: rename Issue::assigned -> Issue::assignees
Align the naming with the field itself and Patch::assignees.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-12-06 09:48:02 +01:00
Sebastian Martinez 3e07808ee5
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
Sebastian Martinez f8005c74c6
httpd: Add comment edits to serialized json
This allows the display of any edits done to comments,
replies and issue descriptions.

This commit doesn't remove the body property
which is the latest comment body but adds a edits property.

Also adds an author property to the `Edit` struct,
which allows us to see the author of an edit action.
2023-12-05 16:01:50 +01:00
Fintan Halpenny 924a2624a4
git: update git2-0.18.1
Update to git2-0.18.1, which also requires updating radicle-git-ext
and radicle-surf.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-12-04 11:11:36 +00:00
cloudhead 6b04eff34c
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
Sebastian Martinez 9ae7fd702e
httpd: Add endpoint with tracking information
This allows us to check which projects are really tracked by the node
and which aren't and with which scopes and policies.
2023-11-30 12:30:07 +01:00
cloudhead 59a08f21a4
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 638c2a3e4c
httpd: Announce refs in project POST/PATCH routes 2023-11-24 13:47:14 +01:00
Sebastian Martinez 1cbca28b7c
httpd: Use a simpler way of obtaining a Blob without a commit 2023-11-24 13:42:30 +01:00
Sebastian Martinez 8277559ee0
Update radicle-surf to 0.17.1 2023-11-24 13:42:30 +01:00
cloudhead 8e76ce03d5
cli: Hints system
Enable hints by default, but allow users to turn them off via
configuration.

Add a hint when pushing while offline.
2023-11-23 11:07:07 +01:00
Sebastian Martinez b64fc22c18
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
Thomas Scholtes 3ccb6a5fac
Move `rad-web` binary to `radicle-httpd` package
Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
2023-11-22 11:27:11 +01:00
cloudhead d4ec2176bb
Update Rust toolchain to 1.74 2023-11-17 16:58:24 +01:00
Fintan Halpenny 25ed6b8b28
httpd: consistent default branch
The test suite for `radicle-httpd` assumed that `master` would be used
for the working copy. However, if a user set their Git default branch
to be something other than `master` then the test suite will fail for
them.

To remedy this, initialise the working copy with the `master` branch
as well.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-11-16 11:06:40 +01:00
Fintan Halpenny c22bf8475a
httpd: return the error message not found errors
It's difficult to debug errors that mention a resource not being
found, but not which resource was not found.

Return the error message for not found variants.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-11-09 16:46:42 +01:00
Fintan Halpenny 82a53e3a53
radicle: UserInfo for Repository::create
The fetch V2 improvements introduced a `UserInfo` type that is used to
set the Git config's name and email when cloning a repository. This
`UserInfo` can also be used when creating a new `Repository`.

The `Storage` type now takes a `UserInfo` so that it can be passed to
`Repository::create`, for creating a new repository.

For testing, this requires adding a new `fixtures::user` so that
testing `Storage` instances can be easily constructed.

It also means that the `radicle-cli` tests all changed with new SHAs
since the name and email are used as part of the hashing input.

N.b. the order of the timelines while testing the identity cob
changed. It's not clear why that is.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-11-09 16:43:34 +01:00
Fintan Halpenny f1f32d8574
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
Fintan Halpenny 75b52e28b2
radicle: separate repository validation
Make the validation logic customisable by extracting it out into a
separate trait that can be defined by other crates.

The Repository validation logic stays the same.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-11-06 12:06:13 +01:00
cloudhead a70664368e
radicle: Move some functions to `Home` type
Certain functions in `Profile` did not need to be in there and could be
moved in the more basic `Home` type.
2023-11-03 17:08:18 +01:00
Rūdolfs Ošiņš 342b05f88d
httpd: Don't panic when node is not running 2023-11-02 17:00:38 +01:00
Sebastian Martinez 15cf5c6100
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 1d167581f2
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 504a198cec
Update `radicle-surf` to v0.17
This commit introduces the `FileStats` struct, that adds the insertions
and deletions for each file to `DiffContent`.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-10-11 14:29:34 +02:00
Sebastian Martinez 9a1a216f70
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 78e6833672
httpd: Add missing COB actions
Handles missing issue and patch actions. Adds embeds to patch comments.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-10-11 13:36:48 +02:00
Sebastian Martinez 35da28d8af
httpd: Return entire files from commit handler
Used for syntax highlighting.

Also improves the handling of multiple parent commits, by adding all of
them.
2023-10-03 12:19:18 +02:00
Sebastian Martinez 313fc1315d
httpd: Increase body size limit for `/projects/*`
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-10-03 11:59:11 +02:00
cloudhead 154566f8ef
cli: Update to `radicle-surf` 0.16 2023-09-27 15:54:16 +02:00
Sebastian Martinez 5acfffb352
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 9df1922f15
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 a3f460e67d
httpd: Add node alias to session endpoints
This will allow us to show the alias of an authenticated user in the web
client.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-09-18 11:18:17 +02:00
Sebastian Martinez 6bb0dd1a28
Update `radicle-surf` to `v0.15.0`
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-09-18 10:57:37 +02:00
cloudhead 54cc92cc83
cob: Add missing `verdict` field to `review.edit`
This is generally useful, and required when constructing a review
without knowing the verdict ahead of time.
2023-09-05 11:17:59 +02:00
Sebastian Martinez d6d280d450
httpd: Return entire files in diff endpoint
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-09-02 19:02:25 +02:00