Radish alpha
r
rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5
Radicle web interface
Radicle
Git
http: release radicle-httpd v0.11.0
Open did:key:z6MkkfM3...sVz5 opened 1 year ago
19 files changed +109 -33 abcf8f34 473f893b
modified .github/workflows/check-build.yml
@@ -10,6 +10,12 @@ jobs:
      - uses: actions/setup-node@v4
        with:
          node-version: "20.9.0"
+
      - uses: dtolnay/rust-toolchain@stable
+
      - uses: Swatinem/rust-cache@v2
+
        with:
+
          workspaces: radicle-httpd -> target
+
      - name: Build
+
        run: cargo build --all --release --manifest-path=./radicle-httpd/Cargo.toml
      - name: Install dependencies
        run: npm ci
      - name: Install Playwright Browsers
modified .github/workflows/check-e2e.yml
@@ -11,6 +11,12 @@ jobs:
    steps:
      - uses: actions/checkout@v4

+
      - uses: dtolnay/rust-toolchain@stable
+
      - uses: Swatinem/rust-cache@v2
+
        with:
+
          workspaces: radicle-httpd -> target
+
      - name: Build
+
        run: cargo build --all --release --manifest-path=./radicle-httpd/Cargo.toml
      - uses: actions/setup-node@v4
        with:
          node-version: "20.9.0"
modified .github/workflows/check-visual.yml
@@ -26,6 +26,12 @@ jobs:
      - uses: actions/setup-node@v4
        with:
          node-version: "20.9.0"
+
      - uses: dtolnay/rust-toolchain@stable
+
      - uses: Swatinem/rust-cache@v2
+
        with:
+
          workspaces: radicle-httpd -> target
+
      - name: Build
+
        run: cargo build --all --release --manifest-path=./radicle-httpd/Cargo.toml

      - name: Install dependencies
        run: npm ci
modified config/default.json
@@ -1,7 +1,7 @@
{
  "nodes": {
    "fallbackPublicExplorer": "https://app.radicle.xyz/nodes/$host/$rid$path",
-
    "apiVersion": "0.1.0",
+
    "apiVersion": "1.0.0",
    "defaultHttpdPort": 443,
    "defaultLocalHttpdPort": 8080,
    "defaultHttpdHostname": "seed.radicle.garden",
modified http-client/lib/shared.ts
@@ -17,11 +17,26 @@ export const nodeConfigSchema = object({
  alias: string(),
  peers: union([
    object({ type: literal("static") }),
-
    object({ type: literal("dynamic"), target: number() }),
+
    object({ type: literal("dynamic") }),
  ]),
  listen: array(string()),
  connect: array(string()),
  externalAddresses: array(string()),
+
  proxy: string().optional(),
+
  onion: union([
+
    object({
+
      mode: literal("proxy"),
+
      address: string(),
+
    }),
+
    object({ mode: literal("forward") }),
+
  ]).optional(),
+
  log: union([
+
    literal("ERROR"),
+
    literal("WARN"),
+
    literal("INFO"),
+
    literal("DEBUG"),
+
    literal("TRACE"),
+
  ]),
  network: union([literal("main"), literal("test")]),
  relay: union([literal("always"), literal("never"), literal("auto")]),
  limits: object({
@@ -40,9 +55,16 @@ export const nodeConfigSchema = object({
        capacity: number(),
      }),
    }),
+
    connection: object({
+
      inbound: number(),
+
      outbound: number(),
+
    }),
+
  }),
+
  workers: number(),
+
  seedingPolicy: object({
+
    default: policySchema,
+
    scope: scopeSchema.optional(),
  }),
-
  policy: policySchema,
-
  scope: scopeSchema,
});

