Commit Graph

247 Commits

Author SHA1 Message Date
cloudhead 8060181b9f
httpd: Fix more routes that return the wrong code
These routes should return 404 if the entity was not found.
2023-08-09 16:59:19 +02:00
cloudhead 5654f08841
httpd: Fix error status code on project not found
It was 500, should be 404.
2023-08-09 12:01:14 +02:00
Alexis Sellier 3bd5589b1a
cob: Stabilize formats
> I'm going to be making a set of breaking changes to COBs in order to
stabilize the data formats. This is hopefully a one-time change that
bundles various breaking changes.

All COBs have been reworked: issue, patch, id.

The changes included are:

* Revise the assign and tag actions to take a single list of
  assignees/tags to set, instead of an "add" and a "remove" list. This
  makes API usage simpler when editing issues, and simplifies the apply
  function
* Rename "tags" to "labels", and the tag action to label. This is
  because tag is confusing in the context of git, as it could mean a git
  tag. Using label removes that confusion.
* Use DIDs instead of PublicKeys for assignees -- this is more
  future-proof
* Modify the manifest file format in the COB tree. Mainly, remove the
  `history_type` key which is redundant, and use camelCase for keys
* Flatten the `Thread` actions into the parent action type
* Ensure that operations on redacted objects do not fail, since
  redactions could have happened concurrently
* Use a consistent naming scheme for actions, using `.` as separator
* Consolidate comment types and remove `CodeComment`, by adding an
  optional `location` field to `Comment`
* Add many placeholder actions that are not yet implemented

To preserve backwards compatibility, a `legacy` module is created with
the old `apply` function. When loading the manifest, we check whether it
is a legacy COB or a "stable" COB, and in the legacy case, use the
legacy code to materialize the state and then convert the object into
the stable type. Eventually, we'll delete the legacy code.
2023-08-07 11:05:14 +02:00
Slack Coder df5c8c7d4f
docker: Make Dockerfile easier to read
Avoid long lines by separating commands and arguments with '\'.
2023-08-03 13:43:20 +02:00
Sebastian Martinez f418b5268c
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
Alexis Sellier 26e3c0fbff
Use numbers for `LocalTime` timestamps
Instead of using strings, use numbers.

*This is a breaking change and affects `config.json` parsing.*

To upgrade, simply unquote any number in your `config.json`.
2023-08-01 15:47:02 +02:00
Sebastian Martinez 5cb4d5cd76
httpd: Add commit parents vector to `/commits/:sha` endpoint
So we can act upon the eventual parents of a commit, after fetching a
single commit we need to have the parents of that commit as part of the
json payload.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-07-26 13:21:31 +02:00
Alexis Sellier f639192dc6
cob: Remove CRDTs from COB state
It turns out that the CRDT formed by the union of Git DAGs
is enough to guarantee everything we need for COBs.

This changes the following things:
* COB operations no longer need to be commutative
* COB histories are traversed in the same deterministic order on all
  replicas
* It's now possible to implement RSMs on top of COBs, eg. scripting
* Lamport clocks have been removed
* `radicle-crdt` is no longer a dependency of `radicle`
* COBs are no longer instances of `Semilattice`
* The `Ops` type was removed in favor of having `Op` contain multiple
  actions
2023-07-25 15:29:27 +02:00
xphoniex 8a61aece01
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
Sebastian Martinez 0e0ff38ff7
httpd: Fix commit count in repo stats in history route
Instead of using always the repo HEAD for the commit count with
`repo::stats` we should use `repo::stats_from` and pass the `parent`
commit.

