@@ -390,40 +390,6 @@ router.get('/resources/:identifier', authenticateToken, async (req, res) => {
390390 }
391391} ) ;
392392
393- router . get ( '/auto-login' , authenticateToken , async ( req , res ) => {
394- try {
395- const userId = req . user . userId ;
396- const users = await query ( 'SELECT ptero_client_api_key FROM users WHERE id = ?' , [ userId ] ) ;
397-
398- if ( ! users [ 0 ] ?. ptero_client_api_key ) {
399- return res . json ( { autoLogin : false , panelUrl : PTERO_URL } ) ;
400- }
401-
402- const apiKey = users [ 0 ] . ptero_client_api_key ;
403- const pteroRes = await fetch ( `${ PTERO_URL } /api/client/account/one-time-token` , {
404- method : 'POST' ,
405- headers : {
406- 'Authorization' : `Bearer ${ apiKey } ` ,
407- 'Accept' : 'application/json' ,
408- 'Content-Type' : 'application/json' ,
409- } ,
410- signal : AbortSignal . timeout ( 10000 ) ,
411- } ) ;
412-
413- if ( ! pteroRes . ok ) {
414- return res . json ( { autoLogin : false , panelUrl : PTERO_URL } ) ;
415- }
416-
417- const data = await pteroRes . json ( ) ;
418- const token = data . attributes ?. token || data . token ;
419-
420- res . json ( { autoLogin : true , token, panelUrl : PTERO_URL } ) ;
421- } catch ( err ) {
422- console . error ( 'Auto-login error:' , err . message ) ;
423- res . status ( 500 ) . json ( { error : 'Failed to generate auto-login link' } ) ;
424- }
425- } ) ;
426-
427393router . put ( '/client-api-key' , authenticateToken , async ( req , res ) => {
428394 try {
429395 const { apiKey } = req . body ;
0 commit comments