mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 18:20:30 +08:00
Query local node for project availability instead of seed node
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
import type { BaseUrl, Project } from "@httpd-client";
|
||||
|
||||
import { cacheQueryProject } from "@app/lib/projects";
|
||||
import { httpdStore } from "@app/lib/httpd";
|
||||
import { httpdStore, api } from "@app/lib/httpd";
|
||||
import { isLocal } from "@app/lib/utils";
|
||||
import { onMount } from "svelte";
|
||||
|
||||
@@ -37,12 +37,10 @@
|
||||
let localProject: "notFound" | "found" | undefined = undefined;
|
||||
$: hideContextHelp =
|
||||
isLocal(baseUrl.hostname) && $httpdStore.state === "authenticated";
|
||||
$: loadingContextHelp =
|
||||
$httpdStore.state !== "stopped" && localProject === undefined;
|
||||
|
||||
httpdStore.subscribe(async () => {
|
||||
if ($httpdStore.state !== "stopped" && !queryingLocalProject) {
|
||||
await cacheQueryProject(baseUrl, project.id);
|
||||
await cacheQueryProject(api.baseUrl, project.id);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -63,7 +61,7 @@
|
||||
|
||||
async function detectLocalProject(): Promise<void> {
|
||||
queryingLocalProject = true;
|
||||
localProject = await cacheQueryProject(baseUrl, project.id);
|
||||
localProject = await cacheQueryProject(api.baseUrl, project.id);
|
||||
queryingLocalProject = false;
|
||||
}
|
||||
|
||||
@@ -252,7 +250,7 @@
|
||||
<div class="bottom">
|
||||
<div class="help" class:expanded>
|
||||
{#if !hideContextHelp && expanded}
|
||||
{#if loadingContextHelp}
|
||||
{#if !localProject}
|
||||
<div
|
||||
style="display: flex; justify-content: center; align-items: center; height: 2rem;">
|
||||
<Loading small />
|
||||
@@ -263,9 +261,9 @@
|
||||
{localProject}
|
||||
{baseUrl}
|
||||
projectId={project.id}
|
||||
hideLocalButton={isLocal(baseUrl.hostname)}
|
||||
disableLocalButton={$httpdStore.state !== "authenticated" ||
|
||||
localProject !== "found"} />
|
||||
hideLocalButton={isLocal(baseUrl.hostname) ||
|
||||
localProject !== "found"}
|
||||
disableLocalButton={$httpdStore.state !== "authenticated"} />
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
@@ -300,7 +298,7 @@
|
||||
</Popover>
|
||||
|
||||
{#if !hideContextHelp}
|
||||
{#if loadingContextHelp}
|
||||
{#if !localProject}
|
||||
<div
|
||||
style="display: flex; justify-content: center; align-items: center; height: 2rem;">
|
||||
<Loading small condensed />
|
||||
@@ -322,9 +320,9 @@
|
||||
{baseUrl}
|
||||
popover
|
||||
projectId={project.id}
|
||||
hideLocalButton={isLocal(baseUrl.hostname)}
|
||||
disableLocalButton={$httpdStore.state !== "authenticated" ||
|
||||
hideLocalButton={isLocal(baseUrl.hostname) ||
|
||||
localProject !== "found"}
|
||||
disableLocalButton={$httpdStore.state !== "authenticated"}
|
||||
slot="popover" />
|
||||
</Popover>
|
||||
{/if}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import { isLocal } from "@app/lib/utils";
|
||||
|
||||
import Button from "@app/components/Button.svelte";
|
||||
import Command from "@app/components/Command.svelte";
|
||||
import ExternalLink from "@app/components/ExternalLink.svelte";
|
||||
import IconSmall from "@app/components/IconSmall.svelte";
|
||||
import Link from "@app/components/Link.svelte";
|
||||
@@ -35,10 +36,11 @@
|
||||
<div>Click the Connect button in the top right corner to get started.</div>
|
||||
{:else if localProject === "notFound"}
|
||||
<div class="title txt-bold">Project not available locally</div>
|
||||
<div>
|
||||
This project hasn't been found on your local node. Click the Clone button
|
||||
in the top right corner to get a local copy.
|
||||
<div style:padding-bottom="0.5rem">
|
||||
This project hasn't been found on your local node. To get a local copy
|
||||
start seeding it using the following command.
|
||||
</div>
|
||||
<Command command={`rad seed ${projectId}`} />
|
||||
{:else if $httpdStore.state === "running" && localProject === "found"}
|
||||
<div class="title txt-bold">Not authenticated</div>
|
||||
<div>To make changes you need to authenticate yourself.</div>
|
||||
|
||||
Reference in New Issue
Block a user