mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-06-16 21:03:58 +08:00
fix(usage): match non-standard source ids
Include normalizeUsageSourceId(apiKey) in candidate ids so provider stats can match usage rows when source is classified as text (issue #198).
This commit is contained in:
@@ -376,6 +376,10 @@ export function buildCandidateUsageSourceIds(input: {
|
||||
|
||||
const apiKey = input.apiKey?.trim();
|
||||
if (apiKey) {
|
||||
// Include the normalised form first so that "non-standard" keys (e.g. short tokens,
|
||||
// keys containing '/' etc.) that are classified as text by normalizeUsageSourceId()
|
||||
// can still match usage details.
|
||||
result.push(normalizeUsageSourceId(apiKey));
|
||||
result.push(`${USAGE_SOURCE_PREFIX_KEY}${fnv1a64Hex(apiKey)}`);
|
||||
result.push(`${USAGE_SOURCE_PREFIX_MASKED}${maskApiKey(apiKey)}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user