@@ -63,8 +63,6 @@ let redirect_uri;
63
63
64
64
app . get ( '/login' , async ( req , res ) => {
65
65
const params = req . query ;
66
- logger . debug ( 'req.headers' , req . headers ) ;
67
- logger . debug ( 'req: ' , req . protocol , req . hostname , req . baseUrl , req . url , req . originalUrl , req . path , req . query ) ;
68
66
69
67
const proto = req . headers [ 'x-forwarded-proto' ] || req . protocol ;
70
68
const host = req . headers [ 'x-forwarded-host' ] || req . headers . host ;
@@ -107,15 +105,11 @@ app.get('/callback', async (req, res) => {
107
105
108
106
client . callback ( redirect_uri . toString ( ) , params , { code_verifier : client . code_verifier } )
109
107
. then ( tokenSet => {
110
-
111
- logger . debug ( 'tokenSet' , tokenSet ) ;
112
108
const user = jwt . decode ( tokenSet . id_token ) ;
113
-
114
109
const token = tokenSet . id_token ;
115
110
116
111
res . cookie ( 'token' , token , { maxAge : 86400000 , httpOnly : true , secure : true , sameSite : 'none' } ) ;
117
112
const return_url = req . cookies . return_url || "/" ;
118
- logger . debug ( 'return_url' , return_url ) ;
119
113
res . redirect ( return_url ) ;
120
114
} )
121
115
. catch ( err => {
@@ -161,7 +155,6 @@ const checkAuth = (req, res, next) => {
161
155
if ( ! token && req . headers . authorization ) {
162
156
token = req . headers . authorization . split ( ' ' ) [ 1 ] ;
163
157
}
164
- logger . debug ( 'token' , token ) ;
165
158
166
159
if ( ! token ) {
167
160
return res . status ( 401 ) . json ( { message : 'Token not found' } ) ;
@@ -240,8 +233,6 @@ function logResponseBody(req, res, next) {
240
233
241
234
res . write = function ( chunk ) {
242
235
chunks . push ( Buffer . from ( chunk ) ) ;
243
- console . log ( 'chunk' , chunk . toString ( 'utf8' ) ) ;
244
- console . log ( 'remote headers' , res . getHeaders ( ) ) ;
245
236
oldWrite . apply ( res , arguments ) ;
246
237
} ;
247
238
@@ -250,19 +241,16 @@ function logResponseBody(req, res, next) {
250
241
chunks . push ( Buffer . from ( chunk ) ) ;
251
242
252
243
let body = Buffer . concat ( chunks ) . toString ( 'utf8' ) ;
253
- logger . debug ( req . path , body ) ;
254
-
255
244
oldEnd . apply ( res , arguments ) ;
256
245
} ;
257
246
258
247
res . on ( 'data' , ( ) => {
259
- logger . debug ( 'remote headers' , res . getHeaders ( ) ) ;
248
+
260
249
} ) ;
261
250
251
+ /** Logs the request to the database */
262
252
res . on ( 'finish' , ( ) => {
263
- logger . debug ( `request url = ${ req . originalUrl } ` ) ;
264
253
const headers = res . getHeaders ( ) ;
265
- logger . debug ( "headers: " , headers ) ;
266
254
267
255
const request = {
268
256
user : req . user ,
@@ -300,12 +288,10 @@ const doProxy = (req, res) => {
300
288
proxyReqOptDecorator : function ( proxyReqOpts , srcReq ) {
301
289
proxyReqOpts . headers [ 'authorization' ] = `Bearer ${ API_KEY } ` ;
302
290
proxyReqOpts . headers [ 'OpenAI-Beta' ] = 'assistants=v2' ;
303
- console . log ( 'proxyReqOpts' , proxyReqOpts . headers ) ;
304
291
return proxyReqOpts ;
305
292
} ,
306
293
proxyReqBodyDecorator : function ( bodyContent , srcReq ) {
307
294
if ( ! srcReq . body || srcReq . method === 'GET' ) {
308
- logger . debug ( 'no body content in GET request' ) ;
309
295
return "" ;
310
296
}
311
297
@@ -318,7 +304,6 @@ const doProxy = (req, res) => {
318
304
parseReqBody : false ,
319
305
proxyReqPathResolver : function ( req ) {
320
306
const path = req . baseUrl . replace ( PREFIX , '/v1' ) ;
321
- logger . debug ( 'path: ' , req . baseUrl , path ) ;
322
307
return path ;
323
308
} ,
324
309
proxyErrorHandler : function ( err , res , next ) {
@@ -332,7 +317,6 @@ const doProxy = (req, res) => {
332
317
proxyReqOptDecorator : function ( proxyReqOpts , srcReq ) {
333
318
proxyReqOpts . headers [ 'authorization' ] = `Bearer ${ API_KEY } ` ;
334
319
proxyReqOpts . headers [ 'OpenAI-Beta' ] = 'assistants=v2' ;
335
- console . log ( 'proxyReqOpts' , proxyReqOpts . headers ) ;
336
320
return proxyReqOpts ;
337
321
} ,
338
322
} )
0 commit comments