@xuda.io/account_module 1.2.2273 → 1.2.2274
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/index.mjs +11 -2
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1512,6 +1512,7 @@ export const get_cpu = async function (req) {
|
|
|
1512
1512
|
};
|
|
1513
1513
|
|
|
1514
1514
|
const get_account_log_object = function (body, status, service, source, response_data, ip, headers, security) {
|
|
1515
|
+
const is_key = !!(body.api_key || body.api_pk || body.api_sk);
|
|
1515
1516
|
return {
|
|
1516
1517
|
uid: body.uid,
|
|
1517
1518
|
ip,
|
|
@@ -1521,7 +1522,12 @@ const get_account_log_object = function (body, status, service, source, response
|
|
|
1521
1522
|
security: _conf.cpi_methods?.[service]?.log,
|
|
1522
1523
|
api_pk: body.api_pk,
|
|
1523
1524
|
api_sk: body.api_sk,
|
|
1524
|
-
|
|
1525
|
+
// Developer API keys (xuda_api_keys) ride req.api_key; `channel` says HOW
|
|
1526
|
+
// the call arrived — 'mcp' (tagged by mcp_module's executor via the
|
|
1527
|
+
// xu-channel header), 'api' (a key over plain REST) or 'dashboard'.
|
|
1528
|
+
api_key: body.api_key,
|
|
1529
|
+
channel: headers?.['xu-channel'] === 'mcp' ? 'mcp' : is_key ? 'api' : 'dashboard',
|
|
1530
|
+
dashboard: !is_key,
|
|
1525
1531
|
response_status_code: status,
|
|
1526
1532
|
response_data,
|
|
1527
1533
|
source,
|
|
@@ -1538,7 +1544,10 @@ export const add_account_log_util = async function (body, status, service, sourc
|
|
|
1538
1544
|
if (_conf.cpi_methods?.[service]?.private) return;
|
|
1539
1545
|
const security = _conf.cpi_methods?.[service].security;
|
|
1540
1546
|
if (!security) {
|
|
1541
|
-
|
|
1547
|
+
// Interactive dashboard reads are noise, but reads made with a developer
|
|
1548
|
+
// key (api_key / api_pk / api_sk) ARE the product — log them so the
|
|
1549
|
+
// Developers overview reflects real API/MCP traffic.
|
|
1550
|
+
if (service.substr(0, 4) === 'get_' && !body.api_pk && !body.api_sk && !body.api_key) return;
|
|
1542
1551
|
}
|
|
1543
1552
|
|
|
1544
1553
|
logs_msa.add_account_log(get_account_log_object(body, status, service, source, response_data, ip, headers, security));
|