This commit is contained in:
2025-06-19 15:09:35 +09:00
parent 01c4c543fc
commit 50516fee21
3 changed files with 26 additions and 1 deletions

View File

@@ -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}`)
},

View File

@@ -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 = {

View File

@@ -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
// キャッシュに保存