Commit Graph

1713 Commits

Author SHA1 Message Date
Sebastian Martinez 501b6ba9eb
httpd: Add author information to assignees 2024-03-08 23:15:34 +01:00
cloudhead a48081f271
cli: Move node addresses command
To make things a little more consistent, move the `rad self --address`
command to `rad node config --addresses`, since it's more about
externally-facing configuration of the node, rather than your local user
or profile.
2024-02-26 14:23:13 +01:00
cloudhead 091f7b7e98
node: Don't limit LAN addresses
These are defacto trusted.
2024-02-26 13:42:06 +01:00
cloudhead 9c96b46c59
cli: Show full path in `rad init`
Instead of showing a '.'
2024-02-26 12:40:17 +01:00
cloudhead 9c9bbbe7bb
node: Expose listen addresses 2024-02-26 12:35:20 +01:00
cloudhead d86d99e002
cli: Fix `rad config` bugs
The command was unable to deal with an invalid config. We fix this by
introducing a way to load the user's home without loading the config.
2024-02-26 12:10:34 +01:00
cloudhead b0fbbeed6b
node: Upgrade dependencies
Fixes issue with improperly closed connections.
2024-02-26 11:47:03 +01:00
cloudhead d16ae3edc9
scripts: Add COB caching script 2024-02-23 18:35:50 +01:00
cloudhead 09f2befa58
radicle: Authorize certain changes if no-op
For backwards compatibility, if a change is a no-op, we allow it even if
it's normall not authorized.
2024-02-23 18:29:07 +01:00
cloudhead 0726754b0e
cli: Add `--repo` option to `issue` and `patch`
Allows users to operate on a repo without a checkout.
2024-02-23 18:16:52 +01:00
cloudhead 449790e252
radicle: Fix indentation of SQL file 2024-02-23 17:57:32 +01:00
Fintan Halpenny 9e745b68d1
cli: add caching commands for patch and issue
In order to bootstrap the COB cache, and also in case of issues,
supply a command for caching a set of patches/issues, or a single
patch/issue.

This is necessary since reads are not read-thru, it may appear that
COBs are missing when in fact they haven't been cached when first
moving over to the cache.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-02-23 16:03:26 +01:00
Fintan Halpenny 985b0af3f6
radicle: implement caching for issues and patches
Implement caching for the `Issue` and `Patch` COB. This is achieved by
having the `Transaction::initial` and `Transaction::commit` methods
take a cache which can update the newly created/updated object. The
`Store::remove` method also takes the cache for removing the object
from the cache, as well as the repository.

This meant that the `*Mut` types for the respective COBs are required
to carry a cache alongside the repository store. Identities will not
be cached, and so this is always set to `NoCache` -- which performs no
caching, and always succeeds.

To perform cache reading for issues and patches, the `cache::Issues`
and `cache::Patches` traits are introduced. They capture the minimal
amount of methods that are needed for the `rad issue` and `rad patch`
CLI commands.

The implementor for each of these traits is there respective `Cache`
types, which combines their backing repository store and the SQLite
database. They both provide convenience methods:
- `create` (and `draft` for patches)
- `get_mut`
- `remove`
which can be used instead of their repository store counterparts.

All uses of the repository stores (where needed) are replaced with
`Cache` types.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-02-23 16:03:21 +01:00
Fintan Halpenny b26842d4d8
radicle: add cob::cache module
Add the cob::cache module which describes an SQLite store and schema
for caching COBs. It also provides in-memory and no-cache types for
testing purposes.

The intention is for the store to be used alongside the existing COB
types so that a write-thru cache can be implemented and used for
efficient reads.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-02-23 13:56:19 +01:00
Fintan Halpenny f7ef9cc8b3
radicle: serialization and deserialization improvements
Add derivations of `Serialize` and `Deserialize` for the `Issue` and
`Thread` cob types.

It's necessary to circumvent `Infallible` for the case of the
`Comment` type. This is because `Infallible` does not have these
traits implemented, and there does not seem to be a plan to do so.
Instead, we can use a custom `Infallible` equivalent, which is dubbed
`Never` here.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-02-23 13:56:19 +01:00
Fintan Halpenny 8239a1d0ac
radicle: add cob storage for MockRepository
Ensure that MockRepository can be used where the COB storage traits
are required. Currently, the implementations of the methods themselves
are not required -- they are left as `todo!()`.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-02-23 13:56:19 +01:00
Fintan Halpenny a1b41542b8
radicle: rename resolved to is_resolved
The standard in the codebase for boolean methods is to prefix them
with `is_`.

Change `resolved` to `is_resolved`.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-02-23 13:56:19 +01:00
Fintan Halpenny 25ff5876ec
radicle: introduce cob::TypedId
The combination of a COB's `TypeName` and `ObjectId` is useful for
parsing a Radicle COB refname, i.e. `refs/cobs/<typename>/<object
id>`.

