feat: add trpc websocket (#205)

This commit is contained in:
Manuel
2024-03-14 18:43:47 +01:00
committed by GitHub
parent 9ae99ad06c
commit 4f375cbe6d
14 changed files with 268 additions and 32 deletions

View File

@@ -12,6 +12,7 @@ import superjson from "superjson";
import type { Session } from "@homarr/auth";
import { auth } from "@homarr/auth";
import { db } from "@homarr/db";
import { logger } from "@homarr/log";
import { ZodError } from "@homarr/validation";
/**
@@ -33,7 +34,10 @@ export const createTRPCContext = async (opts: {
const session = opts.session ?? (await auth());
const source = opts.headers.get("x-trpc-source") ?? "unknown";
console.log(">>> tRPC Request from", source, "by", session?.user);
logger.info(
`tRPC request from ${source} by user '${session?.user.id}'`,
session?.user,
);
return {
session,