generated from Inalegwu/ElectroStatic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
still trying to figure out run loop of app to determine why node is b…
…eing started when info is uninitialized
- Loading branch information
Showing
10 changed files
with
114 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,7 @@ | ||
import { globalState$ } from "@src/shared/state"; | ||
import { publicProcedure, router } from "@src/trpc"; | ||
import * as fs from "node:fs"; | ||
import { v4 } from "uuid"; | ||
import z from "zod"; | ||
|
||
export const nodeRouter = router({ | ||
startNode: publicProcedure.mutation(async ({ ctx }) => { | ||
ctx.node.start(); | ||
}), | ||
sendFile: publicProcedure | ||
.input( | ||
z.object({ | ||
files: z.string().array(), | ||
destinationId: z.string(), | ||
}), | ||
) | ||
.mutation(async ({ ctx, input }) => { | ||
for (const file of input.files) { | ||
const buffer = fs.readFileSync(file); | ||
|
||
ctx.node.dm( | ||
{ | ||
data: buffer, | ||
type: "dm", | ||
}, | ||
input.destinationId, | ||
v4(), | ||
globalState$.applicationId.get(), | ||
10000, | ||
); | ||
} | ||
}), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { event } from "@legendapp/state"; | ||
|
||
export const changeDeviceNameEvent = event(); | ||
export const changeDeviceIdEvent = event(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from "./events"; | ||
export * from "./global"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.