Introduce `TypedId` for this and provide helper functions for parsing
from the git refname types, as well as being able to tell what kind of
COB it is.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-02-23 13:56:19 +01:00
Fintan Halpenny 8728d02c70
cob: move unwrap_used pragma
Clippy does not recognise this `allow` pragma to be used at the
`unwrap` call site. Instead, if it's moved up to the match case it
will be recognised.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-02-23 13:56:19 +01:00
cloudhead 17744a03fd
cob: Properly authorize root actions
Previously, authorization was only checked for ops after the root op.
We also avoid creating empty actions for `assign` and `label`, which
was needed for non-authorized users to be able to create issues/patches.
2024-02-23 12:31:13 +01:00
cloudhead c63aaaceac
cli: Fix `id` COB notifications in `rad inbox` 2024-02-23 11:35:54 +01:00
cloudhead eff40166c9
cli: Add `rad unseed` command
This replaces the `-d` flag of `rad seed`, making it more like `rad
unfollow`.
2024-02-22 16:02:40 +01:00
cloudhead 6b4f055c36
cli: Don't allow missing config file
It's best to just error if the user is missing the config file, since we
create it on profile init. This also gets rid of the privacy leak.
2024-02-22 16:02:40 +01:00
cloudhead 0d18a8fd9e
cli: Better error message in `rad id` 2024-02-22 16:02:40 +01:00
cloudhead e06dd208f4
cli: `rad seed` output improvement
Better colors, and re-order fields to have policy before scope.
2024-02-22 16:02:38 +01:00
Michael Raitza 0908c65f50 httpd: Filter-out private-but-pinned repos
They should only be visible to localhost.
2024-02-16 15:27:08 +01:00
cloudhead 9767b485c2
cli: Improve `rad inbox` output
* Add change authors
* Add object status
* Add colors
2024-02-12 14:03:14 +01:00
cloudhead b477864b83
cli: Stabilize sort order of inbox repos
Sort repositories before displaying them.
2024-02-12 12:01:54 +01:00
cloudhead 9576a6496b
node: Various small fixes 2024-02-12 11:37:31 +01:00
cloudhead 4307bdaae4
sim: Change a few things in the simulator
1. Simplify latency calculation to be more predictable, otherwise,
   setting a latency is not super useful.
2. Turn a hard error into a log. It's not worth fixing it now though, as
   it isn't a problem for the tests.
2024-02-12 11:37:31 +01:00
cloudhead d1f4161ee9
sim: Track messages received in simulator
This is going to be useful for testing message amplification in the
network protocol.

We also reset the state of a few things everytime the simulator is run.
2024-02-12 11:37:31 +01:00
cloudhead 286c639e26
node: Make sure node is "active" when connected
This ensures `last_active` is never `0` for connected peers.
2024-02-12 11:37:31 +01:00
cloudhead d6d90c6fdc
node: Track peer latency
This is useful for a bunch of different network optimizations we're
going to be working on.
2024-02-12 11:36:35 +01:00
cloudhead 664cf20c92
Change default seeding scope to 'all'
This makes the default policy `block` with scope `all`. The good thing
about this is that you don't have to manage individual nodes in the
beginning. You simply seed the repos you want, and everything is
followed within those repos. This matches user expectations, as `rad
seed` does what you expect it to do.

For open-policy seed nodes, it also means that simply changing `block`
to `allow` from the default config is all you need.

This leaves the non-default `followed` scope as a more "advanced"
setting, since it is much more cumbersome: it forces you to follow a
user before you can see their issues/patches, which is not something
most users expect coming from old-shcool forges.
2024-02-12 10:56:21 +01:00
cloudhead 292ff01923
systemd: Update for system install
While these unit files were good for a user install, they were not
appropriate for running *system* services. Since most users nowadays
use `rad node` to manage their node, it makes more sense for the unit
files to be oriented towards server use.
2024-02-08 12:34:26 +01:00
cloudhead 137961c1f7
cli: Add `rad config get`
Gets a specific config value.
2024-02-07 17:12:45 +01:00
cloudhead e5fcbba4c0
cli: Implement `rad block` command
Blocks repos & nodes from beeing seeded/followed.
2024-02-07 15:51:05 +01:00
cloudhead d37c52aade
cli: Allow `rad inspect` without repo existing
To check the seeding policy of a repo without it being in storage.
2024-02-07 15:51:00 +01:00
cloudhead 565e3b889c
cli: Fix output of `rad seed` when empty 2024-02-07 15:45:50 +01:00
cloudhead f46d396e12
clippy: Fix lint 2024-02-07 14:56:26 +01:00
cloudhead d901b911c6
node: Drop self-connections
Also try to avoid initiating a self-connection even if the NID of our
node has changed.
2024-02-07 14:30:42 +01:00
cloudhead 1130608331
cli: Document `rad init --no-seed` 2024-02-07 13:57:08 +01:00
cloudhead fe55de181d
cli: Add new `rad inbox` command
Shows you updates on local repositories.

Included here is a basic implementation of a notification system. A new
database is created and updated after every fetch, with refs that have
changed.

The `rad inbox` command can then list items in the database and delete
them.
2024-02-06 11:40:58 +01:00
cloudhead 98c94de5e3
Various small improvements across crates
Most of these changes should be self-explanatory.

* Atomic fetch was no longer used
* The default policy when initializing should be 'all', as it is with
  `rad init`.
2024-02-06 10:37:44 +01:00
cloudhead bb06663d1c
cli: Organize patch functions better
Move patch showing and timeline to a shared library so we can use it for
`rad inbox`.
2024-02-06 10:36:22 +01:00
cloudhead 8928c5ee26
cli: Fix node file rotation with `rad node start`
This was causing issues (error 22) on macOS and some Linux systems.
2024-02-05 16:26:55 +01:00
Lars Wirzenius 5abd7bf55a
cli: fix formatting of warning of unconnected node
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-02-05 12:53:36 +01:00
cloudhead e12bff0871
cli: Update and remove some dependencies 2024-02-02 09:57:45 +01:00
Sebastian Martinez e799a7ccba
httpd: Add `--path` param to `rad-web`
This passes a `path` variable to the `auth_url` so consumers can open
desired pages directly.
Also checks the cwd to start rad web with a path corresponding to it.
2024-02-01 17:33:21 +01:00
Sebastian Martinez 29cb5c085d
httpd: Add `/nodes/:nid` and `/nodes/:nid/inventory` endpoints to get info on other nodes 2024-02-01 17:29:10 +01:00