From f40a6df041d5071eb38a90a5436eacaaba0f07be Mon Sep 17 00:00:00 2001 From: posimai Date: Sun, 29 Mar 2026 23:18:10 +0900 Subject: [PATCH] fix: handle GitHub fallback response format {repos, fallback} --- index.html | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 4e79690..950586c 100644 --- a/index.html +++ b/index.html @@ -2057,7 +2057,9 @@ async function runGithubScan() { const url = `${apiBase}/atlas/github-scan?token=${encodeURIComponent(token)}${org ? '&org=' + encodeURIComponent(org) : ''}`; const res = await fetch(url); if (!res.ok) { const e = await res.json().catch(() => ({})); throw new Error(e.error || `HTTP ${res.status}`); } - const repos = await res.json(); + const raw = await res.json(); + const repos = Array.isArray(raw) ? raw : (raw.repos || []); + const isFallback = !Array.isArray(raw) && raw.fallback; let added = 0; // Add GitHub org/user as cloud node if not present @@ -2090,8 +2092,9 @@ async function runGithubScan() { initGraph(); setTimeout(fitGraph, 500); statusEl.className = 'scan-status visible ok'; - statusEl.textContent = `${repos.length} リポジトリ検出 — ${added} 件追加`; - showToast(`GitHub: ${added} リポジトリを追加しました`); + const fallbackNote = isFallback ? ' (ユーザーリポジトリにフォールバック)' : ''; + statusEl.textContent = `${repos.length} リポジトリ検出 — ${added} 件追加${fallbackNote}`; + showToast(`GitHub: ${added} リポジトリを追加しました${fallbackNote}`); } catch (e) { statusEl.className = 'scan-status visible err'; statusEl.textContent = `エラー: ${e.message}`;