diff --git a/apps/link/app/_actions/tickets.ts b/apps/link/app/_actions/tickets.ts index 0bb9f55..6c5c305 100644 --- a/apps/link/app/_actions/tickets.ts +++ b/apps/link/app/_actions/tickets.ts @@ -75,7 +75,6 @@ export const updateTicketAction = async ( ticketID: string, ticketInfo: Record, ) => { - console.log({ ticketID, ticketInfo }); try { const input = {}; if (ticketInfo.state) { diff --git a/apps/link/app/_lib/authentication.ts b/apps/link/app/_lib/authentication.ts index b907e98..b7ba2a5 100644 --- a/apps/link/app/_lib/authentication.ts +++ b/apps/link/app/_lib/authentication.ts @@ -109,6 +109,9 @@ export const authOptions: NextAuthOptions = { signOut: "/logout", }, providers, + session: { + maxAge: 7 * 24 * 60 * 60, + }, secret: process.env.NEXTAUTH_SECRET, callbacks: { signIn: async ({ user }) => { diff --git a/apps/link/app/_lib/zammad.ts b/apps/link/app/_lib/zammad.ts index 74a59ec..b15aa9a 100644 --- a/apps/link/app/_lib/zammad.ts +++ b/apps/link/app/_lib/zammad.ts @@ -1,13 +1,19 @@ import { getServerSession } from "app/_lib/authentication"; -import { cookies } from "next/headers"; +import { cookies, headers } from "next/headers"; +import crypto from "crypto"; const getHeaders = async () => { + const userAgent = (await headers()).get("user-agent"); const allCookies = (await cookies()).getAll(); + const hashedUserAgent = crypto + .createHash("sha256") + .update(userAgent) + .digest("hex"); const session = await getServerSession(); - const headers = { + const finalHeaders = { "Content-Type": "application/json", Accept: "application/json", - "X-Browser-Fingerprint": `${session.expires}`, + "X-Browser-Fingerprint": hashedUserAgent, // @ts-ignore "X-CSRF-Token": session.user.zammadCsrfToken, Cookie: allCookies @@ -15,7 +21,7 @@ const getHeaders = async () => { .join("; "), }; - return headers; + return finalHeaders; }; interface ExecuteGraphQLOptions {