This way we allow e.g. a commit history for a peer with lesser commits
to be counted correctly.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-07-25 12:34:03 +02:00
xphoniex 4869fe26e2
Add `-h` flag to binaries
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-07-25 11:58:39 +02:00
Alexis Sellier f92308cf25
cli: Make key encryption optional
By leaving the passphrase prompt blank, users can create unencrypted
keys.
2023-07-20 10:40:15 +02:00
Alexis Sellier 45ccbde226
Update `radicle-surf` and `git-ref-format` 2023-07-14 16:57:55 +02:00
Alexis Sellier b27313bc5c
Don't fail if we can't open the database
We make sure that even if there is no database file, we're still able
to return `None` for the alias lookup.
2023-07-12 11:37:20 +02:00
Alexis Sellier eb701be033
node: Make node aliases required
This is a fairly substantial change, which adds a new configuration file
to the user's `$RAD_HOME` that includes node configuration, including
the alias, and also makes node aliases required.

When running `rad auth`, the user is now prompted for an alias, which
defaults to `$USER`.

When running `rad self`, the alias is now shown.

If the user runs radicle without a config file, the defaults are loaded,
and `$USER` is used as the alias.
2023-07-11 18:08:59 +02:00
Alexis Sellier d6e8f0c53e
httpd: Implement `EditCodeComment` in route 2023-07-03 12:31:05 +02:00
Alexis Sellier 11b32725c8
cob: Implement review code commenting 2023-07-03 12:31:05 +02:00
Alexis Sellier 45e87a63b9
cob: Changes to patch code review CRDT
This patch incorporates several important changes to code review:

* Code review verdict is no longer editable
  * Made reviews redactable instead
* Renamed review top-level comment to "summary"
* Renamed inline comments to "comments"
* Made inline comments addressable by `EntryId`
  * This is to allow for editing
* Removed inline comments from review creation
  * Added a `CodeComment` action instead
* Removed `Semilattice` instance from `Review`
  * Added a `EditReview` action instead to have more control
* Made it valid for revisions to be redacted concurrently with a review/merge

Most of these changes are needed to support proper inline code comments.
2023-07-03 12:31:05 +02:00
Alexis Sellier e4ab523669
cob: Move comment reactions to comment
To simplify the code, we move comment reactions to the comment struct
itself.
2023-07-03 12:31:05 +02:00
Alexis Sellier e33661738c
Move unit files to `systemd` directory 2023-06-22 12:13:30 +02:00
Alexis Sellier 33870572d4
Improve unit files, add binary install to README
After going through the process of getting this working using the unit
files, I found a few issues that are fixed here.
2023-06-22 12:13:30 +02:00
Alexis Sellier 22360f8c25
radicle: Change review data in patch COB
* `CodeLocation` had a `blob` and `commit` field. These are redundant,
  since the review lives under a revision.
  We also change the line range to be diff-compatible, with an old and
  new range. The ranges are optional to account for different scenarios
  like file deletion, move etc.
* `CodeComment` had redundant getters which were removed in favor of
  public fields. We also remove the `timestamp` field, as it will be
  the same as the review timestamp.
2023-06-22 11:15:42 +02:00
Alexis Sellier e700608095
Update `radicle-surf` 2023-06-22 11:15:42 +02:00
Alexis Sellier 5502676aa7
Fixes and improvements to alias handling
* Return the correct alias from a node announcement, stripping '\0'
  bytes.
