wormclaude 1.0.76 → 1.0.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +18 -1
- package/dist/theme.js +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -71,8 +71,25 @@ if (!process.env.WORMCLAUDE_SKIP_UPDATE && !process.env.WORMCLAUDE_BASE_URL) {
|
|
|
71
71
|
catch { /* güncelleme kontrolü best-effort — başarısızsa normal başla */ }
|
|
72
72
|
}
|
|
73
73
|
const config = loadConfig();
|
|
74
|
-
|
|
74
|
+
// Giriş gerekli mi? Anahtar YOKSA veya VARSA ama gateway'de GEÇERSİZSE (401) → login.
|
|
75
|
+
let _needLogin = !config.apiKey;
|
|
76
|
+
if (config.apiKey && !process.env.WORMCLAUDE_BASE_URL) {
|
|
77
|
+
// Açılışta anahtarı doğrula: geçersiz/iptal edilmişse kullanıcıyı 401 duvarına çarptırma.
|
|
78
|
+
try {
|
|
79
|
+
const _base = config.baseUrl || 'https://api.wormclaude.ai/v1';
|
|
80
|
+
const _ac = new AbortController();
|
|
81
|
+
const _to = setTimeout(() => _ac.abort(), 8000);
|
|
82
|
+
const _r = await fetch(`${_base}/account`, { headers: { Authorization: `Bearer ${config.apiKey}` }, signal: _ac.signal });
|
|
83
|
+
clearTimeout(_to);
|
|
84
|
+
if (_r.status === 401 || _r.status === 403)
|
|
85
|
+
_needLogin = true;
|
|
86
|
+
}
|
|
87
|
+
catch { /* ağ hatası → çevrimdışı toleransı: mevcut anahtarla devam et */ }
|
|
88
|
+
}
|
|
89
|
+
if (_needLogin) {
|
|
75
90
|
const _a = await import('./auth.js');
|
|
91
|
+
if (config.apiKey)
|
|
92
|
+
_a.clearStored(); // eski/geçersiz anahtarı temizle
|
|
76
93
|
const _choice = await _a.promptLoginMenu();
|
|
77
94
|
if (_choice !== 'login')
|
|
78
95
|
process.exit(0);
|
package/dist/theme.js
CHANGED