Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
node: Make node aliases required
Alexis Sellier committed 2 years ago
commit 2496a1d93d88a921c5c210fcd38c2d80ff9da66c
parent 5103d9cedda4eae3b72fbfe987fee0e66642fc29
2 files changed +9 -4
modified radicle-httpd/src/api/json.rs
@@ -14,7 +14,7 @@ use radicle::cob::thread;
use radicle::cob::thread::CommentId;
use radicle::cob::{ActorId, Author, Reaction, Timestamp};
use radicle::git::RefString;
-
use radicle::node::AliasStore;
+
use radicle::node::{Alias, AliasStore};
use radicle::prelude::NodeId;
use radicle::storage::{git, refs, ReadRepository};
use radicle_surf::blob::Blob;
@@ -146,7 +146,7 @@ pub(crate) fn patch(
}

/// Returns JSON for an `author` and fills in `alias` when present.
-
fn author(author: &Author, alias: Option<String>) -> Value {
+
fn author(author: &Author, alias: Option<Alias>) -> Value {
    match alias {
        Some(alias) => json!({
            "id": author.id,
@@ -157,7 +157,7 @@ fn author(author: &Author, alias: Option<String>) -> Value {
}

/// Returns JSON for a patch `Merge` and fills in `alias` when present.
-
fn merge(merge: &Merge, nid: &NodeId, alias: Option<String>) -> Value {
+
fn merge(merge: &Merge, nid: &NodeId, alias: Option<Alias>) -> Value {
    match alias {
        Some(alias) => json!({
            "author": {
@@ -180,7 +180,7 @@ fn merge(merge: &Merge, nid: &NodeId, alias: Option<String>) -> Value {
}

/// Returns JSON for a patch `Review` and fills in `alias` when present.
-
fn review(nid: &NodeId, alias: Option<String>, review: &Review) -> Value {
+
fn review(nid: &NodeId, alias: Option<Alias>, review: &Review) -> Value {
    match alias {
        Some(alias) => json!({
            "author": {
modified radicle-httpd/src/test.rs
@@ -16,9 +16,11 @@ use radicle::crypto::ssh::keystore::MemorySigner;
use radicle::crypto::ssh::Keystore;
use radicle::crypto::{KeyPair, Seed, Signer};
use radicle::git::{raw as git2, RefString};
+
use radicle::node;
use radicle::node::address as AddressStore;
use radicle::node::routing as RoutingStore;
use radicle::node::tracking::store as TrackingStore;
+
use radicle::profile;
use radicle::profile::Home;
use radicle::storage::ReadStorage;
use radicle::Storage;
@@ -63,6 +65,9 @@ pub fn profile(home: &Path, seed: [u8; 32]) -> radicle::Profile {
        storage,
        keystore,
        public_key: keypair.pk.into(),
+
        config: profile::Config {
+
            node: node::Config::new(node::Alias::new("seed")),
+
        },
    }
}