@yoooclaw/phone-notifications 1.10.6-beta.1 → 1.10.6
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 +45 -4
- package/dist/index.cjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5424,7 +5424,7 @@ function readBuildInjectedVersion() {
|
|
|
5424
5424
|
if (false) {
|
|
5425
5425
|
return void 0;
|
|
5426
5426
|
}
|
|
5427
|
-
const version = "1.10.6
|
|
5427
|
+
const version = "1.10.6".trim();
|
|
5428
5428
|
return version || void 0;
|
|
5429
5429
|
}
|
|
5430
5430
|
function readPluginVersionFromPackageJson() {
|
|
@@ -11769,6 +11769,7 @@ var WsProxy = class {
|
|
|
11769
11769
|
};
|
|
11770
11770
|
|
|
11771
11771
|
// src/tunnel/proxy.ts
|
|
11772
|
+
var RELAY_TUNNEL_GATEWAY_CLIENT_INSTANCE_ID = "phone-notifications-relay-tunnel";
|
|
11772
11773
|
var MAX_AUTO_PAIRING_APPROVALS = 3;
|
|
11773
11774
|
var approveDevicePairingPromise = null;
|
|
11774
11775
|
var approveDevicePairingWarned = false;
|
|
@@ -12173,7 +12174,8 @@ var TunnelProxy = class {
|
|
|
12173
12174
|
id: clientId,
|
|
12174
12175
|
version: "1.0.0",
|
|
12175
12176
|
platform: process.platform,
|
|
12176
|
-
mode: clientMode
|
|
12177
|
+
mode: clientMode,
|
|
12178
|
+
instanceId: RELAY_TUNNEL_GATEWAY_CLIENT_INSTANCE_ID
|
|
12177
12179
|
},
|
|
12178
12180
|
role,
|
|
12179
12181
|
scopes,
|
|
@@ -12510,8 +12512,24 @@ function resolveExclusiveTunnelHint(params) {
|
|
|
12510
12512
|
if (tailscaleMode) {
|
|
12511
12513
|
return `gateway.tailscale.mode=${tailscaleMode}`;
|
|
12512
12514
|
}
|
|
12515
|
+
const remoteUrl = trimToUndefined2(configData?.gateway?.remote?.url);
|
|
12516
|
+
if (remoteUrl && isExternalGatewayRemoteUrl(remoteUrl)) {
|
|
12517
|
+
return `gateway.remote.url=${remoteUrl}`;
|
|
12518
|
+
}
|
|
12513
12519
|
return void 0;
|
|
12514
12520
|
}
|
|
12521
|
+
function isExternalGatewayRemoteUrl(rawUrl) {
|
|
12522
|
+
let host;
|
|
12523
|
+
try {
|
|
12524
|
+
host = new URL(rawUrl).hostname.toLowerCase();
|
|
12525
|
+
} catch {
|
|
12526
|
+
return false;
|
|
12527
|
+
}
|
|
12528
|
+
if (host === "localhost" || host === "::1" || host === "[::1]") {
|
|
12529
|
+
return false;
|
|
12530
|
+
}
|
|
12531
|
+
return !/^127(?:\.\d{1,3}){0,3}$/.test(host);
|
|
12532
|
+
}
|
|
12515
12533
|
function registerRelayTunnelLifecycle(deps) {
|
|
12516
12534
|
const {
|
|
12517
12535
|
api,
|
|
@@ -13129,6 +13147,7 @@ var index_default = {
|
|
|
13129
13147
|
let broadcastFn = null;
|
|
13130
13148
|
let cronService = null;
|
|
13131
13149
|
let autoUpdateLifecycle = null;
|
|
13150
|
+
let tunnelService = null;
|
|
13132
13151
|
const openclawDir = api.runtime.state.resolveStateDir();
|
|
13133
13152
|
const logger = openclawDir ? new PluginFileLogger(api.logger, openclawDir) : createVersionAwareLogger(api.logger);
|
|
13134
13153
|
const lightRuleCtx = {
|
|
@@ -13155,12 +13174,34 @@ var index_default = {
|
|
|
13155
13174
|
autoUpdateLifecycle?.notifyBroadcastReady();
|
|
13156
13175
|
}
|
|
13157
13176
|
}
|
|
13177
|
+
function isDirectMobileGatewayRequest(opts) {
|
|
13178
|
+
const client = opts.client?.connect?.client;
|
|
13179
|
+
if (!client) return false;
|
|
13180
|
+
if (client.instanceId === RELAY_TUNNEL_GATEWAY_CLIENT_INSTANCE_ID) {
|
|
13181
|
+
return false;
|
|
13182
|
+
}
|
|
13183
|
+
return client.id === "openclaw-ios" || client.id === "openclaw-android";
|
|
13184
|
+
}
|
|
13185
|
+
async function deactivateRelayForDirectGatewayRequest(method, opts) {
|
|
13186
|
+
if (!tunnelService || !isDirectMobileGatewayRequest(opts)) return;
|
|
13187
|
+
const client = opts.client?.connect?.client;
|
|
13188
|
+
try {
|
|
13189
|
+
await tunnelService.deactivateForExternalTunnel(
|
|
13190
|
+
`gateway method ${method} from ${client?.id ?? "unknown"}`
|
|
13191
|
+
);
|
|
13192
|
+
} catch (err2) {
|
|
13193
|
+
logger.warn(
|
|
13194
|
+
`Relay tunnel: failed to deactivate after direct gateway method ${method}: ${err2?.message ?? String(err2)}`
|
|
13195
|
+
);
|
|
13196
|
+
}
|
|
13197
|
+
}
|
|
13158
13198
|
function registerGatewayMethodWithBroadcastCapture(method, handler) {
|
|
13159
|
-
api.registerGatewayMethod(method, (opts) => {
|
|
13199
|
+
api.registerGatewayMethod(method, async (opts) => {
|
|
13160
13200
|
cacheBroadcast(opts.context?.broadcast);
|
|
13161
13201
|
if (opts.context?.cron) {
|
|
13162
13202
|
cronService = opts.context.cron;
|
|
13163
13203
|
}
|
|
13204
|
+
await deactivateRelayForDirectGatewayRequest(method, opts);
|
|
13164
13205
|
return handler(opts);
|
|
13165
13206
|
});
|
|
13166
13207
|
}
|
|
@@ -13199,7 +13240,7 @@ var index_default = {
|
|
|
13199
13240
|
lightRuleRegistry.reload();
|
|
13200
13241
|
}
|
|
13201
13242
|
});
|
|
13202
|
-
|
|
13243
|
+
tunnelService = registerRelayTunnelLifecycle({
|
|
13203
13244
|
api,
|
|
13204
13245
|
config,
|
|
13205
13246
|
logger,
|