1- import { Injectable , Logger } from '@nestjs/common' ;
2- import { ConfigService } from '@nestjs/config' ;
1+ import { Inject , Injectable , Logger } from '@nestjs/common' ;
32
43import type { InternalGraphQLClientFactory as IInternalGraphQLClientFactory } from '@unraid/shared' ;
54import { ApolloClient , InMemoryCache , NormalizedCacheObject } from '@apollo/client/core/index.js' ;
@@ -14,6 +13,8 @@ import { createClient } from 'graphql-ws';
1413import { Agent , fetch as undiciFetch } from 'undici' ;
1514import WebSocket from 'ws' ;
1615
16+ import { SESSION_COOKIE_CONFIG , SessionCookieConfig } from '@app/unraid-api/auth/cookie.service.js' ;
17+
1718/**
1819 * Factory service for creating internal GraphQL clients.
1920 *
@@ -28,7 +29,8 @@ export class InternalGraphQLClientFactory implements IInternalGraphQLClientFacto
2829 private readonly logger = new Logger ( InternalGraphQLClientFactory . name ) ;
2930
3031 constructor (
31- private readonly configService : ConfigService ,
32+ @Inject ( SESSION_COOKIE_CONFIG )
33+ private readonly sessionCookieConfig : SessionCookieConfig ,
3234 private readonly socketConfig : SocketConfigService
3335 ) { }
3436
@@ -143,7 +145,7 @@ export class InternalGraphQLClientFactory implements IInternalGraphQLClientFacto
143145 headers : {
144146 ...headers ,
145147 'x-csrf-token' : cookieAuth . csrfToken ,
146- cookie : `unraid_ ${ cookieAuth . sessionId } =${ cookieAuth . sessionId } ` ,
148+ cookie : `${ this . sessionCookieConfig . namePrefix } ${ cookieAuth . sessionId } =${ cookieAuth . sessionId } ` ,
147149 } ,
148150 } ;
149151 }
0 commit comments