- {#if running}
+ {#if node.state === "running"}
Your node is running and syncing with the network.
+
+ {#if node.config?.scope && node.config?.policy}
+
+
+ Seeding Policy:
+ {capitalize(node.config.policy)}
+
+
+
+ Scope:
+
+ {capitalize(node.config.scope)}
+
+
+
+
+
+ {/if}
Shut down your node if you want to stop sharing and receiving updates.
diff --git a/src/components/ScopePolicyExplainer.svelte b/src/components/ScopePolicyExplainer.svelte
new file mode 100644
index 000000000..31bb41a12
--- /dev/null
+++ b/src/components/ScopePolicyExplainer.svelte
@@ -0,0 +1,17 @@
+
+
+{#if policy === "allow"}
+ All discovered repositories will get seeded,
+{:else if policy === "block"}
+ Only repositories marked as such will get seeded,
+{/if}
+{#if scope === "all"}
+ and all changes in those repos, made by any peer, will be synced.
+{:else if scope === "followed"}
+ and only changes made by explicitly followed peers will be synced.
+{/if}
diff --git a/src/lib/httpd.ts b/src/lib/httpd.ts
index 388e79e8b..e036ecdb1 100644
--- a/src/lib/httpd.ts
+++ b/src/lib/httpd.ts
@@ -1,3 +1,5 @@
+import type { Node } from "@httpd-client";
+
import { get, writable } from "svelte/store";
import { withTimeout, Mutex, E_CANCELED, E_TIMEOUT } from "async-mutex";
@@ -11,15 +13,13 @@ export interface Session {
alias: string;
}
-type NodeState = { state: "running" | "stopped"; id: string };
-
export type HttpdState =
| { state: "stopped" }
- | { state: "running"; node: NodeState }
+ | { state: "running"; node: Node }
| {
state: "authenticated";
session: Session;
- node: NodeState;
+ node: Node;
};
const HTTPD_STATE_STORAGE_KEY = "httpdState";
@@ -60,7 +60,7 @@ export async function authenticate(params: {
sig: params.signature,
pk: params.publicKey,
});
- const { id, state } = await api.getNode();
+ const node = await api.getNode();
const sess = await api.session.getById(params.id);
update({
state: "authenticated",
@@ -69,7 +69,7 @@ export async function authenticate(params: {
publicKey: params.publicKey,
alias: sess.alias,
},
- node: { state, id },
+ node,
});
return true;
} catch (error) {
@@ -91,10 +91,10 @@ export async function disconnect() {
try {
await api.session.delete(httpd.session.id);
- const { id, state } = await api.getNode();
+ const node = await api.getNode();
update({
state: "running",
- node: { state, id },
+ node,
});
} catch (error) {
console.error(error);
@@ -126,10 +126,10 @@ async function checkState() {
await stateMutex
.runExclusive(async () => {
try {
- const { id, state } = await api.getNode();
+ const node = await api.getNode();
if (httpdState && httpdState.state !== "stopped") {
- httpdState.node = { state, id };
+ httpdState.node = node;
}
if (httpdState && httpdState.state === "authenticated") {
@@ -141,7 +141,7 @@ async function checkState() {
) {
update({
state: "running",
- node: { state, id },
+ node,
});
} else {
update(httpdState);
@@ -149,7 +149,7 @@ async function checkState() {
} else {
update({
state: "running",
- node: { state, id },
+ node,
});
}
} catch (error) {
diff --git a/src/views/nodes/View.svelte b/src/views/nodes/View.svelte
index a20e36b43..473a0982f 100644
--- a/src/views/nodes/View.svelte
+++ b/src/views/nodes/View.svelte
@@ -12,6 +12,7 @@
import CopyableId from "@app/components/CopyableId.svelte";
import IconSmall from "@app/components/IconSmall.svelte";
import ProjectCard from "@app/components/ProjectCard.svelte";
+ import ScopePolicyExplainer from "@app/components/ScopePolicyExplainer.svelte";
import HoverPopover from "@app/components/HoverPopover.svelte";
export let baseUrl: BaseUrl;
@@ -178,18 +179,7 @@
- {#if policy === "allow"}
- All discovered repositories will get seeded,
- {:else if policy === "block"}
- Only repositories marked as such will get seeded,
- {/if}
- {#if scope === "all"}
- and all changes in those repos, made by any peer, will be
- synced.
- {:else if scope === "followed"}
- and only changes made by explicitly followed peers will be
- synced.
- {/if}
+