Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Fix mixed content warning when connecting to local node
Rūdolfs Ošiņš committed 3 years ago
commit 9e1fc49ae7199ca1aca2f69a98462934d841d091
parent 016b5e9d0a686f9ae3ec5f74514638de6f6cbc9a
8 files changed +20 -18
modified src/lib/utils.ts
@@ -278,7 +278,7 @@ export function extractHost(origin: string): Host {
    origin === "127.0.0.1" ||
    origin === "127.0.0.1:8080"
  ) {
-
    return { host: "0.0.0.0", port: 8080, scheme: "http" };
+
    return { host: "127.0.0.1", port: 8080, scheme: "http" };
  } else if (origin.includes(":")) {
    return {
      host: origin.split(":")[0],
modified src/views/projects/CloneButton.svelte
@@ -1,17 +1,19 @@
<script lang="ts">
+
  import type { Host } from "@app/lib/api";
+

  import Clipboard from "@app/components/Clipboard.svelte";
  import Floating from "@app/components/Floating.svelte";
  import { closeFocused } from "@app/components/Floating.svelte";
  import { parseRepositoryId } from "@app/lib/utils";

-
  export let seedHost: string;
+
  export let seedHost: Host;
  export let id: string;
  export let name: string;

  $: radCloneUrl = `rad clone ${id}`;
-
  $: gitCloneUrl = `git clone https://${seedHost}/${
-
    parseRepositoryId(id)?.pubkey ?? id
-
  }.git ${name}`;
+
  $: gitCloneUrl = `git clone ${seedHost.scheme}://${seedHost.host}:${
+
    seedHost.port
+
  }/${parseRepositoryId(id)?.pubkey ?? id}.git ${name}`;
</script>

<style>
modified src/views/projects/Header.svelte
@@ -101,7 +101,7 @@
    on:branchChanged={event => updateRevision(event.detail)} />

  {#if seed.addr.host}
-
    <CloneButton seedHost={seed.addr.host} {id} name={project.name} />
+
    <CloneButton seedHost={seed.addr} {id} name={project.name} />
  {/if}

  <span>
modified tests/e2e/clipboard.spec.ts
@@ -55,7 +55,7 @@ test("copy to clipboard", async ({ page, browserName, context }) => {
    await page.getByText("Clone").click();
    await page
      .locator(
-
        `text=git clone https://0.0.0.0/${rid
+
        `text=git clone http://127.0.0.1:8080/${rid
          .replace("rad:", "")
          .substring(0, 10)}`,
      )
@@ -66,7 +66,7 @@ test("copy to clipboard", async ({ page, browserName, context }) => {
      .locator(".clipboard")
      .click();
    await expectClipboard(
-
      `git clone https://0.0.0.0/${rid.replace(
+
      `git clone http://127.0.0.1:8080/${rid.replace(
        "rad:",
        "",
      )}.git source-browsing`,
@@ -79,7 +79,7 @@ test("copy to clipboard", async ({ page, browserName, context }) => {
  {
    await page.locator(".clipboard").first().click();
    await expectClipboard(
-
      "z6Mkk7oqY4pPxhMmGEotDYsFo97vhCj85BLY1H256HrJmjN8@0.0.0.0:8776",
+
      "z6Mkk7oqY4pPxhMmGEotDYsFo97vhCj85BLY1H256HrJmjN8@127.0.0.1:8776",
      page,
    );
  }
modified tests/e2e/hashRouter.spec.ts
@@ -35,7 +35,7 @@ test("navigation between seed and project pages", async ({ page }) => {
  await expectUrlPersistsReload(page);

  await page.locator('role=button[name="Seed"]').click();
-
  await expect(page).toHaveURL("/#/seeds/0.0.0.0");
+
  await expect(page).toHaveURL("/#/seeds/127.0.0.1");
});

test.describe("project page navigation", () => {
modified tests/e2e/historyRouter.spec.ts
@@ -35,7 +35,7 @@ test("navigation between seed and project pages", async ({ page }) => {
  await expectUrlPersistsReload(page);

  await page.locator('role=button[name="Seed"]').click();
-
  await expect(page).toHaveURL("/seeds/0.0.0.0");
+
  await expect(page).toHaveURL("/seeds/127.0.0.1");
});

test.describe("project page navigation", () => {
modified tests/e2e/project.spec.ts
@@ -250,7 +250,7 @@ test("clone modal", async ({ page }) => {
  await page.getByText("Clone").click();
  await expect(page.locator(`text=rad clone ${rid}`)).toBeVisible();
  await expect(
-
    page.locator(`text=https://0.0.0.0/${rid.replace("rad:", "")}.git`),
+
    page.locator(`text=http://127.0.0.1:8080/${rid.replace("rad:", "")}.git`),
  ).toBeVisible();
});

modified tests/support/fixtures.ts
@@ -52,7 +52,7 @@ export const test = base.extend<{
              defaultHttpdPort: 8080,
              defaultHttpdScheme: "http",
              defaultNodePort: 8776,
-
              pinned: [{ host: "0.0.0.0" }],
+
              pinned: [{ host: "127.0.0.1" }],
            },
            projects: { pinned: [] },
          };
@@ -134,14 +134,14 @@ export function configFixture() {
      defaultHttpdPort: 8080,
      defaultHttpdScheme: "http",
      defaultNodePort: 8776,
-
      pinned: [{ host: "0.0.0.0" }],
+
      pinned: [{ host: "127.0.0.1" }],
    },
    projects: {
      pinned: [
        {
          name: "source-browsing",
          id: "rad:git:hnrkdi8be7n4hhqoz9rpzrgd68u9dr3zsxgmy",
-
          seed: "0.0.0.0",
+
          seed: "127.0.0.1",
        },
      ],
    },
@@ -155,14 +155,14 @@ export function appConfigWithFixture() {
      defaultHttpdPort: 8080,
      defaultHttpdScheme: "http",
      defaultNodePort: 8776,
-
      pinned: [{ host: "0.0.0.0" }],
+
      pinned: [{ host: "127.0.0.1" }],
    },
    projects: {
      pinned: [
        {
          name: "source-browsing",
          id: "rad:zKtT7DmF9H34KkvcKj9PHW19WzjT",
-
          seed: "0.0.0.0",
+
          seed: "127.0.0.1",
        },
      ],
    },
@@ -175,7 +175,7 @@ export const aliceRemote =
export const bobRemote =
  "did:key:z6MksMTThc1aDU2Ztc43jJUivuyBLNWiLsDf4X65rABe7HbA";
export const rid = "rad:zKtT7DmF9H34KkvcKj9PHW19WzjT";
-
export const projectFixtureUrl = `/seeds/0.0.0.0/${rid}`;
+
export const projectFixtureUrl = `/seeds/127.0.0.1/${rid}`;
export const seedPort = 8080;
export const seedVersion = "0.1.0-6463768";
export const seedRemote = "z6Mkk7oqY4pPxhMmGEotDYsFo97vhCj85BLY1H256HrJmjN8";