* Accept `AliasStore` types as references and as owned.
* Store a `null` in the database if the alias received is empty.
2023-06-13 11:09:42 +02:00
Sebastian Martinez d2202a07ab
httpd: Add `validate` fn to auth module
Check for AuthState and expiry.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-06-02 17:34:24 +02:00
xphoniex 13bea902b2
radicle: Create `Aliases` and use it in `httpd`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-06-02 14:50:49 +02:00
xphoniex 738d0dcbad
node: Introduce `AliasStore` trait
httpd: use the `AliasStore` trait

Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-06-02 14:48:33 +02:00
xphoniex fd91cf4d28
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
xphoniex c25450d310
httpd: Return `alias` field on `merges` of a patch
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-05-29 12:48:11 +02:00
xphoniex 15070c4074
httpd: Add author to revision of a patch
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-05-29 12:11:13 +02:00
Alexis Sellier e41d67544c
cob: Add `reviewers` field on `Patch`
We aren't ready to support this yet from an end-user perspective, but
we add it in the COB already to prepare.
2023-05-26 10:31:00 +02:00
Alexis Sellier ac60069a33
cob: Remove `description` from `Patch`
Since patches always have a "root" revision, use that revision's description
as the patch description.
2023-05-26 10:31:00 +02:00
xphoniex 95e3b9673d
cli: Show alias on `rad issue` and `rad patch`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-05-22 15:13:28 +02:00
Alexis Sellier 2d55ffba81
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
xphoniex ae5982cd6b
httpd: Add `alias` field to certain routes
* `/patches`, `/issues`, `/remotes`

Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-05-16 12:40:07 +02:00
Alexis Sellier d249937a61
Update dependencies
* radicle-surf
* radicle-git-ext
* amplify
2023-05-10 15:56:21 +02:00
Fintan Halpenny 8508eab8fa
radicle: update radicle-git-ext
This change updates to the latest radicle-git-ext, which required a
few changes within the radicle family of crates.

One set of changes is that the radicle-git-ext crate subsumes
git-commit, git-trailers, and git-ref-format -- so all those imports
go through radicle-git-ext.

The commit code requires that parent `Oid`s point to commits, which
made some tests fail. One of the reasons for these failures is that
the patch tests used fabricated `Oid`s and so the verification would
fail. This is fixed by allowing the test context code to create
`PatchRequest`s that create valid commits.
The other reason for failure was that the identity `Action` passed an
`Oid` that pointed to a blob. This is fixed by removing that code and
making a note of it in documentation.

The final major change was moving the Refspec type into git-ref-format
and removing the AsRefspecs trait. The trait was not required and
could its usage could be replaced by simpler code.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-05-08 10:36:15 +01:00
Alexis Sellier 649d59f143
cob: Include head in initial patch entry in DAG
This change ensures that we include as a parent to the initial commit
of a patch COB, the head of the branch we are proposing as a patch.

This was already happening for patch updates, but we forgot to also
include it for the initial patch revision.

This ensures that the code is always fetched alongside the patch.
2023-05-02 09:18:17 +02:00
Alexis Sellier 3a9c8b7144
radicle: Remove `delegate` from `Remote` type
It wasn't being set correctly, and it's not the place for it,
so we remove it and set it in `httpd`.

Note that `Remote` is now simply a wrapper around `SignedRefs`.
If we want to remove the type or turn it into an alias, it will
require touching lots of different parts of the codebase. I opted
not to do that here as it's lower priority.
2023-04-26 11:06:55 +02:00
Sebastian Martinez 8667553740
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
Alexis Sellier eecea67ffd
cob: Deduplicate change parents 2023-04-14 13:54:27 +02:00
Alexis Sellier 97f076e3cf
Include dependencies for certain COB actions
We ensure that for example, the given commits are fetched before the
revision or merge actions in a patch.
2023-04-14 13:22:10 +02:00
Alexis Sellier 8205f8ad4e
Update `fastrand` dependency to 1.9.0 2023-04-14 13:15:52 +02:00
Alexis Sellier 33461e4be1
Set patch status to `merged` automatically
When a merge is applied to a patch, we check whether the threshold
of delegates has been reached, at which point we set the patch status
to `merged`.

