From e9c08e3f08dfaa260e8fbe2a4289590eef2e1cb3 Mon Sep 17 00:00:00 2001 From: Arnab Chakraborty <11457760+Rocky43007@users.noreply.github.com> Date: Fri, 6 Sep 2024 10:24:34 -0400 Subject: [PATCH] Formatting --- .../src-tauri/capabilities/default.json | 4 +--- apps/desktop/src-tauri/tauri.conf.json | 24 ++++--------------- apps/desktop/src/App.tsx | 4 ---- core/crates/cloud-services/src/error.rs | 14 +++++------ core/crates/cloud-services/src/p2p/runner.rs | 3 +-- core/crates/cloud-services/src/sync/ingest.rs | 19 +++++++-------- core/crates/sync/src/ingest.rs | 6 +---- core/src/p2p/sync/mod.rs | 7 +----- .../settings/client/account/Profile.tsx | 2 +- .../client/account/handlers/windowHandler.ts | 3 ++- .../settings/client/account/index.tsx | 2 +- 11 files changed, 29 insertions(+), 59 deletions(-) diff --git a/apps/desktop/src-tauri/capabilities/default.json b/apps/desktop/src-tauri/capabilities/default.json index 1a0bfa998..2e223b20b 100644 --- a/apps/desktop/src-tauri/capabilities/default.json +++ b/apps/desktop/src-tauri/capabilities/default.json @@ -2,9 +2,7 @@ "$schema": "../gen/schemas/desktop-schema.json", "identifier": "default", "description": "Capability for the main window", - "windows": [ - "main" - ], + "windows": ["main"], "permissions": [ "core:app:default", "core:event:default", diff --git a/apps/desktop/src-tauri/tauri.conf.json b/apps/desktop/src-tauri/tauri.conf.json index 24bc071a5..cff417501 100644 --- a/apps/desktop/src-tauri/tauri.conf.json +++ b/apps/desktop/src-tauri/tauri.conf.json @@ -29,9 +29,7 @@ "transparent": true, "center": true, "windowEffects": { - "effects": [ - "sidebar" - ], + "effects": ["sidebar"], "state": "followsWindowActiveState", "radius": 9 } @@ -48,11 +46,7 @@ }, "bundle": { "active": true, - "targets": [ - "deb", - "msi", - "dmg" - ], + "targets": ["deb", "msi", "dmg"], "publisher": "Spacedrive Technology Inc.", "copyright": "Spacedrive Technology Inc.", "category": "Productivity", @@ -71,20 +65,14 @@ "files": { "/usr/share/spacedrive/models/yolov8s.onnx": "../../.deps/models/yolov8s.onnx" }, - "depends": [ - "libc6", - "libxdo3", - "dbus" - ] + "depends": ["libc6", "libxdo3", "dbus"] } }, "macOS": { "minimumSystemVersion": "10.15", "exceptionDomain": null, "entitlements": null, - "frameworks": [ - "../../.deps/Spacedrive.framework" - ], + "frameworks": ["../../.deps/Spacedrive.framework"], "dmg": { "background": "dmg-background.png", "appPosition": { @@ -121,9 +109,7 @@ "deep-link": { "mobile": [], "desktop": { - "schemes": [ - "spacedrive" - ] + "schemes": ["spacedrive"] } } } diff --git a/apps/desktop/src/App.tsx b/apps/desktop/src/App.tsx index 36888052c..c401ab356 100644 --- a/apps/desktop/src/App.tsx +++ b/apps/desktop/src/App.tsx @@ -42,10 +42,6 @@ import { queryClient } from './query'; import { createMemoryRouterWithHistory } from './router'; import { createUpdater } from './updater'; -//Set global fetch to use tauri fetch -// If the build in in production mode, we need to set the global fetch to use the tauri fetch -// console.log('import.meta.env.DEV', import.meta.env.DEV); - SuperTokens.init({ appInfo: { apiDomain: 'http://localhost:9420', diff --git a/core/crates/cloud-services/src/error.rs b/core/crates/cloud-services/src/error.rs index cefbd9d29..7286bf313 100644 --- a/core/crates/cloud-services/src/error.rs +++ b/core/crates/cloud-services/src/error.rs @@ -12,17 +12,17 @@ use quic_rpc::{ pub enum Error { // Setup errors #[error("Couldn't parse Cloud Services API address URL: {0}")] - InvalidUrl(reqwest_middleware::reqwest::Error), + InvalidUrl(reqwest::Error), #[error("Failed to initialize http client: {0}")] - HttpClientInit(reqwest_middleware::reqwest::Error), + HttpClientInit(reqwest::Error), #[error("Failed to request Cloud Services API address from Auth Server route: {0}")] FailedToRequestApiAddress(reqwest_middleware::Error), #[error("Auth Server's Cloud Services API address route returned an error: {0}")] - AuthServerError(reqwest_middleware::reqwest::Error), + AuthServerError(reqwest::Error), #[error( "Failed to extract response body from Auth Server's Cloud Services API address route: {0}" )] - FailedToExtractApiAddress(reqwest_middleware::reqwest::Error), + FailedToExtractApiAddress(reqwest::Error), #[error("Failed to parse auth server's Cloud Services API address: {0}")] FailedToParseApiAddress(#[from] AddrParseError), #[error("Failed to create endpoint: {0}")] @@ -100,13 +100,13 @@ pub enum Error { #[error("Failed to download sync messages: {0}")] DownloadSyncMessages(reqwest_middleware::Error), #[error("Received an error response from uploading sync messages: {0}")] - ErrorResponseUploadSyncMessages(reqwest_middleware::reqwest::Error), + ErrorResponseUploadSyncMessages(reqwest::Error), #[error("Received an error response from downloading sync messages: {0}")] - ErrorResponseDownloadSyncMessages(reqwest_middleware::reqwest::Error), + ErrorResponseDownloadSyncMessages(reqwest::Error), #[error( "Received an error response from downloading sync messages while reading its bytes: {0}" )] - ErrorResponseDownloadReadBytesSyncMessages(reqwest_middleware::reqwest::Error), + ErrorResponseDownloadReadBytesSyncMessages(reqwest::Error), #[error("Critical error while uploading sync messages")] CriticalErrorWhileUploadingSyncMessages, #[error("Failed to send End update to push sync messages")] diff --git a/core/crates/cloud-services/src/p2p/runner.rs b/core/crates/cloud-services/src/p2p/runner.rs index 30194eb18..d720f94e0 100644 --- a/core/crates/cloud-services/src/p2p/runner.rs +++ b/core/crates/cloud-services/src/p2p/runner.rs @@ -1,6 +1,5 @@ use crate::{ - p2p::JoinSyncGroupError, token_refresher::TokenRefresher, CloudServices, Error, - KeyManager, + p2p::JoinSyncGroupError, token_refresher::TokenRefresher, CloudServices, Error, KeyManager, }; use sd_cloud_schema::{ diff --git a/core/crates/cloud-services/src/sync/ingest.rs b/core/crates/cloud-services/src/sync/ingest.rs index 1522a04ea..ad70362ed 100644 --- a/core/crates/cloud-services/src/sync/ingest.rs +++ b/core/crates/cloud-services/src/sync/ingest.rs @@ -1,11 +1,9 @@ use sd_core_sync::SyncManager; use sd_actors::Stopper; -use sd_prisma::prisma::cloud_crdt_operation; use std::{ future::IntoFuture, - pin::pin, sync::{ atomic::{AtomicBool, Ordering}, Arc, @@ -15,7 +13,6 @@ use std::{ use futures::{FutureExt, StreamExt}; use futures_concurrency::future::Race; use tokio::sync::Notify; -use tracing::debug; // Responsible for taking sync operations received from the cloud, // and applying them to the local database via the sync system's ingest actor. @@ -108,13 +105,15 @@ pub async fn run_actor( state.store(false, Ordering::Relaxed); state_notify.notify_waiters(); - if let Race::Stopped = ( - notify.notified().map(|()| Race::Notified), - stop.into_future().map(|()| Race::Stopped), - ) - .race() - .await - { + if matches!( + ( + notify.notified().map(|()| Race::Notified), + stop.into_future().map(|()| Race::Stopped), + ) + .race() + .await, + Race::Stopped + ) { break; } } diff --git a/core/crates/sync/src/ingest.rs b/core/crates/sync/src/ingest.rs index 5fc0ac49c..b346cfbc7 100644 --- a/core/crates/sync/src/ingest.rs +++ b/core/crates/sync/src/ingest.rs @@ -11,7 +11,6 @@ use sd_sync::{ use std::{ collections::BTreeMap, - future::IntoFuture, num::NonZeroU128, ops::Deref, pin::pin, @@ -21,10 +20,7 @@ use std::{ use async_channel as chan; use futures::{stream, FutureExt, StreamExt}; -use futures_concurrency::{ - future::{Race, TryJoin}, - stream::Merge, -}; +use futures_concurrency::{future::TryJoin, stream::Merge}; use prisma_client_rust::chrono::{DateTime, Utc}; use tokio::sync::oneshot; use tracing::{debug, error, instrument, trace, warn}; diff --git a/core/src/p2p/sync/mod.rs b/core/src/p2p/sync/mod.rs index f14a19689..c66a1e6bb 100644 --- a/core/src/p2p/sync/mod.rs +++ b/core/src/p2p/sync/mod.rs @@ -1,9 +1,6 @@ #![allow(clippy::panic, clippy::unwrap_used)] // TODO: Finish this -use crate::{ - library::Library, - sync::{self, GetOpsArgs}, -}; +use crate::{library::Library, sync::GetOpsArgs}; use sd_p2p_proto::{decode, encode}; use sd_sync::CompressedCRDTOperationsPerModelPerDevice; @@ -139,11 +136,9 @@ mod originator { pub use responder::run as responder; mod responder { - use std::pin::pin; use super::*; use futures::StreamExt; - use originator::tx as rx; pub mod tx { use serde::{Deserialize, Serialize}; diff --git a/interface/app/$libraryId/settings/client/account/Profile.tsx b/interface/app/$libraryId/settings/client/account/Profile.tsx index dd3ce1d6f..8c3e57236 100644 --- a/interface/app/$libraryId/settings/client/account/Profile.tsx +++ b/interface/app/$libraryId/settings/client/account/Profile.tsx @@ -3,7 +3,7 @@ import { Card } from '@sd/ui'; import { TruncatedText } from '~/components'; import { AuthRequiredOverlay } from '~/components/AuthRequiredOverlay'; -const Profile = ({ email }: { email?: string; }) => { +const Profile = ({ email }: { email?: string }) => { const emailName = email?.split('@')[0]; const capitalizedEmailName = (emailName?.charAt(0).toUpperCase() ?? '') + emailName?.slice(1); diff --git a/interface/app/$libraryId/settings/client/account/handlers/windowHandler.ts b/interface/app/$libraryId/settings/client/account/handlers/windowHandler.ts index 4fa988732..129376b5b 100644 --- a/interface/app/$libraryId/settings/client/account/handlers/windowHandler.ts +++ b/interface/app/$libraryId/settings/client/account/handlers/windowHandler.ts @@ -16,7 +16,8 @@ export default function getWindowHandler(original: WindowHandlerInterface): Wind // First try with react-router-dom's useUrlSearchParams // eslint-disable-next-line no-restricted-syntax - const params: URLSearchParams | string = (window.location as any).__TEMP_URL_PARAMS ?? ''; + const params: URLSearchParams | string = + (window.location as any).__TEMP_URL_PARAMS ?? ''; return params.toString(); // const firstQuestionMarkIndex = currentURL.indexOf('?'); diff --git a/interface/app/$libraryId/settings/client/account/index.tsx b/interface/app/$libraryId/settings/client/account/index.tsx index 795ea0d1b..61a231934 100644 --- a/interface/app/$libraryId/settings/client/account/index.tsx +++ b/interface/app/$libraryId/settings/client/account/index.tsx @@ -24,7 +24,7 @@ export const Component = () => { method: 'GET' }); const data = await user_data.json(); - console.log("Data from user (auth API)", data); + console.log('Data from user (auth API)', data); return data; } _().then((data) => {