This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

fix

+26 -23
+26 -23
app/src/app/api/bluesky/stats/route.ts
··· 11 11 12 12 export async function GET(request: NextRequest) { 13 13 try { 14 + // Define the plumber's DID - this is the official plumber account DID 15 + const PLUMBER_DID = 'did:plc:fouf3svmcxzn6bpiw3lgwz22'; 16 + 17 + // List of DIDs to exclude from leaderboard 18 + const excludedDids = [ 19 + PLUMBER_DID, // plumber.flushes.app (formerly plumber.flushing.im) 20 + 'did:plc:fnhrjbkwjiw6iyxxg2o3rljw' // testing.dame.is 21 + ]; 22 + 23 + // List of handles to exclude from leaderboard (as fallback) 24 + // Include both the old and new plumber handles for backward compatibility 25 + const excludedHandles = [ 26 + 'plumber.flushes.app', // New plumber handle 27 + 'plumber.flushing.im', // Old plumber handle (for backward compatibility) 28 + 'testing.dame.is' 29 + ]; 30 + 14 31 // If we have Supabase credentials, fetch stats 15 32 if (supabaseUrl && supabaseKey) { 16 33 const supabase = createClient(supabaseUrl, supabaseKey); ··· 94 111 // 2. Get daily flush counts for the chart 95 112 const { data: dailyData, error: dailyError } = await supabase 96 113 .from('flushing_records') 97 - .select('created_at, did') 114 + .select('created_at, did, handle') 98 115 .order('created_at', { ascending: true }); 99 116 100 117 if (dailyError) { ··· 144 161 const recentUniqueDids = new Set<string>(); 145 162 recentRecords?.forEach(entry => { 146 163 // Only count if not an excluded account 147 - if (entry.did && 148 - !excludedDids.includes(entry.did) && 149 - !(entry.handle && excludedHandles.includes(entry.handle))) { 164 + const isExcludedDid = entry.did && excludedDids.includes(entry.did); 165 + const isExcludedHandle = entry.handle && typeof entry.handle === 'string' && excludedHandles.includes(entry.handle); 166 + 167 + if (entry.did && !isExcludedDid && !isExcludedHandle) { 150 168 recentUniqueDids.add(entry.did); 151 169 } 152 170 }); ··· 163 181 if (!entry.did) return; // Skip entries without a DID 164 182 165 183 // Skip excluded accounts 166 - if (excludedDids.includes(entry.did) || 167 - (entry.handle && excludedHandles.includes(entry.handle))) { 184 + const isExcludedDid = excludedDids.includes(entry.did); 185 + const isExcludedHandle = entry.handle && typeof entry.handle === 'string' && excludedHandles.includes(entry.handle); 186 + 187 + if (isExcludedDid || isExcludedHandle) { 168 188 return; 169 189 } 170 190 ··· 211 231 212 232 // Special count for the plumber account 213 233 let plumberFlushCount = 0; 214 - 215 - // Define the plumber's DID - this is the official plumber account DID 216 - const PLUMBER_DID = 'did:plc:fouf3svmcxzn6bpiw3lgwz22'; 217 - 218 - // List of DIDs to exclude from leaderboard 219 - const excludedDids = [ 220 - PLUMBER_DID, // plumber.flushes.app (formerly plumber.flushing.im) 221 - 'did:plc:fnhrjbkwjiw6iyxxg2o3rljw' // testing.dame.is 222 - ]; 223 - 224 - // List of handles to exclude from leaderboard (as fallback) 225 - // Include both the old and new plumber handles for backward compatibility 226 - const excludedHandles = [ 227 - 'plumber.flushes.app', // New plumber handle 228 - 'plumber.flushing.im', // Old plumber handle (for backward compatibility) 229 - 'testing.dame.is' 230 - ]; 231 234 232 235 leaderboardData?.forEach(entry => { 233 236 // Check if this is the plumber account (by DID or either handle)