Spaces:
Sleeping
Sleeping
Nathan commited on
Commit ·
1982f16
1
Parent(s): 48fec94
Final Fix: Sync Google Keys across all channels
Browse files469 unmodified lines470471472473474475476477478479480481482469 unmodified linesreturn res.send('<h1>❌ Connection Denied</h1><p>This YouTube channel is already linked to another account.</p>');}await db.from('channels').upsert({user_id: userId,channel_id: channel.id,channel_name: channel.snippet.title,token: tokens,is_active: true,is_locked: true // Lock the connection once successful}, { onConflict: 'channel_id' });}res.send('<h1>✅ YouTube Connected!</h1><p>Close this and refresh your dashboard.</p>');469 unmodified lines470471472473474475476477478479480481482483484485486487469 unmodified linesreturn res.send('<h1>❌ Connection Denied</h1><p>This YouTube channel is already linked to another account.</p>');}// 5. Get existing keys to preserve themconst { data: keys } = await db.from('channels').select('custom_client_id, custom_client_secret').eq('user_id', userId).limit(1).maybeSingle();await db.from('channels').upsert({user_id: userId,channel_id: channel.id,channel_name: channel.snippet.title,token: tokens,is_active: true,is_locked: true, // Lock the connection once successfulcustom_client_id: keys?.custom_client_id,custom_client_secret: keys?.custom_client_secret}, { onConflict: 'channel_id' });}res.send('<h1>✅ YouTube Connected!</h1><p>Close this and refresh your dashboard.</p>');
server.js+6-1