From 1bfcdc808ec41032f734f76ef8d03deb85cd4c23 Mon Sep 17 00:00:00 2001 From: Oscar Beaumont Date: Tue, 31 Oct 2023 15:29:25 +1100 Subject: [PATCH] [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 --- .../$libraryId/settings/client/general.tsx | 139 +++++++++--------- packages/client/src/hooks/useFeatureFlag.tsx | 2 +- 2 files changed, 68 insertions(+), 73 deletions(-) diff --git a/interface/app/$libraryId/settings/client/general.tsx b/interface/app/$libraryId/settings/client/general.tsx index 2a75fef9c..707cec6f7 100644 --- a/interface/app/$libraryId/settings/client/general.tsx +++ b/interface/app/$libraryId/settings/client/general.tsx @@ -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)} /> - {p2pSettingsEnabled && ( -
-

Networking

+
+

Networking

- -

- Allow your node to communicate with other Spacedrive nodes - around you -

-

- Required for library sync or - Spacedrop! -

- - } - > - {/* TODO: Switch doesn't handle optional fields correctly */} - - form.setValue('p2p_enabled', !form.getValues('p2p_enabled')) - } + +

+ Allow your node to communicate with other Spacedrive nodes around + you +

+

+ Required for library sync or + Spacedrop! +

+ + } + > + {/* TODO: Switch doesn't handle optional fields correctly */} + form.setValue('p2p_enabled', !form.getValues('p2p_enabled'))} + /> +
+ +
+ ( + + )} /> - - -
- ( - - )} - /> - { - form.setValue( - 'p2p_port', - Number(e.target.value.replace(/[^0-9]/g, '')) - ); - }} - /> -
-
-
- )} + { + form.setValue( + 'p2p_port', + Number(e.target.value.replace(/[^0-9]/g, '')) + ); + }} + /> +
+ +
); }; diff --git a/packages/client/src/hooks/useFeatureFlag.tsx b/packages/client/src/hooks/useFeatureFlag.tsx index 15c1a08f1..9b3d2aef3 100644 --- a/packages/client/src/hooks/useFeatureFlag.tsx +++ b/packages/client/src/hooks/useFeatureFlag.tsx @@ -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.