First autoformat of the PR

This commit is contained in:
Arnab Chakraborty
2024-08-20 20:52:21 +03:00
parent f0b2f9c4ec
commit 81fe5f4ef2
21 changed files with 83 additions and 127 deletions

View File

@@ -34,14 +34,14 @@ uuid = { workspace = true, features = ["serde"] }
# Specific Desktop dependencies
# WARNING: Do NOT enable default features, as that vendors dbus (see below)
opener = { version = "0.7.1", features = ["reveal"], default-features = false }
specta-typescript = "=0.0.7"
tauri-plugin-dialog = "=2.0.0-rc.0"
tauri-plugin-os = "=2.0.0-rc.0"
tauri-plugin-shell = "=2.0.0-rc.0"
tauri-plugin-updater = "=2.0.0-rc.0"
opener = { version = "0.7.1", features = ["reveal"], default-features = false }
specta-typescript = "=0.0.7"
tauri-plugin-deep-link = "=2.0.0-rc.0"
tauri-plugin-http = "2.0.0-rc.0"
tauri-plugin-dialog = "=2.0.0-rc.0"
tauri-plugin-http = "2.0.0-rc.0"
tauri-plugin-os = "=2.0.0-rc.0"
tauri-plugin-shell = "=2.0.0-rc.0"
tauri-plugin-updater = "=2.0.0-rc.0"
[dependencies.tauri]
features = ["linux-libxdo", "macos-private-api", "native-tls-vendored", "unstable"]

View File

@@ -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",

View File

@@ -29,9 +29,7 @@
"transparent": true,
"center": true,
"windowEffects": {
"effects": [
"sidebar"
],
"effects": ["sidebar"],
"state": "followsWindowActiveState",
"radius": 9
}
@@ -43,11 +41,7 @@
},
"bundle": {
"active": true,
"targets": [
"deb",
"msi",
"dmg"
],
"targets": ["deb", "msi", "dmg"],
"publisher": "Spacedrive Technology Inc.",
"copyright": "Spacedrive Technology Inc.",
"category": "Productivity",
@@ -66,11 +60,7 @@
"files": {
"/usr/share/spacedrive/models/yolov8s.onnx": "../../.deps/models/yolov8s.onnx"
},
"depends": [
"libc6",
"libxdo3",
"dbus"
]
"depends": ["libc6", "libxdo3", "dbus"]
}
},
"macOS": {
@@ -114,9 +104,7 @@
"deep-link": {
"mobile": [],
"desktop": {
"schemes": [
"spacedrive"
]
"schemes": ["spacedrive"]
}
}
}

View File

@@ -37,9 +37,7 @@ pub extern "system" fn Java_com_spacedrive_core_SDCoreModule_registerCoreEventLi
if let Err(err) = result {
// TODO: Send rspc error or something here so we can show this in the UI.
// TODO: Maybe reinitialise the core cause it could be in an invalid state?
error!(
"Error in Java_com_spacedrive_core_SDCoreModule_registerCoreEventListener: {err:?}"
);
error!("Error in Java_com_spacedrive_core_SDCoreModule_registerCoreEventListener: {err:?}");
}
}
@@ -109,4 +107,4 @@ pub extern "system" fn Java_com_spacedrive_core_SDCoreModule_handleCoreMsg(
err
);
}
}
}

View File

