diff --git a/oauth/src/api/atproto.js b/oauth/src/api/atproto.js index 584f8cc..5c3480c 100644 --- a/oauth/src/api/atproto.js +++ b/oauth/src/api/atproto.js @@ -63,6 +63,17 @@ export const atproto = { }, async getProfile(bsky, actor) { + // Skip test DIDs + if (actor && actor.includes('test-')) { + logger.log('Skipping profile fetch for test DID:', actor) + return { + did: actor, + handle: 'test.user', + displayName: 'Test User', + avatar: null + } + } + return await request(`${bsky}/xrpc/${ENDPOINTS.getProfile}?actor=${actor}`) }, diff --git a/oauth/src/services/oauth.js b/oauth/src/services/oauth.js index 239fe7d..ea5155a 100644 --- a/oauth/src/services/oauth.js +++ b/oauth/src/services/oauth.js @@ -80,7 +80,8 @@ export class OAuthService { } // Get profile information using authenticated agent - if (this.agent) { + // Skip test DIDs + if (this.agent && did && !did.includes('test-')) { try { await new Promise(resolve => setTimeout(resolve, 300)) const profile = await this.agent.getProfile({ actor: did }) @@ -98,6 +99,8 @@ export class OAuthService { console.log('Failed to get profile from session:', error) // Keep the basic info we have } + } else if (did && did.includes('test-')) { + console.log('Skipping profile fetch for test DID:', did) } this.sessionInfo = { diff --git a/oauth/src/utils/avatarFetcher.js b/oauth/src/utils/avatarFetcher.js index 5d52f3b..d1dbf37 100644 --- a/oauth/src/utils/avatarFetcher.js +++ b/oauth/src/utils/avatarFetcher.js @@ -33,6 +33,12 @@ async function getDid(handle) { // DIDからプロフィール情報を取得 async function getProfile(did, handle) { + // Skip test DIDs + if (did && did.includes('test-')) { + logger.log('Skipping profile fetch for test DID:', did) + return null + } + try { // Determine which public API to use based on handle const pds = await getPdsFromHandle(handle) @@ -81,6 +87,11 @@ async function fetchFreshAvatar(handle, did) { // プロフィール取得 const profile = await getProfile(actualDid, handle) + if (!profile) { + // Test DID or profile fetch failed + return null + } + const avatarUrl = profile.avatar || null // キャッシュに保存