mirror of
https://github.com/YouXam/claude-code-usage-dashboard.git
synced 2026-02-04 15:10:16 +08:00
fix: hide apiKey
This commit is contained in:
@@ -164,6 +164,11 @@ export class ApiClient {
|
|||||||
return data.data;
|
return data.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private sanitizeApiKeyItem(item: ApiKeyListItem): ApiKeyListItem {
|
||||||
|
const { apiKey, ...rest } = item;
|
||||||
|
return rest;
|
||||||
|
}
|
||||||
|
|
||||||
private async fetchUsageBatch(keyIds: string[]): Promise<Record<string, ApiKeyBatchStats>> {
|
private async fetchUsageBatch(keyIds: string[]): Promise<Record<string, ApiKeyBatchStats>> {
|
||||||
await this.ensureValidToken();
|
await this.ensureValidToken();
|
||||||
|
|
||||||
@@ -226,12 +231,13 @@ export class ApiClient {
|
|||||||
const usageStats = await this.getUsageStats(shareableItems.map(item => item.id));
|
const usageStats = await this.getUsageStats(shareableItems.map(item => item.id));
|
||||||
|
|
||||||
return shareableItems.map((item) => {
|
return shareableItems.map((item) => {
|
||||||
|
const sanitizedItem = this.sanitizeApiKeyItem(item);
|
||||||
const stats = usageStats.get(item.id);
|
const stats = usageStats.get(item.id);
|
||||||
const cost = Number(stats?.cost ?? 0);
|
const cost = Number(stats?.cost ?? 0);
|
||||||
const formattedCost = stats?.formattedCost ?? `$${cost.toFixed(2)}`;
|
const formattedCost = stats?.formattedCost ?? `$${cost.toFixed(2)}`;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...item,
|
...sanitizedItem,
|
||||||
usage: {
|
usage: {
|
||||||
total: {
|
total: {
|
||||||
cost,
|
cost,
|
||||||
|
|||||||
Reference in New Issue
Block a user