export type Policy = z.infer<typeof policySchema>;
modified radicle-httpd/Cargo.lock
@@ -1854,7 +1854,7 @@ dependencies = [

[[package]]
name = "radicle-httpd"
-
version = "0.10.0"
+
version = "0.11.0"
dependencies = [
 "anyhow",
 "axum",
modified radicle-httpd/Cargo.toml
@@ -3,7 +3,7 @@ name = "radicle-httpd"
description = "Radicle HTTP daemon"
homepage = "https://radicle.xyz"
license = "MIT OR Apache-2.0"
-
version = "0.10.0"
+
version = "0.11.0"
authors = ["cloudhead <cloudhead@radicle.xyz>"]
edition = "2021"
default-run = "radicle-httpd"
modified radicle-httpd/src/api.rs
@@ -36,7 +36,7 @@ use crate::Options;

pub const RADICLE_VERSION: &str = env!("RADICLE_VERSION");
// This version has to be updated on every breaking change to the radicle-httpd API.
-
pub const API_VERSION: &str = "0.1.0";
+
pub const API_VERSION: &str = "1.0.0";

/// Identifier for sessions
type SessionId = String;
modified scripts/install-binaries
@@ -33,22 +33,28 @@ while [ $# -ne 0 ]; do
done

if test -d "$BINARY_PATH"; then
-
  echo ✅ "Folder $BINARY_PATH exists already skipping download."
+
  echo ✅ "Folder $BINARY_PATH exists already skipping download and build."
else
  mkdir -p "$BINARY_PATH"
  case "$OS" in
  Darwin)
-
    echo Downloading "$RELEASE" from "https://files.radicle.xyz/releases/$RELEASE/radicle-aarch64-apple-darwin.tar.xz"
+
    echo Downloading "$RELEASE" from "https://files.radicle.xyz/releases/$RELEASE/radicle-aarch64-apple-darwin.tar.xz into /tests/tmp/bin/$RELEASE"
    curl --fail -s "https://files.radicle.xyz/releases/$RELEASE/radicle-aarch64-apple-darwin.tar.xz" | tar -xJ --strip-components=2 -C "$BINARY_PATH" "radicle-$RELEASE-aarch64-apple-darwin/bin/" || (echo "Download failed" && exit 1)
    ;;
  Linux)
-
    echo Downloading "$RELEASE" from "https://files.radicle.xyz/releases/$RELEASE/radicle-x86_64-unknown-linux-musl.tar.xz"
+
    echo Downloading "$RELEASE" from "https://files.radicle.xyz/releases/$RELEASE/radicle-x86_64-unknown-linux-musl.tar.xz into /tests/tmp/bin/$RELEASE"
    curl --fail -s "https://files.radicle.xyz/releases/$RELEASE/radicle-x86_64-unknown-linux-musl.tar.xz" | tar -xJ --strip-components=2 -C "$BINARY_PATH" "radicle-$RELEASE-x86_64-unknown-linux-musl/bin/" || (echo "Download failed" && exit 1)
    ;;
  *)
    echo "There are no precompiled binaries for your OS: $OS, compile $RELEASE manually and make sure it's in PATH." && exit 1
    ;;
  esac
+

+
  echo Building radicle-httpd and rad-web
+
  CARGO_TERM_PROGRESS_WIDTH=80 CARGO_TERM_PROGRESS_WHEN=always cargo build --release --all --quiet --manifest-path=$REPO_ROOT/radicle-httpd/Cargo.toml
+
  echo Copying radicle-httpd and rad-web into /tests/tmp/bin/$RELEASE
+
  cp $REPO_ROOT/radicle-httpd/target/release/radicle-httpd $BINARY_PATH
+
  cp $REPO_ROOT/radicle-httpd/target/release/rad-web $BINARY_PATH
fi

echo
modified src/components/ScopePolicyExplainer.svelte
@@ -3,7 +3,7 @@

  import { capitalize } from "lodash";

-
  export let scope: Scope;
+
  export let scope: Scope | undefined = "all";
  export let policy: Policy;
</script>