This requires threading the identity document oid through the "apply"
process.
2023-04-05 10:32:45 +02:00
Sebastian Martinez 87f47cdc67
Reduce pub accessors in patch and issue cob structs
Replaces pub accessors to struct fields with methods
Also creates some methods to compute necessary information

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-31 13:44:37 +02:00
Sebastian Martinez 91efbd9630
Rename `patch::State::Proposed to `patch::State::Open`
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-30 10:46:57 +02:00
Sebastian Martinez 8907ddb8a5
httpd: Add `patch::Action::Lifecycle`
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-30 10:46:57 +02:00
Sebastian Martinez c9aaaec2ee
cob: Add `patch::Action::EditRevision`
To be able to change the description of a patch revision, without the
need to create a new revision.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-30 10:42:49 +02:00
Sebastian Martinez a5746b4f08
httpd: Add reactions to issue and patch json
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-25 12:04:53 +01:00
Sebastian Martinez 6b62f5bb28
httpd: Add patch head refs to patch output
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-25 11:54:09 +01:00
Sebastian Martinez 564886b165
httpd: Add `path` property to `CodeLocation`
For the web client to be able to show file we need to provide
the web client with the file path.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-23 11:41:13 +01:00
Sebastian Martinez 00ea587c6d
httpd: Add `CorsLayer` to `/raw` endpoint
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-23 11:07:58 +01:00
Sebastian Martinez f2d31aa9c0
httpd: Add patch update endpoint
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-22 13:53:19 +01:00
Sebastian Martinez fc724a2333
httpd: Add commit diff endpoint
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-21 18:50:26 +01:00
Sebastian Martinez 73221e43d7
httpd: Add more revision properties to patch
For display purposes in the web client, we add with this commit the
some needed properties to the revisions in the patch endpoint.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-20 18:43:06 +01:00
Rūdolfs Ošiņš d40f40b9af
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
Sebastian Martinez 2c0cdcd1c5
httpd: Add timestamp to revisions json
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-17 13:54:48 +01:00
Rūdolfs Ošiņš fdd6bca311
httpd: Fix status code in commit history endpoint
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
2023-03-15 10:17:41 +01:00
xphoniex 29b933e485
httpd: Use `RID` in tests
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-03-13 16:25:26 +01:00
xphoniex 3ee76c2891
httpd: Separate `Error` types of git route and `/raw`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-03-13 16:25:26 +01:00
xphoniex b80fc5437c
httpd: Move `404` test from `git` to root router
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-03-13 16:25:26 +01:00
Alexis Sellier 7266729924
Make Patch `state` field similar to Issue
Since they are similar objects, they should have similar structure.
This also makes it easier to add state metadata like for issues.
2023-03-13 13:55:12 +01:00
xphoniex 9f1896e07f 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 6e90444406 httpd: Basic alias support for git
Allows cloning via git using an alias instead of the full RID.

Eg. `git clone https://seed.radicle.xyz/heartwood.git`
2023-03-12 18:31:19 +01:00
Alexis Sellier aacacf872f
cob: Use `EntryId` as the operation identifier
By introducing a small limitation: only allowing entries in the change
graph to be addressable, instead of individual operations; we
drastically simplify the CRDT implementation.

There are four advantages:

1. Op ids are just regular SHA-1s
2. There's no need for relative IDs, ops never refer to other ops within the
   same commit
3. There's no need for a nonce, since commits can't collide, and neither can op IDs
4. `OpId` can just be an alias of `EntryId`

