1
0

fix api web

This commit is contained in:
2025-06-03 22:17:36 +09:00
parent f337c20096
commit 13723cf3d7
12 changed files with 750 additions and 31 deletions

View File

@@ -504,8 +504,8 @@ class AtprotoOAuthService {
owner_did: card.owner_did,
obtained_at: card.obtained_at,
is_unique: card.is_unique,
unique_id: card.unique_id,
img: `https://git.syui.ai/ai/ai/raw/branch/main/img/item/card/${card.id}.webp`
unique_id: card.unique_id
})),
total_cards: userCards.length,
updated_at: createdAt,
@@ -584,6 +584,38 @@ class AtprotoOAuthService {
}
}
// ai.card.boxのコレクションを削除
async deleteCardBox(): Promise<void> {
// Ensure we have a valid session
const sessionInfo = await this.checkSession();
if (!sessionInfo) {
throw new Error('認証が必要です。ログインしてください。');
}
const did = sessionInfo.did;
try {
console.log('Deleting card box collection...');
console.log('Using DID:', did);
// Ensure we have a fresh agent
if (!this.agent) {
throw new Error('Agentが初期化されていません。');
}
const response = await this.agent.com.atproto.repo.deleteRecord({
repo: did,
collection: 'ai.card.box',
rkey: 'self'
});
console.log('Card box deleted successfully:', response);
} catch (error) {
console.error('カードボックス削除エラー:', error);
throw error;
}
}
// 手動でトークンを設定(開発・デバッグ用)
setManualTokens(accessJwt: string, refreshJwt: string): void {
console.warn('Manual token setting is not supported with official BrowserOAuthClient');
@@ -613,4 +645,4 @@ class AtprotoOAuthService {
}
export const atprotoOAuthService = new AtprotoOAuthService();
export type { AtprotoSession };
export type { AtprotoSession };