mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-30 10:25:39 +00:00
Remove safe parse to be safe
This commit is contained in:
@@ -8,14 +8,6 @@ import { sendToExitNode } from "#dynamic/lib/exitNodes";
|
|||||||
import { buildClientConfigurationForNewtClient } from "./buildConfiguration";
|
import { buildClientConfigurationForNewtClient } from "./buildConfiguration";
|
||||||
import { canCompress } from "@server/lib/clientVersionChecks";
|
import { canCompress } from "@server/lib/clientVersionChecks";
|
||||||
|
|
||||||
const inputSchema = z.object({
|
|
||||||
publicKey: z.string(),
|
|
||||||
port: z.int().positive(),
|
|
||||||
chainId: z.string()
|
|
||||||
});
|
|
||||||
|
|
||||||
type Input = z.infer<typeof inputSchema>;
|
|
||||||
|
|
||||||
export const handleGetConfigMessage: MessageHandler = async (context) => {
|
export const handleGetConfigMessage: MessageHandler = async (context) => {
|
||||||
const { message, client, sendToClient } = context;
|
const { message, client, sendToClient } = context;
|
||||||
const newt = client as Newt;
|
const newt = client as Newt;
|
||||||
@@ -34,16 +26,7 @@ export const handleGetConfigMessage: MessageHandler = async (context) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const parsed = inputSchema.safeParse(message.data);
|
const { publicKey, port, chainId } = message.data;
|
||||||
if (!parsed.success) {
|
|
||||||
logger.error(
|
|
||||||
"handleGetConfigMessage: Invalid input: " +
|
|
||||||
fromError(parsed.error).toString()
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { publicKey, port, chainId } = message.data as Input;
|
|
||||||
const siteId = newt.siteId;
|
const siteId = newt.siteId;
|
||||||
|
|
||||||
// Get the current site data
|
// Get the current site data
|
||||||
|
|||||||
Reference in New Issue
Block a user