The disadvantage of course, is that we have to be mindful of how we
create op transactions, since each transaction creates an addressable
unit. For example, we must not include multiple patch revisions in the
same transaction.
2023-03-09 17:08:56 +01:00
xphoniex c7a955e9fe
httpd: Run tests off another remote for `test::seed`
Keep `test::contributor(..)` to test interactions with a contributor node.

Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-03-08 15:27:13 +01:00
xphoniex 900796956c
httpd: Remove `radicle_cli` from tests
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-03-07 15:08:11 +01:00
xphoniex 267b0ed312
httpd: Use `radicle-term` instead of `radicle-cli::terminal`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-03-07 14:49:18 +01:00
xphoniex 488468991c
httpd: Set a max allowed size of 4 MiB when serving files raw
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-03-07 09:37:02 +01:00
Alexis Sellier 9000a626d7
Use commit oid for COB parent
We were using the blob oid, which was causing the commit tree to
be invalid.
2023-03-06 15:39:34 +01:00
Alexis Sellier be5c9c9258
cli: Add `--verbose` flag to `init` 2023-03-06 15:38:42 +01:00
Alexis Sellier e69be6051d
cli: Give more control over `init` announcement
Instead of always announcing the inventory, by default we don't.
Users can run `rad push` to trigger an announcement.
2023-03-06 15:38:42 +01:00
Alexis Sellier 8c22012d61
Remove need to pass public key in cob store 2023-03-06 10:56:20 +01:00
Sebastian Martinez 05d2487a47
httpd: Add patch creation endpoint
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-06 10:26:38 +01:00
xphoniex 077c040c08
httpd: Change format of tracing messages
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-03-03 16:13:10 +01:00
Alexis Sellier 5f59493c70
cob: Don't require a local fork to exist
Before this change, the identity document would be loaded for the
COB signer. This meant that a fork would be needed for that signer.

After this change, it's no longer necessary, since the identity doc
head is computed from available remotes.

While making those changes, it was also apparent that some of the
identity-related functions had bad names and error types, this
was fixed as well.
2023-03-01 15:40:30 +01:00
Sebastian Martinez 796ae2f96a
httpd: Sort issues and patches by creation date
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-03-01 13:02:09 +01:00
Alexis Sellier 1bb6f9a921
httpd: Don't load project payload twice 2023-02-28 18:37:26 +01:00
xphoniex de24a04621
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
Alexis Sellier 06a92d52d9
cob: Use hashes for operation ids
It's fairly easy for a user to (by mistake or intentionally) create two
operations with the same OpId. This patch makes it much less likely,
and ensures that if the OpId is equal, it's because the operations
are identical.
2023-02-27 17:11:48 +01:00
Sebastian Martinez 97a2f8c1df
httpd: Add issue and patch counts
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-27 12:57:20 +01:00
xphoniex 34b15f9f16
httpd: Add `/raw` route
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-02-23 06:16:37 +00:00
xphoniex 2606372a14
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 6ca1c89610 httpd: Update `/git` test to use `test` helper fns
Update `axum` to 0.6.7 to be able to use fix in:
https://github.com/tokio-rs/axum/pull/1767

Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-02-22 17:06:32 +01:00
xphoniex f290f6b4a5 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 c1b6ceb141 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 be5afcc600 httpd: Move `git` router & handler into its own file
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-02-22 17:06:32 +01:00
Fintan Halpenny ef0628c48e
Exchange From for TryFrom for PathBuf and Home
The `From` implementation would allow someone to create a `Home` in an
incorrect fashion, for example the path is not canonical.