modified src/lib/httpd.ts
@@ -83,7 +83,12 @@ export async function authenticate(params: {
          publicKey: params.publicKey,
          alias: sess.alias,
        },
-
        node: { id, state, policy: config?.policy, scope: config?.scope },
+
        node: {
+
          id,
+
          state,
+
          policy: config?.seedingPolicy.default,
+
          scope: config?.seedingPolicy.scope,
+
        },
      });
      return true;
    } catch (error) {
@@ -111,8 +116,8 @@ export async function disconnect() {
          node: {
            id,
            state,
-
            policy: config?.policy,
-
            scope: config?.scope,
+
            policy: config?.seedingPolicy.default,
+
            scope: config?.seedingPolicy.scope,
          },
        });
      } catch (error) {
@@ -150,8 +155,8 @@ async function checkState() {
        const node = {
          id,
          state,
-
          policy: config?.policy,
-
          scope: config?.scope,
+
          policy: config?.seedingPolicy.default,
+
          scope: config?.seedingPolicy.scope,
        };

        if (httpdState && httpdState.state === "authenticated") {
modified src/views/nodes/router.ts
@@ -56,8 +56,8 @@ export async function loadNodeRoute(
        stats,
        externalAddresses: node.config?.externalAddresses ?? [],
        version: node.version,
-
        policy: node.config?.policy,
-
        scope: node.config?.scope,
+
        policy: node.config?.seedingPolicy.default,
+
        scope: node.config?.seedingPolicy.scope,
      },
    };
  } catch (error) {
modified src/views/projects/Sidebar/ContextRepo.svelte
@@ -18,7 +18,8 @@
  let expandedNode = false;

  $: shortSeedingPolicy =
-
    node.config?.scope === "all" && node.config?.policy === "allow"
+
    node.config?.seedingPolicy.scope === "all" &&
+
    node.config?.seedingPolicy.default === "allow"
      ? "permissive"
      : "restrictive";
</script>
@@ -113,11 +114,11 @@
        {capitalize(shortSeedingPolicy)}
      </div>
    </div>
-
    {#if expandedNode && node.config}
+
    {#if expandedNode && node.config?.seedingPolicy}
      <div style:padding-left="2.3rem">
        <ScopePolicyExplainer
-
          scope={node.config.scope}
-
          policy={node.config.policy} />
+
          scope={node.config.seedingPolicy.scope}
+
          policy={node.config.seedingPolicy.default} />
      </div>
    {/if}
  </div>
modified tests/e2e/landingPage.spec.ts
@@ -100,7 +100,6 @@ const nodeInfo = {
    listen: [],
    peers: {
      type: "dynamic",
-
      target: 0,
    },
    connect: [],
    externalAddresses: ["seed.rhizoma.dev:8776"],
@@ -132,8 +131,9 @@ const nodeInfo = {
      },
    },
    workers: 32,
-
    policy: "block",
-
    scope: "all",
+
    seedingPolicy: {
+
      default: "block",
+
    },
  },
  state: "running",
};
modified tests/e2e/node.spec.ts
@@ -6,8 +6,7 @@ test("node metadata", async ({ page, peerManager }) => {
    name: "node-metadata-peer",
  });
  await peer.startNode({
-
    policy: "allow",
-
    scope: "all",
+
    seedingPolicy: { default: "allow", scope: "all" },
    alias: "palm",
    externalAddresses: ["seed.radicle.test:8123"],
  });
@@ -19,7 +18,7 @@ test("node metadata", async ({ page, peerManager }) => {
  await expect(
    page.getByText(`${shortNodeRemote}@seed.radicle.test:8123`),
  ).toBeVisible();
-
  await expect(page.getByText("1.0.0-rc.8-")).toBeVisible();
+
  await expect(page.getByText("pre-release")).toBeVisible();
});

test("node projects", async ({ page }) => {
modified tests/e2e/project/commits.spec.ts
@@ -150,6 +150,7 @@ test("relative timestamps", async ({ page }) => {
  await page
    .getByRole("link", { name: `Commits ${aliceMainCommitCount}` })
    .click();
+
  await expect(page.getByText("Thursday, December 15,")).toBeVisible();

  await changeBranch("bob", `main ${shortBobHead}`, page);
  await expect(page.getByTitle("Change branch")).toHaveText(/bob/);
modified tests/support/globalSetup.ts
@@ -50,7 +50,10 @@ export default async function globalSetup(): Promise<() => void> {
  });

  if (!process.env.SKIP_FIXTURE_CREATION) {
-
    await palm.startNode({ policy: "allow", scope: "all", alias: "palm" });
+
    await palm.startNode({
+
      seedingPolicy: { default: "allow", scope: "all" },
+
      alias: "palm",
+
    });
    await palm.startHttpd(defaultHttpdPort);

    try {
modified tests/support/heartwood-release
@@ -1 +1 @@
-
1.0.0-rc.8

\ No newline at end of file
+
1.0.0-rc.11

\ No newline at end of file
modified tests/support/peerManager.ts
@@ -124,10 +124,25 @@ export const NodeConfigSchema = object({
    alias: string(),
    peers: union([
      object({ type: literal("static") }),
-
      object({ type: literal("dynamic"), target: number() }),
+
      object({ type: literal("dynamic") }),
    ]),
    connect: array(string()),
    externalAddresses: array(string()),
+
    proxy: string().optional(),
+
    onion: union([
+
      object({
+
        mode: literal("proxy"),
+
        address: string(),
+
      }),
+
      object({ mode: literal("forward") }),
+
    ]).optional(),
+
    log: union([
+
      literal("ERROR"),
+
      literal("WARN"),
+
      literal("INFO"),
+
      literal("DEBUG"),
+
      literal("TRACE"),
+
    ]),
    network: union([literal("main"), literal("test")]),
    relay: union([literal("always"), literal("never"), literal("auto")]),
    limits: object({
@@ -140,9 +155,15 @@ export const NodeConfigSchema = object({
        inbound: object({ fillRate: number(), capacity: number() }),
        outbound: object({ fillRate: number(), capacity: number() }),
      }),
+
      connection: object({
+
        inbound: number(),
+
        outbound: number(),
+
      }),
+
    }),
+
    seedingPolicy: object({
+
      default: union([literal("allow"), literal("block")]),
+
      scope: union([literal("followed"), literal("all")]).optional(),
    }),
-
    policy: union([literal("allow"), literal("block")]),
-
    scope: union([literal("followed"), literal("all")]),
  }),
});