@yoooclaw/phone-notifications 1.11.9 → 1.11.12

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/dist/index.cjs CHANGED
@@ -5574,7 +5574,7 @@ function readBuildInjectedVersion() {
5574
5574
  if (false) {
5575
5575
  return void 0;
5576
5576
  }
5577
- const version = "1.11.9".trim();
5577
+ const version = "1.11.12".trim();
5578
5578
  return version || void 0;
5579
5579
  }
5580
5580
  function readPluginVersionFromPackageJson() {
@@ -12985,20 +12985,14 @@ async function handleHttpRequest(opts, frame) {
12985
12985
  const mappedPath = mapPath(frame.path);
12986
12986
  const url = new URL(mappedPath, opts.gatewayBaseUrl);
12987
12987
  const startedAtMs = Date.now();
12988
- const trustedProxyHeader = opts.gatewayTrustedProxyHeader?.trim();
12989
- const trustedProxyUser = opts.gatewayTrustedProxyUser?.trim();
12990
- const trustedProxyHeaderLower = trustedProxyHeader?.toLowerCase();
12991
12988
  const localHeaders = {};
12992
12989
  for (const [k, v] of Object.entries(frame.headers ?? {})) {
12993
12990
  const lower = k.toLowerCase();
12994
- if (lower === "authorization" || lower === "x-openclaw-password") continue;
12995
- if (trustedProxyHeaderLower && lower === trustedProxyHeaderLower) continue;
12996
- localHeaders[k] = v;
12991
+ if (lower !== "authorization" && lower !== "x-openclaw-password") {
12992
+ localHeaders[k] = v;
12993
+ }
12997
12994
  }
12998
12995
  localHeaders[RELAY_INTERNAL_HTTP_HEADER] = "1";
12999
- if (trustedProxyHeader && trustedProxyUser) {
13000
- localHeaders[trustedProxyHeader] = trustedProxyUser;
13001
- }
13002
12996
  const authAttempts = buildLocalGatewayAuthAttempts(opts, localHeaders);
13003
12997
  opts.logger.info(
13004
12998
  `TunnelProxy: HTTP id=${frame.id} ${frame.method} ${frame.path} \u2192 ${url.toString()}${summarizeRequestHeaders(frame.headers)}, authAttempts=${authAttempts.map((a) => a.label).join(" -> ")}, body=${previewText2(frame.body)}`
@@ -13443,16 +13437,6 @@ var TunnelProxy = class {
13443
13437
  `TunnelProxy: cleared stale stored device token after gateway mismatch (deviceId=${this.deviceIdentity.deviceId})`
13444
13438
  );
13445
13439
  }
13446
- /**
13447
- * 当 Gateway 处于 trusted-proxy 模式时,构造注入到本地连接的 user header。
13448
- * 其他模式或参数未配齐时返回 undefined,本地用户保持原握手路径不受影响。
13449
- */
13450
- buildTrustedProxyHeaders() {
13451
- const headerName = this.opts.gatewayTrustedProxyHeader?.trim();
13452
- const headerValue = this.opts.gatewayTrustedProxyUser?.trim();
13453
- if (!headerName || !headerValue) return void 0;
13454
- return { [headerName]: headerValue };
13455
- }
13456
13440
  async maybeAutoApproveGatewayPairing(frame) {
13457
13441
  const errorCode = typeof frame?.error?.code === "string" ? frame.error.code : void 0;
13458
13442
  const detailsCode = typeof frame?.error?.details?.code === "string" ? frame.error.details.code : void 0;
@@ -13623,12 +13607,10 @@ var TunnelProxy = class {
13623
13607
  this.gatewayWsConnecting = true;
13624
13608
  this.gatewayWsReady = false;
13625
13609
  const wsUrl = this.opts.gatewayBaseUrl.replace(/^http/, "ws");
13626
- const trustedProxyHeaders = this.buildTrustedProxyHeaders();
13627
- const trustedProxyHint = trustedProxyHeaders ? `, trustedProxyHeader=${Object.keys(trustedProxyHeaders)[0]}` : "";
13628
13610
  this.opts.logger.info(
13629
- `TunnelProxy: RPC WS connecting to gateway ${wsUrl} (pending=${this.gatewayWsPending.length}${trustedProxyHint})`
13611
+ `TunnelProxy: RPC WS connecting to gateway ${wsUrl} (pending=${this.gatewayWsPending.length})`
13630
13612
  );
13631
- const ws = trustedProxyHeaders ? new wrapper_default(wsUrl, { headers: trustedProxyHeaders }) : new wrapper_default(wsUrl);
13613
+ const ws = new wrapper_default(wsUrl);
13632
13614
  ws.on("open", () => {
13633
13615
  this.gatewayWs = ws;
13634
13616
  this.opts.logger.info(
@@ -13961,8 +13943,6 @@ function createTunnelService(opts) {
13961
13943
  gatewayAuthMode: opts.gatewayAuthMode,
13962
13944
  gatewayToken: opts.gatewayToken,
13963
13945
  gatewayPassword: opts.gatewayPassword,
13964
- gatewayTrustedProxyHeader: opts.gatewayTrustedProxyHeader,
13965
- gatewayTrustedProxyUser: opts.gatewayTrustedProxyUser,
13966
13946
  client,
13967
13947
  logger
13968
13948
  });
@@ -14075,14 +14055,9 @@ function readHostGatewayConfig(params) {
14075
14055
  }
14076
14056
  return configData;
14077
14057
  }
14078
- var DEFAULT_TRUSTED_PROXY_HEADER = "x-forwarded-user";
14079
- var DEFAULT_TRUSTED_PROXY_USER = "openclaw";
14080
14058
  function resolveLocalGatewayAuth(params) {
14081
14059
  const envGatewayToken = trimToUndefined2(process.env.OPENCLAW_GATEWAY_TOKEN) ?? trimToUndefined2(process.env.QCLAW_GATEWAY_TOKEN);
14082
14060
  const envGatewayPassword = trimToUndefined2(process.env.OPENCLAW_GATEWAY_PASSWORD) ?? trimToUndefined2(process.env.QCLAW_GATEWAY_PASSWORD);
14083
- const envTrustedProxyUser = trimToUndefined2(
14084
- process.env.OPENCLAW_GATEWAY_TRUSTED_PROXY_USER
14085
- );
14086
14061
  const configData = readHostGatewayConfig(params);
14087
14062
  let configGatewayAuthMode;
14088
14063
  const rawGatewayAuthMode = trimToUndefined2(configData?.gateway?.auth?.mode);
@@ -14091,18 +14066,10 @@ function resolveLocalGatewayAuth(params) {
14091
14066
  }
14092
14067
  const configGatewayToken = trimToUndefined2(configData?.gateway?.auth?.token);
14093
14068
  const configGatewayPassword = trimToUndefined2(configData?.gateway?.auth?.password);
14094
- let gatewayTrustedProxyHeader;
14095
- let gatewayTrustedProxyUser;
14096
- if (rawGatewayAuthMode === "trusted-proxy") {
14097
- gatewayTrustedProxyHeader = trimToUndefined2(configData?.gateway?.auth?.trustedProxy?.userHeader) ?? DEFAULT_TRUSTED_PROXY_HEADER;
14098
- gatewayTrustedProxyUser = envTrustedProxyUser ?? DEFAULT_TRUSTED_PROXY_USER;
14099
- }
14100
14069
  return {
14101
14070
  gatewayAuthMode: configGatewayAuthMode,
14102
14071
  gatewayToken: envGatewayToken ?? configGatewayToken,
14103
- gatewayPassword: envGatewayPassword ?? configGatewayPassword,
14104
- gatewayTrustedProxyHeader,
14105
- gatewayTrustedProxyUser
14072
+ gatewayPassword: envGatewayPassword ?? configGatewayPassword
14106
14073
  };
14107
14074
  }
14108
14075
  function resolveExclusiveTunnelHint(params) {
@@ -14151,21 +14118,10 @@ function registerRelayTunnelLifecycle(deps) {
14151
14118
  return null;
14152
14119
  }
14153
14120
  const gatewayPort = process.env.OPENCLAW_GATEWAY_PORT ?? process.env.QCLAW_GATEWAY_PORT ?? "18789";
14154
- const {
14155
- gatewayAuthMode,
14156
- gatewayToken,
14157
- gatewayPassword,
14158
- gatewayTrustedProxyHeader,
14159
- gatewayTrustedProxyUser
14160
- } = resolveLocalGatewayAuth({
14121
+ const { gatewayAuthMode, gatewayToken, gatewayPassword } = resolveLocalGatewayAuth({
14161
14122
  stateDir: openclawDir,
14162
14123
  logger
14163
14124
  });
14164
- if (gatewayTrustedProxyHeader && gatewayTrustedProxyUser) {
14165
- logger.info(
14166
- `Relay tunnel: gateway in trusted-proxy mode, will inject ${gatewayTrustedProxyHeader} header on local connections`
14167
- );
14168
- }
14169
14125
  const tunnelService = createTunnelService({
14170
14126
  tunnelUrl,
14171
14127
  heartbeatSec: config.relay?.heartbeatSec,
@@ -14174,8 +14130,6 @@ function registerRelayTunnelLifecycle(deps) {
14174
14130
  gatewayAuthMode,
14175
14131
  gatewayToken,
14176
14132
  gatewayPassword,
14177
- gatewayTrustedProxyHeader,
14178
- gatewayTrustedProxyUser,
14179
14133
  logger
14180
14134
  });
14181
14135
  api.registerService(tunnelService);