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:
Rūdolfs Ošiņš
2023-04-12 10:02:04 +02:00
parent 6efe60984b
commit 2d58c600ad
3 changed files with 15 additions and 8 deletions
+12 -5
View File
@@ -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>