diff --git a/frontend/src/components/projects/DependencyTable.vue b/frontend/src/components/projects/DependencyTable.vue index f85df294..f8138a40 100644 --- a/frontend/src/components/projects/DependencyTable.vue +++ b/frontend/src/components/projects/DependencyTable.vue @@ -76,7 +76,7 @@ function reset() { async function onSearch(val: string, name: string) { if (val) { - const projects = await useApi>(`projects?relevance=true&limit=25&offset=0&q=${val.replace("/", " ")}`); + const projects = await useApi>(`projects?relevance=true&limit=25&offset=0&q=${val ? val.replace("/", " ") : ""}`); results.value[name] = projects.result .filter((p) => p.namespace.owner !== route.params.user || p.namespace.slug !== route.params.project) .map((p) => p.namespace); @@ -96,6 +96,22 @@ const filteredDeps = computed(() => { return props.version.pluginDependencies[props.platform]?.filter((d) => !deletedDeps.value.includes(d.name)) || []; }); +function toString(namespace: ProjectNamespace | string) { + if (!namespace) return ""; + if (typeof namespace === "string") return namespace; + return namespace.owner + "/" + namespace.slug; +} + +function fromString(string: string): ProjectNamespace | string | null { + const split = string.split("/"); + return split.length !== 2 + ? string + : { + owner: split[0], + slug: split[1], + }; +} + defineExpose({ results, newDepResults, newDeps, deletedDeps, reset: reset }); @@ -129,7 +145,7 @@ defineExpose({ results, newDepResults, newDeps, deletedDeps, reset: reset }); @@ -172,7 +189,7 @@ defineExpose({ results, newDepResults, newDeps, deletedDeps, reset: reset }); /> diff --git a/frontend/src/components/projects/DownloadButton.vue b/frontend/src/components/projects/DownloadButton.vue index 43819841..8fa48d33 100644 --- a/frontend/src/components/projects/DownloadButton.vue +++ b/frontend/src/components/projects/DownloadButton.vue @@ -43,9 +43,10 @@ const downloadLink = computed(() => { return externalUrl.value; } - const versionString = props.platformSelection ? "recommended" : props.version!.name; - const platform = props.platformSelection ? selectedPlatform.value : props.platform!.name; - return `${window.location.protocol}//${window.location.host}/api/v1/projects/${props.project.namespace.owner}/${props.project.namespace.slug}/versions/${versionString}/${platform}/download`; + const versionString = props.platformSelection ? "recommended" : props.version?.name; + const platform = props.platformSelection ? selectedPlatform.value : props.platform?.name; + const path = `/api/v1/projects/${props.project.namespace.owner}/${props.project.namespace.slug}/versions/${versionString}/${platform}/download`; + return import.meta.env.SSR ? path : `${window.location.protocol}//${window.location.host}${path}`; }); if (props.platformSelection) { diff --git a/frontend/src/components/ui/InputAutocomplete.vue b/frontend/src/components/ui/InputAutocomplete.vue index 2e697d81..3aa91607 100644 --- a/frontend/src/components/ui/InputAutocomplete.vue +++ b/frontend/src/components/ui/InputAutocomplete.vue @@ -1,5 +1,5 @@