From 947354f6c01577801d9903422d8ee5f27703e17e Mon Sep 17 00:00:00 2001 From: Oscar Beaumont Date: Sat, 20 Apr 2024 11:21:20 +0800 Subject: [PATCH] Remove files over p2p feature (#2364) * goodbye * types * a --- core/src/api/mod.rs | 7 ------- core/src/lib.rs | 2 -- packages/client/src/core.ts | 2 +- packages/client/src/stores/featureFlags.tsx | 2 +- 4 files changed, 2 insertions(+), 11 deletions(-) diff --git a/core/src/api/mod.rs b/core/src/api/mod.rs index 70836b6fc..7ec819302 100644 --- a/core/src/api/mod.rs +++ b/core/src/api/mod.rs @@ -64,16 +64,12 @@ pub enum CoreEvent { #[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize, Type)] #[serde(rename_all = "camelCase")] pub enum BackendFeature { - FilesOverP2P, CloudSync, } impl BackendFeature { pub fn restore(&self, node: &Node) { match self { - BackendFeature::FilesOverP2P => { - node.files_over_p2p_flag.store(true, Ordering::Relaxed); - } BackendFeature::CloudSync => { node.cloud_sync_flag.store(true, Ordering::Relaxed); } @@ -181,9 +177,6 @@ pub(crate) fn mount() -> Arc { .map_err(|err| rspc::Error::new(ErrorCode::InternalServerError, err.to_string()))?; match feature { - BackendFeature::FilesOverP2P => { - node.files_over_p2p_flag.store(enabled, Ordering::Relaxed); - } BackendFeature::CloudSync => { node.cloud_sync_flag.store(enabled, Ordering::Relaxed); } diff --git a/core/src/lib.rs b/core/src/lib.rs index 3a3306545..17213e723 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -64,7 +64,6 @@ pub struct Node { pub event_bus: (broadcast::Sender, broadcast::Receiver), pub notifications: Notifications, pub thumbnailer: OldThumbnailer, - pub files_over_p2p_flag: Arc, pub cloud_sync_flag: Arc, pub env: Arc, pub http: reqwest::Client, @@ -135,7 +134,6 @@ impl Node { config, event_bus, libraries, - files_over_p2p_flag: Arc::new(AtomicBool::new(false)), cloud_sync_flag: Arc::new(AtomicBool::new(false)), http: reqwest::Client::new(), env, diff --git a/packages/client/src/core.ts b/packages/client/src/core.ts index c2214e145..d0ac52b6a 100644 --- a/packages/client/src/core.ts +++ b/packages/client/src/core.ts @@ -154,7 +154,7 @@ export type AudioMetadata = { duration: number | null; audio_codec: string | nul * * If you want a variant of this to show up on the frontend it must be added to `backendFeatures` in `useFeatureFlag.tsx` */ -export type BackendFeature = "filesOverP2P" | "cloudSync" +export type BackendFeature = "cloudSync" export type Backup = ({ id: string; timestamp: string; library_id: string; library_name: string }) & { path: string } diff --git a/packages/client/src/stores/featureFlags.tsx b/packages/client/src/stores/featureFlags.tsx index f5cf1393e..9591f3ca9 100644 --- a/packages/client/src/stores/featureFlags.tsx +++ b/packages/client/src/stores/featureFlags.tsx @@ -16,7 +16,7 @@ export const features = [ // 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. -export const backendFeatures: BackendFeature[] = ['filesOverP2P', 'cloudSync']; +export const backendFeatures: BackendFeature[] = ['cloudSync']; export type FeatureFlag = (typeof features)[number] | BackendFeature;