diff --git a/src/shared/core/file-server.ts b/src/shared/core/file-server.ts index 05da5bb..fe0e953 100644 --- a/src/shared/core/file-server.ts +++ b/src/shared/core/file-server.ts @@ -70,6 +70,7 @@ app.post("/upload/", headerValidator, async (ctx) => { }); export default function startFileServer(port: number) { + console.log({ message: `Starting file server on ${port}` }); return serve({ fetch: app.fetch, port: port, diff --git a/src/shared/routers/_app.ts b/src/shared/routers/_app.ts index 19460c1..97de270 100644 --- a/src/shared/routers/_app.ts +++ b/src/shared/routers/_app.ts @@ -11,6 +11,9 @@ export const appRouter = router({ }), node: nodeRouter, files: filesRouter, + platform:publicProcedure.query(()=>{ + return process.platform + }) }); export type AppRouter = typeof appRouter; diff --git a/src/shared/routers/node.ts b/src/shared/routers/node.ts index f120833..2efd348 100644 --- a/src/shared/routers/node.ts +++ b/src/shared/routers/node.ts @@ -1,4 +1,8 @@ import { publicProcedure, router } from "@src/trpc"; +import startServer from "@shared/core/file-server"; +import {globalState$} from "@shared/state"; // TODO -export const nodeRouter = router({}); +export const nodeRouter = router({ + startServer:publicProcedure.mutation(async()=>startServer(globalState$.port.get())), +}); diff --git a/src/shared/storage.ts b/src/shared/storage.ts index 76c1ee0..9f18b1a 100644 --- a/src/shared/storage.ts +++ b/src/shared/storage.ts @@ -1,5 +1,5 @@ import { createStore } from "tinybase/cjs/with-schemas"; -import { createIndexedDbPersister } from "tinybase/cjs/with-schemas/persisters/persister-indexed-db"; +import { createIndexedDbPersister } from "tinybase/cjs/persisters/persister-indexed-db"; export const store = createStore().setTablesSchema({ sent: { diff --git a/src/web/components/device-info.tsx b/src/web/components/device-info.tsx index 67fc90c..79fb4fc 100644 --- a/src/web/components/device-info.tsx +++ b/src/web/components/device-info.tsx @@ -4,7 +4,7 @@ import t from "@src/shared/config"; import { randomNumber } from "@src/shared/utils"; import { Heart, Key, UserRound, Wifi, WifiOff } from "lucide-react"; import { useCallback, useMemo } from "react"; -import { fileTransferState$, globalState$ } from "../../shared/state"; +import { globalState$ } from "../../shared/state"; type Props = { node: any; @@ -97,7 +97,7 @@ export default function DeviceInfo({ node }: Props) { )} - {fileTransferState$.files.get().length > 0 && ( + {[].length > 0 && (