@yoooclaw/phone-notifications 1.11.10 → 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 +8 -49
- package/dist/index.cjs.map +1 -1
- package/package.json +1 -1
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.
|
|
5577
|
+
const version = "1.11.12".trim();
|
|
5578
5578
|
return version || void 0;
|
|
5579
5579
|
}
|
|
5580
5580
|
function readPluginVersionFromPackageJson() {
|
|
@@ -12985,13 +12985,12 @@ 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 trustedProxyHeaderLower = opts.gatewayTrustedProxyHeader?.trim().toLowerCase();
|
|
12989
12988
|
const localHeaders = {};
|
|
12990
12989
|
for (const [k, v] of Object.entries(frame.headers ?? {})) {
|
|
12991
12990
|
const lower = k.toLowerCase();
|
|
12992
|
-
if (lower
|
|
12993
|
-
|
|
12994
|
-
|
|
12991
|
+
if (lower !== "authorization" && lower !== "x-openclaw-password") {
|
|
12992
|
+
localHeaders[k] = v;
|
|
12993
|
+
}
|
|
12995
12994
|
}
|
|
12996
12995
|
localHeaders[RELAY_INTERNAL_HTTP_HEADER] = "1";
|
|
12997
12996
|
const authAttempts = buildLocalGatewayAuthAttempts(opts, localHeaders);
|
|
@@ -13438,16 +13437,6 @@ var TunnelProxy = class {
|
|
|
13438
13437
|
`TunnelProxy: cleared stale stored device token after gateway mismatch (deviceId=${this.deviceIdentity.deviceId})`
|
|
13439
13438
|
);
|
|
13440
13439
|
}
|
|
13441
|
-
/**
|
|
13442
|
-
* 当 Gateway 处于 trusted-proxy 模式时,构造注入到本地连接的 user header。
|
|
13443
|
-
* 其他模式或参数未配齐时返回 undefined,本地用户保持原握手路径不受影响。
|
|
13444
|
-
*/
|
|
13445
|
-
buildTrustedProxyHeaders() {
|
|
13446
|
-
const headerName = this.opts.gatewayTrustedProxyHeader?.trim();
|
|
13447
|
-
const headerValue = this.opts.gatewayTrustedProxyUser?.trim();
|
|
13448
|
-
if (!headerName || !headerValue) return void 0;
|
|
13449
|
-
return { [headerName]: headerValue };
|
|
13450
|
-
}
|
|
13451
13440
|
async maybeAutoApproveGatewayPairing(frame) {
|
|
13452
13441
|
const errorCode = typeof frame?.error?.code === "string" ? frame.error.code : void 0;
|
|
13453
13442
|
const detailsCode = typeof frame?.error?.details?.code === "string" ? frame.error.details.code : void 0;
|
|
@@ -13618,12 +13607,10 @@ var TunnelProxy = class {
|
|
|
13618
13607
|
this.gatewayWsConnecting = true;
|
|
13619
13608
|
this.gatewayWsReady = false;
|
|
13620
13609
|
const wsUrl = this.opts.gatewayBaseUrl.replace(/^http/, "ws");
|
|
13621
|
-
const trustedProxyHeaders = this.buildTrustedProxyHeaders();
|
|
13622
|
-
const trustedProxyHint = trustedProxyHeaders ? `, trustedProxyHeader=${Object.keys(trustedProxyHeaders)[0]}` : "";
|
|
13623
13610
|
this.opts.logger.info(
|
|
13624
|
-
`TunnelProxy: RPC WS connecting to gateway ${wsUrl} (pending=${this.gatewayWsPending.length}
|
|
13611
|
+
`TunnelProxy: RPC WS connecting to gateway ${wsUrl} (pending=${this.gatewayWsPending.length})`
|
|
13625
13612
|
);
|
|
13626
|
-
const ws =
|
|
13613
|
+
const ws = new wrapper_default(wsUrl);
|
|
13627
13614
|
ws.on("open", () => {
|
|
13628
13615
|
this.gatewayWs = ws;
|
|
13629
13616
|
this.opts.logger.info(
|
|
@@ -13956,8 +13943,6 @@ function createTunnelService(opts) {
|
|
|
13956
13943
|
gatewayAuthMode: opts.gatewayAuthMode,
|
|
13957
13944
|
gatewayToken: opts.gatewayToken,
|
|
13958
13945
|
gatewayPassword: opts.gatewayPassword,
|
|
13959
|
-
gatewayTrustedProxyHeader: opts.gatewayTrustedProxyHeader,
|
|
13960
|
-
gatewayTrustedProxyUser: opts.gatewayTrustedProxyUser,
|
|
13961
13946
|
client,
|
|
13962
13947
|
logger
|
|
13963
13948
|
});
|
|
@@ -14070,14 +14055,9 @@ function readHostGatewayConfig(params) {
|
|
|
14070
14055
|
}
|
|
14071
14056
|
return configData;
|
|
14072
14057
|
}
|
|
14073
|
-
var DEFAULT_TRUSTED_PROXY_HEADER = "x-forwarded-user";
|
|
14074
|
-
var DEFAULT_TRUSTED_PROXY_USER = "openclaw";
|
|
14075
14058
|
function resolveLocalGatewayAuth(params) {
|
|
14076
14059
|
const envGatewayToken = trimToUndefined2(process.env.OPENCLAW_GATEWAY_TOKEN) ?? trimToUndefined2(process.env.QCLAW_GATEWAY_TOKEN);
|
|
14077
14060
|
const envGatewayPassword = trimToUndefined2(process.env.OPENCLAW_GATEWAY_PASSWORD) ?? trimToUndefined2(process.env.QCLAW_GATEWAY_PASSWORD);
|
|
14078
|
-
const envTrustedProxyUser = trimToUndefined2(
|
|
14079
|
-
process.env.OPENCLAW_GATEWAY_TRUSTED_PROXY_USER
|
|
14080
|
-
);
|
|
14081
14061
|
const configData = readHostGatewayConfig(params);
|
|
14082
14062
|
let configGatewayAuthMode;
|
|
14083
14063
|
const rawGatewayAuthMode = trimToUndefined2(configData?.gateway?.auth?.mode);
|
|
@@ -14086,18 +14066,10 @@ function resolveLocalGatewayAuth(params) {
|
|
|
14086
14066
|
}
|
|
14087
14067
|
const configGatewayToken = trimToUndefined2(configData?.gateway?.auth?.token);
|
|
14088
14068
|
const configGatewayPassword = trimToUndefined2(configData?.gateway?.auth?.password);
|
|
14089
|
-
let gatewayTrustedProxyHeader;
|
|
14090
|
-
let gatewayTrustedProxyUser;
|
|
14091
|
-
if (rawGatewayAuthMode === "trusted-proxy") {
|
|
14092
|
-
gatewayTrustedProxyHeader = trimToUndefined2(configData?.gateway?.auth?.trustedProxy?.userHeader) ?? DEFAULT_TRUSTED_PROXY_HEADER;
|
|
14093
|
-
gatewayTrustedProxyUser = envTrustedProxyUser ?? DEFAULT_TRUSTED_PROXY_USER;
|
|
14094
|
-
}
|
|
14095
14069
|
return {
|
|
14096
14070
|
gatewayAuthMode: configGatewayAuthMode,
|
|
14097
14071
|
gatewayToken: envGatewayToken ?? configGatewayToken,
|
|
14098
|
-
gatewayPassword: envGatewayPassword ?? configGatewayPassword
|
|
14099
|
-
gatewayTrustedProxyHeader,
|
|
14100
|
-
gatewayTrustedProxyUser
|
|
14072
|
+
gatewayPassword: envGatewayPassword ?? configGatewayPassword
|
|
14101
14073
|
};
|
|
14102
14074
|
}
|
|
14103
14075
|
function resolveExclusiveTunnelHint(params) {
|
|
@@ -14146,21 +14118,10 @@ function registerRelayTunnelLifecycle(deps) {
|
|
|
14146
14118
|
return null;
|
|
14147
14119
|
}
|
|
14148
14120
|
const gatewayPort = process.env.OPENCLAW_GATEWAY_PORT ?? process.env.QCLAW_GATEWAY_PORT ?? "18789";
|
|
14149
|
-
const {
|
|
14150
|
-
gatewayAuthMode,
|
|
14151
|
-
gatewayToken,
|
|
14152
|
-
gatewayPassword,
|
|
14153
|
-
gatewayTrustedProxyHeader,
|
|
14154
|
-
gatewayTrustedProxyUser
|
|
14155
|
-
} = resolveLocalGatewayAuth({
|
|
14121
|
+
const { gatewayAuthMode, gatewayToken, gatewayPassword } = resolveLocalGatewayAuth({
|
|
14156
14122
|
stateDir: openclawDir,
|
|
14157
14123
|
logger
|
|
14158
14124
|
});
|
|
14159
|
-
if (gatewayTrustedProxyHeader && gatewayTrustedProxyUser) {
|
|
14160
|
-
logger.info(
|
|
14161
|
-
`Relay tunnel: gateway in trusted-proxy mode, will inject ${gatewayTrustedProxyHeader} header on local connections`
|
|
14162
|
-
);
|
|
14163
|
-
}
|
|
14164
14125
|
const tunnelService = createTunnelService({
|
|
14165
14126
|
tunnelUrl,
|
|
14166
14127
|
heartbeatSec: config.relay?.heartbeatSec,
|
|
@@ -14169,8 +14130,6 @@ function registerRelayTunnelLifecycle(deps) {
|
|
|
14169
14130
|
gatewayAuthMode,
|
|
14170
14131
|
gatewayToken,
|
|
14171
14132
|
gatewayPassword,
|
|
14172
|
-
gatewayTrustedProxyHeader,
|
|
14173
|
-
gatewayTrustedProxyUser,
|
|
14174
14133
|
logger
|
|
14175
14134
|
});
|
|
14176
14135
|
api.registerService(tunnelService);
|