diff --git a/Cargo.lock b/Cargo.lock index 8b5deaa49..6c68fb83c 100644 Binary files a/Cargo.lock and b/Cargo.lock differ diff --git a/apps/desktop/package.json b/apps/desktop/package.json index 9a12d60bb..82ab9b2b6 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -22,6 +22,7 @@ "@tanstack/react-query": "^4.36.1", "@tauri-apps/api": "=2.0.0-rc.0", "@tauri-apps/plugin-dialog": "=2.0.0-rc.0", + "@tauri-apps/plugin-http": "2.0.0-rc.1", "@tauri-apps/plugin-os": "=2.0.0-rc.0", "@tauri-apps/plugin-shell": "=2.0.0-rc.0", "consistent-hash": "^1.2.2", diff --git a/apps/desktop/src-tauri/Cargo.toml b/apps/desktop/src-tauri/Cargo.toml index 84d9cc29f..aff69b5e3 100644 --- a/apps/desktop/src-tauri/Cargo.toml +++ b/apps/desktop/src-tauri/Cargo.toml @@ -41,6 +41,7 @@ tauri-plugin-os = "=2.0.0-rc.0" tauri-plugin-shell = "=2.0.0-rc.0" tauri-plugin-updater = "=2.0.0-rc.0" tauri-plugin-deep-link = "=2.0.0-rc.0" +tauri-plugin-http = "2.0.0-rc.0" [dependencies.tauri] features = ["linux-libxdo", "macos-private-api", "native-tls-vendored", "unstable"] diff --git a/apps/desktop/src-tauri/capabilities/default.json b/apps/desktop/src-tauri/capabilities/default.json index 0ee040e59..20e0aa609 100644 --- a/apps/desktop/src-tauri/capabilities/default.json +++ b/apps/desktop/src-tauri/capabilities/default.json @@ -2,7 +2,9 @@ "$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", @@ -25,6 +27,20 @@ "core:window:allow-minimize", "core:window:allow-toggle-maximize", "core:window:allow-start-dragging", - "core:webview:allow-internal-toggle-devtools" + "core:webview:allow-internal-toggle-devtools", + { + "identifier": "http:default", + "allow": [ + { + "url": "https://**" + }, + { + "url": "http://**" + }, + { + "url": "http://localhost:9420/" + } + ] + } ] } diff --git a/apps/desktop/src-tauri/src/main.rs b/apps/desktop/src-tauri/src/main.rs index dfb4af182..58e781fd6 100644 --- a/apps/desktop/src-tauri/src/main.rs +++ b/apps/desktop/src-tauri/src/main.rs @@ -363,6 +363,7 @@ async fn main() -> tauri::Result<()> { .plugin(tauri_plugin_dialog::init()) .plugin(tauri_plugin_os::init()) .plugin(tauri_plugin_shell::init()) + .plugin(tauri_plugin_http::init()) // TODO: Bring back Tauri Plugin Window State - it was buggy so we removed it. .plugin(tauri_plugin_updater::Builder::new().build()) .plugin(updater::plugin()) diff --git a/apps/desktop/src/App.tsx b/apps/desktop/src/App.tsx index cd777d3d4..db633ccc8 100644 --- a/apps/desktop/src/App.tsx +++ b/apps/desktop/src/App.tsx @@ -18,6 +18,7 @@ import { RouteTitleContext } from '@sd/interface/hooks/useRouteTitle'; import '@sd/ui/style/style.scss'; +import { fetch } from '@tauri-apps/plugin-http'; import SuperTokens from 'supertokens-web-js'; import EmailPassword from 'supertokens-web-js/recipe/emailpassword'; import Session from 'supertokens-web-js/recipe/session'; @@ -58,6 +59,9 @@ SuperTokens.init({ const startupError = (window as any).__SD_ERROR__ as string | undefined; +//Set global fetch to use tauri fetch +globalThis.fetch = fetch; + export default function App() { useEffect(() => { // This tells Tauri to show the current window because it's finished loading diff --git a/core/src/node/hardware.rs b/core/src/node/hardware.rs index be0370e00..1af50b530 100644 --- a/core/src/node/hardware.rs +++ b/core/src/node/hardware.rs @@ -7,6 +7,7 @@ use strum_macros::{Display, EnumIter}; #[repr(i32)] #[derive(Debug, Clone, Display, Copy, EnumIter, Type, Serialize, Deserialize, Eq, PartialEq)] +#[specta(rename = "core_HardwareModel")] pub enum HardwareModel { Other, MacStudio, diff --git a/interface/app/$libraryId/Layout/Sidebar/DebugPopover.tsx b/interface/app/$libraryId/Layout/Sidebar/DebugPopover.tsx index 10cc65173..60a46fb70 100644 --- a/interface/app/$libraryId/Layout/Sidebar/DebugPopover.tsx +++ b/interface/app/$libraryId/Layout/Sidebar/DebugPopover.tsx @@ -174,12 +174,14 @@ export default () => { {/* */} {/* */} - - +
+ + +
{/* {platform.showDevtools && ( { diff --git a/interface/app/$libraryId/index.tsx b/interface/app/$libraryId/index.tsx index 2f0df905c..6be3b0dd3 100644 --- a/interface/app/$libraryId/index.tsx +++ b/interface/app/$libraryId/index.tsx @@ -79,7 +79,7 @@ export default (platform: Platform) => }, { path: 'auth', - lazy: () => import('./auth'), + lazy: () => import('./Layout/auth'), children: [] }, { path: '*', lazy: () => import('./404') } diff --git a/interface/app/$libraryId/settings/client/account/Tabs.tsx b/interface/app/$libraryId/settings/client/account/Tabs.tsx index e04f90615..890565c64 100644 --- a/interface/app/$libraryId/settings/client/account/Tabs.tsx +++ b/interface/app/$libraryId/settings/client/account/Tabs.tsx @@ -56,7 +56,7 @@ const Tabs = () => { // This is where Google should redirect the user back after login or error. // This URL goes on the Google's dashboard as well. - frontendRedirectURI: 'http://localhost:9420/api/auth/callback/google' + frontendRedirectURI: 'spacedrive://-/auth' }); /* diff --git a/packages/client/src/core.ts b/packages/client/src/core.ts index 4bc80ad02..00b339a1a 100644 --- a/packages/client/src/core.ts +++ b/packages/client/src/core.ts @@ -231,7 +231,7 @@ export type CursorOrderItem = { order: SortOrder; data: T } export type DefaultLocations = { desktop: boolean; documents: boolean; downloads: boolean; pictures: boolean; music: boolean; videos: boolean } -export type Device = { pub_id: DevicePubId; name: string; os: DeviceOS; storage_size: bigint; connection_id: string; created_at: string; updated_at: string } +export type Device = { pub_id: DevicePubId; name: string; os: DeviceOS; storage_size: bigint; used_storage: bigint; connection_id: string; created_at: string; updated_at: string; hardware_model: HardwareModel } export type DeviceDeleteRequest = { access_token: AccessToken; pub_id: DevicePubId } @@ -505,7 +505,7 @@ export type MediaLocation = { latitude: number; longitude: number; pluscode: Plu export type Metadata = { album: string | null; album_artist: string | null; artist: string | null; comment: string | null; composer: string | null; copyright: string | null; creation_time: string | null; date: string | null; disc: number | null; encoder: string | null; encoded_by: string | null; filename: string | null; genre: string | null; language: string | null; performer: string | null; publisher: string | null; service_name: string | null; service_provider: string | null; title: string | null; track: number | null; variant_bit_rate: number | null; custom: { [key in string]: string } } -export type MockDevice = { pub_id: DevicePubId; name: string; os: DeviceOS; used_storage: bigint; storage_size: bigint; created_at: string; updated_at: string; device_model: HardwareModel } +export type MockDevice = { pub_id: DevicePubId; name: string; os: DeviceOS; used_storage: bigint; storage_size: bigint; created_at: string; updated_at: string; device_model: core_HardwareModel } export type NodeConfigP2P = { discovery?: P2PDiscoveryState; port: Port; disabled: boolean; disable_ipv6: boolean; disable_relay: boolean; enable_remote_access: boolean; /** @@ -602,7 +602,7 @@ export type P2PDiscoveryState = "Everyone" | "ContactsOnly" | "Disabled" export type P2PEvent = { type: "PeerChange"; identity: RemoteIdentity; connection: ConnectionMethod; discovery: DiscoveryMethod; metadata: PeerMetadata; addrs: string[] } | { type: "PeerDelete"; identity: RemoteIdentity } | { type: "SpacedropRequest"; id: string; identity: RemoteIdentity; peer_name: string; files: string[] } | { type: "SpacedropProgress"; id: string; percent: number } | { type: "SpacedropTimedOut"; id: string } | { type: "SpacedropRejected"; id: string } -export type PeerMetadata = { name: string; operating_system: OperatingSystem | null; device_model: HardwareModel | null; version: string | null } +export type PeerMetadata = { name: string; operating_system: OperatingSystem | null; device_model: core_HardwareModel | null; version: string | null } export type PlusCode = string @@ -702,3 +702,5 @@ export type UpdateThumbnailerPreferences = Record export type VideoProps = { pixel_format: string | null; color_range: string | null; bits_per_channel: number | null; color_space: string | null; color_primaries: string | null; color_transfer: string | null; field_order: string | null; chroma_location: string | null; width: number; height: number; aspect_ratio_num: number | null; aspect_ratio_den: number | null; properties: string[] } export type Volume = { name: string; mount_points: string[]; total_capacity: string; available_capacity: string; disk_type: DiskType; file_system: string | null; is_root_filesystem: boolean } + +export type core_HardwareModel = "Other" | "MacStudio" | "MacBookAir" | "MacBookPro" | "MacBook" | "MacMini" | "MacPro" | "IMac" | "IMacPro" | "IPad" | "IPhone" | "Simulator" | "Android" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4255f3198..ed3e6a5a7 100644 Binary files a/pnpm-lock.yaml and b/pnpm-lock.yaml differ