Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Don't show port in clone URL if it is the default port
Rūdolfs Ošiņš committed 3 years ago
commit 2d58c600ad28b07772c97fc16bac5d6c4ce8bc0d
parent 6efe60984b446813f5446f3b487c1464dd1e647b
3 files changed +15 -8
modified src/views/projects/CloneButton.svelte
@@ -1,19 +1,26 @@
<script lang="ts">
  import type { BaseUrl } from "@httpd-client";

-
  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";
+
  import { config } from "@app/lib/config";
+

+
  import Clipboard from "@app/components/Clipboard.svelte";
+
  import Floating from "@app/components/Floating.svelte";

  export let baseUrl: BaseUrl;
  export let id: string;
  export let name: string;

  $: radCloneUrl = `rad clone ${id}`;
-
  $: gitCloneUrl = `git clone ${baseUrl.scheme}://${baseUrl.hostname}:${
-
    baseUrl.port
-
  }/${parseRepositoryId(id)?.pubkey ?? id}.git ${name}`;
+
  $: portFragment =
+
    baseUrl.scheme === config.seeds.defaultHttpdScheme &&
+
    baseUrl.port === config.seeds.defaultHttpdPort
+
      ? ""
+
      : `:${baseUrl.port}`;
+
  $: gitCloneUrl = `git clone ${baseUrl.scheme}://${
+
    baseUrl.hostname
+
  }${portFragment}/${parseRepositoryId(id)?.pubkey ?? id}.git ${name}`;
</script>

<style>
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 http://127.0.0.1:8080/${rid
+
        `text=git clone http://127.0.0.1/${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 http://127.0.0.1:8080/${rid.replace(
+
      `git clone http://127.0.0.1/${rid.replace(
        "rad:",
        "",
      )}.git source-browsing`,
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=http://127.0.0.1:8080/${rid.replace("rad:", "")}.git`),
+
    page.locator(`text=http://127.0.0.1/${rid.replace("rad:", "")}.git`),
  ).toBeVisible();
});