feat: add actual user for trpc wss-dev-server (#261)

* feat: add actual user for trpc wss-dev-server #233

* chore: address pull request feedback

* fix: deepsource issue
This commit is contained in:
Meier Lukas
2024-03-25 18:57:59 +01:00
committed by GitHub
parent 87808c1349
commit 058a8c4776
15 changed files with 174 additions and 69 deletions

View File

@@ -10,7 +10,6 @@ import { initTRPC, TRPCError } from "@trpc/server";
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";
@@ -27,11 +26,11 @@ import { ZodError } from "@homarr/validation";
*
* @see https://trpc.io/docs/server/context
*/
export const createTRPCContext = async (opts: {
export const createTRPCContext = (opts: {
headers: Headers;
session: Session | null;
}) => {
const session = opts.session ?? (await auth());
const session = opts.session;
const source = opts.headers.get("x-trpc-source") ?? "unknown";
logger.info(