Commit Graph

206 Commits

Author SHA1 Message Date
cloudhead ca7db1620c
node: Improve Tor configuration flexibility
*Breaking change* The `tor` configuration field is no longer
supported. Users must remove that field from their config.

Allows for a mixed mode, where regular addresses bypass the Tor proxy,
while onion addresses go through it.

When `onion.mode` is set to "forward", Tor connections are fowarded to
the global proxy, and if it isn't set, to the OS's DNS resolution.

For mixed mode, a global proxy simply isn't set, so that IP/DNS is not
proxied.
2024-05-16 14:53:52 +02:00
Sebastian Martinez 5727359319
httpd: Validate blob sizes 2024-05-15 13:03:28 +02:00
Rūdolfs Ošiņš 3b342ab385
httpd: Set cache header for immutable blob endpoint
It is safe to do so because it is content-addressed.
2024-05-15 12:28:30 +02:00
cloudhead 21cced05c1
node: Allow for "WAL" mode in sqlite
This solves concurrency issues between the node and http daemon.
2024-05-14 16:34:30 +02:00
cloudhead a54180199e
node: Further increase the rate-limit defaults
The rate-limitter gets hit on connect, due to historical gossip messages
being exchanged. This results in a high initial burst that needs to be
accounted for.
2024-05-02 13:43:09 +02:00
Sebastian Martinez 5ffbf7545f
httpd: Add apiVersion to root handler and node information
This will help consumers of the httpd to check if they are on the right
version of the API
2024-05-02 13:09:00 +02:00
Sebastian Martinez d04d9d7d1f
httpd: Add threshold to project info 2024-05-02 14:43:12 +02:00
Sebastian Martinez c4d4ad7008
httpd: Add alias to project delegates 2024-05-02 14:43:12 +02:00
Sebastian Martinez 854fc9af8e
httpd: Decouple repo stats from tree endpoint 2024-05-02 14:41:27 +02:00
cloudhead a9b94b0ad6
node: New relay configuration for nodes
Relay now has three values: "always", "never" and "auto".

The first two operate like the previous `true`/`false`. The
new (default) value turns relaying on for nodes with public (external)
addresses and off for nodes without. This should reduce redundant traffic on
the network, that was causing the rate limiters to trigger.
2024-05-02 11:45:29 +02:00
cloudhead abf89438ea
node: Increase default rate-limiter config
With the increase in traffic on the network after launch, the old
defaults don't make sense anymore.

Longer term, we should look into throttling outgoing messages as well,
prioritizing original messages over relayed messages.
2024-05-01 11:06:28 +02:00
cloudhead b31fbde159
node: Add `log` to node config 2024-04-29 15:59:17 +02:00
cloudhead deeb39c558
node: Support "transparent" Tor
This allows for configuring your node such that `.onion` addresses
encountered are treated as regular DNS names.
2024-04-26 10:37:41 +02:00
Sebastian Martinez 7fc3b73e88
Update radicle-surf to 0.21 2024-04-24 11:51:25 +02:00
Sebastian Martinez 574ac3566b
httpd: Remove diff and branches from history route 2024-04-10 11:44:00 +02:00
cloudhead 6be77ca9c3
radicle: Implement `remote_refs_at`
Implement this function on `RemoteRepository`, and move `repositories`
to the trait level.

