test scpt

This commit is contained in:
2025-06-16 22:27:20 +09:00
parent 1e83b50e3f
commit 5339dd28b0
11 changed files with 52 additions and 64 deletions

View File

@ -176,7 +176,7 @@ function App() {
});
}
} catch (err) {
console.error('Failed to load AI profile:', err);
// Failed to load AI profile
// Fallback to config values
setAiProfile({
did: appConfig.aiDid,
@ -221,7 +221,7 @@ function App() {
// Check if handle is allowed
if (appConfig.allowedHandles.length > 0 && !appConfig.allowedHandles.includes(handle)) {
console.warn(`Handle ${handle} is not in allowed list:`, appConfig.allowedHandles);
// Handle not in allowed list
setError(`Access denied: ${handle} is not authorized for this application.`);
setIsLoading(false);
return;
@ -252,7 +252,7 @@ function App() {
if (verifiedUser) {
// Check if handle is allowed
if (appConfig.allowedHandles.length > 0 && !appConfig.allowedHandles.includes(verifiedUser.handle)) {
console.warn(`Handle ${verifiedUser.handle} is not in allowed list:`, appConfig.allowedHandles);
// Handle not in allowed list
setError(`Access denied: ${verifiedUser.handle} is not authorized for this application.`);
setIsLoading(false);
return;
@ -288,7 +288,6 @@ function App() {
// DID解決完了時にデータを再読み込み
useEffect(() => {
if (adminDid && aiDid) {
console.log('DIDs resolved, loading comments and chat history...');
loadAllComments();
loadAiChatHistory();
}
@ -556,7 +555,6 @@ function App() {
try {
// 管理者のユーザーリストを取得 using proper PDS detection
const currentAdminDid = adminDid || appConfig.adminDid;
console.log('loadUsersFromRecord: Using Admin DID:', currentAdminDid);
// Use per-user PDS detection for admin's records
let adminPdsEndpoint;
@ -569,25 +567,19 @@ function App() {
}
const userCollectionUrl = `${adminPdsEndpoint}/xrpc/com.atproto.repo.listRecords?repo=${encodeURIComponent(currentAdminDid)}&collection=${encodeURIComponent(getCollectionNames(appConfig.collections.base).user)}&limit=100`;
console.log('loadUsersFromRecord: Fetching from URL:', userCollectionUrl);
const response = await fetch(userCollectionUrl);
console.log('loadUsersFromRecord: Response status:', response.status);
if (!response.ok) {
console.log('loadUsersFromRecord: Failed to fetch, using default users');
return getDefaultUsers();
}
const data = await response.json();
const userRecords = data.records || [];
console.log('loadUsersFromRecord: Found user records:', userRecords.length);
if (userRecords.length === 0) {
console.log('loadUsersFromRecord: No user records found, using default users');
const defaultUsers = getDefaultUsers();
console.log('loadUsersFromRecord: Default users:', defaultUsers);
return defaultUsers;
}
@ -620,7 +612,6 @@ function App() {
}
}
console.log('loadUsersFromRecord: Resolved users:', allUsers);
return allUsers;
} catch (err) {
// Failed to load users from records, using defaults
@ -689,7 +680,6 @@ function App() {
});
}
console.log('getDefaultUsers: Returning default users:', defaultUsers);
return defaultUsers;
};
@ -699,7 +689,6 @@ function App() {
// ユーザーリストを動的に取得
const knownUsers = await loadUsersFromRecord();
console.log('loadAllComments: Using users for comment fetching:', knownUsers);
const allComments = [];
@ -1247,25 +1236,6 @@ function App() {
return (
<div className="app">
{/* Debug Info */}
<div style={{
padding: '10px',
backgroundColor: '#f0f0f0',
border: '1px solid #ccc',
marginBottom: '10px',
fontSize: '12px'
}}>
<strong>Debug Info:</strong><br />
Admin Handle: {appConfig.adminHandle}<br />
Admin DID (resolved): {adminDid || 'resolving...'}<br />
Admin DID (config): {appConfig.adminDid}<br />
AI Handle: {appConfig.aiHandle}<br />
AI DID (resolved): {aiDid || 'resolving...'}<br />
AI DID (config): {appConfig.aiDid}<br />
Collection Base: {appConfig.collections.base}<br />
User Collection: {appConfig.collections.base}.user<br />
DIDs Resolved: {adminDid && aiDid ? 'Yes' : 'No'}
</div>
<main className="app-main">
<section className="comment-section">

View File

@ -32,7 +32,7 @@ export const AIProfile: React.FC<AIProfileProps> = ({ aiDid }) => {
description: response.data.description,
});
} catch (error) {
console.error('Failed to fetch AI profile:', error);
// Failed to fetch AI profile
// Fallback to basic info
setProfile({
did: aiDid,

View File

@ -26,7 +26,7 @@ export const CardBox: React.FC<CardBoxProps> = ({ userDid }) => {
const data = await atprotoOAuthService.getCardsFromBox();
setBoxData(data);
} catch (err) {
console.error('カードボックス読み込みエラー:', err);
// Failed to load card box
setError(err instanceof Error ? err.message : 'カードボックスの読み込みに失敗しました');
} finally {
setLoading(false);
@ -52,7 +52,7 @@ export const CardBox: React.FC<CardBoxProps> = ({ userDid }) => {
setBoxData({ records: [] });
alert('カードボックスを削除しました');
} catch (err) {
console.error('カードボックス削除エラー:', err);
// Failed to delete card box
setError(err instanceof Error ? err.message : 'カードボックスの削除に失敗しました');
} finally {
setIsDeleting(false);

View File

@ -32,7 +32,7 @@ export const CardList: React.FC = () => {
const data = await response.json();
setMasterData(data);
} catch (err) {
console.error('Error loading card master data:', err);
// Failed to load card master data
setError(err instanceof Error ? err.message : 'Failed to load card data');
} finally {
setLoading(false);

View File

@ -29,7 +29,7 @@ export const CollectionAnalysis: React.FC<CollectionAnalysisProps> = ({ userDid
const result = await aiCardApi.analyzeCollection(userDid);
setAnalysis(result);
} catch (err) {
console.error('Collection analysis failed:', err);
// Collection analysis failed
setError('AI分析機能を利用するにはai.gptサーバーが必要です。基本機能はai.cardサーバーのみで利用できます。');
} finally {
setLoading(false);

View File

@ -48,7 +48,7 @@ export const GachaAnimation: React.FC<GachaAnimationProps> = ({
await atprotoOAuthService.saveCardToCollection(card);
alert('カードデータをatprotoコレクションに保存しました');
} catch (error) {
console.error('保存エラー:', error);
// Failed to save card
alert('保存に失敗しました。認証が必要かもしれません。');
} finally {
setIsSharing(false);

View File

@ -30,7 +30,7 @@ export const GachaStats: React.FC = () => {
try {
result = await aiCardApi.getEnhancedStats();
} catch (aiError) {
console.warn('AI統計が利用できません、基本統計に切り替えます:', aiError);
// AI stats unavailable, using basic stats
setUseAI(false);
result = await cardApi.getGachaStats();
}
@ -39,7 +39,7 @@ export const GachaStats: React.FC = () => {
}
setStats(result);
} catch (err) {
console.error('Gacha stats failed:', err);
// Gacha stats failed
setError('統計データの取得に失敗しました。ai.cardサーバーが起動していることを確認してください。');
} finally {
setLoading(false);

View File

@ -168,7 +168,7 @@ export async function resolveHandleToDid(handle: string): Promise<{ did: string;
pds: actualPds
};
} catch (error) {
console.error(`Failed to resolve handle ${handle}:`, error);
// Failed to resolve handle
// Fallback to handle-based detection
const fallbackPds = detectPdsFromHandle(handle);
@ -204,7 +204,7 @@ export async function getProfileForUser(handleOrDid: string, knownPdsEndpoint?:
return await response.json();
} catch (error) {
console.error(`Failed to get profile for ${handleOrDid}:`, error);
// Failed to get profile
// Final fallback: try with default Bluesky API
try {