@@ -43,7 +43,7 @@ const AccountProfile = () => {
style={tw`w-full items-center justify-start gap-1 bg-app-input !px-2`}
>
<View style={tw`w-[20px]`}>
<Envelope weight="fill" size={20} color='white' />
<Envelope weight="fill" size={20} color="white" />
</View>
<Text style={tw`text-white`}>{userInfo ? userInfo.email : ''}</Text>
</Card>

View File

@@ -1,3 +1,4 @@
import { useNavigation } from '@react-navigation/native';
import { useState } from 'react';
import { Controller } from 'react-hook-form';
import { Text, View } from 'react-native';
@@ -7,11 +8,15 @@ import { Button } from '~/components/primitive/Button';
import { Input } from '~/components/primitive/Input';
import { toast } from '~/components/primitive/Toast';
import { tw } from '~/lib/tailwind';
import { useNavigation } from '@react-navigation/native';
import { SettingsStackScreenProps } from '~/navigation/tabs/SettingsStack';
import ShowPassword from './ShowPassword';
async function signInClicked(email: string, password: string, navigator: SettingsStackScreenProps<'AccountProfile'>['navigation']) {
async function signInClicked(
email: string,
password: string,
navigator: SettingsStackScreenProps<'AccountProfile'>['navigation']
) {
try {
const req = await fetch('http://localhost:9420/api/auth/signin', {
method: 'POST',
@@ -63,7 +68,7 @@ async function signInClicked(email: string, password: string, navigator: Setting
// the frontend SDK.
toast.success('Sign in successful');
// Refresh the page to show the user is logged in
navigator.navigate('AccountProfile')
navigator.navigate('AccountProfile');
}
} catch (err: any) {
if (err.isSuperTokensGeneralError === true) {

View File

@@ -145,10 +145,10 @@ const Register = () => {
secureTextEntry={!showPassword}
/>
<ShowPassword
showPassword={showPassword}
setShowPassword={setShowPassword}
plural={true}
/>
showPassword={showPassword}
setShowPassword={setShowPassword}
plural={true}
/>
</View>
)}
/>

View File

@@ -1,2 +1 @@

View File

@@ -3,9 +3,7 @@ use std::path::Path;
// #[cfg(not(any(target_os = "ios", target_os = "android")))]
// use keyring::Entry;
use regex::Regex;
use tokio::{fs, io};
use tracing::{debug, error};
mod invalidate;
mod library;

View File

@@ -1,8 +1,4 @@
use sd_sync::*;
use std::sync::{
atomic::{self, AtomicBool},
Arc,
};
use std::sync::{atomic::AtomicBool, Arc};
use tokio::sync::Notify;
use uuid::Uuid;
@@ -29,7 +25,6 @@ pub async fn declare_actors(
db: Arc<sd_prisma::prisma::PrismaClient>,
) -> State {
let ingest_notify = Arc::new(Notify::new());
let state = State::default();
// actors
// .declare(
@@ -90,7 +85,7 @@ pub async fn declare_actors(
// )
// .await;
state
State::default()
}
macro_rules! err_break {

View File

@@ -1,34 +1,22 @@
use crate::{library::Libraries, Node};
use futures::FutureExt;
use futures_concurrency::future::Race;
use sd_actors::Stopper;
use sd_cloud_api::{library::message_collections::get::InstanceTimestamp, RequestConfigProvider};
use sd_p2p::RemoteIdentity;
use sd_prisma::prisma::{cloud_crdt_operation, instance, PrismaClient, SortOrder};
use sd_prisma::prisma::{cloud_crdt_operation, instance, PrismaClient};
use sd_sync::CRDTOperation;
use sd_utils::uuid_to_bytes;
use std::{
collections::{hash_map::Entry, HashMap},
future::IntoFuture,
str::FromStr,
sync::{
atomic::{AtomicBool, Ordering},
Arc,
},
time::Duration,
collections::HashMap,
sync::{atomic::AtomicBool, Arc},
};
use base64::prelude::*;
use chrono::Utc;
use serde_json::to_vec;
use tokio::{sync::Notify, time::sleep};
use tracing::{debug, info};
use tokio::sync::Notify;
use uuid::Uuid;
use super::{err_break, CompressedCRDTOperations};
// Responsible for downloading sync operations from the cloud to be processed by the ingester
#[allow(clippy::too_many_arguments)]

View File

@@ -1,27 +1,12 @@
use sd_actors::Stopper;
use sd_core_cloud_services::CloudServices;
use sd_core_sync::{SyncMessage, NTP64};
use sd_core_sync::SyncMessage;
use std::{
future::IntoFuture,
sync::{
atomic::{AtomicBool, Ordering},
Arc,
},
time::Duration,
};
use std::sync::{atomic::AtomicBool, Arc};
use futures::FutureExt;
use futures_concurrency::future::Race;
use tokio::{
sync::{broadcast, Notify},
time::sleep,
};
use tracing::debug;
use tokio::sync::{broadcast, Notify};
use uuid::Uuid;
use super::{err_break, CompressedCRDTOperations};
enum RaceNotifiedOrStopped {
Notified,
Stopped,

View File

@@ -1,6 +1,6 @@
use crate::{
api::{utils::InvalidateOperationEvent, CoreEvent},
cloud, invalidate_query,
invalidate_query,
location::metadata::{LocationMetadataError, SpacedriveLocationMetadataFile},
object::tag,
p2p, sync,

View File

@@ -174,7 +174,7 @@ export default () => {
{/* <FeatureFlagSelector /> */}
<InvalidateDebugPanel />
{/* <TestNotifications /> */}
<div className='flex gap-2'>
<div className="flex gap-2">
<Button size="sm" variant="gray" onClick={() => navigate('./debug/cache')}>
Cache Debug
</Button>

View File

@@ -138,7 +138,7 @@ function Tabs() {
else if (e.button === 1) removeTab(index);
}}
className={clsx(
'duration-[50ms] group relative flex h-full min-w-40 shrink-0 flex-row items-center justify-center px-8 text-center',
'group relative flex h-full min-w-40 shrink-0 flex-row items-center justify-center px-8 text-center duration-[50ms]',
ctx.tabIndex === index
? 'text-ink'
: 'top-bar-blur border-t border-sidebar-divider bg-sidebar/30 text-ink-faint/60 transition-colors hover:bg-app/50'
@@ -166,7 +166,7 @@ function Tabs() {
<Tooltip keybinds={[keybind.icon, 'T']} label={t('new_tab')}>
<button
onClick={addTab}
className="duration-[50ms] flex flex-row items-center justify-center rounded p-1.5 transition-colors hover:bg-app/80"
className="flex flex-row items-center justify-center rounded p-1.5 transition-colors duration-[50ms] hover:bg-app/80"
>
<Plus weight="bold" size={14} />
</button>

View File

@@ -3,6 +3,7 @@ import { Controller } from 'react-hook-form';
import { signIn } from 'supertokens-web-js/recipe/emailpassword';
import { nonLibraryClient, useZodForm } from '@sd/client';
import { Button, Form, Input, toast, z } from '@sd/ui';
import ShowPassword from './ShowPassword';
async function signInClicked(email: string, password: string) {

View File

@@ -1,8 +1,9 @@
import { zodResolver } from '@hookform/resolvers/zod';
import { Button, Form, Input, toast, z } from '@sd/ui';
import { useState } from 'react';
import { Controller, useForm } from 'react-hook-form';
import { signUp } from 'supertokens-web-js/recipe/emailpassword';
import { Button, Form, Input, toast, z } from '@sd/ui';
import ShowPassword from './ShowPassword';
const RegisterSchema = z

View File

@@ -1,6 +1,6 @@
import { CookieHandlerInterface } from "supertokens-website/utils/cookieHandler/types";
import { CookieHandlerInterface } from 'supertokens-website/utils/cookieHandler/types';
const frontendCookiesKey = "frontendCookies";
const frontendCookiesKey = 'frontendCookies';
/**
* Tauri handles cookies differently than in browser environments. The SuperTokens
@@ -12,8 +12,8 @@ function getCookiesFromStorage(): string {
const cookiesFromStorage = window.localStorage.getItem(frontendCookiesKey);
if (cookiesFromStorage === null) {
window.localStorage.setItem(frontendCookiesKey, "[]");
return "";
window.localStorage.setItem(frontendCookiesKey, '[]');
return '';
}
/**
@@ -25,20 +25,20 @@ function getCookiesFromStorage(): string {
for (let cookieIndex = 0; cookieIndex < cookieArrayInStorage.length; cookieIndex++) {
const currentCookieString = cookieArrayInStorage[cookieIndex];
const parts = currentCookieString?.split(";");
let expirationString: string = "";
const parts = currentCookieString?.split(';');
let expirationString: string = '';
for (let partIndex = 0; partIndex < parts!.length; partIndex++) {
const currentPart = parts![partIndex];
if (currentPart!.toLocaleLowerCase().includes("expires=")) {
if (currentPart!.toLocaleLowerCase().includes('expires=')) {
expirationString = currentPart!;
break;
}
}
if (expirationString !== "") {
const expirationValueString = expirationString.split("=")[1];
if (expirationString !== '') {
const expirationValueString = expirationString.split('=')[1];
const expirationDate = new Date(expirationValueString!);
const currentTimeInMillis = Date.now();
@@ -57,11 +57,11 @@ function getCookiesFromStorage(): string {
*/
window.localStorage.setItem(frontendCookiesKey, JSON.stringify(cookieArrayToReturn));
return cookieArrayToReturn.join("; ");
return cookieArrayToReturn.join('; ');
}
function setCookieToStorage(cookieString: string) {
const cookieName = cookieString.split(";")[0]!.split("=")[0];
const cookieName = cookieString.split(';')[0]!.split('=')[0];
const cookiesFromStorage = window.localStorage.getItem(frontendCookiesKey);
let cookiesArray: string[] = [];
@@ -105,6 +105,6 @@ export default function getCookieHandler(original: CookieHandlerInterface): Cook
},
setCookie: async function (cookieString: string) {
setCookieToStorage(cookieString);
},
}
};
}

View File

@@ -1,4 +1,4 @@
import { WindowHandlerInterface } from "supertokens-website/utils/windowHandler/types";
import { WindowHandlerInterface } from 'supertokens-website/utils/windowHandler/types';
/**
* This example app uses HashRouter from react-router-dom. The SuperTokens SDK relies on
@@ -13,76 +13,76 @@ export default function getWindowHandler(original: WindowHandlerInterface): Wind
...original.location,
getSearch: function () {
const currentURL = window.location.href;
const firstQuestionMarkIndex = currentURL.indexOf("?");
const firstQuestionMarkIndex = currentURL.indexOf('?');
if (firstQuestionMarkIndex !== -1) {
// Return the query string from the url
let queryString = currentURL.substring(firstQuestionMarkIndex);
// Remove any hash
if (queryString.includes("#")) {
queryString = queryString.split("#")[0] ?? "";
if (queryString.includes('#')) {
queryString = queryString.split('#')[0] ?? '';
}
return queryString;
}
return "";
return '';
},
getHash: function () {
// Location hash always starts with a #, when returning we prepend it
let locationHash = window.location.hash;
if (locationHash === "") {
return "#";
if (locationHash === '') {
return '#';
}
if (locationHash.startsWith("#")) {
if (locationHash.startsWith('#')) {
// Remove the starting pound symbol
locationHash = locationHash.substring(1);
}
if (!locationHash.includes("#")) {
if (!locationHash.includes('#')) {
// The remaining string did not have any "#" character
return "#";
return '#';
}
const locationSplit = locationHash.split("#");
const locationSplit = locationHash.split('#');
if (locationSplit.length < 2) {
// The string contains a "#" but is followed by nothing
return "#";
return '#';
}
return "#" + locationSplit[1];
return '#' + locationSplit[1];
},
getOrigin: function () {
return "http://localhost:8001";
return 'http://localhost:8001';
},
getHostName: function () {
return "localhost";
return 'localhost';
},
getPathName: function () {
let locationHash = window.location.hash;
if (locationHash === "") {
return "";
if (locationHash === '') {
return '';
}
if (locationHash.startsWith("#")) {
if (locationHash.startsWith('#')) {
// Remove the starting pound symbol
locationHash = locationHash.substring(1);
}
locationHash = locationHash.split("?")[0] ?? "";
locationHash = locationHash.split('?')[0] ?? '';
if (locationHash.includes("#")) {
if (locationHash.includes('#')) {
// Remove location hash
locationHash = locationHash.split("#")[0] ?? "";
locationHash = locationHash.split('#')[0] ?? '';
}
return locationHash;
},
},
}
}
};
}

View File

@@ -88,7 +88,7 @@ export default (props: Props) => {
exit={{ height: 0, opacity: 0 }}
className="relative mt-2 flex origin-top flex-col gap-1 pl-8"
>
<div className="absolute inset-y-0 left-6 mb-7 w-[2px] rounded-t-full bg-[#5E5F69] "></div>
<div className="absolute inset-y-0 left-6 mb-7 w-[2px] rounded-t-full bg-[#5E5F69]"></div>
{cloudDevicesList.data?.map(
(

View File

@@ -1,6 +1,6 @@
import { useEffect } from "react";
import { useNavigate } from "react-router";
import { DeeplinkEvent } from "~/util/events";
import { useEffect } from 'react';
import { useNavigate } from 'react-router';
import { DeeplinkEvent } from '~/util/events';
export const useDeeplinkEventHandler = () => {
const navigate = useNavigate();
@@ -17,4 +17,4 @@ export const useDeeplinkEventHandler = () => {
document.addEventListener('deeplink', handler);
return () => document.removeEventListener('deeplink', handler);
}, [navigate]);
}
};