This function will be used to quickly get the `RefsAt` of all repository
remotes.
2024-04-05 21:59:28 +02:00
cloudhead 991505ec9d
radicle: Switch error type for repository methods
This simplifies error handling for the next commit.
2024-04-03 14:25:02 +02:00
cloudhead 9cdf0aa1fd
Update radicle crates to 0.9.0 2024-03-26 11:56:27 +01:00
cloudhead 77076af23c
radicle: Add new `ash.radicle.garden` seed node
Add the new `ash` node as a preferred seed, to load balance.
2024-03-26 10:36:31 +01:00
Sebastian Martinez 3aca2a11b0
httpd: Only return cache header on success 2024-03-21 12:45:13 +01:00
cloudhead 04a4aa06c9
httpd: Fix broken test 2024-03-21 12:43:35 +01:00
cloudhead 74abd789c7
httpd: Fix private repo visibility
Make private repos invisible on all routes, including /raw endpoints
and Git clones.
2024-03-17 21:13:25 +01:00
Sebastian Martinez 98bb91680d
httpd: Update stats to count all repos
Instead of filtering private repos for a total count, we should count
all repos.
2024-03-11 12:38:00 +01:00
Sebastian Martinez 955c942c18
httpd: Improve alias use in tests 2024-03-11 12:31:28 +01:00
Sebastian Martinez 088549a333
httpd: Add support for submodules 2024-03-11 12:27:27 +01:00
cloudhead 3d7ae89a83
httpd: Fix tests 2024-03-11 12:24:30 +01:00
Sebastian Martinez 325289d28f
httpd: Insert test node into node db in `test::profile` fn
To allow the `AliasStore` to retrieve an alias from the node db, we need
to insert it manually into the database in the `profile` function, else
we won't find any Aliases there.
2024-03-11 11:52:46 +01:00
Thomas Scholtes e52ce483a1
httpd: Mark immutable response as such with Cache-Control header
For responses to requests for content that is content-addressed with Git
object IDs and consequently immutable, we add a Cache-Control HTTP
header that marks the responses as public, immutable and instructs
clients to cache the response for up to 7 days.
2024-03-08 23:31:43 +01:00
Alexis Sellier 786ce40f95
node: Add connection limits
The limits are roughly modeled after the Bitcoin network.
2024-03-08 23:24:34 +01:00
Sebastian Martinez 5bdc2ad1fb
httpd: Add author alias to reactions 2024-03-08 23:20:38 +01:00
Sebastian Martinez 501b6ba9eb
httpd: Add author information to assignees 2024-03-08 23:15:34 +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 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
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
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 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
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
Sebastian Martinez db6cb55d6c
httpd: Add review ids to review json 2024-02-01 17:25:18 +01:00
Sebastian Martinez 5333f8217a
httpd: Add reactions to revisions, improve json for comment reactions
Instead of using tuples and lots of arrays, this commit tries to use
`BTreeMap`s to provide more context to review, issues, patch and other
comments.

Also the returned object by the httpd is more aligned with what is
needed by the consumer, so less recomputation is needed for display.
2024-01-31 12:14:05 +01:00
cloudhead 131103cb53
Fix code around default policies
Make the code a little clearer and ensure that we are always calling the
`Config` and not the `Store`, so that we fallback on the default policy.
2024-01-25 21:11:08 +01:00
cloudhead 7a5e5ec865
httpd: Don't show unseeded repos 2024-01-25 16:31:28 +01:00
Fintan Halpenny 49584f4e73
radicle: pinned repositories configuration
Introduce pinned repositories to the `profile::Config`, i.e.
`config.json`.

This is used for pinning repositories in the httpd `/projects` handle.

To allow returning all repositories, an `all` query parameter is also
included.

This is non-backwards compatible change, since we introduce the `show`
query parameter which, if not supplied, will default to `pinned`.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-01-24 10:55:27 +01:00
cloudhead a46bcb2247
cob: Distinguish between commit parents
Previously, COB change commits would not distinguish between their
parents. This means that they would try to load source code commits
(eg. for patch COBs) and then fail since those commits wouldn't have a
manifest or `Rad-Resource`.

We introduce a backwards compatible change here which is that parent
oids that are not COB commits are accompanied by a commit trailer called
`Rad-Related`. This is for all related content that should be pulled in
but is not part of the change graph proper.

When building the change graph, we simply ignore commits that are marked
as "related".
2024-01-22 21:20:01 +01:00
cloudhead f87dfba9cd
Rename `Id` to `RepoId`
Rename the type to make it clearer and consistent with `NodeId`.
2024-01-22 15:51:44 +01:00
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
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