mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-02-20 07:37:26 -05:00
[ENG-1928] Update to tauri 2.0.1 stable (#2752)
* Update to tauri 2.0.0 stable - Update a some othe dependencies - Autoformat rust and toml files * Fix clippy complain * Update tauri 2.0.1 - Update rspc - Update some frontend files due changes in rspc - Update some frontend build dependencies * Revert babel update * Fix code typing typing and style + a couple of bugs * More type fixes
This commit is contained in:
committed by
GitHub
parent
f4622b5d2f
commit
cdc50140b0
BIN
Cargo.lock
generated
BIN
Cargo.lock
generated
Binary file not shown.
18
Cargo.toml
18
Cargo.toml
@@ -21,7 +21,7 @@ rust-version = "1.81"
|
||||
[workspace.dependencies]
|
||||
# Third party dependencies used by one or more of our crates
|
||||
async-channel = "2.3"
|
||||
async-stream = "0.3.5"
|
||||
async-stream = "0.3.6"
|
||||
async-trait = "0.1.80"
|
||||
axum = "0.6.20" # Update blocked by hyper
|
||||
base64 = "0.22.1"
|
||||
@@ -30,7 +30,7 @@ chrono = "0.4.38"
|
||||
ed25519-dalek = "2.1"
|
||||
futures = "0.3.30"
|
||||
futures-concurrency = "7.6"
|
||||
globset = "0.4.14"
|
||||
globset = "0.4.15"
|
||||
http = "0.2" # Update blocked by axum
|
||||
hyper = "0.14" # Update blocked due to API breaking changes
|
||||
image = "0.24.9" # Update blocked due to https://github.com/image-rs/image/issues/2230
|
||||
@@ -41,7 +41,7 @@ mimalloc = "0.1.43"
|
||||
normpath = "1.2"
|
||||
pin-project-lite = "0.2.14"
|
||||
rand = "0.9.0-alpha.2"
|
||||
regex = "1.10"
|
||||
regex = "1.11"
|
||||
reqwest = { version = "0.11", default-features = false } # Update blocked by hyper
|
||||
rmp = "0.8.14"
|
||||
rmp-serde = "1.3"
|
||||
@@ -52,11 +52,11 @@ serde_json = "1.0"
|
||||
specta = "=2.0.0-rc.20"
|
||||
strum = "0.26"
|
||||
strum_macros = "0.26"
|
||||
tempfile = "3.10"
|
||||
tempfile = "3.13"
|
||||
thiserror = "1.0"
|
||||
tokio = "1.38"
|
||||
tokio-stream = "0.1.15"
|
||||
tokio-util = "0.7.11"
|
||||
tokio = "1.40"
|
||||
tokio-stream = "0.1.16"
|
||||
tokio-util = "0.7.12"
|
||||
tracing = "0.1.40"
|
||||
tracing-subscriber = "0.3.18"
|
||||
tracing-test = "0.2.5"
|
||||
@@ -81,10 +81,10 @@ rev = "4f9ef9d38c"
|
||||
git = "https://github.com/spacedriveapp/if-watch.git"
|
||||
rev = "a92c17d3f8"
|
||||
|
||||
# We hack it to the high heavens
|
||||
# We use our own version of rspc
|
||||
[patch.crates-io.rspc]
|
||||
git = "https://github.com/spacedriveapp/rspc.git"
|
||||
rev = "0018e80231"
|
||||
rev = "bc882f4724"
|
||||
|
||||
# Add `Control::open_stream_with_addrs`
|
||||
[patch.crates-io.libp2p]
|
||||
|
||||
@@ -13,5 +13,5 @@ tokio = { workspace = true, features = ["fs"] }
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
wgpu = { version = "22.1", default-features = false }
|
||||
# WARNING: gtk should follow the same version used by tauri
|
||||
# https://github.com/tauri-apps/tauri/blob/tauri-v2.0.0-rc.2/core/tauri/Cargo.toml
|
||||
# https://github.com/tauri-apps/tauri/blob/tauri-v2.0.0/crates/tauri/Cargo.toml#L100
|
||||
gtk = { version = "0.18", features = ["v3_24"] }
|
||||
|
||||
@@ -12,18 +12,18 @@
|
||||
"lint": "eslint src --cache"
|
||||
},
|
||||
"dependencies": {
|
||||
"@oscartbeaumont-sd/rspc-client": "=0.0.0-main-dc31e5b2",
|
||||
"@oscartbeaumont-sd/rspc-tauri": "=0.0.0-main-dc31e5b2",
|
||||
"@oscartbeaumont-sd/rspc-client": "github:spacedriveapp/rspc#path:packages/client&bc882f4724",
|
||||
"@oscartbeaumont-sd/rspc-tauri": "github:spacedriveapp/rspc#path:packages/tauri&bc882f4724",
|
||||
"@remix-run/router": "=1.13.1",
|
||||
"@sd/client": "workspace:*",
|
||||
"@sd/interface": "workspace:*",
|
||||
"@sd/ui": "workspace:*",
|
||||
"@t3-oss/env-core": "^0.7.1",
|
||||
"@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-os": "=2.0.0-rc.0",
|
||||
"@tauri-apps/plugin-shell": "=2.0.0-rc.0",
|
||||
"@tauri-apps/api": "=2.0.1",
|
||||
"@tauri-apps/plugin-dialog": "2.0.0",
|
||||
"@tauri-apps/plugin-os": "2.0.0",
|
||||
"@tauri-apps/plugin-shell": "2.0.0",
|
||||
"consistent-hash": "^1.2.2",
|
||||
"immer": "^10.0.3",
|
||||
"react": "^18.2.0",
|
||||
@@ -34,11 +34,11 @@
|
||||
"devDependencies": {
|
||||
"@sd/config": "workspace:*",
|
||||
"@sentry/vite-plugin": "^2.16.0",
|
||||
"@tauri-apps/cli": "=2.0.0-rc.3",
|
||||
"@tauri-apps/cli": "2.0.1",
|
||||
"@types/react": "^18.2.67",
|
||||
"@types/react-dom": "^18.2.22",
|
||||
"sass": "^1.72.0",
|
||||
"typescript": "^5.4.2",
|
||||
"typescript": "^5.6.2",
|
||||
"vite": "^5.2.0",
|
||||
"vite-tsconfig-paths": "^4.3.2"
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ http = { workspace = true }
|
||||
hyper = { workspace = true }
|
||||
prisma-client-rust = { workspace = true }
|
||||
rand = { workspace = true }
|
||||
rspc = { workspace = true, features = ["tauri", "tracing"] }
|
||||
rspc = { workspace = true, features = ["tauri"] }
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
specta = { workspace = true }
|
||||
@@ -36,22 +36,22 @@ uuid = { workspace = true, features = ["serde"] }
|
||||
# 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"
|
||||
tauri-plugin-dialog = "=2.0.1"
|
||||
tauri-plugin-os = "=2.0.1"
|
||||
tauri-plugin-shell = "=2.0.1"
|
||||
tauri-plugin-updater = "=2.0.2"
|
||||
|
||||
# memory allocator
|
||||
mimalloc = { workspace = true }
|
||||
|
||||
[dependencies.tauri]
|
||||
features = ["linux-libxdo", "macos-private-api", "native-tls-vendored", "unstable"]
|
||||
version = "=2.0.0-rc.2"
|
||||
version = "=2.0.1"
|
||||
|
||||
[dependencies.tauri-specta]
|
||||
features = ["derive", "typescript"]
|
||||
git = "https://github.com/spacedriveapp/tauri-specta"
|
||||
rev = "6069a05029"
|
||||
rev = "1baf68be47"
|
||||
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
# Spacedrive Sub-crates
|
||||
@@ -60,8 +60,8 @@ sd-desktop-linux = { path = "../crates/linux" }
|
||||
# Specific Desktop dependencies
|
||||
# WARNING: dbus must NOT be vendored, as that breaks the app on Linux,X11,Nvidia
|
||||
dbus = { version = "0.9.7", features = ["stdfd"] }
|
||||
# https://github.com/tauri-apps/tauri/blob/tauri-v2.0.0-rc.2/core/tauri/Cargo.toml#L86
|
||||
webkit2gtk = { version = "=2.0.1", features = ["v2_38"] }
|
||||
# https://github.com/tauri-apps/tauri/blob/tauri-v2.0.0/crates/tauri/Cargo.toml#L101
|
||||
webkit2gtk = { version = "=2.0.1", features = ["v2_40"] }
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
# Spacedrive Sub-crates
|
||||
@@ -73,7 +73,7 @@ sd-desktop-windows = { path = "../crates/windows" }
|
||||
|
||||
[build-dependencies]
|
||||
# Specific Desktop dependencies
|
||||
tauri-build = "=2.0.0-rc.2"
|
||||
tauri-build = "=2.0.1"
|
||||
|
||||
[features]
|
||||
ai-models = ["sd-core/ai"]
|
||||
|
||||
2
apps/desktop/src/commands.ts
generated
2
apps/desktop/src/commands.ts
generated
@@ -203,7 +203,7 @@ export type Update = { version: string };
|
||||
type __EventObj__<T> = {
|
||||
listen: (cb: TAURI_API_EVENT.EventCallback<T>) => ReturnType<typeof TAURI_API_EVENT.listen<T>>;
|
||||
once: (cb: TAURI_API_EVENT.EventCallback<T>) => ReturnType<typeof TAURI_API_EVENT.once<T>>;
|
||||
emit: T extends null
|
||||
emit: null extends T
|
||||
? (payload?: T) => ReturnType<typeof TAURI_API_EVENT.emit>
|
||||
: (payload: T) => ReturnType<typeof TAURI_API_EVENT.emit>;
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { tauriLink } from '@oscartbeaumont-sd/rspc-tauri/v2';
|
||||
import { tauriLink } from '@oscartbeaumont-sd/rspc-tauri/src/v2';
|
||||
|
||||
globalThis.isDev = import.meta.env.DEV;
|
||||
globalThis.rspcLinks = [
|
||||
|
||||
@@ -73,10 +73,7 @@ export const platform = {
|
||||
if (opts?.multiple) return result as any; // Tauri don't properly type narrow on `multiple` argument
|
||||
return result;
|
||||
},
|
||||
openFilePickerDialog: () =>
|
||||
dialogOpen({
|
||||
multiple: true
|
||||
}).then((result) => result?.map((r) => r.path) ?? null),
|
||||
openFilePickerDialog: () => dialogOpen({ multiple: true }),
|
||||
saveFilePickerDialog: (opts) => dialogSave(opts),
|
||||
showDevtools: () => invoke('show_devtools'),
|
||||
confirm: (msg, cb) => confirm(msg).then(cb),
|
||||
|
||||
@@ -13,6 +13,7 @@ module.exports = {
|
||||
],
|
||||
'tailwindcss/no-contradicting-classname': 'warn',
|
||||
'tailwindcss/enforces-shorthand': 'off',
|
||||
'@typescript-eslint/no-require-imports': 'off',
|
||||
'no-restricted-imports': [
|
||||
'error',
|
||||
{
|
||||
|
||||
@@ -5,9 +5,6 @@ const path = require('path');
|
||||
// Needed for transforming svgs from @sd/assets
|
||||
const [reactSVGPath, reactSVGExclude] = resolveUniqueModule('react-native-svg');
|
||||
|
||||
const [rspcClientPath, rspcClientExclude] = resolveUniqueModule('@oscartbeaumont-sd/rspc-client');
|
||||
const [rspcReactPath, rspcReactExclude] = resolveUniqueModule('@oscartbeaumont-sd/rspc-react');
|
||||
|
||||
const { getDefaultConfig } = require('expo/metro-config');
|
||||
const expoDefaultConfig = getDefaultConfig(__dirname);
|
||||
|
||||
@@ -23,7 +20,7 @@ const metroConfig = makeMetroConfig({
|
||||
extraNodeModules: {
|
||||
'react-native-svg': reactSVGPath
|
||||
},
|
||||
blockList: exclusionList([reactSVGExclude, rspcClientExclude, rspcReactExclude]),
|
||||
blockList: exclusionList([reactSVGExclude]),
|
||||
sourceExts: [...expoDefaultConfig.resolver.sourceExts, 'svg'],
|
||||
assetExts: expoDefaultConfig.resolver.assetExts.filter((ext) => ext !== 'svg'),
|
||||
disableHierarchicalLookup: false,
|
||||
@@ -31,22 +28,6 @@ const metroConfig = makeMetroConfig({
|
||||
path.resolve(projectRoot, 'node_modules'),
|
||||
path.resolve(workspaceRoot, 'node_modules')
|
||||
],
|
||||
resolveRequest: (context, moduleName, platform) => {
|
||||
if (moduleName.startsWith('@oscartbeaumont-sd/rspc-client/v2')) {
|
||||
return {
|
||||
filePath: path.resolve(rspcClientPath, 'dist', 'v2.js'),
|
||||
type: 'sourceFile'
|
||||
};
|
||||
}
|
||||
if (moduleName.startsWith('@oscartbeaumont-sd/rspc-react/v2')) {
|
||||
return {
|
||||
filePath: path.resolve(rspcReactPath, 'dist', 'v2.js'),
|
||||
type: 'sourceFile'
|
||||
};
|
||||
}
|
||||
// Optionally, chain to the standard Metro resolver.
|
||||
return context.resolveRequest(context, moduleName, platform);
|
||||
},
|
||||
platforms: ['ios', 'android']
|
||||
},
|
||||
transformer: {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { AlphaRSPCError, Link, RspcRequest } from '@oscartbeaumont-sd/rspc-client/v2';
|
||||
import { AlphaRSPCError, Link, RspcRequest } from '@oscartbeaumont-sd/rspc-client/src/v2';
|
||||
import { EventEmitter, requireNativeModule } from 'expo-modules-core';
|
||||
|
||||
// It loads the native module object from the JSI or falls back to
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
"@dr.pogodin/react-native-fs": "^2.24.1",
|
||||
"@gorhom/bottom-sheet": "^4.6.1",
|
||||
"@hookform/resolvers": "^3.1.0",
|
||||
"@oscartbeaumont-sd/rspc-client": "=0.0.0-main-dc31e5b2",
|
||||
"@oscartbeaumont-sd/rspc-react": "=0.0.0-main-dc31e5b2",
|
||||
"@oscartbeaumont-sd/rspc-client": "github:spacedriveapp/rspc#path:packages/client&bc882f4724",
|
||||
"@oscartbeaumont-sd/rspc-react": "github:spacedriveapp/rspc#path:packages/react&bc882f4724",
|
||||
"@react-native-async-storage/async-storage": "~1.23.1",
|
||||
"@react-native-masked-view/masked-view": "^0.3.1",
|
||||
"@react-navigation/bottom-tabs": "^6.5.19",
|
||||
@@ -33,7 +33,7 @@
|
||||
"@sd/client": "workspace:*",
|
||||
"@shopify/flash-list": "1.6.4",
|
||||
"@tanstack/react-query": "^4.36.1",
|
||||
"babel-preset-solid": "^1.8.9",
|
||||
"babel-preset-solid": "^1.9.0",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"dayjs": "^1.11.10",
|
||||
"event-target-polyfill": "^0.0.4",
|
||||
@@ -82,7 +82,7 @@
|
||||
"@rnx-kit/metro-config": "^1.3.15",
|
||||
"@sd/config": "workspace:*",
|
||||
"@types/react": "^18.2.79",
|
||||
"babel-plugin-module-resolver": "^5.0.0",
|
||||
"babel-plugin-module-resolver": "^5.0.2",
|
||||
"eslint-plugin-react-native": "^4.1.0",
|
||||
"react-native-svg-transformer": "^1.3.0",
|
||||
"typescript": "^5.3.3"
|
||||
|
||||
@@ -108,7 +108,7 @@ function AppNavigation() {
|
||||
if (navRef.getRootState().routeNames.includes('GetStarted')) {
|
||||
return;
|
||||
}
|
||||
currentRouteName && setCurrentPath(currentRouteName);
|
||||
if (currentRouteName) setCurrentPath(currentRouteName);
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -25,7 +25,7 @@ const DrawerLibraryManager = () => {
|
||||
}, [isDrawerOpen]);
|
||||
|
||||
const { library: currentLibrary, libraries } = useClientContext();
|
||||
const navigation = useNavigation();
|
||||
const navigation = useNavigation<any>();
|
||||
|
||||
const modalRef = useRef<ModalRef>(null);
|
||||
const modalRef_import = useRef<ModalRef>(null);
|
||||
|
||||
@@ -63,9 +63,8 @@ const Explorer = (props: Props) => {
|
||||
showAppsSuggestions: false, // If there is not an installed app that can open the file, open the Play Store with suggested apps
|
||||
showOpenWithDialog: true // if there is more than one app that can open the file, show an Open With dialogue box
|
||||
});
|
||||
filePath &&
|
||||
filePath.object_id &&
|
||||
(await libraryClient.mutation(['files.updateAccessTime', [filePath.object_id]]));
|
||||
if (filePath && filePath.object_id)
|
||||
await libraryClient.mutation(['files.updateAccessTime', [filePath.object_id]]);
|
||||
} catch (error) {
|
||||
toast.error('Error opening object');
|
||||
}
|
||||
|
||||
@@ -170,10 +170,11 @@ const toastErrorSuccess = (
|
||||
) => {
|
||||
return {
|
||||
onError: () => {
|
||||
errorMessage && toast.error(errorMessage);
|
||||
if (errorMessage) toast.error(errorMessage);
|
||||
},
|
||||
onSuccess: () => {
|
||||
successMessage && toast.success(successMessage), successCallBack?.();
|
||||
if (successMessage) toast.success(successMessage);
|
||||
successCallBack?.();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -102,9 +102,8 @@ export const ActionsModal = () => {
|
||||
showAppsSuggestions: false, // If there is not an installed app that can open the file, open the Play Store with suggested apps
|
||||
showOpenWithDialog: true // if there is more than one app that can open the file, show an Open With dialogue box
|
||||
});
|
||||
filePath &&
|
||||
filePath.object_id &&
|
||||
(await updateAccessTime.mutateAsync([filePath.object_id]).catch(console.error));
|
||||
if (filePath && filePath.object_id)
|
||||
await updateAccessTime.mutateAsync([filePath.object_id]).catch(console.error);
|
||||
} catch (error) {
|
||||
toast.error('Error opening object');
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { useSearchStore } from '~/stores/searchStore';
|
||||
|
||||
const SaveSearchModal = forwardRef<ModalRef>((_, ref) => {
|
||||
const [searchName, setSearchName] = useState('');
|
||||
const navigation = useNavigation();
|
||||
const navigation = useNavigation<any>();
|
||||
const searchStore = useSearchStore();
|
||||
const saveSearch = useLibraryMutation('search.saved.create', {
|
||||
onSuccess: () => {
|
||||
|
||||
@@ -19,7 +19,7 @@ interface CategoryItemProps {
|
||||
}
|
||||
|
||||
const CategoryItem = ({ name, icon, items, style, kind }: CategoryItemProps) => {
|
||||
const navigation = useNavigation();
|
||||
const navigation = useNavigation<any>();
|
||||
const searchStore = useSearchStore();
|
||||
return (
|
||||
<Pressable
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as RNFS from '@dr.pogodin/react-native-fs';
|
||||
import { AlphaRSPCError } from '@oscartbeaumont-sd/rspc-client/v2';
|
||||
import { AlphaRSPCError } from '@oscartbeaumont-sd/rspc-client/src/v2';
|
||||
import { UseQueryResult } from '@tanstack/react-query';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Platform, Text, View } from 'react-native';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as RNFS from '@dr.pogodin/react-native-fs';
|
||||
import { AlphaRSPCError } from '@oscartbeaumont-sd/rspc-client/v2';
|
||||
import { AlphaRSPCError } from '@oscartbeaumont-sd/rspc-client/src/v2';
|
||||
import { UseQueryResult } from '@tanstack/react-query';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Platform, Text, View } from 'react-native';
|
||||
|
||||
@@ -67,7 +67,7 @@ interface Props {
|
||||
}
|
||||
|
||||
const SavedSearch = ({ search }: Props) => {
|
||||
const navigation = useNavigation();
|
||||
const navigation = useNavigation<any>();
|
||||
const dataForSearch = useSavedSearch(search);
|
||||
const rspc = useRspcLibraryContext();
|
||||
const deleteSearch = useLibraryMutation('search.saved.delete', {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { IconTypes } from '@sd/assets/util';
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { SavedSearch, SearchFilterArgs, useLibraryQuery } from '@sd/client';
|
||||
import { SavedSearch, SearchFilterArgs, Tag, useLibraryQuery } from '@sd/client';
|
||||
import { kinds } from '~/components/search/filters/Kind';
|
||||
import { Filters, SearchFilters } from '~/stores/searchStore';
|
||||
|
||||
@@ -56,7 +57,14 @@ export function useSavedSearch(search: SavedSearch) {
|
||||
// it is then 'matched' with the data from the "Saved Search"
|
||||
|
||||
const prepFilters = useCallback(() => {
|
||||
const data = {} as Record<SearchFilters, any>;
|
||||
const data = {
|
||||
locations: undefined as undefined | { id: number; name: string | null }[],
|
||||
tags: undefined as undefined | { id: number; color: string | null }[],
|
||||
kind: undefined as undefined | { name: string; id: number; icon: IconTypes }[],
|
||||
name: [] as unknown[],
|
||||
extension: [] as unknown[],
|
||||
hidden: []
|
||||
};
|
||||
filterKeys.forEach((key: SearchFilters) => {
|
||||
switch (key) {
|
||||
case 'locations':
|
||||
@@ -97,7 +105,7 @@ export function useSavedSearch(search: SavedSearch) {
|
||||
|
||||
const filters: Partial<Filters> = useMemo(() => {
|
||||
return parseFilters.reduce(
|
||||
(acc: Record<SearchFilters, {}>, curr: keyof SearchFilterArgs) => {
|
||||
(acc: Record<SearchFilters, unknown>, curr: keyof SearchFilterArgs) => {
|
||||
const objectOrFilePath = Object.keys(curr)[0] as 'filePath' | 'object';
|
||||
const key = Object.keys(curr[objectOrFilePath])[0] as SearchFilters; //locations, tags, kind, etc...
|
||||
|
||||
@@ -113,12 +121,22 @@ export function useSavedSearch(search: SavedSearch) {
|
||||
switch (type) {
|
||||
case 'contains':
|
||||
// some filters have a name property and some are just strings
|
||||
return prepFilters()[key].filter((item: any) => {
|
||||
return item.name ? item.name === values[type] : item;
|
||||
return prepFilters()[key]?.filter((item: unknown) => {
|
||||
return typeof item === 'object' &&
|
||||
item != null &&
|
||||
'name' in item &&
|
||||
item.name
|
||||
? item.name === values[type]
|
||||
: item;
|
||||
});
|
||||
case 'in':
|
||||
return prepFilters()[key].filter((item: any) =>
|
||||
values[type]?.includes(item.id)
|
||||
return prepFilters()[key]?.filter(
|
||||
(item: unknown) =>
|
||||
typeof item === 'object' &&
|
||||
item != null &&
|
||||
'id' in item &&
|
||||
typeof item.id === 'number' &&
|
||||
values[type]?.includes(item.id)
|
||||
);
|
||||
default:
|
||||
return values;
|
||||
|
||||
@@ -42,11 +42,3 @@ export type RootStackScreenProps<Screen extends keyof RootStackParamList> = Nati
|
||||
RootStackParamList,
|
||||
Screen
|
||||
>;
|
||||
|
||||
// This declaration is used by useNavigation, Link, ref etc.
|
||||
declare global {
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
namespace ReactNavigation {
|
||||
interface RootParamList extends RootStackParamList {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ const { width } = Dimensions.get('window');
|
||||
|
||||
const BackfillWaiting = () => {
|
||||
const animation = useSharedValue(0);
|
||||
const navigation = useNavigation();
|
||||
const navigation = useNavigation<any>();
|
||||
|
||||
useEffect(() => {
|
||||
animation.value = withRepeat(
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"rollup-plugin-node-builtins": "^2.1.2",
|
||||
"storybook": "^8.0.1",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"typescript": "^5.4.2",
|
||||
"typescript": "^5.6.2",
|
||||
"vite": "^5.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"lint": "eslint src --cache"
|
||||
},
|
||||
"dependencies": {
|
||||
"@oscartbeaumont-sd/rspc-client": "=0.0.0-main-dc31e5b2",
|
||||
"@oscartbeaumont-sd/rspc-client": "github:spacedriveapp/rspc#path:packages/client&bc882f4724",
|
||||
"@sd/client": "workspace:*",
|
||||
"@sd/interface": "workspace:*",
|
||||
"@tanstack/react-query": "^4.36.1",
|
||||
@@ -40,7 +40,7 @@
|
||||
"postcss": "^8.4.36",
|
||||
"rollup-plugin-visualizer": "^5.12.0",
|
||||
"start-server-and-test": "^2.0.3",
|
||||
"typescript": "^5.4.2",
|
||||
"typescript": "^5.6.2",
|
||||
"vite": "^5.2.0",
|
||||
"vite-tsconfig-paths": "^4.3.2"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { wsBatchLink } from '@oscartbeaumont-sd/rspc-client/v2';
|
||||
import { wsBatchLink } from '@oscartbeaumont-sd/rspc-client/src/v2';
|
||||
|
||||
globalThis.isDev = import.meta.env.DEV;
|
||||
globalThis.rspcLinks = [
|
||||
|
||||
@@ -63,7 +63,7 @@ regex = { workspace = true }
|
||||
reqwest = { workspace = true, features = ["json", "native-tls-vendored"] }
|
||||
rmp-serde = { workspace = true }
|
||||
rmpv = { workspace = true }
|
||||
rspc = { workspace = true, features = ["alpha", "axum", "chrono", "tracing", "unstable", "uuid"] }
|
||||
rspc = { workspace = true, features = ["alpha", "axum", "chrono", "unstable", "uuid"] }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json = { workspace = true }
|
||||
specta = { workspace = true }
|
||||
|
||||
@@ -404,7 +404,7 @@ impl ReportBuilder {
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn new(id: JobId, name: JobName) -> Self {
|
||||
pub const fn new(id: JobId, name: JobName) -> Self {
|
||||
Self {
|
||||
id,
|
||||
name,
|
||||
|
||||
@@ -92,7 +92,7 @@ pub static ALL_THUMBNAILABLE_EXTENSIONS: LazyLock<Vec<Extension>> = LazyLock::ne
|
||||
THUMBNAILABLE_EXTENSIONS.clone()
|
||||
});
|
||||
|
||||
static WEBP_CONFIG: std::sync::LazyLock<WebPConfig> = std::sync::LazyLock::new(|| {
|
||||
static WEBP_CONFIG: LazyLock<WebPConfig> = LazyLock::new(|| {
|
||||
let mut config = WebPConfig::new().expect("failed to instantiate global webp config");
|
||||
config.lossless = 0;
|
||||
config.alpha_compression = 1;
|
||||
|
||||
@@ -42,7 +42,7 @@ pub(crate) fn mount() -> AlphaRouter<Ctx> {
|
||||
|
||||
let auth_response = match match node
|
||||
.http
|
||||
.post(&format!(
|
||||
.post(format!(
|
||||
"{}/login/device/code",
|
||||
&node.env.api_url.lock().await
|
||||
))
|
||||
@@ -74,7 +74,7 @@ pub(crate) fn mount() -> AlphaRouter<Ctx> {
|
||||
tokio::time::sleep(Duration::from_secs(5)).await;
|
||||
|
||||
let token_resp = match node.http
|
||||
.post(&format!("{}/login/oauth/access_token", &node.env.api_url.lock().await))
|
||||
.post(format!("{}/login/oauth/access_token", &node.env.api_url.lock().await))
|
||||
.form(&[
|
||||
("grant_type", sd_cloud_api::auth::DEVICE_CODE_URN),
|
||||
("device_code", &auth_response.device_code),
|
||||
|
||||
@@ -47,7 +47,7 @@ pub async fn update_library_statistics(
|
||||
node.config
|
||||
.data_directory()
|
||||
.join("libraries")
|
||||
.join(&format!("{}.db", library.id)),
|
||||
.join(format!("{}.db", library.id)),
|
||||
)
|
||||
.await
|
||||
.unwrap_or(0);
|
||||
|
||||
@@ -127,11 +127,10 @@ impl ModelAndSession {
|
||||
self.maybe_model = Some(new_model);
|
||||
self.maybe_session = Some(session);
|
||||
})
|
||||
.map_err(|e| {
|
||||
.inspect_err(|e| {
|
||||
error!("Failed to load new model: {e:#?}");
|
||||
self.maybe_model = None;
|
||||
self.maybe_session = None;
|
||||
|
||||
e
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ pub mod user {
|
||||
|
||||
config
|
||||
.client
|
||||
.get(&format!("{}/api/v1/user/me", config.api_url))
|
||||
.get(format!("{}/api/v1/user/me", config.api_url))
|
||||
.with_auth(auth_token)
|
||||
.send()
|
||||
.await
|
||||
@@ -153,7 +153,7 @@ pub mod library {
|
||||
|
||||
config
|
||||
.client
|
||||
.get(&format!(
|
||||
.get(format!(
|
||||
"{}/api/v1/libraries/{}",
|
||||
config.api_url, library_id
|
||||
))
|
||||
@@ -180,7 +180,7 @@ pub mod library {
|
||||
|
||||
config
|
||||
.client
|
||||
.get(&format!("{}/api/v1/libraries", config.api_url))
|
||||
.get(format!("{}/api/v1/libraries", config.api_url))
|
||||
.with_auth(auth_token)
|
||||
.send()
|
||||
.await
|
||||
@@ -219,7 +219,7 @@ pub mod library {
|
||||
|
||||
config
|
||||
.client
|
||||
.post(&format!(
|
||||
.post(format!(
|
||||
"{}/api/v1/libraries/{}",
|
||||
config.api_url, library_id
|
||||
))
|
||||
@@ -256,7 +256,7 @@ pub mod library {
|
||||
|
||||
config
|
||||
.client
|
||||
.patch(&format!(
|
||||
.patch(format!(
|
||||
"{}/api/v1/libraries/{}",
|
||||
config.api_url, library_id
|
||||
))
|
||||
@@ -289,7 +289,7 @@ pub mod library {
|
||||
|
||||
config
|
||||
.client
|
||||
.patch(&format!(
|
||||
.patch(format!(
|
||||
"{}/api/v1/libraries/{}/{}",
|
||||
config.api_url, library_id, instance_id
|
||||
))
|
||||
@@ -325,7 +325,7 @@ pub mod library {
|
||||
|
||||
config
|
||||
.client
|
||||
.post(&format!(
|
||||
.post(format!(
|
||||
"{}/api/v1/libraries/{library_id}/instances/{instance_uuid}",
|
||||
config.api_url
|
||||
))
|
||||
@@ -372,7 +372,7 @@ pub mod library {
|
||||
|
||||
let res = config
|
||||
.client
|
||||
.post(&format!(
|
||||
.post(format!(
|
||||
"{}/api/v1/libraries/{}/messageCollections/get",
|
||||
config.api_url, library_id
|
||||
))
|
||||
@@ -439,7 +439,7 @@ pub mod library {
|
||||
|
||||
let res = config
|
||||
.client
|
||||
.post(&format!(
|
||||
.post(format!(
|
||||
"{}/api/v1/libraries/{}/messageCollections/requestAdd",
|
||||
config.api_url, library_id
|
||||
))
|
||||
@@ -499,7 +499,7 @@ pub mod library {
|
||||
|
||||
config
|
||||
.client
|
||||
.post(&format!(
|
||||
.post(format!(
|
||||
"{}/api/v1/libraries/{}/messageCollections/doAdd",
|
||||
config.api_url, library_id
|
||||
))
|
||||
@@ -536,7 +536,7 @@ pub mod locations {
|
||||
|
||||
config
|
||||
.client
|
||||
.get(&format!("{}/api/v1/locations", config.api_url))
|
||||
.get(format!("{}/api/v1/locations", config.api_url))
|
||||
.with_auth(auth_token)
|
||||
.send()
|
||||
.await
|
||||
@@ -560,7 +560,7 @@ pub mod locations {
|
||||
|
||||
config
|
||||
.client
|
||||
.post(&format!("{}/api/v1/locations", config.api_url))
|
||||
.post(format!("{}/api/v1/locations", config.api_url))
|
||||
.json(&json!({
|
||||
"name": name,
|
||||
}))
|
||||
@@ -587,7 +587,7 @@ pub mod locations {
|
||||
|
||||
config
|
||||
.client
|
||||
.post(&format!("{}/api/v1/locations/delete", config.api_url))
|
||||
.post(format!("{}/api/v1/locations/delete", config.api_url))
|
||||
.json(&json!({
|
||||
"id": id,
|
||||
}))
|
||||
@@ -614,7 +614,7 @@ pub mod locations {
|
||||
|
||||
config
|
||||
.client
|
||||
.post(&format!("{}/api/v1/locations/authorize", config.api_url))
|
||||
.post(format!("{}/api/v1/locations/authorize", config.api_url))
|
||||
.json(&json!({ "id": id }))
|
||||
.with_auth(auth_token)
|
||||
.send()
|
||||
|
||||
@@ -24,7 +24,7 @@ bincode = { version = "=2.0.0-rc.3", features = ["alloc", "derive"], optional =
|
||||
# Disable defaults for libheif* to avoid bindgen and use pre-compiled headers
|
||||
libheif-rs = { version = "1.0", default-features = false, optional = true }
|
||||
libheif-sys = { version = "2.1", default-features = false, optional = true }
|
||||
resvg = "0.43.0"
|
||||
resvg = "0.44.0"
|
||||
|
||||
[dependencies.pdfium-render]
|
||||
default-features = false
|
||||
|
||||
@@ -35,6 +35,7 @@ impl ImageHandler for SvgHandler {
|
||||
image_href_resolver: usvg::ImageHrefResolver::default(),
|
||||
font_resolver: usvg::FontResolver::default(),
|
||||
fontdb: Arc::new(fontdb),
|
||||
style_sheet: None,
|
||||
};
|
||||
|
||||
let rtree = usvg::Tree::from_data(&data, &options)?;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tanstack/react-query": "^4.36.1",
|
||||
"typescript": "^5.4.2",
|
||||
"typescript": "^5.6.2",
|
||||
"vite": "^5.2.0",
|
||||
"tailwindcss": "^3.3.3"
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ impl Drop for Interrupter {
|
||||
}
|
||||
|
||||
impl Interrupter {
|
||||
pub(crate) fn new(interrupt_tx: chan::Receiver<InterruptionRequest>) -> Self {
|
||||
pub(crate) const fn new(interrupt_tx: chan::Receiver<InterruptionRequest>) -> Self {
|
||||
Self {
|
||||
interrupt_rx: interrupt_tx,
|
||||
}
|
||||
@@ -659,7 +659,7 @@ pub struct TaskWorktable {
|
||||
}
|
||||
|
||||
impl TaskWorktable {
|
||||
pub fn new(worker_id: WorkerId, interrupt_tx: chan::Sender<InterruptionRequest>) -> Self {
|
||||
pub const fn new(worker_id: WorkerId, interrupt_tx: chan::Sender<InterruptionRequest>) -> Self {
|
||||
Self {
|
||||
started: AtomicBool::new(false),
|
||||
is_running: AtomicBool::new(false),
|
||||
@@ -899,7 +899,7 @@ pub struct PanicOnSenderDrop<E: RunError> {
|
||||
}
|
||||
|
||||
impl<E: RunError> PanicOnSenderDrop<E> {
|
||||
pub fn new(
|
||||
pub const fn new(
|
||||
task_id: TaskId,
|
||||
done_tx: oneshot::Sender<Result<TaskStatus<E>, SystemError>>,
|
||||
) -> Self {
|
||||
|
||||
@@ -205,7 +205,11 @@ const Video = ({ paused, blackBars, blackBarsSize, className, ...props }: VideoP
|
||||
|
||||
useEffect(() => {
|
||||
if (!ref.current) return;
|
||||
paused ? ref.current.pause() : ref.current.play();
|
||||
if (paused) {
|
||||
ref.current.pause();
|
||||
} else {
|
||||
ref.current.play();
|
||||
}
|
||||
}, [paused]);
|
||||
|
||||
return (
|
||||
|
||||
@@ -265,7 +265,7 @@ export const RenameTextBox = forwardRef<HTMLDivElement, RenameTextBoxProps>(
|
||||
}}
|
||||
onMouseDownCapture={(e) => {
|
||||
if (allowRename) e.stopPropagation();
|
||||
e.button === 0 && (renamable.current = !disabled);
|
||||
if (e.button === 0) renamable.current = !disabled;
|
||||
}}
|
||||
onMouseUp={(e) => {
|
||||
if (e.button === 0 || renamable.current || !allowRename) {
|
||||
|
||||
@@ -156,14 +156,16 @@ export const MediaData = ({ data }: Props) => {
|
||||
} else if ('FFmpeg' in data) {
|
||||
const streamKinds = new Set(
|
||||
data.FFmpeg.programs.flatMap((program) =>
|
||||
program.streams.map((stream) => stream.codec?.kind)
|
||||
program.streams
|
||||
.map((stream) => stream.codec?.kind)
|
||||
.filter((kind): kind is string => !!kind)
|
||||
)
|
||||
);
|
||||
const type = streamKinds.has('video')
|
||||
? 'Video'
|
||||
: streamKinds.has('audio')
|
||||
? 'Audio'
|
||||
: (capitalize(streamKinds.values().next().value) ?? 'Unknown');
|
||||
: capitalize(streamKinds.values().next().value ?? 'Unknown');
|
||||
|
||||
const bit_rate = humanizeSize(int32ArrayToBigInt(data.FFmpeg.bit_rate), {
|
||||
is_bit: true,
|
||||
|
||||
@@ -638,12 +638,12 @@ export const QuickPreview = () => {
|
||||
data={item}
|
||||
onLoad={(type) => {
|
||||
setThumbnailLoading('loaded');
|
||||
type.variant === 'original' &&
|
||||
if (type.variant === 'original')
|
||||
setThumbErrorToast(undefined);
|
||||
}}
|
||||
onError={(type, error) => {
|
||||
setThumbnailLoading('error');
|
||||
type.variant === 'original' &&
|
||||
if (type.variant === 'original')
|
||||
setThumbErrorToast({
|
||||
title: t('error_loading_original_file'),
|
||||
body: error.message
|
||||
|
||||
@@ -175,7 +175,7 @@ export const View = ({ emptyNotice, ...contextProps }: ExplorerViewProps) => {
|
||||
// This is to allow drag multi-selection
|
||||
if (e.shiftKey || (isWindowsExplorer ? e.ctrlKey : e.metaKey)) return;
|
||||
|
||||
explorer.selectedItems.size !== 0 && explorer.resetSelectedItems();
|
||||
if (explorer.selectedItems.size !== 0) explorer.resetSelectedItems();
|
||||
}}
|
||||
>
|
||||
<div ref={setDroppableRef} className="size-full">
|
||||
|
||||
@@ -141,7 +141,7 @@ export default () => {
|
||||
size="sm"
|
||||
variant="gray"
|
||||
onClick={() => {
|
||||
platform.reloadWebview && platform.reloadWebview();
|
||||
if (platform.reloadWebview) platform.reloadWebview();
|
||||
}}
|
||||
>
|
||||
Reload
|
||||
|
||||
@@ -150,19 +150,19 @@ const toastErrorSuccess = (
|
||||
) => {
|
||||
return {
|
||||
onError: () => {
|
||||
errorMessage &&
|
||||
if (errorMessage)
|
||||
toast.error({
|
||||
title: 'Error',
|
||||
body: errorMessage
|
||||
});
|
||||
},
|
||||
onSuccess: () => {
|
||||
successMessage &&
|
||||
if (successMessage)
|
||||
toast.success({
|
||||
title: 'Success',
|
||||
body: successMessage
|
||||
}),
|
||||
successCallBack?.();
|
||||
});
|
||||
successCallBack?.();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -37,7 +37,7 @@ export function useIncomingSpacedropToast() {
|
||||
{
|
||||
duration: 30 * 1000,
|
||||
onClose: ({ event }) => {
|
||||
event !== 'on-action' && acceptSpacedrop.mutate([data.id, null]);
|
||||
if (event !== 'on-action') acceptSpacedrop.mutate([data.id, null]);
|
||||
},
|
||||
action: {
|
||||
label: t('accept'),
|
||||
|
||||
@@ -18,7 +18,7 @@ export interface ToolOption {
|
||||
topBarActive?: boolean;
|
||||
popOverComponent?: JSX.Element | ((props: { triggerClose: () => void }) => JSX.Element);
|
||||
showAtResolution: ShowAtResolution;
|
||||
keybinds?: Array<String | ModifierKeys>;
|
||||
keybinds?: Array<string | ModifierKeys>;
|
||||
}
|
||||
|
||||
export type ShowAtResolution = 'sm:flex' | 'md:flex' | 'lg:flex' | 'xl:flex' | '2xl:flex';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type AlphaClient } from '@oscartbeaumont-sd/rspc-client/v2';
|
||||
import { type AlphaClient } from '@oscartbeaumont-sd/rspc-client/src/v2';
|
||||
import { ArrowLeft, ArrowRight, Info } from '@phosphor-icons/react';
|
||||
import * as Dialog from '@radix-ui/react-dialog';
|
||||
import { iconNames } from '@sd/assets/util';
|
||||
|
||||
@@ -44,8 +44,6 @@ const interpolateHexColor = (color1: string, color2: string, factor: number): st
|
||||
return `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1).toUpperCase()}`;
|
||||
};
|
||||
|
||||
interface FileKindStatsProps {}
|
||||
|
||||
const defaultFileKinds: FileKind[] = [
|
||||
{ kind: 4, name: 'Package', count: 0n, total_bytes: 0n },
|
||||
{ kind: 8, name: 'Archive', count: 0n, total_bytes: 0n },
|
||||
@@ -67,7 +65,7 @@ const defaultFileKinds: FileKind[] = [
|
||||
{ kind: 25, name: 'Screenshot', count: 0n, total_bytes: 0n }
|
||||
];
|
||||
|
||||
const FileKindStats: React.FC<FileKindStatsProps> = () => {
|
||||
const FileKindStats: React.FC = () => {
|
||||
const isDark = useIsDark();
|
||||
const navigate = useNavigate();
|
||||
const { t } = useLocale();
|
||||
|
||||
@@ -78,9 +78,9 @@ const StarfieldEffect: React.FC = () => {
|
||||
a: number
|
||||
) => {
|
||||
const i = (x + y * canvas.width) * 4;
|
||||
pix[i] += r;
|
||||
pix[i + 1] += g;
|
||||
pix[i + 2] += b;
|
||||
pix[i] = (pix[i] ?? 0) + r;
|
||||
pix[i + 1] = (pix[i + 1] ?? 0) + g;
|
||||
pix[i + 2] = (pix[i + 2] ?? 0) + b;
|
||||
pix[i + 3] = a;
|
||||
};
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ export default function DeleteLibraryDialog(props: Props) {
|
||||
|
||||
queryClient.invalidateQueries(['library.list']);
|
||||
|
||||
platform.refreshMenuBar && platform.refreshMenuBar();
|
||||
if (platform.refreshMenuBar) platform.refreshMenuBar();
|
||||
|
||||
submitPlausibleEvent({
|
||||
event: {
|
||||
|
||||
@@ -45,7 +45,7 @@ export default (props: UseDialogProps & { librariesCtx: LibraryConfigWrapped[] |
|
||||
return [...(libraries || []), library];
|
||||
});
|
||||
|
||||
platform.refreshMenuBar && platform.refreshMenuBar();
|
||||
if (platform.refreshMenuBar) platform.refreshMenuBar();
|
||||
|
||||
navigate(`/${library.uuid}`, { replace: true });
|
||||
} catch (e: any) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { initRspc, wsBatchLink, type AlphaClient } from '@oscartbeaumont-sd/rspc-client/v2';
|
||||
import { initRspc, wsBatchLink, type AlphaClient } from '@oscartbeaumont-sd/rspc-client/src/v2';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import {
|
||||
@@ -267,14 +267,12 @@ function RemoteLayout() {
|
||||
<QueryClientProvider client={rspcClient[2]}>
|
||||
<context.Provider
|
||||
value={{
|
||||
// @ts-expect-error
|
||||
client: rspcClient[0],
|
||||
queryClient: rspcClient[2]
|
||||
}}
|
||||
>
|
||||
<context2.Provider
|
||||
value={{
|
||||
// @ts-expect-error
|
||||
client: rspcClient[1],
|
||||
queryClient: rspcClient[2]
|
||||
}}
|
||||
|
||||
@@ -117,7 +117,7 @@ const useFormState = () => {
|
||||
]);
|
||||
insertLibrary(queryClient, library);
|
||||
|
||||
platform.refreshMenuBar && platform.refreshMenuBar();
|
||||
if (platform.refreshMenuBar) platform.refreshMenuBar();
|
||||
|
||||
if (telemetryState.shareFullTelemetry) {
|
||||
submitPlausibleEvent({ event: { type: 'libraryCreate' } });
|
||||
|
||||
@@ -67,7 +67,7 @@ function CloudLibraries() {
|
||||
return [...(libraries || []), library];
|
||||
});
|
||||
|
||||
platform.refreshMenuBar && platform.refreshMenuBar();
|
||||
if (platform.refreshMenuBar) platform.refreshMenuBar();
|
||||
|
||||
resetOnboardingStore();
|
||||
navigate(`/${library.uuid}`, { replace: true });
|
||||
|
||||
@@ -38,7 +38,7 @@ const AlertDialog = (props: Props) => {
|
||||
<Button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
props.value && navigator.clipboard.writeText(props.value);
|
||||
if (props.value) navigator.clipboard.writeText(props.value);
|
||||
}}
|
||||
size="icon"
|
||||
>
|
||||
|
||||
@@ -32,10 +32,10 @@ export const useKeybindEventHandler = (libraryId?: string) => {
|
||||
console.log('Add Location!'); // TODO: Implement
|
||||
break;
|
||||
case 'open_settings':
|
||||
libraryId && navigate(`/${libraryId}/settings/client/general`);
|
||||
if (libraryId) navigate(`/${libraryId}/settings/client/general`);
|
||||
break;
|
||||
case 'reload_explorer':
|
||||
!isNaN(id) && rescan(id);
|
||||
if (!isNaN(id)) rescan(id);
|
||||
break;
|
||||
// case 'open_overview':
|
||||
// libraryId && navigate(`/${libraryId}/overview`);
|
||||
|
||||
@@ -12,8 +12,12 @@ export const useScrolled = (ref: React.RefObject<HTMLDivElement>, y = 1) => {
|
||||
};
|
||||
|
||||
onScroll();
|
||||
ref.current?.addEventListener('scroll', onScroll);
|
||||
() => ref.current?.removeEventListener('scroll', onScroll);
|
||||
|
||||
const { current } = ref;
|
||||
if (current) {
|
||||
current.addEventListener('scroll', onScroll);
|
||||
return () => current.removeEventListener('scroll', onScroll);
|
||||
}
|
||||
}, [ref, y]);
|
||||
|
||||
return { isScrolled };
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
"@types/uuid": "^9.0.8",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"type-fest": "^4.13.0",
|
||||
"typescript": "^5.4.2",
|
||||
"typescript": "^5.6.2",
|
||||
"vite": "^5.2.0",
|
||||
"vite-plugin-svgr": "^3.3.0"
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
"patchedDependencies": {
|
||||
"@remix-run/router@1.13.1": "patches/@remix-run__router@1.13.1.patch",
|
||||
"@contentlayer/cli@0.3.4": "patches/@contentlayer__cli@0.3.4.patch",
|
||||
"@oscartbeaumont-sd/rspc-tauri@0.0.0-main-dc31e5b2": "patches/@oscartbeaumont-sd__rspc-tauri@0.0.0-main-dc31e5b2.patch",
|
||||
"tailwindcss-animate@1.0.7": "patches/tailwindcss-animate@1.0.7.patch",
|
||||
"@react-navigation/drawer@6.6.15": "patches/@react-navigation__drawer@6.6.15.patch"
|
||||
},
|
||||
@@ -51,7 +50,7 @@
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/plugin-syntax-import-assertions": "^7.24.1",
|
||||
"@babel/plugin-syntax-import-assertions": "^7.24.0",
|
||||
"@cspell/dict-rust": "^4.0.2",
|
||||
"@cspell/dict-typescript": "^3.1.2",
|
||||
"@ianvs/prettier-plugin-sort-imports": "^4.3.1",
|
||||
@@ -62,7 +61,7 @@
|
||||
"prisma": "^5.18.0",
|
||||
"turbo": "^1.12.5",
|
||||
"turbo-ignore": "^1.12.5",
|
||||
"typescript": "^5.4.2",
|
||||
"typescript": "^5.6.2",
|
||||
"vite": "^5.2.0"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"typecheck": "tsc -b"
|
||||
},
|
||||
"dependencies": {
|
||||
"@oscartbeaumont-sd/rspc-client": "=0.0.0-main-dc31e5b2",
|
||||
"@oscartbeaumont-sd/rspc-react": "=0.0.0-main-dc31e5b2",
|
||||
"@oscartbeaumont-sd/rspc-client": "github:spacedriveapp/rspc#path:packages/client&bc882f4724",
|
||||
"@oscartbeaumont-sd/rspc-react": "github:spacedriveapp/rspc#path:packages/react&bc882f4724",
|
||||
"@solid-primitives/deep": "^0.2.4",
|
||||
"@tanstack/react-query": "^4.36.1",
|
||||
"@tanstack/solid-query": "^5.17.9",
|
||||
@@ -28,7 +28,7 @@
|
||||
"devDependencies": {
|
||||
"@sd/config": "workspace:*",
|
||||
"@types/react": "^18.2.67",
|
||||
"typescript": "^5.4.2"
|
||||
"typescript": "^5.6.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^18.2"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { AlphaClient } from '@oscartbeaumont-sd/rspc-client/v2';
|
||||
import { AlphaClient } from '@oscartbeaumont-sd/rspc-client/src/v2';
|
||||
import { createContext, PropsWithChildren, useContext, useMemo } from 'react';
|
||||
|
||||
import { LibraryConfigWrapped, Procedures } from '../core';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Link } from '@oscartbeaumont-sd/rspc-client/v2';
|
||||
import { Link } from '@oscartbeaumont-sd/rspc-client/src/v2';
|
||||
|
||||
declare global {
|
||||
// eslint-disable-next-line
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import {
|
||||
inferMutationInput,
|
||||
inferMutationResult,
|
||||
ProcedureDef
|
||||
} from '@oscartbeaumont-sd/rspc-client';
|
||||
import { AlphaRSPCError, initRspc } from '@oscartbeaumont-sd/rspc-client/v2';
|
||||
import { BaseOptions, Context, createReactQueryHooks } from '@oscartbeaumont-sd/rspc-react/v2';
|
||||
import { QueryClient, useMutation, UseMutationOptions, useQuery } from '@tanstack/react-query';
|
||||
import { ProcedureDef } from '@oscartbeaumont-sd/rspc-client';
|
||||
import { AlphaRSPCError, initRspc } from '@oscartbeaumont-sd/rspc-client/src/v2';
|
||||
import { Context, createReactQueryHooks } from '@oscartbeaumont-sd/rspc-react/src/v2';
|
||||
import { QueryClient } from '@tanstack/react-query';
|
||||
import { createContext, PropsWithChildren, useContext } from 'react';
|
||||
import { match, P } from 'ts-pattern';
|
||||
|
||||
@@ -46,7 +42,7 @@ export type LibraryProceduresDef = {
|
||||
subscriptions: StripLibraryArgsFromInput<LibraryProcedures<'subscriptions'>, true>;
|
||||
};
|
||||
|
||||
export const context = createContext<Context<Procedures>>(undefined!);
|
||||
export const context = createContext<Context<NonLibraryProceduresDef>>(undefined!);
|
||||
export const context2 = createContext<Context<LibraryProceduresDef>>(undefined!);
|
||||
|
||||
export const useRspcContext = () => useContext(context);
|
||||
@@ -60,7 +56,7 @@ export const rspc2 = initRspc<Procedures>({
|
||||
}); // TODO: Removing this?
|
||||
|
||||
export const nonLibraryClient = rspc.dangerouslyHookIntoInternals<NonLibraryProceduresDef>();
|
||||
// @ts-expect-error // TODO: Fix
|
||||
|
||||
const nonLibraryHooks = createReactQueryHooks<NonLibraryProceduresDef>(nonLibraryClient, {
|
||||
context // TODO: Shared context
|
||||
});
|
||||
@@ -73,7 +69,7 @@ export const libraryClient = rspc2.dangerouslyHookIntoInternals<LibraryProcedure
|
||||
return [keyAndInput[0], { library_id: libraryId, arg: keyAndInput[1] ?? null }];
|
||||
}
|
||||
});
|
||||
// @ts-expect-error // TODO: idk
|
||||
|
||||
const libraryHooks = createReactQueryHooks<LibraryProceduresDef>(libraryClient, {
|
||||
context: context2
|
||||
});
|
||||
|
||||
@@ -27,13 +27,9 @@ type AllowReactiveScope<T> = T extends object
|
||||
}
|
||||
: T | (() => T);
|
||||
|
||||
type Props<T> =
|
||||
| {
|
||||
root: FunctionComponent<{}>;
|
||||
}
|
||||
| ({
|
||||
root: FunctionComponent<T>;
|
||||
} & AllowReactiveScope<T>);
|
||||
type Props<T extends object = object> =
|
||||
| { root: FunctionComponent<object> }
|
||||
| ({ root: FunctionComponent<T> } & AllowReactiveScope<T>);
|
||||
|
||||
export function WithReact<T extends object>(props: Props<T>) {
|
||||
const portalCtx = useSolidContext(solidPortalCtx);
|
||||
@@ -60,7 +56,7 @@ export function WithReact<T extends object>(props: Props<T>) {
|
||||
createElement(
|
||||
Wrapper,
|
||||
{
|
||||
root: props.root as any,
|
||||
root: props.root as FunctionComponent<object>,
|
||||
owner: getOwner()!,
|
||||
childProps: () => splitProps(props, ['root'])[1]
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Store } from 'solid-js/store';
|
||||
|
||||
import { useObserver } from './useObserver';
|
||||
|
||||
export function useSolidStore<T extends object = {}>(store: Store<T>) {
|
||||
export function useSolidStore<T extends object = object>(store: Store<T>) {
|
||||
const state = useObserver(() => ({ ...store }));
|
||||
return new Proxy(state, {
|
||||
get: (target, prop) => Reflect.get(target, prop),
|
||||
|
||||
@@ -11,14 +11,14 @@
|
||||
"lint": "eslint . --cache"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^7.3.1",
|
||||
"@typescript-eslint/parser": "^7.3.1",
|
||||
"@typescript-eslint/eslint-plugin": "^8.8.0",
|
||||
"@typescript-eslint/parser": "^8.8.0",
|
||||
"@vitejs/plugin-react-swc": "^3.6.0",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-config-next": "^14.1.3",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-config-turbo": "^1.12.5",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"eslint-plugin-react": "^7.34.1",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-solid": "^0.13.1",
|
||||
|
||||
@@ -62,6 +62,6 @@
|
||||
"tailwindcss": "^3.4.1",
|
||||
"tailwindcss-animate": "^1.0.7",
|
||||
"tailwindcss-radix": "^2.8.0",
|
||||
"typescript": "^5.4.2"
|
||||
"typescript": "^5.6.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import clsx from 'clsx';
|
||||
import { ComponentProps, forwardRef } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
export interface ButtonBaseProps extends VariantProps<typeof buttonStyles> {}
|
||||
export type ButtonBaseProps = VariantProps<typeof buttonStyles>;
|
||||
|
||||
export type ButtonProps = ButtonBaseProps &
|
||||
React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
||||
|
||||
@@ -59,7 +59,7 @@ const Root = (props: PropsWithChildren<DropdownMenuProps>) => {
|
||||
|
||||
const measureRef = useCallback(
|
||||
(ref: HTMLButtonElement | null) => {
|
||||
alignToTrigger && ref && setWidth(ref.getBoundingClientRect().width);
|
||||
if (alignToTrigger && ref) setWidth(ref.getBoundingClientRect().width);
|
||||
},
|
||||
[alignToTrigger]
|
||||
);
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
'use client';
|
||||
|
||||
/* eslint-disable tailwindcss/migration-from-tailwind-2 */
|
||||
import * as RadioGroup from '@radix-ui/react-radio-group';
|
||||
import clsx from 'clsx';
|
||||
import { forwardRef } from 'react';
|
||||
|
||||
export interface RootProps extends RadioGroup.RadioGroupProps {}
|
||||
export type RootProps = RadioGroup.RadioGroupProps;
|
||||
export const Root = forwardRef<HTMLDivElement, RootProps>(
|
||||
({ children, className, ...props }, ref) => {
|
||||
return (
|
||||
@@ -20,7 +19,7 @@ export const Root = forwardRef<HTMLDivElement, RootProps>(
|
||||
// RadioGroup.Item
|
||||
// )`rounded-md border border-app-line bg-app-box px-4 py-2 flex items-center space-x-2`;
|
||||
|
||||
export interface ItemProps extends RadioGroup.RadioGroupItemProps {}
|
||||
export type ItemProps = RadioGroup.RadioGroupItemProps;
|
||||
export const Item = ({ children, ...props }: ItemProps) => {
|
||||
return (
|
||||
<div
|
||||
@@ -31,8 +30,9 @@ export const Item = ({ children, ...props }: ItemProps) => {
|
||||
>
|
||||
<RadioGroup.Item
|
||||
id={'radio' + props.value}
|
||||
// eslint-disable-next-line tailwindcss/migration-from-tailwind-2
|
||||
className={clsx(
|
||||
'peer relative mr-1 mt-1 size-4 flex-shrink-0 rounded-full border border-app-line',
|
||||
'peer relative mr-1 mt-1 size-4 shrink-0 rounded-full border border-app-line',
|
||||
'radix-state-checked:bg-accent',
|
||||
'radix-state-unchecked:bg-app-input',
|
||||
'focus:outline-none focus:ring-0 focus:ring-offset-0 focus-visible:ring focus-visible:ring-accent focus-visible:ring-opacity-75 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-gray-800'
|
||||
|
||||
@@ -149,7 +149,7 @@ const Toast = forwardRef<HTMLDivElement, ToastProps>(
|
||||
<Button
|
||||
variant="gray"
|
||||
onClick={() => {
|
||||
typeof cancel === 'object' && cancel.onClick?.();
|
||||
if (typeof cancel === 'object') cancel.onClick?.();
|
||||
props.onClose?.({ id: props.id, event: 'on-cancel' });
|
||||
toast.dismiss(props.id);
|
||||
}}
|
||||
|
||||
@@ -19,7 +19,7 @@ export interface TooltipProps
|
||||
tooltipClassName?: string;
|
||||
labelClassName?: string;
|
||||
asChild?: boolean;
|
||||
keybinds?: Array<String | keyof typeof ModifierKeys>;
|
||||
keybinds?: Array<string | keyof typeof ModifierKeys>;
|
||||
}
|
||||
|
||||
const separateKeybinds = (keybinds: TooltipProps['keybinds']): TooltipProps['keybinds'] => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { forwardRef } from 'react';
|
||||
import { CheckBox as Root } from '../CheckBox';
|
||||
import { FormField, useFormField, UseFormFieldProps } from './FormField';
|
||||
|
||||
export interface CheckBoxFieldProps extends UseFormFieldProps {}
|
||||
export type CheckBoxFieldProps = UseFormFieldProps;
|
||||
|
||||
export const CheckBoxField = forwardRef<HTMLInputElement, CheckBoxFieldProps>((props, ref) => {
|
||||
const { formFieldProps, childProps } = useFormField(props);
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
diff --git a/dist/index.js b/dist/index.js
|
||||
index df70b20e9381e7bf44f9a35b11174e40ede80376..bc06927b7290891717c48999f79d0705ef6b8df7 100644
|
||||
--- a/dist/index.js
|
||||
+++ b/dist/index.js
|
||||
@@ -17,7 +17,7 @@ class TauriTransport {
|
||||
});
|
||||
// @ts-ignore
|
||||
this.requestMap.set(id, resolve);
|
||||
- await window.appWindow.emit("plugin:rspc:transport", {
|
||||
+ await window.getCurrentWindow().emit("plugin:rspc:transport", {
|
||||
id,
|
||||
method: operation,
|
||||
params: {
|
||||
diff --git a/dist/index.mjs b/dist/index.mjs
|
||||
index a80ac6155a4a920173c442b4d7b458a46ab63624..03b3d9ee6d3691980584c1fd58c17f7c81dbab39 100644
|
||||
--- a/dist/index.mjs
|
||||
+++ b/dist/index.mjs
|
||||
@@ -1,6 +1,6 @@
|
||||
import { randomId, RSPCError } from '@oscartbeaumont-sd/rspc-client';
|
||||
import { listen } from '@tauri-apps/api/event';
|
||||
-import { appWindow } from '@tauri-apps/api/window';
|
||||
+import { getCurrentWindow } from '@tauri-apps/api/window';
|
||||
|
||||
// @ts-nocheck No one asked
|
||||
class TauriTransport {
|
||||
@@ -15,7 +15,7 @@ class TauriTransport {
|
||||
});
|
||||
// @ts-ignore
|
||||
this.requestMap.set(id, resolve);
|
||||
- await appWindow.emit("plugin:rspc:transport", {
|
||||
+ await getCurrentWindow().emit("plugin:rspc:transport", {
|
||||
id,
|
||||
method: operation,
|
||||
params: {
|
||||
diff --git a/dist/v2.js b/dist/v2.js
|
||||
index e597db7bf00a7e62f32266814345b257b8f8d0da..fa683640a0c0c9f1796ed1af1fd0d04c2df7c68b 100644
|
||||
--- a/dist/v2.js
|
||||
+++ b/dist/v2.js
|
||||
@@ -44,7 +44,7 @@ var window = require('@tauri-apps/api/window');
|
||||
if (!listener) {
|
||||
await listener;
|
||||
}
|
||||
- await window.appWindow.emit("plugin:rspc:transport", currentBatch);
|
||||
+ await window.getCurrentWindow().emit("plugin:rspc:transport", currentBatch);
|
||||
})();
|
||||
});
|
||||
}
|
||||
diff --git a/dist/v2.mjs b/dist/v2.mjs
|
||||
index bd7ceb6927d187dd2ff7cf9a9364d7c312a75b88..844495e36aef0c1337e7393685c1a33fedb88c2c 100644
|
||||
--- a/dist/v2.mjs
|
||||
+++ b/dist/v2.mjs
|
||||
@@ -1,6 +1,6 @@
|
||||
import { AlphaRSPCError } from '@oscartbeaumont-sd/rspc-client/v2';
|
||||
import { listen } from '@tauri-apps/api/event';
|
||||
-import { appWindow } from '@tauri-apps/api/window';
|
||||
+import { getCurrentWindow } from '@tauri-apps/api/window';
|
||||
|
||||
// @ts-nocheck No one asked
|
||||
/**
|
||||
@@ -42,7 +42,7 @@ import { appWindow } from '@tauri-apps/api/window';
|
||||
if (!listener) {
|
||||
await listener;
|
||||
}
|
||||
- await appWindow.emit("plugin:rspc:transport", currentBatch);
|
||||
+ await getCurrentWindow().emit("plugin:rspc:transport", currentBatch);
|
||||
})();
|
||||
});
|
||||
}
|
||||
BIN
pnpm-lock.yaml
generated
BIN
pnpm-lock.yaml
generated
Binary file not shown.
@@ -19,7 +19,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"smol-toml": "^1.3.0",
|
||||
"archive-wasm": "^1.7.0",
|
||||
"archive-wasm": "^1.7.1",
|
||||
"mustache": "^4.2.0",
|
||||
"os-proxy-config": "^1.1.1",
|
||||
"plist": "^3.1.0",
|
||||
@@ -28,17 +28,17 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.24.0",
|
||||
"@babel/eslint-parser": "^7.24.1",
|
||||
"@babel/eslint-plugin": "^7.23.5",
|
||||
"@babel/eslint-parser": "^7.24.0",
|
||||
"@babel/eslint-plugin": "^7.24.0",
|
||||
"@types/mustache": "^4.2.5",
|
||||
"@types/node": ">18.18.x",
|
||||
"@typescript-eslint/eslint-plugin": "^7.3.1",
|
||||
"@typescript-eslint/parser": "^7.3.1",
|
||||
"eslint": "^8.57.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.8.0",
|
||||
"@typescript-eslint/parser": "^8.8.0",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-config-standard": "^17.1.0",
|
||||
"eslint-plugin-jsdoc": "^48.2.1",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"typescript": "^5.4.2"
|
||||
"eslint-plugin-jsdoc": "^50.3.1",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"typescript": "^5.6.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,13 @@ const __dirname = path.dirname(__filename)
|
||||
// NOTE: Must point to package root path
|
||||
const __root = path.resolve(path.join(__dirname, '..'))
|
||||
|
||||
const extractOpts = {
|
||||
chmod: 0o600,
|
||||
sizeLimit: 256n * 1024n * 1024n,
|
||||
recursive: true,
|
||||
overwrite: true,
|
||||
}
|
||||
|
||||
const bugWarn =
|
||||
'This is probably a bug, please open a issue with you system info at: ' +
|
||||
'https://github.com/spacedriveapp/spacedrive/issues/new/choose'
|
||||
@@ -74,13 +81,7 @@ try {
|
||||
)
|
||||
|
||||
console.log(`Extracting native dependencies...`)
|
||||
await spinTask(
|
||||
extractTo(archiveData, nativeDeps, {
|
||||
chmod: 0o600,
|
||||
recursive: true,
|
||||
overwrite: true,
|
||||
})
|
||||
)
|
||||
await spinTask(extractTo(archiveData, nativeDeps, extractOpts))
|
||||
} catch (e) {
|
||||
console.error(`Failed to download native dependencies.\n${bugWarn}`)
|
||||
if (__debug) console.error(e)
|
||||
@@ -119,14 +120,7 @@ try {
|
||||
)
|
||||
|
||||
console.log(`Extracting native dependencies...`)
|
||||
await spinTask(
|
||||
extractTo(archiveData, specificMobileNativeDeps, {
|
||||
chmod: 0o600,
|
||||
sizeLimit: 256n * 1024n * 1024n,
|
||||
recursive: true,
|
||||
overwrite: true,
|
||||
})
|
||||
)
|
||||
await spinTask(extractTo(archiveData, specificMobileNativeDeps, extractOpts))
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(`Failed to download native dependencies for mobile.\n${bugWarn}`)
|
||||
|
||||
Reference in New Issue
Block a user