Exchange `From` for a `TryFrom` implementation.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-02-17 10:37:39 +01:00
Sebastian Martinez b04451a1bd
Use `Did` in a bunch more places
Instead of showing just public keys we need to show the fully qualified
spec for a NID which is prefixed by `did🔑` While we want to maintain
`Author` and `ActorId` for internal use.

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-16 18:01:42 +01:00
xphoniex a1e1e04fd9
httpd: Return correct count for `patches`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-02-16 16:51:02 +01:00
Alexis Sellier 950fae209d
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 867eea5c38
httpd: Add delegates to project routes
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-14 14:50:42 +01:00
Sebastian Martinez 881e9af219
httpd: Add `assignees` to `Issues::create`
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-13 13:47:15 +01:00
Alexis Sellier 27d0c8f235
cli: Track projects we initialize 2023-02-12 16:48:46 +01:00
xphoniex bdc0ab9881
Update `radicle-git` and `radicle-surf`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-02-10 22:14:50 +01:00
Sebastian Martinez a57b33c785
httpd: Add `api::test::patch` request method
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-10 12:17:03 +01:00
Sebastian Martinez 0087a4b50c
radicle-httpd: Add DELETE to allowed methods
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-09 16:48:48 +01:00
Alexis Sellier f01735bef6
cli: Have `init` trigger routing table updates
Before this change, nodes had to be restarted to announce newly
initialized projects.
2023-02-08 16:29:42 +01:00
Sebastian Martinez 1128842457
httpd: Add DELETE route to remove sessions
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-07 20:59:06 +01:00
Sebastian Martinez af3ea6a11a
httpd: Add issue endpoints
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-06 14:14:06 +01:00
Sebastian Martinez b4ddb31cf3
Extract `json!` into `api::json`
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-04 19:42:14 +01:00
Sebastian Martinez d9f878bc45
httpd: Remove session serialization, improve tests
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-04 19:39:25 +01:00
Sebastian Martinez 58eeb3ab91
httpd: Refactor auth and session handling
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-04 19:38:26 +01:00
Sebastian Martinez 3d0a68eeb5
httpd: Remove session serialize and rework
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-04 19:37:35 +01:00
Sebastian Martinez 34064ef8b5
Add `GET /api/v1/sessions/:id` route to get session information
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-02-04 19:35:58 +01:00
Fintan Halpenny 3f48c2c516
Rust 1.67
Rust 1.67 was announced[0]. Update the necessary files for running
1.67 and fix the clippy suggestions for string interpolation.

[0]: https://blog.rust-lang.org/2023/01/26/Rust-1.67.0.html

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-02-04 19:30:29 +01:00
xphoniex c1ba45fcd8
httpd: Extract `issue` json response
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-02-04 13:46:26 +00:00
xphoniex 4552c1f296
httpd: Add routes for patch ops
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-02-04 13:22:09 +00:00
Alexis Sellier f1a6a86689
node: Check refs when getting local inventory
If we don't do this, we're going to be returning broken repos.
2023-01-30 11:38:00 +01:00
xphoniex a5811e43a7
Update `radicle-surf`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-01-28 20:19:23 +01:00
Sebastian Martinez f07a875ce1
Add web-based authentication
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
2023-01-27 17:23:05 +01:00
Alexis Sellier 0a9bb23e4e
Replace `RAD_DEBUG` with `RAD_SEED`
The latter is strictly more powerful.
2023-01-25 17:09:16 +01:00
xphoniex a3f4c2ec67
httpd: Remove `lastCommit` in `/tree` for entries
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-01-25 15:35:24 +01:00
xphoniex 59ff46e49c
httpd: Clean up `json.rs`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-01-25 15:35:24 +01:00
xphoniex ccbcdd4998
httpd: Change `sha1` into `id`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-01-25 15:35:24 +01:00
xphoniex 57fbc1ed46
httpd: Use `commits`/`commit` instead of `headers`/`header`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-01-25 15:35:24 +01:00
xphoniex f065bce876
httpd: change `committerTime` into `committer.time`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-01-25 15:35:24 +01:00
xphoniex 7ec903d712
httpd: Update axum from 0.5.x to 0.6.x
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-01-18 14:09:48 +00:00
Han Xu 4ea67250ea
httpd: Dogfood the new radicle-surf API
Signed-off-by: Han Xu <keepsimple@gmail.com>
2023-01-18 14:22:01 +01:00
Alexis Sellier be9def8b11
Rename `profile::Paths` to `profile::Home`
This makes the intent clearer.

Signed-off-by: Alexis Sellier <self@cloudhead.io>
2023-01-17 11:01:36 +01:00
Alexis Sellier d31968509d
Speed up node E2E tests
By allowing the node to run using a `MockSigner`, we speed up tests
significantly, since PBKDF2 doesn't need to run.

