mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-15 19:30:38 +08:00
Don't show port in clone URL if it is the default port
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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`,
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user