@xuda.io/account_module 1.2.2272 → 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 CHANGED
@@ -37,11 +37,7 @@ const account_info_properties = [
37
37
  'public_profile_disabled',
38
38
  ];
39
39
 
40
- global._conf = (
41
- await import(path.join(process.env.XUDA_HOME, process.env.XUDA_CONFIG), {
42
- with: { type: 'json' },
43
- })
44
- ).default;
40
+ global._conf = (await import(path.join(process.env.XUDA_HOME, "common", "load_conf.mjs"))).loadConf();
45
41
 
46
42
  const _common = await import(path.join(process.env.XUDA_HOME, 'common', 'xuda_node_common.mjs'));
47
43
  const _utils = await import(path.join(process.env.XUDA_HOME, 'common', 'xuda-cpi-utils.mjs'));
@@ -1516,6 +1512,7 @@ export const get_cpu = async function (req) {
1516
1512
  };
1517
1513
 
1518
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);
1519
1516
  return {
1520
1517
  uid: body.uid,
1521
1518
  ip,
@@ -1525,7 +1522,12 @@ const get_account_log_object = function (body, status, service, source, response
1525
1522
  security: _conf.cpi_methods?.[service]?.log,
1526
1523
  api_pk: body.api_pk,
1527
1524
  api_sk: body.api_sk,
1528
- dashboard: !body.api_pk && !body.api_sk,
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,
1529
1531
  response_status_code: status,
1530
1532
  response_data,
1531
1533
  source,
@@ -1542,7 +1544,10 @@ export const add_account_log_util = async function (body, status, service, sourc
1542
1544
  if (_conf.cpi_methods?.[service]?.private) return;
1543
1545
  const security = _conf.cpi_methods?.[service].security;
1544
1546
  if (!security) {
1545
- if (service.substr(0, 4) === 'get_' && !body.api_pk && !body.api_sk) return;
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;
1546
1551
  }
1547
1552
 
1548
1553
  logs_msa.add_account_log(get_account_log_object(body, status, service, source, response_data, ip, headers, security));