Signed-off-by: Alexis Sellier <self@cloudhead.io>
2023-01-17 11:01:36 +01:00
xphoniex 7962ac0a8e
httpd: Add api tests
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2023-01-12 20:30:53 +01:00
Alexis Sellier 911c194fb3
cob: Create proper `OpId` type
To still access a comment's author, we add a new `author` field.
2022-12-31 09:58:51 +01:00
xphoniex bd1b4ac5c1
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
xphoniex 1f55d7a327
Update `radicle-git` to `79a94721366490053e2d8ac1c1afa14fb0c25f09`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-12-23 13:22:55 +01:00
Alexis Sellier e47d7ca2aa
cob: Implement comment edit action
This implementation intentionally preserves all edits such that
they may be displayed in an application as an edit history.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-16 12:32:20 +01:00
Adam Szkoda ac3ee5f709
Build container images for deployment
Signed-off-by: Adam Szkoda <adaszko@gmail.com>
2022-12-14 17:15:40 +01:00
Adam Szkoda 9186d1f30f
Do not install OpenSSL as it's statically linked 2022-12-14 17:15:40 +01:00
Adam Szkoda 294ae8fd24
Put fully static binaries into containers 2022-12-14 17:15:40 +01:00
Adam Szkoda 4abb24feca
Dockerize services
Signed-off-by: Adam Szkoda <adaszko@gmail.com>
2022-12-14 17:15:40 +01:00
Alexis Sellier 98c1566109
Make `Doc` type payload generic 2022-12-09 22:05:38 +01:00
xphoniex 46951b1b42
httpd: Use `HashSet` instead of `BTreeSet`
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-12-09 10:49:28 +01:00
xphoniex fb8020e582
httpd: Conform response from issue handlers to previous model
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-12-09 10:49:09 +01:00
Alexis Sellier 5d2be57cd9
Rename patch/issue "status"
This reverts to the previous naming, since after serialization
we would otherwise end up with `{ status: { status: closed } }`.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-09 10:44:59 +01:00
Alexis Sellier 207d2133f9
Remove delegate names from identity doc
We are working on other mechanisms to help identify keys, and this
is just redundant.

Also update some of the CLI examples to create a canonical example
for documentation.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-07 12:16:00 +01:00
Alexis Sellier 09a8b46f34
cob: Move clock out of `Issue`
The clock shouldn't be part of the issue state, but rather
the local "actor" state.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-12-01 12:05:44 +01:00
xphoniex 1b00e8a413
httpd: implement `IntoResponse` for api error variants
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-11-30 13:06:03 +00:00
xphoniex b96f357c2e
Migrate `/v1/stats` route
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-11-30 13:06:03 +00:00
xphoniex e5e8a403fc
Migrate `/projects`: `issues`, `issue` handlers
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-11-30 13:06:03 +00:00
xphoniex b4902d3408
Migrate `/projects`: `remotes`, `remote`, `blob`, `readme` handlers
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-11-30 13:06:03 +00:00
xphoniex 84c3cf4cf1
Migrate `/projects`: `history` and `tree` handlers
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-11-30 13:06:03 +00:00
xphoniex dea7082a6f
Migrate `/projects`: `root`, `project`, `commit`, `activity` handlers
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-11-30 13:06:03 +00:00
xphoniex 77e0a176bd
Migrate `/v1/delegates` route
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-11-30 13:06:03 +00:00
xphoniex 6f8511c360
Migrate `/v1/sessions` route
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-11-30 13:06:03 +00:00
xphoniex acd7aeb9c9
Migrate `/v1/`, `/v1/node` routes to heartwood
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-11-30 13:06:03 +00:00
Alexis Sellier 617e0c1877
Remove redundant `Options` type
Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-19 11:47:29 +02:00
Alexis Sellier 2f6cf9c7a5
httpd: implement `git` fetch-only server
Introduces a new `radicle-httpd` crate which will serve as the basis
for heartwood's HTTP backend.

The first part of this is a git server which allows projects to be
fetched from storage using plain `git`.

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
2022-10-19 11:36:16 +02:00