diff --git a/index.html b/index.html
index 18aab3f..029de2f 100644
--- a/index.html
+++ b/index.html
@@ -2306,6 +2306,26 @@ function bindEvents() {
location.reload();
});
+ // ── API キーの永続化 ──────────────────────────────────────
+ const TOKEN_KEYS = {
+ 'tailscale-token-input': 'posimai-atlas-token-tailscale',
+ 'github-token-input': 'posimai-atlas-token-github',
+ 'github-org-input': 'posimai-atlas-token-github-org',
+ 'vercel-token-input': 'posimai-atlas-token-vercel',
+ };
+ // ページロード時に復元
+ Object.entries(TOKEN_KEYS).forEach(([id, key]) => {
+ const val = localStorage.getItem(key);
+ if (val) document.getElementById(id).value = val;
+ });
+ // 入力のたびに保存
+ Object.entries(TOKEN_KEYS).forEach(([id, key]) => {
+ document.getElementById(id).addEventListener('input', e => {
+ if (e.target.value) localStorage.setItem(key, e.target.value);
+ else localStorage.removeItem(key);
+ });
+ });
+
document.getElementById('btnTailscaleScan').addEventListener('click', runTailscaleScan);
document.getElementById('tailscale-token-input').addEventListener('keydown', e => {
if (e.key === 'Enter') runTailscaleScan();