mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-04-20 22:50:11 -04:00
[ENG-1380] Stabilise p2p settings (#1703)
* let me create pr * a whole lotta changes * split `p2p_manager.rs` into smaller files * the arcpocalypse is over * minor generic cleanup * wip removing 'MetadataManager' * more wip * wip: i am changing branch * discovery2 -> discovery * make it somewhat compile * more wip * wip: reassembling manager stream * state more goodly * wip * more wip * removing generic from sd_p2p::Manager * reassemble networked libraries * wip: hooking back up mDNS * multi-flume wip * contain bad code to a single file * p2p_manager_actor + split handlers into file per operation * cleanup after restructure * cleaning up more * wip: reenable resync * wip: remote identity in connection payload * track connected clients (required for `service.rs`) * a big ass iterator * working towards finishing `service.rs` * service shutdown * hook up listen channel in service * fix address resolution * merge nlm stuff into LibrariesService * finish library to service mapping * less footguns in p2p - seal `PeerId` * fix previous pr * p2p state rspc query * send node events to the frontend * minor * wip * more worky, less crashy * make spacedrop work + debug state * fix mdns expiry * clippy * other clippy * remove feature flag
This commit is contained in:
@@ -29,7 +29,6 @@ export const Component = () => {
|
||||
const platform = usePlatform();
|
||||
const debugState = useDebugState();
|
||||
const editNode = useBridgeMutation('nodes.edit');
|
||||
const p2pSettingsEnabled = useFeatureFlag('p2pSettings');
|
||||
const connectedPeers = useConnectedPeers();
|
||||
|
||||
const form = useZodForm({
|
||||
@@ -171,79 +170,75 @@ export const Component = () => {
|
||||
onClick={() => (getDebugState().enabled = !debugState.enabled)}
|
||||
/>
|
||||
</Setting>
|
||||
{p2pSettingsEnabled && (
|
||||
<div className="flex flex-col gap-4">
|
||||
<h1 className="mb-3 text-lg font-bold text-ink">Networking</h1>
|
||||
<div className="flex flex-col gap-4">
|
||||
<h1 className="mb-3 text-lg font-bold text-ink">Networking</h1>
|
||||
|
||||
<Setting
|
||||
mini
|
||||
title="Enable Networking"
|
||||
description={
|
||||
<>
|
||||
<p className="text-sm text-gray-400">
|
||||
Allow your node to communicate with other Spacedrive nodes
|
||||
around you
|
||||
</p>
|
||||
<p className="mb-2 text-sm text-gray-400">
|
||||
<span className="font-bold">Required</span> for library sync or
|
||||
Spacedrop!
|
||||
</p>
|
||||
</>
|
||||
}
|
||||
>
|
||||
{/* TODO: Switch doesn't handle optional fields correctly */}
|
||||
<Switch
|
||||
size="md"
|
||||
checked={watchP2pEnabled || false}
|
||||
onClick={() =>
|
||||
form.setValue('p2p_enabled', !form.getValues('p2p_enabled'))
|
||||
}
|
||||
<Setting
|
||||
mini
|
||||
title="Enable Networking"
|
||||
description={
|
||||
<>
|
||||
<p className="text-sm text-gray-400">
|
||||
Allow your node to communicate with other Spacedrive nodes around
|
||||
you
|
||||
</p>
|
||||
<p className="mb-2 text-sm text-gray-400">
|
||||
<span className="font-bold">Required</span> for library sync or
|
||||
Spacedrop!
|
||||
</p>
|
||||
</>
|
||||
}
|
||||
>
|
||||
{/* TODO: Switch doesn't handle optional fields correctly */}
|
||||
<Switch
|
||||
size="md"
|
||||
checked={watchP2pEnabled || false}
|
||||
onClick={() => form.setValue('p2p_enabled', !form.getValues('p2p_enabled'))}
|
||||
/>
|
||||
</Setting>
|
||||
<Setting
|
||||
mini
|
||||
title="Networking Port"
|
||||
description="The port for Spacedrive's Peer-to-peer networking to communicate on. You should leave this disabled unless you have a restictive firewall. Do not expose to the internet!"
|
||||
>
|
||||
<div className="flex gap-2">
|
||||
<Controller
|
||||
control={form.control}
|
||||
name="customOrDefault"
|
||||
render={({ field }) => (
|
||||
<Select
|
||||
disabled={!watchP2pEnabled}
|
||||
className={clsx(!watchP2pEnabled && 'opacity-50')}
|
||||
{...field}
|
||||
onChange={(e) => {
|
||||
field.onChange(e);
|
||||
form.setValue('p2p_port', 0);
|
||||
}}
|
||||
>
|
||||
<SelectOption value="Default">Default</SelectOption>
|
||||
<SelectOption value="Custom">Custom</SelectOption>
|
||||
</Select>
|
||||
)}
|
||||
/>
|
||||
</Setting>
|
||||
<Setting
|
||||
mini
|
||||
title="Networking Port"
|
||||
description="The port for Spacedrive's Peer-to-peer networking to communicate on. You should leave this disabled unless you have a restictive firewall. Do not expose to the internet!"
|
||||
>
|
||||
<div className="flex gap-2">
|
||||
<Controller
|
||||
control={form.control}
|
||||
name="customOrDefault"
|
||||
render={({ field }) => (
|
||||
<Select
|
||||
disabled={!watchP2pEnabled}
|
||||
className={clsx(!watchP2pEnabled && 'opacity-50')}
|
||||
{...field}
|
||||
onChange={(e) => {
|
||||
field.onChange(e);
|
||||
form.setValue('p2p_port', 0);
|
||||
}}
|
||||
>
|
||||
<SelectOption value="Default">Default</SelectOption>
|
||||
<SelectOption value="Custom">Custom</SelectOption>
|
||||
</Select>
|
||||
)}
|
||||
/>
|
||||
<Input
|
||||
className={clsx(
|
||||
'w-[66px]',
|
||||
watchCustomOrDefault === 'Default' || !watchP2pEnabled
|
||||
? 'opacity-50'
|
||||
: 'opacity-100'
|
||||
)}
|
||||
disabled={watchCustomOrDefault === 'Default' || !watchP2pEnabled}
|
||||
{...form.register('p2p_port')}
|
||||
onChange={(e) => {
|
||||
form.setValue(
|
||||
'p2p_port',
|
||||
Number(e.target.value.replace(/[^0-9]/g, ''))
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Setting>
|
||||
</div>
|
||||
)}
|
||||
<Input
|
||||
className={clsx(
|
||||
'w-[66px]',
|
||||
watchCustomOrDefault === 'Default' || !watchP2pEnabled
|
||||
? 'opacity-50'
|
||||
: 'opacity-100'
|
||||
)}
|
||||
disabled={watchCustomOrDefault === 'Default' || !watchP2pEnabled}
|
||||
{...form.register('p2p_port')}
|
||||
onChange={(e) => {
|
||||
form.setValue(
|
||||
'p2p_port',
|
||||
Number(e.target.value.replace(/[^0-9]/g, ''))
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Setting>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { BackendFeature } from '../core';
|
||||
import { valtioPersist } from '../lib/valito';
|
||||
import { nonLibraryClient, useBridgeQuery } from '../rspc';
|
||||
|
||||
export const features = ['spacedrop', 'p2pPairing', 'syncRoute', 'backups', 'p2pSettings'] as const;
|
||||
export const features = ['spacedrop', 'p2pPairing', 'syncRoute', 'backups'] as const;
|
||||
|
||||
// This defines which backend feature flags show up in the UI.
|
||||
// This is kinda a hack to not having the runtime array of possible features as Specta only exports the types.
|
||||
|
||||
Reference in New Issue
Block a user